hexsha
stringlengths 40
40
| size
int64 7
1.05M
| ext
stringclasses 13
values | lang
stringclasses 1
value | max_stars_repo_path
stringlengths 4
269
| max_stars_repo_name
stringlengths 5
108
| max_stars_repo_head_hexsha
stringlengths 40
40
| max_stars_repo_licenses
listlengths 1
9
| max_stars_count
int64 1
191k
⌀ | max_stars_repo_stars_event_min_datetime
stringlengths 24
24
⌀ | max_stars_repo_stars_event_max_datetime
stringlengths 24
24
⌀ | max_issues_repo_path
stringlengths 4
269
| max_issues_repo_name
stringlengths 5
116
| max_issues_repo_head_hexsha
stringlengths 40
40
| max_issues_repo_licenses
listlengths 1
9
| max_issues_count
int64 1
67k
⌀ | max_issues_repo_issues_event_min_datetime
stringlengths 24
24
⌀ | max_issues_repo_issues_event_max_datetime
stringlengths 24
24
⌀ | max_forks_repo_path
stringlengths 4
269
| max_forks_repo_name
stringlengths 5
116
| max_forks_repo_head_hexsha
stringlengths 40
40
| max_forks_repo_licenses
listlengths 1
9
| max_forks_count
int64 1
105k
⌀ | max_forks_repo_forks_event_min_datetime
stringlengths 24
24
⌀ | max_forks_repo_forks_event_max_datetime
stringlengths 24
24
⌀ | content
stringlengths 7
1.05M
| avg_line_length
float64 1.21
330k
| max_line_length
int64 6
990k
| alphanum_fraction
float64 0.01
0.99
| author_id
stringlengths 2
40
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
43080d177f46fb72ce682e4cbc4d4d59f9ab2773
| 12,463
|
cpp
|
C++
|
black-scholes-omp/blackScholesAnalyticEngine.cpp
|
BeauJoh/HeCBench
|
594b845171d686dc951971ce36ed59cf114dd2b4
|
[
"BSD-3-Clause"
] | 58
|
2020-08-06T18:53:44.000Z
|
2021-10-01T07:59:46.000Z
|
black-scholes-omp/blackScholesAnalyticEngine.cpp
|
BeauJoh/HeCBench
|
594b845171d686dc951971ce36ed59cf114dd2b4
|
[
"BSD-3-Clause"
] | 2
|
2020-12-04T12:35:02.000Z
|
2021-03-04T22:49:25.000Z
|
black-scholes-omp/blackScholesAnalyticEngine.cpp
|
BeauJoh/HeCBench
|
594b845171d686dc951971ce36ed59cf114dd2b4
|
[
"BSD-3-Clause"
] | 13
|
2020-08-19T13:44:18.000Z
|
2021-09-08T04:25:34.000Z
|
//blackScholesAnalyticEngine.cpp
//Functions for running black scholes using the analytic engine (from Quantlib) on the GPU
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <sys/time.h>
#include <time.h>
#define NUM_DIFF_SETTINGS 37
//needed for optionInputStruct
#include "blackScholesAnalyticEngineStructs.h"
//needed for the kernel(s) to run on the GPU
#include "blackScholesAnalyticEngineKernels.cpp"
#include "blackScholesAnalyticEngineKernelsCpu.cpp"
//function to run the black scholes analytic engine on the gpu
void runBlackScholesAnalyticEngine()
{
int numberOfSamples = 50000000;
{
int numVals = numberOfSamples;//nSamplesArray[numTime];
optionInputStruct* values = new optionInputStruct[numVals];
for (int numOption = 0; numOption < numVals; numOption++)
{
if ((numOption % NUM_DIFF_SETTINGS) == 0)
{
optionInputStruct currVal = { CALL, 40.00, 42.00, 0.08, 0.04, 0.75, 0.35, 5.0975, 1.0e-4};
values[numOption] = currVal;
}
if ((numOption % NUM_DIFF_SETTINGS) == 1)
{
optionInputStruct currVal = { CALL, 100.00, 90.00, 0.10, 0.10, 0.10, 0.15, 0.0205, 1.0e-4};
values[numOption] = currVal;
}
if ((numOption % NUM_DIFF_SETTINGS) == 2)
{
optionInputStruct currVal = { CALL, 100.00, 100.00, 0.10, 0.10, 0.10, 0.15, 1.8734, 1.0e-4};
values[numOption] = currVal;
}
if ((numOption % NUM_DIFF_SETTINGS) == 3)
{
optionInputStruct currVal = { CALL, 100.00, 110.00, 0.10, 0.10, 0.10, 0.15, 9.9413, 1.0e-4};
values[numOption] = currVal;
}
if ((numOption % NUM_DIFF_SETTINGS) == 4)
{
optionInputStruct currVal = { CALL, 100.00, 90.00, 0.10, 0.10, 0.10, 0.25, 0.3150, 1.0e-4};
values[numOption] = currVal;
}
if ((numOption % NUM_DIFF_SETTINGS) == 5)
{
optionInputStruct currVal = { CALL, 100.00, 100.00, 0.10, 0.10, 0.10, 0.25, 3.1217, 1.0e-4};
values[numOption] = currVal;
}
if ((numOption % NUM_DIFF_SETTINGS) == 6)
{
optionInputStruct currVal = { CALL, 100.00, 110.00, 0.10, 0.10, 0.10, 0.25, 10.3556, 1.0e-4};
values[numOption] = currVal;
}
if ((numOption % NUM_DIFF_SETTINGS) == 7)
{
optionInputStruct currVal = { CALL, 100.00, 90.00, 0.10, 0.10, 0.10, 0.35, 0.9474, 1.0e-4};
values[numOption] = currVal;
}
if ((numOption % NUM_DIFF_SETTINGS) == 8)
{
optionInputStruct currVal = { CALL, 100.00, 100.00, 0.10, 0.10, 0.10, 0.35, 4.3693, 1.0e-4};
values[numOption] = currVal;
}
if ((numOption % NUM_DIFF_SETTINGS) == 9)
{
optionInputStruct currVal = { CALL, 100.00, 110.00, 0.10, 0.10, 0.10, 0.35, 11.1381, 1.0e-4};
values[numOption] = currVal;
}
if ((numOption % NUM_DIFF_SETTINGS) == 10)
{
optionInputStruct currVal = { CALL, 100.00, 90.00, 0.10, 0.10, 0.50, 0.15, 0.8069, 1.0e-4};
values[numOption] = currVal;
}
if ((numOption % NUM_DIFF_SETTINGS) == 11)
{
optionInputStruct currVal = { CALL, 100.00, 100.00, 0.10, 0.10, 0.50, 0.15, 4.0232, 1.0e-4};
values[numOption] = currVal;
}
if ((numOption % NUM_DIFF_SETTINGS) == 12)
{
optionInputStruct currVal = { CALL, 100.00, 110.00, 0.10, 0.10, 0.50, 0.15, 10.5769, 1.0e-4};
values[numOption] = currVal;
}
if ((numOption % NUM_DIFF_SETTINGS) == 13)
{
optionInputStruct currVal = { CALL, 100.00, 90.00, 0.10, 0.10, 0.50, 0.25, 2.7026, 1.0e-4};
values[numOption] = currVal;
}
if ((numOption % NUM_DIFF_SETTINGS) == 14)
{
optionInputStruct currVal = { CALL, 100.00, 100.00, 0.10, 0.10, 0.50, 0.25, 6.6997, 1.0e-4};
values[numOption] = currVal;
}
if ((numOption % NUM_DIFF_SETTINGS) == 15)
{
optionInputStruct currVal = { CALL, 100.00, 110.00, 0.10, 0.10, 0.50, 0.25, 12.7857, 1.0e-4};
values[numOption] = currVal;
}
if ((numOption % NUM_DIFF_SETTINGS) == 16)
{
optionInputStruct currVal = { CALL, 100.00, 90.00, 0.10, 0.10, 0.50, 0.35, 4.9329, 1.0e-4};
values[numOption] = currVal;
}
if ((numOption % NUM_DIFF_SETTINGS) == 17)
{
optionInputStruct currVal = { CALL, 100.00, 100.00, 0.10, 0.10, 0.50, 0.35, 9.3679, 1.0e-4};
values[numOption] = currVal;
}
if ((numOption % NUM_DIFF_SETTINGS) == 18)
{
optionInputStruct currVal = { CALL, 100.00, 110.00, 0.10, 0.10, 0.50, 0.35, 15.3086, 1.0e-4};
values[numOption] = currVal;
}
if ((numOption % NUM_DIFF_SETTINGS) == 19)
{
optionInputStruct currVal = { PUT, 100.00, 90.00, 0.10, 0.10, 0.10, 0.15, 9.9210, 1.0e-4};
values[numOption] = currVal;
}
if ((numOption % NUM_DIFF_SETTINGS) == 20)
{
optionInputStruct currVal = { PUT, 100.00, 100.00, 0.10, 0.10, 0.10, 0.15, 1.8734, 1.0e-4};
values[numOption] = currVal;
}
if ((numOption % NUM_DIFF_SETTINGS) == 21)
{
optionInputStruct currVal = { PUT, 100.00, 110.00, 0.10, 0.10, 0.10, 0.15, 0.0408, 1.0e-4};
values[numOption] = currVal;
}
if ((numOption % NUM_DIFF_SETTINGS) == 22)
{
optionInputStruct currVal = { PUT, 100.00, 90.00, 0.10, 0.10, 0.10, 0.25, 10.2155, 1.0e-4};
values[numOption] = currVal;
}
if ((numOption % NUM_DIFF_SETTINGS) == 23)
{
optionInputStruct currVal = { PUT, 100.00, 100.00, 0.10, 0.10, 0.10, 0.25, 3.1217, 1.0e-4};
values[numOption] = currVal;
}
if ((numOption % NUM_DIFF_SETTINGS) == 24)
{
optionInputStruct currVal = { PUT, 100.00, 110.00, 0.10, 0.10, 0.10, 0.25, 0.4551, 1.0e-4};
values[numOption] = currVal;
}
if ((numOption % NUM_DIFF_SETTINGS) == 25)
{
optionInputStruct currVal = { PUT, 100.00, 90.00, 0.10, 0.10, 0.10, 0.35, 10.8479, 1.0e-4};
values[numOption] = currVal;
}
if ((numOption % NUM_DIFF_SETTINGS) == 26)
{
optionInputStruct currVal = { PUT, 100.00, 100.00, 0.10, 0.10, 0.10, 0.35, 4.3693, 1.0e-4};
values[numOption] = currVal;
}
if ((numOption % NUM_DIFF_SETTINGS) == 27)
{
optionInputStruct currVal = { PUT, 100.00, 110.00, 0.10, 0.10, 0.10, 0.35, 1.2376, 1.0e-4};
values[numOption] = currVal;
}
if ((numOption % NUM_DIFF_SETTINGS) == 28)
{
optionInputStruct currVal = { PUT, 100.00, 90.00, 0.10, 0.10, 0.50, 0.15, 10.3192, 1.0e-4};
values[numOption] = currVal;
}
if ((numOption % NUM_DIFF_SETTINGS) == 29)
{
optionInputStruct currVal = { PUT, 100.00, 100.00, 0.10, 0.10, 0.50, 0.15, 4.0232, 1.0e-4};
values[numOption] = currVal;
}
if ((numOption % NUM_DIFF_SETTINGS) == 30)
{
optionInputStruct currVal = { PUT, 100.00, 110.00, 0.10, 0.10, 0.50, 0.15, 1.0646, 1.0e-4};
values[numOption] = currVal;
}
if ((numOption % NUM_DIFF_SETTINGS) == 31)
{
optionInputStruct currVal = { PUT, 100.00, 90.00, 0.10, 0.10, 0.50, 0.25, 12.2149, 1.0e-4};
values[numOption] = currVal;
}
if ((numOption % NUM_DIFF_SETTINGS) == 32)
{
optionInputStruct currVal = { PUT, 100.00, 100.00, 0.10, 0.10, 0.50, 0.25, 6.6997, 1.0e-4};
values[numOption] = currVal;
}
if ((numOption % NUM_DIFF_SETTINGS) == 33)
{
optionInputStruct currVal = { PUT, 100.00, 110.00, 0.10, 0.10, 0.50, 0.25, 3.2734, 1.0e-4};
values[numOption] = currVal;
}
if ((numOption % NUM_DIFF_SETTINGS) == 34)
{
optionInputStruct currVal = { PUT, 100.00, 90.00, 0.10, 0.10, 0.50, 0.35, 14.4452, 1.0e-4};
values[numOption] = currVal;
}
if ((numOption % NUM_DIFF_SETTINGS) == 35)
{
optionInputStruct currVal = { PUT, 100.00, 100.00, 0.10, 0.10, 0.50, 0.35, 9.3679, 1.0e-4};
values[numOption] = currVal;
}
if ((numOption % NUM_DIFF_SETTINGS) == 36)
{
optionInputStruct currVal = { PUT, 100.00, 110.00, 0.10, 0.10, 0.50, 0.35, 5.7963, 1.0e-4};
values[numOption] = currVal;
}
}
// Run GPU code
//initialize the arrays
//declare and allocate the input and output data on the CPU
float* outputVals = (float*)malloc(numVals * sizeof(float));
printf("Number of options: %d\n\n", numVals);
long seconds, useconds;
float mtimeCpu, mtimeGpu;
struct timeval start;
gettimeofday(&start, NULL);
#pragma omp target map(to: values[0:numVals]) map(from: outputVals[0:numVals])
{
#pragma omp teams distribute parallel for simd thread_limit(THREAD_BLOCK_SIZE)
for (int optionNum = 0; optionNum < numVals; optionNum++) {
optionInputStruct threadOption = values[optionNum];
payoffStruct currPayoff;
currPayoff.type = threadOption.type;
currPayoff.strike = threadOption.strike;
yieldTermStruct qTS;
qTS.timeYearFraction = threadOption.t;
qTS.forward = threadOption.q;
yieldTermStruct rTS;
rTS.timeYearFraction = threadOption.t;
rTS.forward = threadOption.r;
blackVolStruct volTS;
volTS.timeYearFraction = threadOption.t;
volTS.volatility = threadOption.vol;
blackScholesMertStruct stochProcess;
stochProcess.x0 = threadOption.spot;
stochProcess.dividendTS = qTS;
stochProcess.riskFreeTS = rTS;
stochProcess.blackVolTS = volTS;
optionStruct currOption;
currOption.payoff = currPayoff;
currOption.yearFractionTime = threadOption.t;
currOption.pricingEngine = stochProcess;
float variance = getBlackVolBlackVar(currOption.pricingEngine.blackVolTS);
float dividendDiscount = getDiscountOnDividendYield(currOption.yearFractionTime, currOption.pricingEngine.dividendTS);
float riskFreeDiscount = getDiscountOnRiskFreeRate(currOption.yearFractionTime, currOption.pricingEngine.riskFreeTS);
float spot = currOption.pricingEngine.x0;
float forwardPrice = spot * dividendDiscount / riskFreeDiscount;
//declare the blackCalcStruct
blackCalcStruct blackCalc;
//initialize the calculator
initBlackCalculator(blackCalc, currOption.payoff, forwardPrice, sqrtf(variance), riskFreeDiscount);
//retrieve the results values
float resultVal = getResultVal(blackCalc);
//write the resulting value to global memory
outputVals[optionNum] = resultVal;
}
}
struct timeval end;
gettimeofday(&end, NULL);
seconds = end.tv_sec - start.tv_sec;
useconds = end.tv_usec - start.tv_usec;
mtimeGpu = ((seconds) * 1000 + ((float)useconds)/1000.0) + 0.5f;
printf("Run on GPU\n");
printf("Processing time on GPU: %f (ms)\n", mtimeGpu);
float totResult = 0.0f;
for (int i=0; i<numVals; i++)
{
totResult += outputVals[i];
}
printf("Summation of output prices on GPU: %f\n", totResult);
printf("Output price at index %d on GPU: %f\n\n", numVals/2, outputVals[numVals/2]);
//run on CPU
gettimeofday(&start, NULL);
for (size_t numOption=0; numOption < numVals; numOption++)
{
getOutValOptionCpu(values, outputVals, numOption, numVals);
}
gettimeofday(&end, NULL);
seconds = end.tv_sec - start.tv_sec;
useconds = end.tv_usec - start.tv_usec;
mtimeCpu = ((seconds) * 1000 + ((float)useconds)/1000.0) + 0.5f;
printf("Run on CPU\n");
printf("Processing time on CPU: %f (ms)\n", mtimeCpu);
totResult = 0.0f;
for (int i=0; i<numVals; i++)
{
totResult += outputVals[i];
}
printf("Summation of output prices on CPU: %f\n", totResult);
printf("Output price at index %d on CPU:: %f\n\n", numVals/2, outputVals[numVals/2]);
printf("Speedup on GPU: %f\n", mtimeCpu / mtimeGpu);
delete [] values;
free(outputVals);
}
}
////////////////////////////////////////////////////////////////////////////////
// Program main
////////////////////////////////////////////////////////////////////////////////
int
main( int argc, char** argv)
{
runBlackScholesAnalyticEngine();
return 0;
}
| 36.229651
| 126
| 0.584209
|
BeauJoh
|
43089c698d09a99f0bacf73df2f963cdc5a0e482
| 10,865
|
cpp
|
C++
|
third_party/libassimp/code/X3DImporter_Shape.cpp
|
tpsiaki/filament
|
772af1e8971e65bbff314cf696a9f32da79e3485
|
[
"Apache-2.0"
] | 140
|
2016-03-13T03:01:25.000Z
|
2022-02-06T09:47:04.000Z
|
third_party/libassimp/code/X3DImporter_Shape.cpp
|
tpsiaki/filament
|
772af1e8971e65bbff314cf696a9f32da79e3485
|
[
"Apache-2.0"
] | 469
|
2016-05-15T07:01:56.000Z
|
2020-05-29T23:58:59.000Z
|
third_party/libassimp/code/X3DImporter_Shape.cpp
|
tpsiaki/filament
|
772af1e8971e65bbff314cf696a9f32da79e3485
|
[
"Apache-2.0"
] | 72
|
2016-03-13T10:17:54.000Z
|
2020-02-24T05:40:02.000Z
|
/*
Open Asset Import Library (assimp)
----------------------------------------------------------------------
Copyright (c) 2006-2018, assimp team
All rights reserved.
Redistribution and use of this software in source and binary forms,
with or without modification, are permitted provided that the
following conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
* Neither the name of the assimp team, nor the names of its
contributors may be used to endorse or promote products
derived from this software without specific prior
written permission of the assimp team.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
----------------------------------------------------------------------
*/
/// \file X3DImporter_Shape.cpp
/// \brief Parsing data from nodes of "Shape" set of X3D.
/// \date 2015-2016
/// \author smal.root@gmail.com
#ifndef ASSIMP_BUILD_NO_X3D_IMPORTER
#include "X3DImporter.hpp"
#include "X3DImporter_Macro.hpp"
namespace Assimp
{
// <Shape
// DEF="" ID
// USE="" IDREF
// bboxCenter="0 0 0" SFVec3f [initializeOnly]
// bboxSize="-1 -1 -1" SFVec3f [initializeOnly]
// >
// <!-- ShapeChildContentModel -->
// "ShapeChildContentModel is the child-node content model corresponding to X3DShapeNode. ShapeChildContentModel can contain a single Appearance node and a
// single geometry node, in any order.
// A ProtoInstance node (with the proper node type) can be substituted for any node in this content model."
// </Shape>
// A Shape node is unlit if either of the following is true:
// The shape's appearance field is NULL (default).
// The material field in the Appearance node is NULL (default).
// NOTE Geometry nodes that represent lines or points do not support lighting.
void X3DImporter::ParseNode_Shape_Shape()
{
std::string use, def;
CX3DImporter_NodeElement* ne( nullptr );
MACRO_ATTRREAD_LOOPBEG;
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
MACRO_ATTRREAD_LOOPEND;
// if "USE" defined then find already defined element.
if(!use.empty())
{
MACRO_USE_CHECKANDAPPLY(def, use, ENET_Shape, ne);
}
else
{
// create and if needed - define new geometry object.
ne = new CX3DImporter_NodeElement_Shape(NodeElement_Cur);
if(!def.empty()) ne->ID = def;
// check for child nodes
if(!mReader->isEmptyElement())
{
ParseHelper_Node_Enter(ne);
MACRO_NODECHECK_LOOPBEGIN("Shape");
// check for appearance node
if(XML_CheckNode_NameEqual("Appearance")) { ParseNode_Shape_Appearance(); continue; }
// check for X3DGeometryNodes
if(XML_CheckNode_NameEqual("Arc2D")) { ParseNode_Geometry2D_Arc2D(); continue; }
if(XML_CheckNode_NameEqual("ArcClose2D")) { ParseNode_Geometry2D_ArcClose2D(); continue; }
if(XML_CheckNode_NameEqual("Circle2D")) { ParseNode_Geometry2D_Circle2D(); continue; }
if(XML_CheckNode_NameEqual("Disk2D")) { ParseNode_Geometry2D_Disk2D(); continue; }
if(XML_CheckNode_NameEqual("Polyline2D")) { ParseNode_Geometry2D_Polyline2D(); continue; }
if(XML_CheckNode_NameEqual("Polypoint2D")) { ParseNode_Geometry2D_Polypoint2D(); continue; }
if(XML_CheckNode_NameEqual("Rectangle2D")) { ParseNode_Geometry2D_Rectangle2D(); continue; }
if(XML_CheckNode_NameEqual("TriangleSet2D")) { ParseNode_Geometry2D_TriangleSet2D(); continue; }
if(XML_CheckNode_NameEqual("Box")) { ParseNode_Geometry3D_Box(); continue; }
if(XML_CheckNode_NameEqual("Cone")) { ParseNode_Geometry3D_Cone(); continue; }
if(XML_CheckNode_NameEqual("Cylinder")) { ParseNode_Geometry3D_Cylinder(); continue; }
if(XML_CheckNode_NameEqual("ElevationGrid")) { ParseNode_Geometry3D_ElevationGrid(); continue; }
if(XML_CheckNode_NameEqual("Extrusion")) { ParseNode_Geometry3D_Extrusion(); continue; }
if(XML_CheckNode_NameEqual("IndexedFaceSet")) { ParseNode_Geometry3D_IndexedFaceSet(); continue; }
if(XML_CheckNode_NameEqual("Sphere")) { ParseNode_Geometry3D_Sphere(); continue; }
if(XML_CheckNode_NameEqual("IndexedLineSet")) { ParseNode_Rendering_IndexedLineSet(); continue; }
if(XML_CheckNode_NameEqual("LineSet")) { ParseNode_Rendering_LineSet(); continue; }
if(XML_CheckNode_NameEqual("PointSet")) { ParseNode_Rendering_PointSet(); continue; }
if(XML_CheckNode_NameEqual("IndexedTriangleFanSet")) { ParseNode_Rendering_IndexedTriangleFanSet(); continue; }
if(XML_CheckNode_NameEqual("IndexedTriangleSet")) { ParseNode_Rendering_IndexedTriangleSet(); continue; }
if(XML_CheckNode_NameEqual("IndexedTriangleStripSet")) { ParseNode_Rendering_IndexedTriangleStripSet(); continue; }
if(XML_CheckNode_NameEqual("TriangleFanSet")) { ParseNode_Rendering_TriangleFanSet(); continue; }
if(XML_CheckNode_NameEqual("TriangleSet")) { ParseNode_Rendering_TriangleSet(); continue; }
if(XML_CheckNode_NameEqual("TriangleStripSet")) { ParseNode_Rendering_TriangleStripSet(); continue; }
// check for X3DMetadataObject
if(!ParseHelper_CheckRead_X3DMetadataObject()) XML_CheckNode_SkipUnsupported("Shape");
MACRO_NODECHECK_LOOPEND("Shape");
ParseHelper_Node_Exit();
}// if(!mReader->isEmptyElement())
else
{
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
}
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
}// if(!use.empty()) else
}
// <Appearance
// DEF="" ID
// USE="" IDREF
// >
// <!-- AppearanceChildContentModel -->
// "Child-node content model corresponding to X3DAppearanceChildNode. Appearance can contain FillProperties, LineProperties, Material, any Texture node and
// any TextureTransform node, in any order. No more than one instance of these nodes is allowed. Appearance may also contain multiple shaders (ComposedShader,
// PackagedShader, ProgramShader).
// A ProtoInstance node (with the proper node type) can be substituted for any node in this content model."
// </Appearance>
void X3DImporter::ParseNode_Shape_Appearance()
{
std::string use, def;
CX3DImporter_NodeElement* ne( nullptr );
MACRO_ATTRREAD_LOOPBEG;
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
MACRO_ATTRREAD_LOOPEND;
// if "USE" defined then find already defined element.
if(!use.empty())
{
MACRO_USE_CHECKANDAPPLY(def, use, ENET_Appearance, ne);
}
else
{
// create and if needed - define new geometry object.
ne = new CX3DImporter_NodeElement_Appearance(NodeElement_Cur);
if(!def.empty()) ne->ID = def;
// check for child nodes
if(!mReader->isEmptyElement())
{
ParseHelper_Node_Enter(ne);
MACRO_NODECHECK_LOOPBEGIN("Appearance");
if(XML_CheckNode_NameEqual("Material")) { ParseNode_Shape_Material(); continue; }
if(XML_CheckNode_NameEqual("ImageTexture")) { ParseNode_Texturing_ImageTexture(); continue; }
if(XML_CheckNode_NameEqual("TextureTransform")) { ParseNode_Texturing_TextureTransform(); continue; }
// check for X3DMetadataObject
if(!ParseHelper_CheckRead_X3DMetadataObject()) XML_CheckNode_SkipUnsupported("Appearance");
MACRO_NODECHECK_LOOPEND("Appearance");
ParseHelper_Node_Exit();
}// if(!mReader->isEmptyElement())
else
{
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
}
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
}// if(!use.empty()) else
}
// <Material
// DEF="" ID
// USE="" IDREF
// ambientIntensity="0.2" SFFloat [inputOutput]
// diffuseColor="0.8 0.8 0.8" SFColor [inputOutput]
// emissiveColor="0 0 0" SFColor [inputOutput]
// shininess="0.2" SFFloat [inputOutput]
// specularColor="0 0 0" SFColor [inputOutput]
// transparency="0" SFFloat [inputOutput]
// />
void X3DImporter::ParseNode_Shape_Material()
{
std::string use, def;
float ambientIntensity = 0.2f;
float shininess = 0.2f;
float transparency = 0;
aiColor3D diffuseColor(0.8f, 0.8f, 0.8f);
aiColor3D emissiveColor(0, 0, 0);
aiColor3D specularColor(0, 0, 0);
CX3DImporter_NodeElement* ne( nullptr );
MACRO_ATTRREAD_LOOPBEG;
MACRO_ATTRREAD_CHECKUSEDEF_RET(def, use);
MACRO_ATTRREAD_CHECK_RET("ambientIntensity", ambientIntensity, XML_ReadNode_GetAttrVal_AsFloat);
MACRO_ATTRREAD_CHECK_RET("shininess", shininess, XML_ReadNode_GetAttrVal_AsFloat);
MACRO_ATTRREAD_CHECK_RET("transparency", transparency, XML_ReadNode_GetAttrVal_AsFloat);
MACRO_ATTRREAD_CHECK_REF("diffuseColor", diffuseColor, XML_ReadNode_GetAttrVal_AsCol3f);
MACRO_ATTRREAD_CHECK_REF("emissiveColor", emissiveColor, XML_ReadNode_GetAttrVal_AsCol3f);
MACRO_ATTRREAD_CHECK_REF("specularColor", specularColor, XML_ReadNode_GetAttrVal_AsCol3f);
MACRO_ATTRREAD_LOOPEND;
// if "USE" defined then find already defined element.
if(!use.empty())
{
MACRO_USE_CHECKANDAPPLY(def, use, ENET_Material, ne);
}
else
{
// create and if needed - define new geometry object.
ne = new CX3DImporter_NodeElement_Material(NodeElement_Cur);
if(!def.empty()) ne->ID = def;
((CX3DImporter_NodeElement_Material*)ne)->AmbientIntensity = ambientIntensity;
((CX3DImporter_NodeElement_Material*)ne)->Shininess = shininess;
((CX3DImporter_NodeElement_Material*)ne)->Transparency = transparency;
((CX3DImporter_NodeElement_Material*)ne)->DiffuseColor = diffuseColor;
((CX3DImporter_NodeElement_Material*)ne)->EmissiveColor = emissiveColor;
((CX3DImporter_NodeElement_Material*)ne)->SpecularColor = specularColor;
// check for child nodes
if(!mReader->isEmptyElement())
ParseNode_Metadata(ne, "Material");
else
NodeElement_Cur->Child.push_back(ne);// add made object as child to current element
NodeElement_List.push_back(ne);// add element to node element list because its a new object in graph
}// if(!use.empty()) else
}
}// namespace Assimp
#endif // !ASSIMP_BUILD_NO_X3D_IMPORTER
| 43.286853
| 158
| 0.743488
|
tpsiaki
|
43092dcd24e5c1b62b7d45b1342ea31908935e4e
| 40,625
|
cpp
|
C++
|
ROLE/custom/hls/common/src/common.cpp
|
cloudFPGA/cFp_Zoo
|
3aefb12108f99fcfd0d39a8aae97cf87428a6873
|
[
"Apache-2.0"
] | 6
|
2021-12-29T10:58:28.000Z
|
2022-02-15T06:07:05.000Z
|
ROLE/custom/hls/common/src/common.cpp
|
cloudFPGA/cFp_Zoo
|
3aefb12108f99fcfd0d39a8aae97cf87428a6873
|
[
"Apache-2.0"
] | 2
|
2022-01-17T10:35:55.000Z
|
2022-02-04T09:28:47.000Z
|
ROLE/custom/hls/common/src/common.cpp
|
cloudFPGA/cFp_Zoo
|
3aefb12108f99fcfd0d39a8aae97cf87428a6873
|
[
"Apache-2.0"
] | null | null | null |
/*******************************************************************************
* Copyright 2016 -- 2022 IBM Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
/*****************************************************************************
* @file commom.cpp
* @brief Common functions for testbenches - body.
*
* @date September 2021
* @author FAB, WEI, NGL, DID, DCO
*
* @ingroup IBMZRL
* @addtogroup IBMZRL
* \{
*****************************************************************************/
#include "../include/common.hpp"
using namespace std;
/*****************************************************************************
* @brief Initialize an input data stream from a file.
*
* @param[in] sDataStream the input data stream to set.
* @param[in] dataStreamName the name of the data stream.
* @param[in] inpFileName the name of the input file to read from.
* @return OK if successful otherwise KO.
******************************************************************************/
bool setInputDataStream(stream<UdpWord> &sDataStream, const string dataStreamName,
const string inpFileName, int simCnt) {
string strLine;
ifstream inpFileStream;
string datFile = "../../../../test/" + inpFileName;
UdpWord udpWord=NetworkWord(0,0,0);
//-- STEP-1 : OPEN FILE
inpFileStream.open(datFile.c_str());
if ( !inpFileStream ) {
cout << "### ERROR : Could not open the input data file " << datFile << endl;
return(KO);
}
//-- STEP-2 : SET DATA STREAM
while (inpFileStream) {
if (!inpFileStream.eof()) {
getline(inpFileStream, strLine);
if (strLine.empty()) continue;
sscanf(strLine.c_str(), "%llx %x %d", &udpWord.tdata, &udpWord.tkeep, &udpWord.tlast);
// Write to sDataStream
if (sDataStream.full()) {
printf("### ERROR : Stream is full. Cannot write stream with data from file \"%s\".\n", inpFileName.c_str());
return(KO);
} else {
sDataStream.write(udpWord);
// Print Data to console
#if DEBUG_LEVEL == TRACE_ALL
printf("[%4.4d] TB is filling input stream [%s] - Data write = {D=0x%16.16llX, K=0x%2.2X, L=%d} \n",
simCnt, dataStreamName.c_str(),
udpWord.tdata.to_long(), udpWord.tkeep.to_int(), udpWord.tlast.to_int());
#endif
}
}
}
//-- STEP-3: CLOSE FILE
inpFileStream.close();
//strLine.clear();
return(OK);
}
/*****************************************************************************
* @brief Read data from a stream.
*
* @param[in] sDataStream, the output data stream to read.
* @param[in] dataStreamName, the name of the data stream.
* @param[out] udpWord, a pointer to the storage location of the data
* to read.
* @return VALID if a data was read, otherwise UNVALID.
******************************************************************************/
bool readDataStream(stream <UdpWord> &sDataStream, UdpWord *udpWord) {
// Get the DUT/Data results
sDataStream.read(*udpWord);
return(VALID);
}
/*****************************************************************************
* @brief Pack an array of 8 x ap_uint<8> into a ap_uint<64> word.
*
* @param[in] buffer A pointer to an array of 8 x ap_uint<8>
* @return An ap_uint<64> word.
******************************************************************************/
ap_uint<64> pack_ap_uint_64_ (ap_uint<8> *buffer) {
ap_uint<64> value = 0;
value = buffer[7];
value = (value << 8 ) + buffer[6];
value = (value << 8 ) + buffer[5];
value = (value << 8 ) + buffer[4];
value = (value << 8 ) + buffer[3];
value = (value << 8 ) + buffer[2];
value = (value << 8 ) + buffer[1];
value = (value << 8 ) + buffer[0];
return value ;
}
/*****************************************************************************
* @brief Unpack an ap_uint<64> word to an array of 8 x ap_uint<8>.
*
* @param[in] buffer A pointer to an ap_uint<64> word
* @return An ap_uint<64> word.
******************************************************************************/
void unpack_ap_uint_64_ (ap_uint<64> value, ap_uint<8> *buffer) {
for (unsigned int i=0; i<8; i++) {
buffer[i] = (value >> 8*i );
}
}
/*****************************************************************************
* @brief Dump a data word to a file.
*
* @param[in] udpWord, a pointer to the data word to dump.
* @param[in] outFileStream,the output file stream to write to.
* @return OK if successful, otherwise KO.
******************************************************************************/
bool dumpDataToFile(UdpWord *udpWord, ofstream &outFileStream) {
if (!outFileStream.is_open()) {
printf("### ERROR : Output file stream is not open. \n");
return(KO);
}
outFileStream << hex << noshowbase << setfill('0') << setw(16) << udpWord->tdata.to_uint64();
outFileStream << " ";
outFileStream << hex << noshowbase << setfill('0') << setw(2) << udpWord->tkeep.to_int();
outFileStream << " ";
outFileStream << setw(1) << udpWord->tlast.to_int() << "\n";
return(OK);
}
/*****************************************************************************
* @brief Fill an output file with data from an output stream.
*
* @param[in] sDataStream, the output data stream to set.
* @param[in] dataStreamName, the name of the data stream.
* @param[in] outFileName, the name of the output file to write to.
* @return OK if successful, otherwise KO.
******************************************************************************/
bool getOutputDataStream(stream<UdpWord> &sDataStream,
const string dataStreamName, const string outFileName, int simCnt)
{
//string strLine;
ofstream outFileStream;
string datFile = "../../../../test/" + outFileName;
UdpWord udpWord=NetworkWord(0,0,0);
bool rc = OK;
//-- STEP-1 : OPEN FILE
outFileStream.open(datFile.c_str());
if ( !outFileStream ) {
cout << "### ERROR : Could not open the output data file " << datFile << endl;
return(KO);
}
//-- STEP-2 : EMPTY STREAM AND DUMP DATA TO FILE
while (!sDataStream.empty()) {
if (readDataStream(sDataStream, &udpWord) == VALID) {
// Print DUT/Data to console
#if DEBUG_LEVEL == TRACE_ALL
printf("[%4.4d] TB is draining output stream [%s] - Data read = {D=0x%16.16llX, K=0x%2.2X, L=%d} \n",
simCnt, dataStreamName.c_str(),
udpWord.tdata.to_long(), udpWord.tkeep.to_int(), udpWord.tlast.to_int());
#endif
if (!dumpDataToFile(&udpWord, outFileStream)) {
rc = KO;
break;
}
}
}
//-- STEP-3: CLOSE FILE
outFileStream.close();
return(rc);
}
/*****************************************************************************
* @brief Fill an output file with data from an image.
*
*
* @param[in] sDataStream the input image in xf::cv::Mat format.
* @param[in] outFileName the name of the output file to write to.
* @return OK if successful, otherwise KO.
******************************************************************************/
bool dumpStringToFile(const string s, const string outFileName, int simCnt)
{
//string strLine;
ofstream outFileStream;
string datFile = "../../../../test/" + outFileName;
UdpWord udpWord=NetworkWord(0,0,0);
bool rc = OK;
unsigned int bytes_per_line = 8;
//-- STEP-1 : OPEN FILE
outFileStream.open(datFile.c_str());
if ( !outFileStream ) {
cout << "### ERROR : Could not open the output data file " << datFile << endl;
return(KO);
}
#if DEBUG_LEVEL == TRACE_ALL
printf("came to dumpStringToFile: s.length()=%u\n", s.length());
#endif
ap_uint<8> value[bytes_per_line];
unsigned int total_bytes = 0;
//-- STEP-2 : DUMP STRING DATA TO FILE
for (unsigned int i = 0; i < s.length(); i+=bytes_per_line, total_bytes+=bytes_per_line) {
//if (NPIX == XF_NPPC8) {
for (unsigned int k = 0; k < bytes_per_line; k++) {
if (i+k < s.length()) {
value[k] = s[i+k];
}
else {
value[k] = 0;
}
#if DEBUG_LEVEL == TRACE_ALL
printf("DEBUG: In dumpStringToFile: value[%u]=%c\n", k, (char)value[k]);
#endif
}
udpWord.tdata = pack_ap_uint_64_(value);
udpWord.tkeep = 255;
// We are signaling a packet termination either at the end of the image or the end of MTU
if ((total_bytes >= (s.length() - bytes_per_line)) ||
((total_bytes + bytes_per_line) % PACK_SIZE == 0)) {
udpWord.tlast = 1;
}
else {
udpWord.tlast = 0;
}
#if DEBUG_LEVEL == TRACE_ALL
printf("[%4.4d] IMG TB is dumping string to file [%s] - Data read [%u] = {val=%u, D=0x%16.16llX, K=0x%2.2X, L=%d} \n",
simCnt, datFile.c_str(), total_bytes, value,
udpWord.tdata.to_long(), udpWord.tkeep.to_int(), udpWord.tlast.to_int());
#endif
if (!dumpDataToFile(&udpWord, outFileStream)) {
rc = KO;
break;
}
}
//-- STEP-3: CLOSE FILE
outFileStream.close();
return(rc);
}
/*****************************************************************************
* @brief Fill an output file with data from an image.
*
*
* @param[in] sDataStream the input image in xf::cv::Mat format.
* @param[in] outFileName the name of the output file to write to.
* @return OK if successful, otherwise KO.
******************************************************************************/
bool dumpStringToFileOnlyRawData(const string s, const string outFileName, int simCnt, size_t out_size)
{
//printStringHex(s, out_size);
//string strLine;
ofstream outFileStream;
string datFile = outFileName; //"../../../../test/" + outFileName;
bool rc = OK;
unsigned int bytes_per_line = 8;
ap_uint<64> tdata = 0;
//-- STEP-1 : OPEN FILE
outFileStream.open(datFile.c_str());
if ( !outFileStream ) {
cout << "### ERROR : Could not open the output data file " << datFile << endl;
return(KO);
}
#if DEBUG_LEVEL == TRACE_ALL
printf("came to dumpStringToFileOnlyRawData: s.length()=%u\n", out_size);
#endif
ap_uint<8> value[bytes_per_line];
unsigned int total_bytes = 0;
//-- STEP-2 : DUMP STRING DATA TO FILE
for (unsigned int i = 0; i < out_size; i+=bytes_per_line, total_bytes+=bytes_per_line) {
for (unsigned int k = 0; k < bytes_per_line; k++) {
if (i+k < out_size) {
value[k] = s[i+k];
}
else {
value[k] = 0;
}
#if DEBUG_LEVEL == TRACE_ALL
printf("DEBUG: In dumpStringToFileOnlyRawData: value[%u]=%c\n", k, (char)value[k]);
#endif
}
tdata = pack_ap_uint_64_(value);
#if DEBUG_LEVEL == TRACE_ALL
printf("[%4.4d] IMG TB is dumping string to file [%s] - Data read [%u] = {val=%u, D=0x%16.16llX} \n",
simCnt, datFile.c_str(), total_bytes, value, tdata.to_long());
#endif
outFileStream << hex << setfill('0') << setw(16) << tdata.to_uint64();
//outFileStream << hex << noshowbase << setfill('0') << setw(16) << tdata.to_uint64();
outFileStream << "\n";
}
//-- STEP-3: CLOSE FILE
outFileStream.close();
return(rc);
}
/*****************************************************************************
* @brief Fill an output file with data from a string and
* set the tlast every gno packets
*
*
* @param[in] sDataStream the input image in xf::cv::Mat format.
* @param[in] outFileName the name of the output file to write to.
* @param[in] simCnt
* @param[in] gno the counter value at which this function set the tlast=1
* @return OK if successful, otherwise KO.
******************************************************************************/
bool dumpStringToFileWithLastSetEveryGnoPackets(string s, const string outFileName, int simCnt, int gno)
{
string strLine;
ofstream outFileStream;
string datFile = "../../../../test/" + outFileName;
UdpWord udpWord=NetworkWord(0,0,0);
bool rc = OK;
unsigned int bytes_per_line = 8;
//-- STEP-1 : OPEN FILE
outFileStream.open(datFile.c_str());
if ( !outFileStream ) {
cout << "### ERROR : Could not open the output data file " << datFile << endl;
return(KO);
}
#if DEBUG_LEVEL == TRACE_ALL
printf("came to dumpStringToFile: s.length()=%u\n", s.length());
#endif
ap_uint<8> value[bytes_per_line];
unsigned int total_bytes = 0;
int cntr = 0;
//-- STEP-2 : DUMP STRING DATA TO FILE
for (unsigned int i = 0; i < s.length(); cntr += 1, i+=bytes_per_line, total_bytes+=bytes_per_line) {
//if (NPIX == XF_NPPC8) {
for (unsigned int k = 0; k < bytes_per_line; k++) {
if (i+k < s.length()) {
value[k] = s[i+k];
}
else {
value[k] = 0;
}
#if DEBUG_LEVEL == TRACE_ALL
printf("DEBUG: In dumpStringToFile: value[%u]=%c\n", k, (char)value[k]);
#endif
}
udpWord.tdata = pack_ap_uint_64_(value);
udpWord.tkeep = 255;
// We are signaling a packet termination either at the end of the image or the end of MTU
if ((total_bytes >= (s.length() - bytes_per_line)) ||
((total_bytes + bytes_per_line) % PACK_SIZE == 0) || ( cntr!= 0 && ((cntr+1) % gno == 0))) {
udpWord.tlast = 1;
}
else {
udpWord.tlast = 0;
}
#if DEBUG_LEVEL == TRACE_ALL
printf("[%4.4d] IMG TB is dumping string to file [%s] - Data read [%u] = {val=%u, D=0x%16.16llX, K=0x%2.2X, L=%d} \n",
simCnt, datFile.c_str(), total_bytes, value,
udpWord.tdata.to_long(), udpWord.tkeep.to_int(), udpWord.tlast.to_int());
#endif
if (!dumpDataToFile(&udpWord, outFileStream)) {
rc = KO;
break;
}
}
//-- STEP-3: CLOSE FILE
outFileStream.close();
return(rc);
}
/*****************************************************************************
* @brief Initialize an input data stream from a file.
*
* @param[in] inpFileName the name of the input file to read from.
* @param[out] strOutput the output string to set.
* @return OK if successful otherwise KO.
******************************************************************************/
bool dumpFileToString(const string inpFileName, char* charOutput, int simCnt) {
string strLine;
ifstream inpFileStream;
string datFile = "../../../../test/" + inpFileName;
UdpWord udpWord=NetworkWord(0,0,0);
unsigned int i = 0;
unsigned int bytes_per_line = 8;
ap_uint<8> value[bytes_per_line];
for(i=0; i < bytes_per_line; i++){
value[i]=0;
}
i=0;
//-- STEP-1 : OPEN FILE
inpFileStream.open(datFile.c_str());
if ( !inpFileStream ) {
cout << "### ERROR : Could not open the input data file " << datFile << endl;
return(KO);
}
//-- STEP-2 : SET DATA STREAM
while (inpFileStream) {
if (!inpFileStream.eof()) {
getline(inpFileStream, strLine);
//cout << strLine << endl;
if (strLine.empty()) continue;
sscanf(strLine.c_str(), "%llx %x %d", &udpWord.tdata, &udpWord.tkeep, &udpWord.tlast);
// Write to strOutput
//printf("Debug: (char)udpWord.tdata.to_long()=%c\n", (char)udpWord.tdata.to_long());
unpack_ap_uint_64_(udpWord.tdata, value);
for (unsigned int k = 0; k < bytes_per_line; k++) {
charOutput[i++] = value[k];
// Print Data to console
#if DEBUG_LEVEL == TRACE_ALL
printf("[%4.4d] TB is filling string with character %c\n",
simCnt, (char)value[k]);
#endif
}
}
}
//-- STEP-3: CLOSE FILE
inpFileStream.close();
//strLine.clear();
return(OK);
}
/*****************************************************************************
* @brief Initialize an input data stream from a file with only data
*
* @param[in] inpFileName the name of the input file to read from.
* @param[out] strOutput the output string to set.
* @return OK if successful otherwise KO.
******************************************************************************/
template<unsigned int bytes_per_line = 8>
string dumpFileToStringRawDataString(const string inpFileName, int * rawdatalines, size_t outputSize) {
string strLine;
string tmp_Out;
ifstream inpFileStream;
string datFile = inpFileName;
string charOutput;
//charOutput.reserve(outputSize);
//strLine.reserve(outputSize);
//tmp_Out.reserve(bytes_per_line);
unsigned long long int mylongunsigned;
unsigned long long int zero_byte=0;
unsigned int i = 0;
char my_tmp_buf [bytes_per_line];
//-- STEP-1 : OPEN FILE
inpFileStream.open(datFile.c_str());
if ( !inpFileStream ) {
cout << "### ERROR : Could not open the input data file " << datFile << endl;
return "";
}
//-- STEP-2 : SET DATA STREAM
while (inpFileStream) {
if (!inpFileStream.eof()) {
getline(inpFileStream, strLine);
memcpy(my_tmp_buf,&zero_byte, bytes_per_line);
if (strLine.empty()) continue;
*rawdatalines+=1;
mylongunsigned=stoul(strLine,nullptr,16);
hex2ascii(strLine, tmp_Out);
// Write to strOutput
memcpy(my_tmp_buf,(char *)&mylongunsigned, sizeof(unsigned long long int));
charOutput.append(my_tmp_buf, bytes_per_line);
i++;
}
}
//-- STEP-3: CLOSE FILE
inpFileStream.close();
//tmp_Out.clear();
return string(charOutput);
}
/*****************************************************************************
* @brief convert a char to its hexadecimal representation.
*
* @param[in] c the standard char value to convert to hex
* @return the hexadecimal value of the input
******************************************************************************/
// C++98 guarantees that '0', '1', ... '9' are consecutive.
// It only guarantees that 'a' ... 'f' and 'A' ... 'F' are
// in increasing order, but the only two alternative encodings
// of the basic source character set that are still used by
// anyone today (ASCII and EBCDIC) make them consecutive.
unsigned char hexval(unsigned char c)
{
if ('0' <= c && c <= '9')
return c - '0';
else if ('a' <= c && c <= 'f')
return c - 'a' + 10;
else if ('A' <= c && c <= 'F')
return c - 'A' + 10;
else abort();
}
/*****************************************************************************
* @brief Convert a hexadecimal string to a ascii string
*FIXME:
* @param[in] in the input hexadecimal string
* @param[out] out the output ascii string
******************************************************************************/
void hex2ascii(const string& in, string& out)
{
out.clear();
out.reserve(in.length() / 2);
for (string::const_iterator p = in.begin(); p != in.end(); p++)
{
unsigned char c = hexval(*p);
p++;
if (p == in.end()) break; // incomplete last digit - should report error
c = (c << 4) + hexval(*p); // + takes precedence over <<
out.push_back(c);
}
}
/*****************************************************************************
* @brief Convert a ascii string to a hexadecimal string
*FIXME:
* @param[in] in the input ascii string
* @param[out] out the output hexadecimal string
******************************************************************************/
void ascii2hex(const string& in, string& out)
{
std::stringstream sstream;
for ( string::const_iterator item = in.begin(); item != in.end(); item++){
sstream << std::hex << int(*item);
}
out=sstream.str();
}
/*****************************************************************************
* @brief Convert a ascii string to a hexadecimal string
*FIXME:
* @param[in] in the input ascii string
* @param[out] out the output hexadecimal string
* @param[in] bytesize the input ascii string size
******************************************************************************/
void ascii2hexWithSize(const string& in, string& out, size_t bytesize)
{
std::stringstream sstream;
for ( int i=0; i<bytesize; i++){
sstream << std::hex << int(in[i]);
}
out=sstream.str();
}
/*****************************************************************************
* @brief Check the presence of a given corner value at the begin and the end of a string
*
* @param[in] str the input string to be checked
* @param[in] corner the corner char to find
* @return true if it is present, false otherwise
******************************************************************************/
bool isCornerPresent(string str, string corner)
{
int n = str.length();
int cl = corner.length();
// If length of corner string is more, it
// cannot be present at corners.
if (n < cl)
return false;
// Return true if corner string is present at
// both corners of given string.
return (str.substr(0, cl).compare(corner) == 0 &&
str.substr(n-cl, cl).compare(corner) == 0);
}
/*****************************************************************************
* @brief Convert a hex string to a integer into a char buffer with the SAME dimensions
*FIXME:
* @param[in] in the input hex string
* @param[out] out the output numerical hexadec string string
* @param[in] byteSize the bytesize of the input string and the buffer, it assumes equal dimension
******************************************************************************/
template<typename T>
void string2hexnumerics(const string& in, char * out, size_t byteSize)
{
for (unsigned int i = 0; i < byteSize; i++)
{
std::sprintf(out+i, "%d", (T)in[i]);
}
}
void stringHex2Unsigned(const string& in, unsigned int * out, size_t byteSize)
{
for (unsigned int i = 0; i < byteSize; i++)
{
std::sprintf((char*)out+i, "%u", (unsigned int)in[i]);
}
}
/*****************************************************************************
* @brief Convert a hex string to a integer into a char buffer with the SAME dimensions
* FIXME:
* @param[in] in the input hex string
* @param[out] out the output numerical hexadec string string
* @param[in] byteSize the bytesize of the input string and the buffer, it assumes equal dimension
******************************************************************************/
void string2hexnumericsString(const string& in, string &out, size_t byteSize)
{
char tmp_out [byteSize];
for (unsigned int i = 0; i < byteSize; i++)
{
std::sprintf(tmp_out+i, "%d", (int)in[i]);
}
out.append(tmp_out);
}
/*****************************************************************************
* @brief Create the commands for a memory test with start/max address to test-nop to execute-stop
*
* @param[in] mem_address max target address to test
* @param[out] out the output string with start/max address-nops4trgtCCsNeeded-stop
* @param[in] testingNumber the number of tests to perform on the memory
*
******************************************************************************/
template<unsigned int bytes_per_line = 8>
string createMemTestCommands(unsigned long long int mem_address, unsigned int testingNumber, unsigned int burst_size)
{
string out;
char start_cmd [bytes_per_line];
char stop_cmd [bytes_per_line];
char value_cmd[bytes_per_line];
char burst_cmd[bytes_per_line];
//WARNING: currently hardcoded way of start and stop commands with a 1 and 2 for start and stop respectively
for (unsigned int k = 0; k < bytes_per_line; k++) {
value_cmd[k] = (char)0;
if (k != 0) {
stop_cmd[k] = (char)0;
start_cmd[k] = (char)0;
burst_cmd[k] = (char)0;
}
else {
start_cmd[k] = (char)1;
stop_cmd[k] = (char)2;
burst_cmd[k] = (char)4;
}
}
memcpy(start_cmd+1, (char*)&testingNumber, 2);
out = out.append(start_cmd,3);
memcpy(value_cmd, (char*)&mem_address, 5);
out = out.append(value_cmd,5);
memcpy(burst_cmd+1,(char*)&burst_size,2);
out = out.append(burst_cmd,8);
return string(out);
}
/*****************************************************************************
* @brief Create the expected output results for the memory test (with FAULT INJECTION)
*
* @param[in] mem_address max target address to test
* @param[out] out the results of the memory test (with FAULT INJECTION)
* @param[in] testingNumber the number of tests to perform on the memory
*
******************************************************************************/
template<unsigned int bytes_per_line = 8>
string createMemTestGoldenOutput(unsigned long long int mem_address, unsigned int testingNumber, bool with_bw_analysis)
{
char addr_cmd [bytes_per_line]; // Half of the command filled with start other half with the address
char fault_cntr_cmd [bytes_per_line];
char fault_addr_cmd [bytes_per_line];
char filler_cmd [bytes_per_line];
char clock_cycles_cmd [bytes_per_line];
char end_of_tests_cmd [bytes_per_line];
char stop_cmd [bytes_per_line];
unsigned int fault_addr = 0;
unsigned int clock_cycles = 0;
const unsigned int first_faultTests = 3;
string out;
//given parameters
unsigned int mem_word_size = 512;
unsigned int mem_size_of_word_size = 20;
// computations the first faulty address and the the fault counter
unsigned int mem_addr_per_word = mem_word_size / 8; // byte size of this word
unsigned int fault_cntr = 0;
//precomputing the cc
clock_cycles = mem_address % mem_addr_per_word == 0 ? mem_address / mem_addr_per_word : (unsigned int) mem_address / mem_addr_per_word + 1;
//simulating the fault injection
for (unsigned int j = 1; j < mem_address/64; j++)
{
ap_uint<512> currentNumber = j;
ap_uint<512> nextNumber = (currentNumber+1) xor 1;
ap_uint<512> tmpNumber = nextNumber;
tmpNumber = nextNumber & 0;
if( nextNumber != (tmpNumber)){
fault_cntr+=1;
}
}
// for (unsigned int j = 0; j < mem_address; j+=mem_addr_per_word)
// {
// ap_uint<32> currentNumber = j;
// ap_uint<32> nextNumber = (currentNumber+1) xor 1;
// ap_uint<32> prevNumber = currentNumber;
// ap_uint<32> tmpNumber = nextNumber;
// ap_uint<32> mask = 0;
// for (unsigned int i = 0; i < mem_word_size/32 && j > 0; i++){
// tmpNumber = nextNumber & 0;
// if( nextNumber != (tmpNumber)){
// fault_cntr+=1;
// }
// prevNumber = currentNumber;
// currentNumber = nextNumber;
// nextNumber = (nextNumber + 1 ) xor i;
// }
// }
//init the commands and fill em out of the fault simulation before
for(unsigned int i = 0; i < testingNumber; i++){
for (unsigned int k = 0; k < bytes_per_line; k++) {
addr_cmd[k] = (char)0;
filler_cmd[k] = (char)0;
fault_cntr_cmd[k] = (char)0;
fault_addr_cmd[k] = (char)0;
stop_cmd[k] = (char)0;
stop_cmd[k] = (char)0;
end_of_tests_cmd[k] = (char)0;
clock_cycles_cmd[k] = (char)0;
}
stop_cmd[0] = (char)2;
end_of_tests_cmd[0] = (char)3;
memcpy(end_of_tests_cmd+1, (char*)&testingNumber, 2);
memcpy(addr_cmd, (char*)&mem_address, sizeof(unsigned long long int));
out = out.append(addr_cmd,bytes_per_line);
//if not yet in the fault injection point just let em empty as expected from good tests
if(i < first_faultTests-1 || mem_address <= mem_addr_per_word)
{
out = out.append(filler_cmd,bytes_per_line);
out = out.append(filler_cmd,bytes_per_line);
}else{
memcpy(fault_cntr_cmd, (char*)&fault_cntr, sizeof(unsigned int));
out = out.append(fault_cntr_cmd,bytes_per_line);
memcpy(fault_addr_cmd, (char*)&mem_addr_per_word, sizeof(unsigned int));
out = out.append(fault_addr_cmd,bytes_per_line);
}
// memcpy(clock_cycles_cmd, (char*)&clock_cycles, sizeof(unsigned int));
// memcpy(clock_cycles_cmd+sizeof(unsigned int), (char*)&clock_cycles, sizeof(unsigned int));
// out = out.append(clock_cycles_cmd,bytes_per_line);
////TODO: to make everything pass at the csim lvl since cc of read count always one
const unsigned int dummycc=1;
memcpy(clock_cycles_cmd,(char*)& dummycc, sizeof(unsigned int));
out = out.append(clock_cycles_cmd,bytes_per_line);//read
out = out.append(filler_cmd,bytes_per_line);//write
}
out = out.append(end_of_tests_cmd,bytes_per_line);
// out.append(stop_cmd,bytes_per_line);
return string(out);
}
/*****************************************************************************
* @brief Create the expected output results for the uppercase
*
* @param[in] input_string the input string of the uppercase
*
* @return out the results of the uppercase
******************************************************************************/
std::string createUppercaseGoldenOutput(std::string input_string){
std::string strGold;
strGold = input_string;
uppercase_conversion:
for (unsigned int i = 0; i < strGold.length(); i++ ) {
if (strGold[i] >= 'a' && strGold[i] <= 'z'){
strGold[i] = strGold[i] - ('a' - 'A');
}
}
return strGold;
}
/*****************************************************************************
* @brief reverse a given string
*
* @param[in] str the string to reverse.
* @return nothing, print to stdout.
******************************************************************************/
void reverseStr(string& str)
{
int n = str.length();
// Swap character starting from two
// corners
for (int i = 0; i < n / 2; i++)
swap(str[i], str[n - i - 1]);
}
/*****************************************************************************
* @brief Parse the memory test output contained in astring with a given size
*
* @param[in] longbuf the buffer containing the output
* @param[in] charOutputSize the bytesize of the buffer
* @param[in] rawdatalines the number of lines in the given outbuf
* @return vectpr of MemoryTestResult data strcuture
******************************************************************************/
template<unsigned int bytes_per_line=8>
std::vector<MemoryTestResult> parseMemoryTestOutput(const string longbuf, size_t charOutputSize, int rawdatalines)
{
std::vector<MemoryTestResult> testResults_vector;
int rawiterations = charOutputSize / 8; //should be equivalent to rawdatalines
unsigned int mem_word_size = 512;
unsigned int mem_word_byte_size = mem_word_size/8;
bool is_stop_present = rawdatalines % (3+1+1) == 0; //guard to check if multiple data of 3 64bytes or with
int k = 1;
char myTmpOutBuff [bytes_per_line];
for (int i = 0; i < bytes_per_line; ++i)
{
myTmpOutBuff[i]=(char)0;
}
unsigned int testingNumber_out=0, fault_cntr_out=0, fault_addr_out=0;
unsigned long long int max_memory_addr_out=0, clock_cycles_read=0, clock_cycles_write=0;
for (int i = 1; i < rawdatalines+1; i++)
{
string tmp_outbuff;
tmp_outbuff= longbuf.substr((i-1)*bytes_per_line,bytes_per_line);
if(is_stop_present && k==7){
cout << "DEBUG the stop is present and is here" << endl;
} else if( ( (i == rawdatalines-1) || (i == rawdatalines) ) && k==6){ //check it is either the last or one before the last
//substr extraction and parsing
//strncpy(myTmpOutBuff,tmp_outbuff.c_str()+1,bytes_per_line-1);
//testingNumber_out = *reinterpret_cast<unsigned long long*>(myTmpOutBuff);
memcpy(&testingNumber_out,tmp_outbuff.c_str()+1,bytes_per_line/2);
#if DEBUG_LEVEL == TRACE_ALL
cout << "DEBUG last command with the iterations " << testingNumber_out << endl;
#endif
}else if(k==5){
//strncpy(myTmpOutBuff,tmp_outbuff.c_str(),bytes_per_line);
//clock_cycles_read = *reinterpret_cast<unsigned long long int*>(myTmpOutBuff);
memcpy(&clock_cycles_read,tmp_outbuff.c_str(),bytes_per_line);
#if DEBUG_LEVEL == TRACE_ALL
cout << "DEBUG clock_cycles_read (or the fourth half data pckt) " << clock_cycles_read << endl;
cout << "DEBUG clock_cycles_write (or the fourth half data pckt) " << clock_cycles_write << endl;
#endif
MemoryTestResult tmpResult(max_memory_addr_out,fault_cntr_out,fault_addr_out,clock_cycles_write,clock_cycles_read);
testResults_vector.push_back(tmpResult);
if(!( (i+1 == rawdatalines-1) || (i+1 == rawdatalines) )){
k=0;
#if DEBUG_LEVEL == TRACE_ALL
cout << "DEBUG reinit the counter" << endl;
#endif
}
unsigned int written_words = max_memory_addr_out%mem_word_byte_size == 0 ? max_memory_addr_out/mem_word_byte_size : max_memory_addr_out/mem_word_byte_size + 1;
double rd_bndwdth = ( (double)written_words*(double)mem_word_size / ( (double)tmpResult.clock_cycles_read * ( 6.4 ) ) ); // Gbit/T
double wr_bndwdth = ( (double)written_words*(double)mem_word_size / ( (double)tmpResult.clock_cycles_write * ( 6.4 ) ) );
#if DEBUG_LEVEL == TRACE_ALL
cout << "Written " << written_words << " words" << endl;
cout << "DEBUG overall test results: target address " << tmpResult.target_address << " ";
cout << "Fault counter: " << tmpResult.fault_cntr << " ";
cout << "First fault at address: " << tmpResult.first_fault_address << " " << endl;
cout << " RD BW " << rd_bndwdth << "[GBit/s] with cc equal to " << tmpResult.clock_cycles_read << " " << endl;
cout << " WR BW " << wr_bndwdth << "[GBit/s] with cc equal to " << tmpResult.clock_cycles_write << " " << endl;
#endif
} else if(k==4){ //clock cycless
//char mySecondTmpOutBuff[bytes_per_line/2];
//string additional_string;
//init the buffer
//for(int i=0;i<bytes_per_line;i++){myTmpOutBuff[i]=(char)0;mySecondTmpOutBuff[i%(bytes_per_line/2)]=(char)0;}
// additional_string=tmp_outbuff.substr(bytes_per_line/2,bytes_per_line/2);
//
// tmp_outbuff = tmp_outbuff.erase(bytes_per_line/2,bytes_per_line/2);
// strncpy(myTmpOutBuff,tmp_outbuff.c_str(),bytes_per_line/2);
// clock_cycles_read = *reinterpret_cast<unsigned int*>(myTmpOutBuff);
//
// strncpy(mySecondTmpOutBuff,additional_string.c_str(),bytes_per_line/2);
// clock_cycles_write = *reinterpret_cast<unsigned int*>(mySecondTmpOutBuff);
//strncpy(myTmpOutBuff,tmp_outbuff.c_str(),bytes_per_line);
//clock_cycles_write = *reinterpret_cast<unsigned long long int*>(myTmpOutBuff);
memcpy(&clock_cycles_write,tmp_outbuff.c_str(),bytes_per_line);
}else if(k==3){ // first fault address
//substr extraction and parsing
//strncpy(myTmpOutBuff,tmp_outbuff.c_str(),bytes_per_line);
//fault_addr_out = *reinterpret_cast<unsigned long long int *>(myTmpOutBuff);
memcpy(&fault_addr_out,tmp_outbuff.c_str(),bytes_per_line/2);
#if DEBUG_LEVEL == TRACE_ALL
cout << "DEBUG first fault address (or the third data pckt) " << fault_addr_out << endl;
#endif
}else if(k==2){ // fault cntr
//strncpy(myTmpOutBuff,tmp_outbuff.c_str(),bytes_per_line);
//fault_cntr_out = *reinterpret_cast<unsigned long long int *>(myTmpOutBuff);
memcpy(&fault_cntr_out,tmp_outbuff.c_str(),bytes_per_line/2);
#if DEBUG_LEVEL == TRACE_ALL
cout << "DEBUG the fault counters (or the second data pack) " << fault_cntr_out << endl;
#endif
}else { //max addrss
//substr extraction and parsing
// strncpy(myTmpOutBuff,tmp_outbuff.c_str(),bytes_per_line);
// max_memory_addr_out = *reinterpret_cast<unsigned long long *>(myTmpOutBuff);
memcpy(&max_memory_addr_out,tmp_outbuff.c_str(),bytes_per_line);
#if DEBUG_LEVEL == TRACE_ALL
cout << "DEBUG max address (or the first data pack) " << max_memory_addr_out << endl;
#endif
}
k++;
tmp_outbuff.clear();
}
return testResults_vector;
}
/*****************************************************************************
* @brief print byte-per-byte a given string in hexadecimal format
*
* @param[in] inStr string to print
* @param[in] strSize bytsize to print (can be even less, NOT more )
*
******************************************************************************/
void printStringHex(const string inStr, size_t strSize){
#if DEBUG_LEVEL == TRACE_ALL
printf("Going to print a hex string :D\n");
#endif
for (size_t i = 0; i < strSize; i++)
{
printf("%x",inStr[i]);
}
printf("\n");
}
/*****************************************************************************
* @brief print byte-per-byte a given char buff in hexadecimal format
*
* @param[in] inStr char buff to print
* @param[in] strSize bytsize to print (can be even less, NOT more )
*
******************************************************************************/
void printCharBuffHex(const char * inStr, size_t strSize){
#if DEBUG_LEVEL == TRACE_ALL
printf("Going to prit a hex char buff :D\n");
#endif
for (size_t i = 0; i < strSize; i++)
{
printf("%x",inStr[i]);
}
printf("\n");
}
/*****************************************************************************
* @brief print the binary representation of a target pointer buffer of a given size.
* Assumes little endian.
* @param[in] size the bytesize to print from ptr.
* @param[in] ptr the buffer pointer.
* @return nothing, print to stdout.
******************************************************************************/
void printBits(size_t const size, void const * const ptr)
{
unsigned char *b = (unsigned char*) ptr;
unsigned char byte;
int i, j;
for (i = size-1; i >= 0; i--) {
for (j = 7; j >= 0; j--) {
byte = (b[i] >> j) & 1;
printf("%u", byte);
}
}
puts("");
}
static inline ssize_t
__file_size(const char *fname)
{
int rc;
struct stat s;
rc = lstat(fname, &s);
if (rc != 0) {
fprintf(stderr, "err: Cannot find %s!\n", fname);
return rc;
}
return s.st_size;
}
static inline ssize_t
__file_read(const char *fname, char *buff, size_t len)
{
int rc;
FILE *fp;
if ((fname == NULL) || (buff == NULL) || (len == 0))
return -EINVAL;
fp = fopen(fname, "r");
if (!fp) {
fprintf(stderr, "err: Cannot open file %s: %s\n",
fname, strerror(errno));
return -ENODEV;
}
rc = fread(buff, len, 1, fp);
if (rc == -1) {
fprintf(stderr, "err: Cannot read from %s: %s\n",
fname, strerror(errno));
fclose(fp);
return -EIO;
}
fclose(fp);
return rc;
}
static inline ssize_t
__file_write(const char *fname, const char *buff, size_t len)
{
int rc;
FILE *fp;
if ((fname == NULL) || (buff == NULL) || (len == 0))
return -EINVAL;
fp = fopen(fname, "w+");
if (!fp) {
fprintf(stderr, "err: Cannot open file %s: %s\n",
fname, strerror(errno));
return -ENODEV;
}
rc = fwrite(buff, len, 1, fp);
if (rc == -1) {
fprintf(stderr, "err: Cannot write to %s: %s\n",
fname, strerror(errno));
fclose(fp);
return -EIO;
}
fclose(fp);
return rc;
}
/*! \} */
| 37.202381
| 166
| 0.552862
|
cloudFPGA
|
430e66876b32f5d02868476d2af6e5bb3895cfd5
| 19,921
|
cpp
|
C++
|
authkeys.cpp
|
lool/bootgen
|
6bea30996979f085701542d8905966240545cd8e
|
[
"Apache-2.0",
"CC0-1.0"
] | null | null | null |
authkeys.cpp
|
lool/bootgen
|
6bea30996979f085701542d8905966240545cd8e
|
[
"Apache-2.0",
"CC0-1.0"
] | null | null | null |
authkeys.cpp
|
lool/bootgen
|
6bea30996979f085701542d8905966240545cd8e
|
[
"Apache-2.0",
"CC0-1.0"
] | null | null | null |
/******************************************************************************
* Copyright 2015-2020 Xilinx, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
/*
-------------------------------------------------------------------------------
*********************************************** H E A D E R F I L E S ***
-------------------------------------------------------------------------------
*/
#include <iomanip>
#include <iostream>
#include "authkeys.h"
#include "authentication.h"
#include "options.h"
/*
-------------------------------------------------------------------------------
***************************************************** F U N C T I O N S ***
-------------------------------------------------------------------------------
*/
/******************************************************************************/
Key::Key(const std::string& name0)
: Loaded(false)
, isSecret(false)
, name(name0)
{
keySize = AuthenticationContext::GetRsaKeyLength();
N = new uint8_t [keySize];
N_ext = new uint8_t [keySize];
D = new uint8_t [keySize];
E = new uint8_t [WORD_SIZE_IN_BYTES];
P = new uint8_t [keySize/2];
Q = new uint8_t [keySize/2];
memset(N, 0, keySize);
memset(N_ext, 0, keySize);
memset(E, 0, WORD_SIZE_IN_BYTES);
memset(P, 0, keySize/2);
memset(Q, 0, keySize/2);
memset(D, 0, keySize);
}
/******************************************************************************/
Key::Key(const Key& otherKey)
{
keySize = AuthenticationContext::GetRsaKeyLength();
N = new uint8_t [keySize];
N_ext = new uint8_t [keySize];
D = new uint8_t [keySize];
E = new uint8_t [WORD_SIZE_IN_BYTES];
P = new uint8_t [keySize/2];
Q = new uint8_t [keySize/2];
memcpy(this,&otherKey,sizeof(Key));
}
/******************************************************************************/
Key::~Key()
{
if(N != NULL)
{
delete[] N;
}
if(N_ext != NULL)
{
delete[] N_ext;
}
if(D != NULL)
{
delete[] D;
}
if(E != NULL)
{
delete[] E;
}
if(P != NULL)
{
delete[] P;
}
if(Q != NULL)
{
delete[] Q;
}
}
/******************************************************************************/
void Key::ParsePublic(const std::string& filename)
{
Parse(filename,false);
}
/******************************************************************************/
void Key::ParseSecret(const std::string& filename)
{
Parse(filename,true);
}
/******************************************************************************/
void Key::Parse(const std::string& filename, bool isSecret0)
{
uint8_t errCode = 0;
isSecret = isSecret0;
std::string basefile = StringUtils::BaseName(filename);
FILE* f;
f = fopen(filename.c_str(),"r");
if (f == NULL)
{
LOG_ERROR("Cannot open key %s", filename.c_str());
}
try
{
int name;
do
{
name = getc(f);
} while (name >= 0 && isspace(name));
fseek(f,0,0);
/* If the file starts with 'N', then it is Xilinx Format
If it starts with '-', then it is OpenSSL format */
if (name == 'N')
{
errCode = ParseXilinxRsaKey(f);
}
else if (name == '-')
{
errCode = ParseOpenSSLKey(f);
}
else
{
LOG_ERROR("Unsupported key file - %s\n Supported key formats: Xilinx Format & OpenSSL format", basefile.c_str());
}
fclose(f);
if(errCode != 0)
{
LOG_ERROR("RSA authentication key parsing failed - %s", basefile.c_str());
}
/* Calculate the modulus extension, i.e. Montgomery Reduction term RR
and some sanity check for the keys passed */
{
BIGNUM m;
m.d = (BN_ULONG*)N;
m.dmax = keySize / sizeof(BN_ULONG);
m.top = keySize / sizeof(BN_ULONG);
m.flags = 0;
m.neg = 0;
BN_CTX_Class ctxInst;
BN_MONT_CTX_Class montClass(ctxInst);
montClass.Set(m);
montClass.GetModulusExtension(N_ext, m, keySize);
}
Loaded = true;
}
catch(...)
{
fclose(f);
throw;
}
}
/******************************************************************************/
uint8_t Key::ParseOpenSSLKey(FILE* f)
{
RSA_Class rsaInst;
OpenSSL_add_all_algorithms();
uint32_t keySzRd;
if (isSecret)
{
rsaInst.rsa = PEM_read_RSAPrivateKey(f, NULL, NULL, NULL);
if(rsaInst.rsa == NULL)
{
return 1;
}
#if OPENSSL_VERSION_NUMBER > 0x10100000L
keySzRd = BN_num_bytes(RSA_get0_n(rsaInst.rsa));
#else
keySzRd = BN_num_bytes(rsaInst.rsa->n);
#endif
if (keySzRd != keySize)
{
LOG_ERROR("Incorrect Key Size !!!\n\t Key Size is %d bits. Expected key size is %d bits", keySzRd * 8, keySize * 8);
}
#if OPENSSL_VERSION_NUMBER > 0x10100000L
memcpy(D, RSA_get0_d(rsaInst.rsa)->d, keySize);
#else
memcpy(D, rsaInst.rsa->d->d, keySize);
#endif
}
else
{
rsaInst.rsa = PEM_read_RSA_PUBKEY(f, NULL, NULL, NULL);
if(rsaInst.rsa == NULL)
{
return 1;
}
#if OPENSSL_VERSION_NUMBER > 0x10100000L
keySzRd = BN_num_bytes(RSA_get0_n(rsaInst.rsa));
#else
keySzRd = BN_num_bytes(rsaInst.rsa->n);
#endif
if (keySzRd != keySize)
{
LOG_ERROR("Incorrect Key Size !!!\n\t Key Size is %d bits. Expected key size is %d bits", keySzRd * 8, keySize * 8);
}
memset(D,0,keySize);
}
#if OPENSSL_VERSION_NUMBER > 0x10100000L
memcpy(N, RSA_get0_n(rsaInst.rsa)->d, keySize);
memcpy(E, RSA_get0_e(rsaInst.rsa)->d, sizeof(uint32_t));
#else
memcpy(N, rsaInst.rsa->n->d, keySize);
memcpy(E, rsaInst.rsa->e->d, sizeof(uint32_t));
#endif
return 0;
}
/******************************************************************************/
uint8_t Key::ParseXilinxRsaKey(FILE* f)
{
int name;
/* Check for N in the key file followed by '=', Once got, parse the value of N */
do
{
name = getc(f);
} while (name >= 0 && isspace(name));
if (name != 'N')
{
LOG_DEBUG(DEBUG_STAMP, "Bad Key file, expected N, got %c", name);
return 1;
}
do
{
name = getc(f);
} while (name >= 0 && isspace(name));
if (name != '=')
{
LOG_DEBUG(DEBUG_STAMP, "Bad Key file, expected =, got %c", name);
return 1;
}
LOG_TRACE("Parsing 'N' from key file");
Hex2Byte(f, N, keySize);
/* Check for E in the key file followed by '=' Once got, parse the value of E */
do
{
name = getc(f);
} while (name >= 0 && isspace(name));
if (name != 'E')
{
LOG_DEBUG(DEBUG_STAMP, "Bad Key file, expected E, got %c",name);
return 1;
}
do
{
name = getc(f);
} while (name >= 0 && isspace(name));
if (name != '=')
{
LOG_DEBUG(DEBUG_STAMP, "Bad Key file, expected =, got %c",name);
return 1;
}
uint32_t temp;
LOG_TRACE("Parsing 'E' from key file");
if(EOF != fscanf(f,"%X",&temp))
{
E[0] = (uint8_t)(temp);
E[1] = (uint8_t)(temp>>8);
E[2] = (uint8_t)(temp>>16);
E[3] = (uint8_t)(temp>>24);
}
if (isSecret)
{
/* Check for D in the key file followed by '=' Once got, parse the value of D */
do
{
name = getc(f);
} while (name >= 0 && isspace(name));
if(name != 'D')
{
LOG_DEBUG(DEBUG_STAMP, "Bad Key file, expected D, got %c",name);
return 1;
}
do
{
name = getc(f);
} while (name >= 0 && isspace(name));
if (name != '=')
{
LOG_DEBUG(DEBUG_STAMP, "Bad Key file, expected =, got %c",name);
return 1;
}
LOG_TRACE("Parsing 'D' from key file");
Hex2Byte(f, D, keySize);
/* The rest of parsing is for sanity checking purpose
Not used for signing or verfication */
/* Check for P in the key file followed by '=' Once got, parse the value of P */
do
{
name = getc(f);
} while (name >= 0 && isspace(name));
if(name == 'P')
{
do
{
name = getc(f);
} while (name >= 0 && isspace(name));
if (name != '=')
{
LOG_DEBUG(DEBUG_STAMP, "Bad Key file, expected =, got %c",name);
return 1;
}
LOG_TRACE("Parsing 'P' from key file");
Hex2Byte(f, P, keySize/2);
/* Check for Q in the key file followed by '=' Once got, parse the value of Q */
do
{
name = getc(f);
} while (name >= 0 && isspace(name));
if(name != 'Q')
{
LOG_DEBUG(DEBUG_STAMP, "Bad Key file, expected Q, got %c",name);
return 1;
}
do
{
name = getc(f);
} while (name >= 0 && isspace(name));
if(name != '=')
{
LOG_DEBUG(DEBUG_STAMP, "Bad Key file, expected =, got %c",name);
return 1;
}
LOG_TRACE("Parsing 'Q' from key file");
Hex2Byte(f, Q, keySize/2);
/* Sanity check block, N = PxQ */
{
uint8_t *Ncheck = new uint8_t [keySize];
Multiply_p_q(P, Q, Ncheck);
if (memcmp(N, Ncheck, keySize))
{
delete[] Ncheck;
LOG_DEBUG(DEBUG_STAMP, "Inconsistency found in key file, P * Q != N");
return 1;
}
delete[] Ncheck;
}
}
}
else
{
/* If it is a public key, D=0 */
memset(D, 0, keySize);
}
return 0;
}
/******************************************************************************/
void Key::WriteRsaFile(std::ofstream& file, const RSA* rsa, bool secret, uint16_t keyLength)
{
uint8_t *temp = new uint8_t [keyLength];
file << "N = ";
#if OPENSSL_VERSION_NUMBER > 0x10100000L
memcpy(temp, RSA_get0_n(rsa)->d, keyLength);
#else
memcpy(temp, rsa->n->d, keyLength);
#endif
for (uint32_t index = keyLength; index != 0; index--)
{
file << std::uppercase << std::hex << std::setfill('0') << std::setw(2) << int(temp[index-1]);
}
file << "\n\nE = ";
#if OPENSSL_VERSION_NUMBER > 0x10100000L
uint32_t* temp_e = (uint32_t*)RSA_get0_e(rsa)->d;
#else
uint32_t* temp_e = (uint32_t*)rsa->e->d;
#endif
file << std::uppercase << std::hex << std::setfill('0') << std::setw(8) << *temp_e;
if (secret)
{
file << "\n\nD = ";
#if OPENSSL_VERSION_NUMBER > 0x10100000L
memcpy(temp, RSA_get0_d(rsa)->d, keyLength);
#else
memcpy(temp, rsa->d->d, keyLength);
#endif
for (uint32_t index = keyLength; index != 0; index--)
{
file << std::uppercase << std::hex << std::setfill('0') << std::setw(2) << int(temp[index - 1]);
}
}
delete[] temp;
}
/******************************************************************************/
void Key::GenerateRsaKeys(KeyGenerationStruct* keygen)
{
RSA *rsa = NULL;
bool publicKeyGenerated = false;
bool privateKeyGenerated = false;
OpenSSL_add_all_algorithms();
FILE* file;
if ((rsa = RSA_generate_key(keygen->keyLength*8, RSA_F4, NULL, NULL)) == NULL)
{
LOG_ERROR("Failure creating authentication Keys");
}
else
{
if(keygen->format == GenAuthKeys::PEM)
{
if(keygen->ppk_file != "")
{
file = fopen(keygen->ppk_file.c_str(), "wb");
PEM_write_RSA_PUBKEY(file, rsa);
fclose(file);
LOG_INFO("PPK generation in PEM format successful");
publicKeyGenerated = true;
}
if(keygen->psk_file != "")
{
file = fopen(keygen->psk_file.c_str(), "wb");
PEM_write_RSAPrivateKey(file, rsa, NULL, NULL, 0, NULL, NULL);
fclose(file);
LOG_INFO("PSK generation in PEM format successful");
publicKeyGenerated = true;
}
}
else
{
if(keygen->ppk_file != "")
{
std::ofstream file1(keygen->ppk_file.c_str());
WriteRsaFile(file1, rsa, false, keygen->keyLength);
file1.close();
LOG_INFO("PPK generation in RSA format successful");
publicKeyGenerated = true;
}
if(keygen->psk_file != "")
{
std::ofstream file2(keygen->psk_file.c_str());
WriteRsaFile(file2, rsa, true, keygen->keyLength);
file2.close();
LOG_INFO("PSK generation in RSA format successful");
publicKeyGenerated = true;
}
}
}
rsa=NULL;
if ((rsa=RSA_generate_key(keygen->keyLength*8, RSA_F4, NULL, NULL)) == NULL)
{
LOG_ERROR("Failure creating authentication Keys");
}
else
{
if(keygen->format == GenAuthKeys::PEM)
{
if(keygen->spk_file != "")
{
file = fopen(keygen->spk_file.c_str(), "wb");
PEM_write_RSA_PUBKEY(file, rsa);
fclose(file);
LOG_INFO("SPK generation in PEM format successful");
privateKeyGenerated = true;
}
if(keygen->ssk_file != "")
{
file = fopen(keygen->ssk_file.c_str(), "wb");
PEM_write_RSAPrivateKey(file, rsa, NULL, NULL, 0, NULL, NULL);
fclose(file);
LOG_INFO("SSK generation in PEM format successful");
privateKeyGenerated = true;
}
}
else
{
if(keygen->spk_file != "")
{
std::ofstream file3(keygen->spk_file.c_str());
WriteRsaFile(file3, rsa, false, keygen->keyLength);
file3.close();
LOG_INFO("SPK generation in RSA format successful");
privateKeyGenerated = true;
}
if(keygen->ssk_file != "")
{
std::ofstream file4(keygen->ssk_file.c_str());
WriteRsaFile(file4, rsa, true, keygen->keyLength);
file4.close();
LOG_INFO("SSK generation in RSA format successful");
privateKeyGenerated = true;
}
}
}
if(!publicKeyGenerated && !privateKeyGenerated)
{
LOG_DEBUG(DEBUG_STAMP, "Key paths are not specified in the BIF file");
LOG_ERROR("Failed to generate authentication keys. Please specify the key paths in BIF file");
}
}
/******************************************************************************/
void Key2048::Export(void* acKey)
{
ACKey2048* key = (ACKey2048*)acKey;
if (!Loaded)
{
std::string pubsec = (isSecret) ? " (Secret)" : " (Public)";
LOG_ERROR("%s - $s is not loaded", name.c_str(), pubsec.c_str());
}
memset(key,0,sizeof(ACKey2048));
memcpy(key->N, N, 256);
memcpy(key->N_extension, N_ext, 256);
memcpy(key->E, E, 4);
}
/******************************************************************************/
void Key2048::Import(const void* acKey, const std::string& name0)
{
ACKey2048* key = (ACKey2048*)acKey;
Loaded = true;
isSecret = false;
name = name0;
memcpy(N,key->N,keySize);
memcpy(N_ext,key->N_extension,keySize);
memcpy(E,key->E,sizeof(uint32_t));
memset(P,0,keySize/2);
memset(Q,0,keySize/2);
/* Fill secret exponent with zeros */
memset(D,0,keySize);
}
/******************************************************************************/
void Key4096::Export(void* acKey)
{
ACKey4096* key = (ACKey4096*)acKey;
if (!Loaded)
{
std::string pubsec = (isSecret) ? " (Secret)" : " (Public)";
LOG_ERROR("%s - $s is not loaded", name.c_str(), pubsec.c_str());
}
memset(key, 0, sizeof(ACKey4096));
memcpy(key->N, N, keySize);
memcpy(key->N_extension, N_ext, keySize);
memcpy(key->E, E, 4);
}
/******************************************************************************/
void Key4096::Import(const void* acKey, const std::string& name0)
{
ACKey4096* key = (ACKey4096*)acKey;
Loaded = true;
isSecret = false;
name = name0;
memcpy(N, key->N, keySize);
memcpy(N_ext, key->N_extension, keySize);
memcpy(E, key->E, sizeof(uint32_t));
memset(P, 0, keySize/2);
memset(Q, 0, keySize/2);
/* Fill secret exponent with zeros */
memset(D, 0, keySize);
}
/******************************************************************************/
void Key::SetKeyName(std::string keyname)
{
name = keyname;
}
/******************************************************************************/
void Key::Multiply_p_q(uint8_t p[], uint8_t q[], uint8_t n[])
{
memset(n,0,256);
/* Multiply p * q, and store in n */
for(int i = 0; i < 128; i++)
{
for(int j = 0; j < 128; j++)
{
uint16_t prod = p[i] * q[j];
int k = i+j;
while (prod && k < 256)
{
uint16_t sum = n[k] + (prod & 0xFF);
n[k] = sum & 0xFF;
prod >>= 8;
sum >>= 8;
prod = (prod + sum);
k++;
}
}
}
}
/******************************************************************************/
void Key::Hex2Byte(FILE* f, uint8_t* data, int count)
{
char *buf;
buf = (char *) malloc(2000);
if (buf != NULL)
{
char *tempbuf = buf;
if (fscanf(f, "%s", tempbuf) != 1)
{
LOG_ERROR("Error parsing key");
}
int len = strlen(tempbuf)/2;
if(len != count)
{
LOG_ERROR("Key size is %d bytes, expected size is %d bytes", len, count);
}
for(int i = count-1; i >= 0; i--)
{
int v;
if (sscanf(tempbuf, "%2X", &v) != 1)
{
LOG_DEBUG(DEBUG_STAMP, "Failure reading the authentication key file");
LOG_ERROR("Failure in key parsing !!!");
}
if (v < 0 || v > 255)
{
LOG_DEBUG(DEBUG_STAMP, "Failure converting the hex characters from key file");
LOG_ERROR("Failure in key parsing !!!");
}
if(i > 0)
{
tempbuf += 2;
}
data[i] = v;
}
}
else
{
LOG_DEBUG(DEBUG_STAMP, "Memory Allocation error while reading keys");
LOG_ERROR("Failure in key parsing !!!");
}
free(buf);
}
| 29.468935
| 135
| 0.460268
|
lool
|
430f062bea3510384e4041aa4f67a63e2376f500
| 31,543
|
cpp
|
C++
|
indra/newview/lldrawpoolterrain.cpp
|
SaladDais/LLUDP-Encryption
|
8a426cd0dd154e1a10903e0e6383f4deb2a6098a
|
[
"ISC"
] | 1
|
2022-01-29T07:10:03.000Z
|
2022-01-29T07:10:03.000Z
|
indra/newview/lldrawpoolterrain.cpp
|
bloomsirenix/Firestorm-manikineko
|
67e1bb03b2d05ab16ab98097870094a8cc9de2e7
|
[
"Unlicense"
] | null | null | null |
indra/newview/lldrawpoolterrain.cpp
|
bloomsirenix/Firestorm-manikineko
|
67e1bb03b2d05ab16ab98097870094a8cc9de2e7
|
[
"Unlicense"
] | 1
|
2021-10-01T22:22:27.000Z
|
2021-10-01T22:22:27.000Z
|
/**
* @file lldrawpoolterrain.cpp
* @brief LLDrawPoolTerrain class implementation
*
* $LicenseInfo:firstyear=2002&license=viewerlgpl$
* Second Life Viewer Source Code
* Copyright (C) 2010, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation;
* version 2.1 of the License only.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
* $/LicenseInfo$
*/
#include "llviewerprecompiledheaders.h"
#include "lldrawpoolterrain.h"
#include "llfasttimer.h"
#include "llagent.h"
#include "llviewercontrol.h"
#include "lldrawable.h"
#include "llface.h"
#include "llsky.h"
#include "llsurface.h"
#include "llsurfacepatch.h"
#include "llviewerregion.h"
#include "llvlcomposition.h"
#include "llviewerparcelmgr.h" // for gRenderParcelOwnership
#include "llviewerparceloverlay.h"
#include "llvosurfacepatch.h"
#include "llviewercamera.h"
#include "llviewertexturelist.h" // To get alpha gradients
#include "llworld.h"
#include "pipeline.h"
#include "llviewershadermgr.h"
#include "llrender.h"
#include "llenvironment.h"
#include "llsettingsvo.h"
const F32 DETAIL_SCALE = 1.f/16.f;
int DebugDetailMap = 0;
S32 LLDrawPoolTerrain::sDetailMode = 1;
F32 LLDrawPoolTerrain::sDetailScale = DETAIL_SCALE;
static LLGLSLShader* sShader = NULL;
static LLTrace::BlockTimerStatHandle FTM_SHADOW_TERRAIN("Terrain Shadow");
LLDrawPoolTerrain::LLDrawPoolTerrain(LLViewerTexture *texturep) :
LLFacePool(POOL_TERRAIN),
mTexturep(texturep)
{
// Hack!
// <FS:PP> Attempt to speed up things a little
// sDetailScale = 1.f/gSavedSettings.getF32("RenderTerrainScale");
// sDetailMode = gSavedSettings.getS32("RenderTerrainDetail");
static LLCachedControl<F32> RenderTerrainScale(gSavedSettings, "RenderTerrainScale");
static LLCachedControl<S32> RenderTerrainDetail(gSavedSettings, "RenderTerrainDetail");
sDetailScale = 1.f/RenderTerrainScale;
sDetailMode = RenderTerrainDetail();
// </FS:PP>
mAlphaRampImagep = LLViewerTextureManager::getFetchedTexture(IMG_ALPHA_GRAD);
//gGL.getTexUnit(0)->bind(mAlphaRampImagep.get());
mAlphaRampImagep->setAddressMode(LLTexUnit::TAM_CLAMP);
m2DAlphaRampImagep = LLViewerTextureManager::getFetchedTexture(IMG_ALPHA_GRAD_2D);
//gGL.getTexUnit(0)->bind(m2DAlphaRampImagep.get());
m2DAlphaRampImagep->setAddressMode(LLTexUnit::TAM_CLAMP);
mTexturep->setBoostLevel(LLGLTexture::BOOST_TERRAIN);
//gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
}
LLDrawPoolTerrain::~LLDrawPoolTerrain()
{
llassert( gPipeline.findPool( getType(), getTexture() ) == NULL );
}
U32 LLDrawPoolTerrain::getVertexDataMask()
{
if (LLPipeline::sShadowRender)
{
return LLVertexBuffer::MAP_VERTEX;
}
else if (LLGLSLShader::sCurBoundShaderPtr)
{
return VERTEX_DATA_MASK & ~(LLVertexBuffer::MAP_TEXCOORD2 | LLVertexBuffer::MAP_TEXCOORD3);
}
else
{
return VERTEX_DATA_MASK;
}
}
void LLDrawPoolTerrain::prerender()
{
mShaderLevel = LLViewerShaderMgr::instance()->getShaderLevel(LLViewerShaderMgr::SHADER_ENVIRONMENT);
// <FS:Ansariel> Use faster LLCachedControls for frequently visited locations
//sDetailMode = gSavedSettings.getS32("RenderTerrainDetail");
static LLCachedControl<S32> renderTerrainDetail(gSavedSettings, "RenderTerrainDetail");
sDetailMode = renderTerrainDetail();
// </FS:Ansariel>
}
void LLDrawPoolTerrain::beginRenderPass( S32 pass )
{
LL_RECORD_BLOCK_TIME(FTM_RENDER_TERRAIN);
LLFacePool::beginRenderPass(pass);
sShader = LLPipeline::sUnderWaterRender ?
&gTerrainWaterProgram :
&gTerrainProgram;
if (mShaderLevel > 1 && sShader->mShaderLevel > 0)
{
sShader->bind();
}
}
void LLDrawPoolTerrain::endRenderPass( S32 pass )
{
LL_RECORD_BLOCK_TIME(FTM_RENDER_TERRAIN);
//LLFacePool::endRenderPass(pass);
if (mShaderLevel > 1 && sShader->mShaderLevel > 0) {
sShader->unbind();
}
}
//static
S32 LLDrawPoolTerrain::getDetailMode()
{
return sDetailMode;
}
void LLDrawPoolTerrain::boostTerrainDetailTextures()
{
// Hack! Get the region that this draw pool is rendering from!
LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion();
LLVLComposition *compp = regionp->getComposition();
for (S32 i = 0; i < 4; i++)
{
compp->mDetailTextures[i]->setBoostLevel(LLGLTexture::BOOST_TERRAIN);
compp->mDetailTextures[i]->addTextureStats(1024.f*1024.f); // assume large pixel area
}
}
void LLDrawPoolTerrain::render(S32 pass)
{
LL_RECORD_BLOCK_TIME(FTM_RENDER_TERRAIN);
if (mDrawFace.empty())
{
return;
}
boostTerrainDetailTextures();
LLOverrideFaceColor override(this, 1.f, 1.f, 1.f, 1.f);
if (!gGLManager.mHasMultitexture)
{
// No multitexture, render simple land.
renderSimple(); // Render without multitexture
return;
}
// Render simplified land if video card can't do sufficient multitexturing
if (!gGLManager.mHasARBEnvCombine || (gGLManager.mNumTextureUnits < 2))
{
renderSimple(); // Render without multitexture
return;
}
LLGLSPipeline gls;
if (mShaderLevel > 1 && sShader->mShaderLevel > 0)
{
gPipeline.enableLightsDynamic();
renderFullShader();
}
else
{
gPipeline.enableLightsStatic();
if (sDetailMode == 0)
{
renderSimple();
}
else if (gGLManager.mNumTextureUnits < 4)
{
renderFull2TU();
}
else
{
renderFull4TU();
}
}
// Special-case for land ownership feedback
// <FS:Ansariel> Use faster LLCachedControls for frequently visited locations
//if (gSavedSettings.getBOOL("ShowParcelOwners"))
static LLCachedControl<bool> showParcelOwners(gSavedSettings, "ShowParcelOwners");
if (showParcelOwners)
// </FS:Ansariel>
{
hilightParcelOwners(false);
}
}
void LLDrawPoolTerrain::beginDeferredPass(S32 pass)
{
LL_RECORD_BLOCK_TIME(FTM_RENDER_TERRAIN);
LLFacePool::beginRenderPass(pass);
sShader = LLPipeline::sUnderWaterRender ? &gDeferredTerrainWaterProgram : &gDeferredTerrainProgram;
sShader->bind();
}
void LLDrawPoolTerrain::endDeferredPass(S32 pass)
{
LL_RECORD_BLOCK_TIME(FTM_RENDER_TERRAIN);
LLFacePool::endRenderPass(pass);
sShader->unbind();
}
void LLDrawPoolTerrain::renderDeferred(S32 pass)
{
LL_RECORD_BLOCK_TIME(FTM_RENDER_TERRAIN);
if (mDrawFace.empty())
{
return;
}
boostTerrainDetailTextures();
renderFullShader();
// Special-case for land ownership feedback
// <FS:Ansariel> Use faster LLCachedControls for frequently visited locations
//if (gSavedSettings.getBOOL("ShowParcelOwners"))
static LLCachedControl<bool> showParcelOwners(gSavedSettings, "ShowParcelOwners");
if (showParcelOwners)
// </FS:Ansariel>
{
hilightParcelOwners(true);
}
}
void LLDrawPoolTerrain::beginShadowPass(S32 pass)
{
LL_RECORD_BLOCK_TIME(FTM_SHADOW_TERRAIN);
LLFacePool::beginRenderPass(pass);
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
gDeferredShadowProgram.bind();
LLEnvironment& environment = LLEnvironment::instance();
gDeferredShadowProgram.uniform1i(LLShaderMgr::SUN_UP_FACTOR, environment.getIsSunUp() ? 1 : 0);
}
void LLDrawPoolTerrain::endShadowPass(S32 pass)
{
LL_RECORD_BLOCK_TIME(FTM_SHADOW_TERRAIN);
LLFacePool::endRenderPass(pass);
gDeferredShadowProgram.unbind();
}
void LLDrawPoolTerrain::renderShadow(S32 pass)
{
LL_RECORD_BLOCK_TIME(FTM_SHADOW_TERRAIN);
if (mDrawFace.empty())
{
return;
}
//LLGLEnable offset(GL_POLYGON_OFFSET);
//glCullFace(GL_FRONT);
drawLoop();
//glCullFace(GL_BACK);
}
void LLDrawPoolTerrain::drawLoop()
{
if (!mDrawFace.empty())
{
for (std::vector<LLFace*>::iterator iter = mDrawFace.begin();
iter != mDrawFace.end(); iter++)
{
LLFace *facep = *iter;
LLMatrix4* model_matrix = &(facep->getDrawable()->getRegion()->mRenderMatrix);
if (model_matrix != gGLLastMatrix)
{
llassert(gGL.getMatrixMode() == LLRender::MM_MODELVIEW);
gGLLastMatrix = model_matrix;
gGL.loadMatrix(gGLModelView);
if (model_matrix)
{
gGL.multMatrix((GLfloat*) model_matrix->mMatrix);
}
gPipeline.mMatrixOpCount++;
}
facep->renderIndexed();
}
}
}
void LLDrawPoolTerrain::renderFullShader()
{
// Hack! Get the region that this draw pool is rendering from!
LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion();
LLVLComposition *compp = regionp->getComposition();
// [SL:KB] - Patch: Render-TextureToggle (Catznip-4.0)
LLViewerTexture *detail_texture0p = (LLPipeline::sRenderTextures) ? compp->mDetailTextures[0] : LLViewerFetchedTexture::sDefaultDiffuseImagep;
LLViewerTexture *detail_texture1p = (LLPipeline::sRenderTextures) ? compp->mDetailTextures[1] : LLViewerFetchedTexture::sDefaultDiffuseImagep;
LLViewerTexture *detail_texture2p = (LLPipeline::sRenderTextures) ? compp->mDetailTextures[2] : LLViewerFetchedTexture::sDefaultDiffuseImagep;
LLViewerTexture *detail_texture3p = (LLPipeline::sRenderTextures) ? compp->mDetailTextures[3] : LLViewerFetchedTexture::sDefaultDiffuseImagep;
// [/SL:KB]
// LLViewerTexture *detail_texture0p = compp->mDetailTextures[0];
// LLViewerTexture *detail_texture1p = compp->mDetailTextures[1];
// LLViewerTexture *detail_texture2p = compp->mDetailTextures[2];
// LLViewerTexture *detail_texture3p = compp->mDetailTextures[3];
LLVector3d region_origin_global = gAgent.getRegion()->getOriginGlobal();
F32 offset_x = (F32)fmod(region_origin_global.mdV[VX], 1.0/(F64)sDetailScale)*sDetailScale;
F32 offset_y = (F32)fmod(region_origin_global.mdV[VY], 1.0/(F64)sDetailScale)*sDetailScale;
LLVector4 tp0, tp1;
tp0.setVec(sDetailScale, 0.0f, 0.0f, offset_x);
tp1.setVec(0.0f, sDetailScale, 0.0f, offset_y);
//
// detail texture 0
//
S32 detail0 = sShader->enableTexture(LLViewerShaderMgr::TERRAIN_DETAIL0);
gGL.getTexUnit(detail0)->bind(detail_texture0p);
gGL.getTexUnit(detail0)->setTextureAddressMode(LLTexUnit::TAM_WRAP);
gGL.getTexUnit(detail0)->activate();
LLGLSLShader* shader = LLGLSLShader::sCurBoundShaderPtr;
llassert(shader);
shader->uniform4fv(LLShaderMgr::OBJECT_PLANE_S, 1, tp0.mV);
shader->uniform4fv(LLShaderMgr::OBJECT_PLANE_T, 1, tp1.mV);
LLSettingsWater::ptr_t pwater = LLEnvironment::instance().getCurrentWater();
((LLSettingsVOWater*)pwater.get())->updateShader(shader);
//
// detail texture 1
//
S32 detail1 = sShader->enableTexture(LLViewerShaderMgr::TERRAIN_DETAIL1);
gGL.getTexUnit(detail1)->bind(detail_texture1p);
gGL.getTexUnit(detail1)->setTextureAddressMode(LLTexUnit::TAM_WRAP);
gGL.getTexUnit(detail1)->activate();
// detail texture 2
//
S32 detail2 = sShader->enableTexture(LLViewerShaderMgr::TERRAIN_DETAIL2);
gGL.getTexUnit(detail2)->bind(detail_texture2p);
gGL.getTexUnit(detail2)->setTextureAddressMode(LLTexUnit::TAM_WRAP);
gGL.getTexUnit(detail2)->activate();
// detail texture 3
//
S32 detail3 = sShader->enableTexture(LLViewerShaderMgr::TERRAIN_DETAIL3);
gGL.getTexUnit(detail3)->bind(detail_texture3p);
gGL.getTexUnit(detail3)->setTextureAddressMode(LLTexUnit::TAM_WRAP);
gGL.getTexUnit(detail3)->activate();
//
// Alpha Ramp
//
S32 alpha_ramp = sShader->enableTexture(LLViewerShaderMgr::TERRAIN_ALPHARAMP);
gGL.getTexUnit(alpha_ramp)->bind(m2DAlphaRampImagep);
gGL.getTexUnit(alpha_ramp)->setTextureAddressMode(LLTexUnit::TAM_CLAMP);
// GL_BLEND disabled by default
drawLoop();
// Disable multitexture
sShader->disableTexture(LLViewerShaderMgr::TERRAIN_ALPHARAMP);
sShader->disableTexture(LLViewerShaderMgr::TERRAIN_DETAIL0);
sShader->disableTexture(LLViewerShaderMgr::TERRAIN_DETAIL1);
sShader->disableTexture(LLViewerShaderMgr::TERRAIN_DETAIL2);
sShader->disableTexture(LLViewerShaderMgr::TERRAIN_DETAIL3);
gGL.getTexUnit(alpha_ramp)->unbind(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(alpha_ramp)->disable();
gGL.getTexUnit(alpha_ramp)->activate();
gGL.getTexUnit(detail3)->unbind(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(detail3)->disable();
gGL.getTexUnit(detail3)->activate();
gGL.getTexUnit(detail2)->unbind(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(detail2)->disable();
gGL.getTexUnit(detail2)->activate();
gGL.getTexUnit(detail1)->unbind(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(detail1)->disable();
gGL.getTexUnit(detail1)->activate();
//----------------------------------------------------------------------------
// Restore Texture Unit 0 defaults
gGL.getTexUnit(detail0)->unbind(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(detail0)->enable(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(detail0)->activate();
}
void LLDrawPoolTerrain::hilightParcelOwners(bool deferred)
{
if (mShaderLevel > 1)
{ //use fullbright shader for highlighting
LLGLSLShader* old_shader = sShader;
sShader->unbind();
sShader = deferred ? &gDeferredHighlightProgram : &gHighlightProgram;
sShader->bind();
gGL.diffuseColor4f(1, 1, 1, 1);
LLGLEnable polyOffset(GL_POLYGON_OFFSET_FILL);
glPolygonOffset(-1.0f, -1.0f);
renderOwnership();
sShader = old_shader;
sShader->bind();
}
else
{
gPipeline.disableLights();
renderOwnership();
}
}
void LLDrawPoolTerrain::renderFull4TU()
{
// Hack! Get the region that this draw pool is rendering from!
LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion();
LLVLComposition *compp = regionp->getComposition();
// [SL:KB] - Patch: Render-TextureToggle (Catznip-4.0)
LLViewerTexture *detail_texture0p = (LLPipeline::sRenderTextures) ? compp->mDetailTextures[0] : LLViewerFetchedTexture::sDefaultDiffuseImagep;
LLViewerTexture *detail_texture1p = (LLPipeline::sRenderTextures) ? compp->mDetailTextures[1] : LLViewerFetchedTexture::sDefaultDiffuseImagep;
LLViewerTexture *detail_texture2p = (LLPipeline::sRenderTextures) ? compp->mDetailTextures[2] : LLViewerFetchedTexture::sDefaultDiffuseImagep;
LLViewerTexture *detail_texture3p = (LLPipeline::sRenderTextures) ? compp->mDetailTextures[3] : LLViewerFetchedTexture::sDefaultDiffuseImagep;
// [/SL:KB]
// LLViewerTexture *detail_texture0p = compp->mDetailTextures[0];
// LLViewerTexture *detail_texture1p = compp->mDetailTextures[1];
// LLViewerTexture *detail_texture2p = compp->mDetailTextures[2];
// LLViewerTexture *detail_texture3p = compp->mDetailTextures[3];
LLVector3d region_origin_global = gAgent.getRegion()->getOriginGlobal();
F32 offset_x = (F32)fmod(region_origin_global.mdV[VX], 1.0/(F64)sDetailScale)*sDetailScale;
F32 offset_y = (F32)fmod(region_origin_global.mdV[VY], 1.0/(F64)sDetailScale)*sDetailScale;
LLVector4 tp0, tp1;
tp0.setVec(sDetailScale, 0.0f, 0.0f, offset_x);
tp1.setVec(0.0f, sDetailScale, 0.0f, offset_y);
gGL.blendFunc(LLRender::BF_ONE_MINUS_SOURCE_ALPHA, LLRender::BF_SOURCE_ALPHA);
//----------------------------------------------------------------------------
// Pass 1/1
//
// Stage 0: detail texture 0
//
gGL.getTexUnit(0)->activate();
gGL.getTexUnit(0)->bind(detail_texture0p);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_COLOR);
//
// Stage 1: Generate alpha ramp for detail0/detail1 transition
//
gGL.getTexUnit(1)->bind(m2DAlphaRampImagep.get());
gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(1)->activate();
// Care about alpha only
gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR);
gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA);
//
// Stage 2: Interpolate detail1 with existing based on ramp
//
gGL.getTexUnit(2)->bind(detail_texture1p);
gGL.getTexUnit(2)->enable(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(2)->activate();
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
gGL.getTexUnit(2)->setTextureColorBlend(LLTexUnit::TBO_LERP_PREV_ALPHA, LLTexUnit::TBS_PREV_COLOR, LLTexUnit::TBS_TEX_COLOR);
//
// Stage 3: Modulate with primary (vertex) color for lighting
//
gGL.getTexUnit(3)->bind(detail_texture1p);
gGL.getTexUnit(3)->enable(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(3)->activate();
// Set alpha texture and do lighting modulation
gGL.getTexUnit(3)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_PREV_COLOR, LLTexUnit::TBS_VERT_COLOR);
gGL.getTexUnit(0)->activate();
// GL_BLEND disabled by default
drawLoop();
//----------------------------------------------------------------------------
// Second pass
// Stage 0: Write detail3 into base
//
gGL.getTexUnit(0)->activate();
gGL.getTexUnit(0)->bind(detail_texture3p);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_COLOR);
//
// Stage 1: Generate alpha ramp for detail2/detail3 transition
//
gGL.getTexUnit(1)->bind(m2DAlphaRampImagep);
gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(1)->activate();
// Set the texture matrix
gGL.matrixMode(LLRender::MM_TEXTURE);
gGL.loadIdentity();
gGL.translatef(-2.f, 0.f, 0.f);
// Care about alpha only
gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR);
gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA);
//
// Stage 2: Interpolate detail2 with existing based on ramp
//
gGL.getTexUnit(2)->bind(detail_texture2p);
gGL.getTexUnit(2)->enable(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(2)->activate();
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
gGL.getTexUnit(2)->setTextureColorBlend(LLTexUnit::TBO_LERP_PREV_ALPHA, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_PREV_COLOR);
//
// Stage 3: Generate alpha ramp for detail1/detail2 transition
//
gGL.getTexUnit(3)->bind(m2DAlphaRampImagep);
gGL.getTexUnit(3)->enable(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(3)->activate();
// Set the texture matrix
gGL.matrixMode(LLRender::MM_TEXTURE);
gGL.loadIdentity();
gGL.translatef(-1.f, 0.f, 0.f);
gGL.matrixMode(LLRender::MM_MODELVIEW);
// Set alpha texture and do lighting modulation
gGL.getTexUnit(3)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_PREV_COLOR, LLTexUnit::TBS_VERT_COLOR);
gGL.getTexUnit(3)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA);
gGL.getTexUnit(0)->activate();
{
LLGLEnable blend(GL_BLEND);
drawLoop();
}
LLVertexBuffer::unbind();
// Disable multitexture
gGL.getTexUnit(3)->unbind(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(3)->disable();
gGL.getTexUnit(3)->activate();
gGL.matrixMode(LLRender::MM_TEXTURE);
gGL.loadIdentity();
gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.getTexUnit(2)->unbind(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(2)->disable();
gGL.getTexUnit(2)->activate();
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
gGL.matrixMode(LLRender::MM_TEXTURE);
gGL.loadIdentity();
gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(1)->disable();
gGL.getTexUnit(1)->activate();
gGL.matrixMode(LLRender::MM_TEXTURE);
gGL.loadIdentity();
gGL.matrixMode(LLRender::MM_MODELVIEW);
// Restore blend state
gGL.setSceneBlendType(LLRender::BT_ALPHA);
//----------------------------------------------------------------------------
// Restore Texture Unit 0 defaults
gGL.getTexUnit(0)->activate();
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
gGL.matrixMode(LLRender::MM_TEXTURE);
gGL.loadIdentity();
gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
}
void LLDrawPoolTerrain::renderFull2TU()
{
// Hack! Get the region that this draw pool is rendering from!
LLViewerRegion *regionp = mDrawFace[0]->getDrawable()->getVObj()->getRegion();
LLVLComposition *compp = regionp->getComposition();
// [SL:KB] - Patch: Render-TextureToggle (Catznip-4.0)
LLViewerTexture *detail_texture0p = (LLPipeline::sRenderTextures) ? compp->mDetailTextures[0] : LLViewerFetchedTexture::sDefaultDiffuseImagep;
LLViewerTexture *detail_texture1p = (LLPipeline::sRenderTextures) ? compp->mDetailTextures[1] : LLViewerFetchedTexture::sDefaultDiffuseImagep;
LLViewerTexture *detail_texture2p = (LLPipeline::sRenderTextures) ? compp->mDetailTextures[2] : LLViewerFetchedTexture::sDefaultDiffuseImagep;
LLViewerTexture *detail_texture3p = (LLPipeline::sRenderTextures) ? compp->mDetailTextures[3] : LLViewerFetchedTexture::sDefaultDiffuseImagep;
// [/SL:KB]
// LLViewerTexture *detail_texture0p = compp->mDetailTextures[0];
// LLViewerTexture *detail_texture1p = compp->mDetailTextures[1];
// LLViewerTexture *detail_texture2p = compp->mDetailTextures[2];
// LLViewerTexture *detail_texture3p = compp->mDetailTextures[3];
LLVector3d region_origin_global = gAgent.getRegion()->getOriginGlobal();
F32 offset_x = (F32)fmod(region_origin_global.mdV[VX], 1.0/(F64)sDetailScale)*sDetailScale;
F32 offset_y = (F32)fmod(region_origin_global.mdV[VY], 1.0/(F64)sDetailScale)*sDetailScale;
LLVector4 tp0, tp1;
tp0.setVec(sDetailScale, 0.0f, 0.0f, offset_x);
tp1.setVec(0.0f, sDetailScale, 0.0f, offset_y);
gGL.blendFunc(LLRender::BF_ONE_MINUS_SOURCE_ALPHA, LLRender::BF_SOURCE_ALPHA);
//----------------------------------------------------------------------------
// Pass 1/4
//
// Stage 0: Render detail 0 into base
//
gGL.getTexUnit(0)->bind(detail_texture0p);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_VERT_COLOR);
drawLoop();
//----------------------------------------------------------------------------
// Pass 2/4
//
// Stage 0: Generate alpha ramp for detail0/detail1 transition
//
gGL.getTexUnit(0)->bind(m2DAlphaRampImagep);
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
// Care about alpha only
gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR);
gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA);
//
// Stage 1: Write detail1
//
gGL.getTexUnit(1)->bind(detail_texture1p);
gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(1)->activate();
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_VERT_COLOR);
gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_ALPHA);
gGL.getTexUnit(0)->activate();
{
LLGLEnable blend(GL_BLEND);
drawLoop();
}
//----------------------------------------------------------------------------
// Pass 3/4
//
// Stage 0: Generate alpha ramp for detail1/detail2 transition
//
gGL.getTexUnit(0)->bind(m2DAlphaRampImagep);
// Set the texture matrix
gGL.matrixMode(LLRender::MM_TEXTURE);
gGL.loadIdentity();
gGL.translatef(-1.f, 0.f, 0.f);
gGL.matrixMode(LLRender::MM_MODELVIEW);
// Care about alpha only
gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR);
gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA);
//
// Stage 1: Write detail2
//
gGL.getTexUnit(1)->bind(detail_texture2p);
gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(1)->activate();
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_VERT_COLOR);
gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_ALPHA);
{
LLGLEnable blend(GL_BLEND);
drawLoop();
}
//----------------------------------------------------------------------------
// Pass 4/4
//
// Stage 0: Generate alpha ramp for detail2/detail3 transition
//
gGL.getTexUnit(0)->activate();
gGL.getTexUnit(0)->bind(m2DAlphaRampImagep);
// Set the texture matrix
gGL.matrixMode(LLRender::MM_TEXTURE);
gGL.loadIdentity();
gGL.translatef(-2.f, 0.f, 0.f);
gGL.matrixMode(LLRender::MM_MODELVIEW);
// Care about alpha only
gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR);
gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_TEX_ALPHA);
// Stage 1: Write detail3
gGL.getTexUnit(1)->bind(detail_texture3p);
gGL.getTexUnit(1)->enable(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(1)->activate();
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
gGL.getTexUnit(1)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_VERT_COLOR);
gGL.getTexUnit(1)->setTextureAlphaBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_ALPHA);
gGL.getTexUnit(0)->activate();
{
LLGLEnable blend(GL_BLEND);
drawLoop();
}
// Restore blend state
gGL.setSceneBlendType(LLRender::BT_ALPHA);
// Disable multitexture
gGL.getTexUnit(1)->unbind(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(1)->disable();
gGL.getTexUnit(1)->activate();
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
gGL.matrixMode(LLRender::MM_TEXTURE);
gGL.loadIdentity();
gGL.matrixMode(LLRender::MM_MODELVIEW);
//----------------------------------------------------------------------------
// Restore Texture Unit 0 defaults
gGL.getTexUnit(0)->activate();
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
gGL.matrixMode(LLRender::MM_TEXTURE);
gGL.loadIdentity();
gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
}
void LLDrawPoolTerrain::renderSimple()
{
LLVector4 tp0, tp1;
//----------------------------------------------------------------------------
// Pass 1/1
// Stage 0: Base terrain texture pass
mTexturep->addTextureStats(1024.f*1024.f);
gGL.getTexUnit(0)->activate();
gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
gGL.getTexUnit(0)->bind(mTexturep);
LLVector3 origin_agent = mDrawFace[0]->getDrawable()->getVObj()->getRegion()->getOriginAgent();
F32 tscale = 1.f/256.f;
tp0.setVec(tscale, 0.f, 0.0f, -1.f*(origin_agent.mV[0]/256.f));
tp1.setVec(0.f, tscale, 0.0f, -1.f*(origin_agent.mV[1]/256.f));
if (LLGLSLShader::sNoFixedFunction)
{
sShader->uniform4fv(LLShaderMgr::OBJECT_PLANE_S, 1, tp0.mV);
sShader->uniform4fv(LLShaderMgr::OBJECT_PLANE_T, 1, tp1.mV);
}
else
{
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_OBJECT_LINEAR);
glTexGenfv(GL_S, GL_OBJECT_PLANE, tp0.mV);
glTexGenfv(GL_T, GL_OBJECT_PLANE, tp1.mV);
}
gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_VERT_COLOR);
drawLoop();
//----------------------------------------------------------------------------
// Restore Texture Unit 0 defaults
gGL.getTexUnit(0)->activate();
gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
if (!LLGLSLShader::sNoFixedFunction)
{
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
}
gGL.matrixMode(LLRender::MM_TEXTURE);
gGL.loadIdentity();
gGL.matrixMode(LLRender::MM_MODELVIEW);
gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
}
//============================================================================
void LLDrawPoolTerrain::renderOwnership()
{
LLGLSPipelineAlpha gls_pipeline_alpha;
llassert(!mDrawFace.empty());
// Each terrain pool is associated with a single region.
// We need to peek back into the viewer's data to find out
// which ownership overlay texture to use.
LLFace *facep = mDrawFace[0];
LLDrawable *drawablep = facep->getDrawable();
const LLViewerObject *objectp = drawablep->getVObj();
const LLVOSurfacePatch *vo_surface_patchp = (LLVOSurfacePatch *)objectp;
LLSurfacePatch *surface_patchp = vo_surface_patchp->getPatch();
LLSurface *surfacep = surface_patchp->getSurface();
LLViewerRegion *regionp = surfacep->getRegion();
LLViewerParcelOverlay *overlayp = regionp->getParcelOverlay();
LLViewerTexture *texturep = overlayp->getTexture();
gGL.getTexUnit(0)->bind(texturep);
// *NOTE: Because the region is 256 meters wide, but has 257 pixels, the
// texture coordinates for pixel 256x256 is not 1,1. This makes the
// ownership map not line up with the selection. We address this with
// a texture matrix multiply.
gGL.matrixMode(LLRender::MM_TEXTURE);
gGL.pushMatrix();
const F32 TEXTURE_FUDGE = 257.f / 256.f;
gGL.scalef( TEXTURE_FUDGE, TEXTURE_FUDGE, 1.f );
for (std::vector<LLFace*>::iterator iter = mDrawFace.begin();
iter != mDrawFace.end(); iter++)
{
LLFace *facep = *iter;
facep->renderIndexed(LLVertexBuffer::MAP_VERTEX |
LLVertexBuffer::MAP_TEXCOORD0);
}
gGL.matrixMode(LLRender::MM_TEXTURE);
gGL.popMatrix();
gGL.matrixMode(LLRender::MM_MODELVIEW);
}
void LLDrawPoolTerrain::dirtyTextures(const std::set<LLViewerFetchedTexture*>& textures)
{
LLViewerFetchedTexture* tex = LLViewerTextureManager::staticCastToFetchedTexture(mTexturep) ;
if (tex && textures.find(tex) != textures.end())
{
for (std::vector<LLFace*>::iterator iter = mReferences.begin();
iter != mReferences.end(); iter++)
{
LLFace *facep = *iter;
gPipeline.markTextured(facep->getDrawable());
}
}
}
LLViewerTexture *LLDrawPoolTerrain::getTexture()
{
return mTexturep;
}
LLViewerTexture *LLDrawPoolTerrain::getDebugTexture()
{
return mTexturep;
}
LLColor3 LLDrawPoolTerrain::getDebugColor() const
{
return LLColor3(0.f, 0.f, 1.f);
}
| 31.861616
| 143
| 0.735314
|
SaladDais
|
43101b0ae11df976c4f2821f837e019a0c5d5c96
| 8,242
|
cpp
|
C++
|
apps/log/src/main_log.cpp
|
ShmFw/shmfw
|
d386841f8b1425cbeca8c8a3fc6919bf8d83c38e
|
[
"BSD-3-Clause"
] | 1
|
2016-02-06T14:57:32.000Z
|
2016-02-06T14:57:32.000Z
|
apps/log/src/main_log.cpp
|
ShmFw/shmfw
|
d386841f8b1425cbeca8c8a3fc6919bf8d83c38e
|
[
"BSD-3-Clause"
] | null | null | null |
apps/log/src/main_log.cpp
|
ShmFw/shmfw
|
d386841f8b1425cbeca8c8a3fc6919bf8d83c38e
|
[
"BSD-3-Clause"
] | 1
|
2018-11-07T02:45:24.000Z
|
2018-11-07T02:45:24.000Z
|
/***************************************************************************
* Software License Agreement (BSD License) *
* Copyright (C) 2012 by Markus Bader <markus.bader@tuwien.ac.at> *
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright *
* notice, this list of conditions and the following disclaimer. *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in *
* the documentation and/or other materials provided with the *
* distribution. *
* 3. Neither the name of the copyright holder nor the names of its *
* contributors may be used to endorse or promote products derived *
* from this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS *
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE *
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, *
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, *
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; *
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER *
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT *
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY *
* WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *
* POSSIBILITY OF SUCH DAMAGE. *
***************************************************************************/
#include <iostream>
#include <stdlib.h>
#include <signal.h>
#include "shmfw/variable.h"
#include "shmfw/vector.h"
#include "shmfw/log.h"
#include <boost/program_options.hpp>
#include <boost/thread.hpp>
#include <ncurses.h>
bool loop_program = true;
struct Prarmeters {
bool clear;
std::string shm_memory_name;
unsigned int shm_memory_size;
std::string variable_name;
std::string log_file;
int process_cout_level;
int source;
int file_level;
int cout_level;
bool timeout_msg;
bool pull;
bool buffer;
bool timestamp;
int timeout;
};
Prarmeters readArgs ( int argc, char **argv ) {
namespace po = boost::program_options;
Prarmeters params;
po::options_description desc ( "Allowed Parameters" );
desc.add_options()
( "help", "get this help message" )
( "clear", "clears the shared memory" )
( "msg_off,o", "switches the timeout message off" )
( "buffer", "shows the buffer id" )
( "timestamp_off", "switches the timestamp off" )
( "pull,p", "pulls for log messages (no trigger needed)" )
( "timeout,t", po::value<int> ( ¶ms.timeout )->default_value ( 2000 ), "timeout for timeout message in ms" )
( "source,s", po::value<int> ( ¶ms.source )->default_value ( -1 ), "source filter (-1 off)" )
( "process_cout_level", po::value<int> ( ¶ms.process_cout_level )->default_value ( ShmFw::Message::NA ), "level of message to be printed by the meassage creating process" )
( "cout_level", po::value<int> ( ¶ms.cout_level )->default_value ( ShmFw::Message::NA ), "level of message to be printed by this process" )
( "file_level", po::value<int> ( ¶ms.file_level )->default_value ( ShmFw::Message::NA ), "level of message to be stored" )
( "file,f", po::value<std::string> ( ¶ms.log_file )->default_value ( "/tmp/log" ), "log file prefix, if empty it will print of cout" )
( "shm_log,l", po::value<std::string> ( ¶ms.variable_name )->default_value ( "log" ), "shared variable name of the logger" )
( "shm_memory_name", po::value<std::string> ( ¶ms.shm_memory_name )->default_value ( ShmFw::DEFAULT_LOG_SEGMENT_NAME() ), "shared memory segment name" )
( "shm_memory_size", po::value<unsigned int> ( ¶ms.shm_memory_size )->default_value ( ShmFw::DEFAULT_LOG_SEGMENT_SIZE() ), "shared memory segment size" );
po::variables_map vm;
try {
po::store ( po::parse_command_line ( argc, argv, desc ), vm );
} catch ( const std::exception &ex ) {
std::cout << desc << std::endl;;
exit ( 1 );
}
po::notify ( vm );
if ( vm.count ( "help" ) ) {
std::cout << desc << std::endl;
exit ( 1 );
}
params.clear = ( vm.count ( "clear" ) > 0 );
params.timeout_msg = ! ( vm.count ( "msg_off" ) > 0 );
params.pull = ( vm.count ( "pull" ) > 0 );
params.buffer = ( vm.count ( "buffer" ) > 0 );
params.timestamp = !( vm.count ( "timestamp_off" ) > 0 );
return params;
}
void printMsgs ( std::vector<ShmFw::Message> &msgs, std::ofstream &file, const Prarmeters ¶ms ) {
for ( unsigned int i = 0; i < msgs.size(); i++ ) {
ShmFw::Message &msg = msgs[i];
if ( !params.log_file.empty() ) {
file << std::setw ( 4 ) << i << ": " << msg << std::endl;
}
//source log level/type filter
if ( msg.getType() >= params.cout_level ) {
if ( params.buffer ) std::cout << std::setw ( 4 ) << i << ": ";
if ( params.timestamp ) std::cout << boost::posix_time::to_simple_string ( msg.getTime() ).substr(12,26) << ": ";
if ( msg.getType() != ShmFw::Message::NA ) std::cout << ": " << std::setw ( 8 ) << msg.typeStr() << ": ";
std::cout << msg.getMsg();
std::cout << std::endl;
}
}
}
void dequeLog ( ShmFw::Log &log, const Prarmeters ¶ms ) {
std::vector<ShmFw::Message> msgs;
std::ofstream file;
boost::posix_time::ptime now = boost::posix_time::microsec_clock::local_time();
std::string datedFileName = params.log_file + std::string ( "_" ) + boost::posix_time::to_iso_string ( now ) + std::string ( ".txt" );
if ( !params.log_file.empty() ) {
file.open ( datedFileName.c_str(), std::ios::out | std::ios::binary );
}
while ( loop_program ) {
bool wait_ones = true;
while ( ( log.timed_wait ( params.timeout ) == false ) && loop_program && wait_ones ) {
if ( params.timeout_msg ) std::cout << "waited " << params.timeout << " ms" << std::endl;
if ( params.pull ) wait_ones = false;
}
msgs.clear();
log.lock();
#if BOOST_VERSION / 100 % 1000 <= 55
for ( ShmFw::Log::Iterator it = log->begin(); it != log->end(); it++ ) {
//source filter
if ( (params.source < 0) || (params.source == ( *it ).getSource())) {
msgs.push_back ( *it );
log.pop_front();
}
}
#else
#endif
log.unlock();
printMsgs ( msgs, file, params );
}
if ( !params.log_file.empty() ) file.close();
}
void terminate ( int param ) {
std::cout << "Closing program!" << std::endl;
loop_program = false;
}
int main ( int argc, char *argv[] ) {
signal ( SIGINT, terminate );
signal ( SIGKILL, terminate );
Prarmeters params = readArgs ( argc, argv );
if ( params.clear ) {
ShmFw::Handler::removeSegment ( params.shm_memory_name );
std::cout << "Shared Memory " << params.shm_memory_name << " cleared" << std::endl;
exit ( 1 );
}
ShmFw::HandlerPtr shmHdl = ShmFw::Handler::create ( params.shm_memory_name, params.shm_memory_size );
ShmFw::Log log ( shmHdl, params.variable_name );
log.process_cout_level ( params.process_cout_level );
log.unlock();
dequeLog ( log, params );
log.unlock();
exit ( 0 );
}
| 43.378947
| 180
| 0.575467
|
ShmFw
|
4310b7e363a524d20b0f5c04306fecfce32c5f94
| 59,237
|
cc
|
C++
|
deps/exokit-bindings/glfw/src/glfw.cc
|
Palmer-JC/exokit
|
55ee5a36d97c6bda5d380780632631b13ba0c8d2
|
[
"MIT"
] | 547
|
2019-04-07T14:34:01.000Z
|
2022-03-25T08:58:50.000Z
|
deps/exokit-bindings/glfw/src/glfw.cc
|
TizenTeam/exokit
|
7734835a71cf5dff4575aafb2ecd9c9ad339977c
|
[
"MIT"
] | 514
|
2018-03-22T00:31:38.000Z
|
2019-04-06T21:16:45.000Z
|
deps/exokit-bindings/glfw/src/glfw.cc
|
TizenTeam/exokit
|
7734835a71cf5dff4575aafb2ecd9c9ad339977c
|
[
"MIT"
] | 120
|
2019-04-15T18:36:25.000Z
|
2022-03-03T01:11:34.000Z
|
#include <glfw/include/glfw.h>
#include <windowsystem.h>
#include <webgl.h>
#include "canvas/src/stb_image.h"
#include <exout>
#if defined(TARGET_OS_MAC) || defined(__linux__)
#define MAIN_THREAD_POLLING 1
#endif
namespace glfw {
thread_local NATIVEwindow *currentWindow = nullptr;
std::mutex windowHandleMutex;
NATIVEwindow *sharedWindow = nullptr;
InjectionHandler mainThreadInjectionHandler;
std::mutex injectionHandlerMapMutex;
int lastX = -1, lastY = -1; // XXX track this per-window
uint64_t lastClickTime = 0;
#ifdef MAIN_THREAD_POLLING
std::thread::id mainThreadId;
bool hasMainThreadId = false;
#endif
WindowState::WindowState() {}
WindowState::~WindowState() {}
void RunEventInWindowThread(uv_async_t *async) {
Nan::HandleScope scope;
EventHandler *eventHandler = (EventHandler *)async->data;
std::deque<std::function<void(std::function<void(int argc, Local<Value> *argv)>)>> localFns;
Local<Function> handlerFn;
{
std::lock_guard<std::mutex> lock(eventHandler->mutex);
localFns = std::move(eventHandler->fns);
eventHandler->fns.clear();
handlerFn = Nan::New(eventHandler->handlerFn);
}
for (auto iter = localFns.begin(); iter != localFns.end(); iter++) {
Nan::HandleScope scope;
(*iter)([&](int argc, Local<Value> *argv) -> void {
Local<Object> asyncObject = Nan::New<Object>();
AsyncResource asyncResource(Isolate::GetCurrent(), asyncObject, "mlEvents");
asyncResource.MakeCallback(handlerFn, argc, argv);
});
}
}
EventHandler::EventHandler(uv_loop_t *loop, Local<Function> handlerFn) : async(new uv_async_t()), handlerFn(handlerFn) {
uv_async_init(loop, async.get(), RunEventInWindowThread);
async->data = this;
}
EventHandler::~EventHandler() {
uv_close((uv_handle_t *)async.release(), [](uv_handle_t *handle) {
delete handle;
});
}
InjectionHandler::InjectionHandler() {}
void QueueEvent(NATIVEwindow *window, std::function<void(std::function<void(int, Local<Value> *)>)> fn) {
WindowState *windowState = (WindowState *)glfwGetWindowUserPointer(window);
if (windowState->handler) {
EventHandler *eventHandler = windowState->handler.get();
{
std::lock_guard<std::mutex> lock(eventHandler->mutex);
eventHandler->fns.push_back(fn);
}
uv_async_send(eventHandler->async.get());
}
}
bool glfwInitialized = false;
void initializeGlfw() {
glewExperimental = GL_TRUE;
if (glfwInit() == GLFW_TRUE) {
atexit([]() {
glfwTerminate();
});
glfwDefaultWindowHints();
// we use OpenGL 2.1, GLSL 1.20. Comment this for now as this is for GLSL 1.50
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 2);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_RESIZABLE, 1);
glfwWindowHint(GLFW_VISIBLE, 1);
glfwWindowHint(GLFW_DECORATED, 1);
glfwWindowHint(GLFW_RED_BITS, 8);
glfwWindowHint(GLFW_GREEN_BITS, 8);
glfwWindowHint(GLFW_BLUE_BITS, 8);
glfwWindowHint(GLFW_DEPTH_BITS, 24);
glfwWindowHint(GLFW_REFRESH_RATE, 0);
glfwWindowHint(GLFW_CONTEXT_RELEASE_BEHAVIOR, GLFW_RELEASE_BEHAVIOR_NONE);
glfwSetErrorCallback([](int err, const char *errString) {
fprintf(stderr, "GLFW error: %d: %s", err, errString);
});
} else {
exerr << "Failed to initialize GLFW" << std::endl;
abort();
}
}
void handleInjections() {
std::lock_guard<std::mutex> lock(injectionHandlerMapMutex);
for (auto iter = mainThreadInjectionHandler.fns.begin(); iter != mainThreadInjectionHandler.fns.end(); iter++) {
std::function<void(InjectionHandler *)> &fn = *iter;
fn(&mainThreadInjectionHandler);
}
mainThreadInjectionHandler.fns.clear();
}
void QueueInjection(std::function<void(InjectionHandler *injectionHandler)> fn) {
if (!glfwInitialized) {
#ifndef MAIN_THREAD_POLLING
std::thread([&]() -> void {
initializeGlfw();
for (;;) {
glfwWaitEvents();
handleInjections();
}
}).detach();
#else
{
std::lock_guard<std::mutex> lock(injectionHandlerMapMutex);
mainThreadInjectionHandler.fns.push_back([](InjectionHandler *injectionHandler) -> void {
initializeGlfw();
});
}
#endif
glfwInitialized = true;
}
{
std::lock_guard<std::mutex> lock(injectionHandlerMapMutex);
mainThreadInjectionHandler.fns.push_back(fn);
}
#ifndef MAIN_THREAD_POLLING
glfwPostEmptyEvent();
#else
if (std::this_thread::get_id() == mainThreadId) {
handleInjections();
}
#endif
}
GLFWmonitor* _activeMonitor;
GLFWmonitor* getMonitor() {
if (_activeMonitor) {
return _activeMonitor;
} else {
GLFWmonitor *monitor = glfwGetPrimaryMonitor();
return monitor;
}
}
NAN_METHOD(GetMonitors) {
int monitor_count, mode_count, xpos, ypos, width, height;
int i, j;
GLFWmonitor **monitors = glfwGetMonitors(&monitor_count);
GLFWmonitor *primary = glfwGetPrimaryMonitor();
const GLFWvidmode *mode, *modes;
Local<Array> js_monitors = Nan::New<Array>(monitor_count);
Local<Object> js_monitor, js_mode;
Local<Array> js_modes;
for(i=0; i<monitor_count; i++){
js_monitor = Nan::New<Object>();
js_monitor->Set(JS_STR("is_primary"), JS_BOOL(monitors[i] == primary));
js_monitor->Set(JS_STR("index"), JS_INT(i));
js_monitor->Set(JS_STR("name"), JS_STR(glfwGetMonitorName(monitors[i])));
glfwGetMonitorPos(monitors[i], &xpos, &ypos);
js_monitor->Set(JS_STR("pos_x"), JS_INT(xpos));
js_monitor->Set(JS_STR("pos_y"), JS_INT(ypos));
glfwGetMonitorPhysicalSize(monitors[i], &width, &height);
js_monitor->Set(JS_STR("width_mm"), JS_INT(width));
js_monitor->Set(JS_STR("height_mm"), JS_INT(height));
mode = glfwGetVideoMode(monitors[i]);
js_monitor->Set(JS_STR("width"), JS_INT(mode->width));
js_monitor->Set(JS_STR("height"), JS_INT(mode->height));
js_monitor->Set(JS_STR("rate"), JS_INT(mode->refreshRate));
modes = glfwGetVideoModes(monitors[i], &mode_count);
js_modes = Nan::New<Array>(mode_count);
for(j=0; j<mode_count; j++){
js_mode = Nan::New<Object>();
js_mode->Set(JS_STR("width"), JS_INT(modes[j].width));
js_mode->Set(JS_STR("height"), JS_INT(modes[j].height));
js_mode->Set(JS_STR("rate"), JS_INT(modes[j].refreshRate));
// NOTE: Are color bits necessary?
js_modes->Set(JS_INT(j), js_mode);
}
js_monitor->Set(JS_STR("modes"), js_modes);
js_monitors->Set(JS_INT(i), js_monitor);
}
info.GetReturnValue().Set(js_monitors);
}
NAN_METHOD(SetMonitor) {
int index = TO_INT32(info[0]);
int monitor_count;
GLFWmonitor **monitors = glfwGetMonitors(&monitor_count);
_activeMonitor = monitors[index];
}
void GetScreenSize(int *width, int *height) {
uv_sem_t sem;
uv_sem_init(&sem, 0);
QueueInjection([&](InjectionHandler *injectionHandler) -> void {
GLFWmonitor *monitor = glfwGetPrimaryMonitor();
const GLFWvidmode *videoMode = glfwGetVideoMode(monitor);
*width = videoMode->width;
*height = videoMode->height;
uv_sem_post(&sem);
});
uv_sem_wait(&sem);
uv_sem_destroy(&sem);
}
NAN_METHOD(GetScreenSize) {
int width, height;
GetScreenSize(&width, &height);
Local<Array> result = Nan::New<Array>(2);
result->Set(0, JS_INT(width));
result->Set(1, JS_INT(height));
info.GetReturnValue().Set(result);
}
// Window callbacks handling
void APIENTRY windowPosCB(NATIVEwindow *window, int xpos, int ypos) {
QueueEvent(window, [=](std::function<void(int, Local<Value> *)> eventHandlerFn) -> void {
Local<Object> evt = Nan::New<Object>();
evt->Set(JS_STR("type"),JS_STR("move"));
evt->Set(JS_STR("x"),JS_INT(xpos));
evt->Set(JS_STR("y"),JS_INT(ypos));
// evt->Set(JS_STR("windowHandle"), pointerToArray(window));
Local<Value> argv[] = {
JS_STR("move"), // event name
evt,
};
eventHandlerFn(sizeof(argv)/sizeof(argv[0]), argv);
});
}
void APIENTRY windowSizeCB(NATIVEwindow *window, int w, int h) {
QueueEvent(window, [=](std::function<void(int, Local<Value> *)> eventHandlerFn) -> void {
Local<Object> evt = Nan::New<Object>();
evt->Set(JS_STR("type"),JS_STR("windowResize"));
evt->Set(JS_STR("width"),JS_INT(w));
evt->Set(JS_STR("height"),JS_INT(h));
// evt->Set(JS_STR("windowHandle"), pointerToArray(window));
Local<Value> argv[] = {
JS_STR("windowResize"), // event name
evt,
};
eventHandlerFn(sizeof(argv)/sizeof(argv[0]), argv);
});
}
void APIENTRY windowFramebufferSizeCB(NATIVEwindow *window, int w, int h) {
QueueEvent(window, [=](std::function<void(int, Local<Value> *)> eventHandlerFn) -> void {
Local<Object> evt = Nan::New<Object>();
evt->Set(JS_STR("type"),JS_STR("framebufferResize"));
evt->Set(JS_STR("width"),JS_INT(w));
evt->Set(JS_STR("height"),JS_INT(h));
// evt->Set(JS_STR("windowHandle"), pointerToArray(window));
Local<Value> argv[] = {
JS_STR("framebufferResize"), // event name
evt,
};
eventHandlerFn(sizeof(argv)/sizeof(argv[0]), argv);
});
}
void APIENTRY windowDropCB(NATIVEwindow *window, int count, const char **paths) {
std::vector<char *> localPaths(count);
for (int i = 0; i < count; i++) {
const char *path = paths[i];
size_t size = strlen(path) + 1;
char *localPath = new char[size];
memcpy(localPath, path, size);
localPaths[i] = localPath;
}
QueueEvent(window, [localPaths{std::move(localPaths)}](std::function<void(int, Local<Value> *)> eventHandlerFn) -> void {
Local<Array> pathsArray = Nan::New<Array>(localPaths.size());
for (int i = 0; i < localPaths.size(); i++) {
pathsArray->Set(i, JS_STR(localPaths[i]));
}
Local<Object> evt = Nan::New<Object>();
evt->Set(JS_STR("paths"), pathsArray);
// evt->Set(JS_STR("windowHandle"), pointerToArray(window));
Local<Value> argv[] = {
JS_STR("drop"), // event name
evt,
};
eventHandlerFn(sizeof(argv)/sizeof(argv[0]), argv);
for (int i = 0; i < localPaths.size(); i++) {
delete[] localPaths[i];
}
});
}
void APIENTRY windowCloseCB(NATIVEwindow *window) {
QueueEvent(window, [=](std::function<void(int, Local<Value> *)> eventHandlerFn) -> void {
Local<Object> evt = Nan::New<Object>();
// evt->Set(JS_STR("windowHandle"), pointerToArray(window));
Local<Value> argv[] = {
JS_STR("quit"), // event name
evt,
};
eventHandlerFn(sizeof(argv)/sizeof(argv[0]), argv);
});
}
void APIENTRY windowRefreshCB(NATIVEwindow *window) {
QueueEvent(window, [=](std::function<void(int, Local<Value> *)> eventHandlerFn) -> void {
Local<Object> evt = Nan::New<Object>();
evt->Set(JS_STR("type"),JS_STR("refresh"));
// evt->Set(JS_STR("windowHandle"), pointerToArray(window));
Local<Value> argv[] = {
JS_STR("refresh"), // event name
evt,
};
eventHandlerFn(sizeof(argv)/sizeof(argv[0]), argv);
});
}
void APIENTRY windowFocusCB(NATIVEwindow *window, int focused) {
QueueEvent(window, [=](std::function<void(int, Local<Value> *)> eventHandlerFn) -> void {
Local<Object> evt = Nan::New<Object>();
evt->Set(JS_STR("type"),JS_STR("focus"));
evt->Set(JS_STR("focused"),JS_BOOL((bool)focused));
// evt->Set(JS_STR("windowHandle"), pointerToArray(window));
Local<Value> argv[] = {
JS_STR("focus"), // event name
evt,
};
eventHandlerFn(sizeof(argv)/sizeof(argv[0]), argv);
});
}
void APIENTRY windowMaximizeCB(NATIVEwindow *window, int maximized) {
QueueEvent(window, [=](std::function<void(int, Local<Value> *)> eventHandlerFn) -> void {
Local<Object> evt = Nan::New<Object>();
evt->Set(JS_STR("type"),JS_STR("maximize"));
evt->Set(JS_STR("maximized"),JS_BOOL((bool)maximized));
// evt->Set(JS_STR("windowHandle"), pointerToArray(window));
Local<Value> argv[] = {
JS_STR("maximize"), // event name
evt,
};
eventHandlerFn(sizeof(argv)/sizeof(argv[0]), argv);
});
}
void APIENTRY windowIconifyCB(NATIVEwindow *window, int iconified) {
QueueEvent(window, [=](std::function<void(int, Local<Value> *)> eventHandlerFn) -> void {
Local<Object> evt = Nan::New<Object>();
evt->Set(JS_STR("type"),JS_STR("minimize"));
evt->Set(JS_STR("minimized"),JS_BOOL((bool)iconified));
// evt->Set(JS_STR("windowHandle"), pointerToArray(window));
Local<Value> argv[] = {
JS_STR("minimize"), // event name
evt,
};
eventHandlerFn(sizeof(argv)/sizeof(argv[0]), argv);
});
}
static int jsKeyCode[]={
/*GLFW_KEY_ESCAPE*/ 27,
/*GLFW_KEY_ENTER*/ 13,
/*GLFW_KEY_TAB*/ 9,
/*GLFW_KEY_BACKSPACE*/ 8,
/*GLFW_KEY_INSERT*/ 45,
/*GLFW_KEY_DELETE*/ 46,
/*GLFW_KEY_RIGHT*/ 39,
/*GLFW_KEY_LEFT*/ 37,
/*GLFW_KEY_DOWN*/ 40,
/*GLFW_KEY_UP*/ 38,
/*GLFW_KEY_PAGE_UP*/ 33,
/*GLFW_KEY_PAGE_DOWN*/ 34,
/*GLFW_KEY_HOME*/ 36,
/*GLFW_KEY_END*/ 35,
/*GLFW_KEY_CAPS_LOCK*/ 20,
/*GLFW_KEY_SCROLL_LOCK*/ 145,
/*GLFW_KEY_NUM_LOCK*/ 144,
/*GLFW_KEY_PRINT_SCREEN*/ 144, /* TODO */
/*GLFW_KEY_PAUSE*/ 19,
/*GLFW_KEY_F1*/ 112,
/*GLFW_KEY_F2*/ 113,
/*GLFW_KEY_F3*/ 114,
/*GLFW_KEY_F4*/ 115,
/*GLFW_KEY_F5*/ 116,
/*GLFW_KEY_F6*/ 117,
/*GLFW_KEY_F7*/ 118,
/*GLFW_KEY_F8*/ 119,
/*GLFW_KEY_F9*/ 120,
/*GLFW_KEY_F10*/ 121,
/*GLFW_KEY_F11*/ 122,
/*GLFW_KEY_F12*/ 123,
/*GLFW_KEY_F13*/ 123, /* unknown */
/*GLFW_KEY_F14*/ 123, /* unknown */
/*GLFW_KEY_F15*/ 123, /* unknown */
/*GLFW_KEY_F16*/ 123, /* unknown */
/*GLFW_KEY_F17*/ 123, /* unknown */
/*GLFW_KEY_F18*/ 123, /* unknown */
/*GLFW_KEY_F19*/ 123, /* unknown */
/*GLFW_KEY_F20*/ 123, /* unknown */
/*GLFW_KEY_F21*/ 123, /* unknown */
/*GLFW_KEY_F22*/ 123, /* unknown */
/*GLFW_KEY_F23*/ 123, /* unknown */
/*GLFW_KEY_F24*/ 123, /* unknown */
/*GLFW_KEY_F25*/ 123, /* unknown */
/*GLFW_KEY_KP_0*/ 96,
/*GLFW_KEY_KP_1*/ 97,
/*GLFW_KEY_KP_2*/ 98,
/*GLFW_KEY_KP_3*/ 99,
/*GLFW_KEY_KP_4*/ 100,
/*GLFW_KEY_KP_5*/ 101,
/*GLFW_KEY_KP_6*/ 102,
/*GLFW_KEY_KP_7*/ 103,
/*GLFW_KEY_KP_8*/ 104,
/*GLFW_KEY_KP_9*/ 105,
/*GLFW_KEY_KP_DECIMAL*/ 110,
/*GLFW_KEY_KP_DIVIDE*/ 111,
/*GLFW_KEY_KP_MULTIPLY*/ 106,
/*GLFW_KEY_KP_SUBTRACT*/ 109,
/*GLFW_KEY_KP_ADD*/ 107,
/*GLFW_KEY_KP_ENTER*/ 13,
/*GLFW_KEY_KP_EQUAL*/ 187,
/*GLFW_KEY_LEFT_SHIFT*/ 16,
/*GLFW_KEY_LEFT_CONTROL*/ 17,
/*GLFW_KEY_LEFT_ALT*/ 18,
/*GLFW_KEY_LEFT_SUPER*/ 91,
/*GLFW_KEY_RIGHT_SHIFT*/ 16,
/*GLFW_KEY_RIGHT_CONTROL*/17,
/*GLFW_KEY_RIGHT_ALT*/ 18,
/*GLFW_KEY_RIGHT_SUPER*/ 93,
/*GLFW_KEY_MENU*/ 18
};
const char *actionNames = "keyup\0 keydown\0keypress";
void APIENTRY keyCB(NATIVEwindow *window, int key, int scancode, int action, int mods) {
if (key >= 0) { // media keys are -1
bool isPrintable = true;
switch (key) {
case GLFW_KEY_ESCAPE:
case GLFW_KEY_ENTER:
case GLFW_KEY_TAB:
case GLFW_KEY_BACKSPACE:
case GLFW_KEY_INSERT:
case GLFW_KEY_DELETE:
case GLFW_KEY_RIGHT:
case GLFW_KEY_LEFT:
case GLFW_KEY_DOWN:
case GLFW_KEY_UP:
case GLFW_KEY_PAGE_UP:
case GLFW_KEY_PAGE_DOWN:
case GLFW_KEY_HOME:
case GLFW_KEY_END:
case GLFW_KEY_CAPS_LOCK:
case GLFW_KEY_SCROLL_LOCK:
case GLFW_KEY_NUM_LOCK:
case GLFW_KEY_PRINT_SCREEN:
case GLFW_KEY_PAUSE:
case GLFW_KEY_F1:
case GLFW_KEY_F2:
case GLFW_KEY_F3:
case GLFW_KEY_F4:
case GLFW_KEY_F5:
case GLFW_KEY_F6:
case GLFW_KEY_F7:
case GLFW_KEY_F8:
case GLFW_KEY_F9:
case GLFW_KEY_F10:
case GLFW_KEY_F11:
case GLFW_KEY_F12:
case GLFW_KEY_F13:
case GLFW_KEY_F14:
case GLFW_KEY_F15:
case GLFW_KEY_F16:
case GLFW_KEY_F17:
case GLFW_KEY_F18:
case GLFW_KEY_F19:
case GLFW_KEY_F20:
case GLFW_KEY_F21:
case GLFW_KEY_F22:
case GLFW_KEY_F23:
case GLFW_KEY_F24:
case GLFW_KEY_F25:
case GLFW_KEY_LEFT_SHIFT:
case GLFW_KEY_LEFT_CONTROL:
case GLFW_KEY_LEFT_ALT:
case GLFW_KEY_LEFT_SUPER:
case GLFW_KEY_RIGHT_SHIFT:
case GLFW_KEY_RIGHT_CONTROL:
case GLFW_KEY_RIGHT_ALT:
case GLFW_KEY_RIGHT_SUPER:
case GLFW_KEY_MENU:
isPrintable = false;
}
if (!isPrintable && action == GLFW_REPEAT) {
action = GLFW_PRESS;
}
int charCode = key;
if (action == GLFW_RELEASE || action == GLFW_PRESS) {
switch (key) {
case GLFW_KEY_SLASH: key = 191; break; // /
case GLFW_KEY_GRAVE_ACCENT: key = 192; break; // `
case GLFW_KEY_LEFT_BRACKET: key = 219; break; // [
case GLFW_KEY_BACKSLASH: key = 220; break; /* \ */
case GLFW_KEY_RIGHT_BRACKET: key = 221; break; // ]
case GLFW_KEY_APOSTROPHE: key = 222; break; // '
case GLFW_KEY_PERIOD: key = 190; break; // '
case GLFW_KEY_COMMA: key = 188; break; // '
case GLFW_KEY_SEMICOLON: key = 186; break; // ;
case GLFW_KEY_EQUAL: key = 187; break; // =
case GLFW_KEY_MINUS: key = 189; break; // -
}
}
switch (key) {
case GLFW_KEY_ESCAPE: key = 27; break;
case GLFW_KEY_ENTER: key = 13; break;
case GLFW_KEY_TAB: key = 9; break;
case GLFW_KEY_BACKSPACE: key = 8; break;
case GLFW_KEY_INSERT: key = 45; break;
case GLFW_KEY_DELETE: key = 46; break;
case GLFW_KEY_RIGHT: key = 39; break;
case GLFW_KEY_LEFT: key = 37; break;
case GLFW_KEY_DOWN: key = 40; break;
case GLFW_KEY_UP: key = 38; break;
case GLFW_KEY_PAGE_UP: key = 33; break;
case GLFW_KEY_PAGE_DOWN: key = 34; break;
case GLFW_KEY_HOME: key = 36; break;
case GLFW_KEY_END: key = 35; break;
case GLFW_KEY_CAPS_LOCK: key = 20; break;
case GLFW_KEY_SCROLL_LOCK: key = 145; break;
case GLFW_KEY_NUM_LOCK: key = 144; break;
case GLFW_KEY_PRINT_SCREEN: key = 144; break; /* TODO */
case GLFW_KEY_PAUSE: key = 19; break;
case GLFW_KEY_F1: key = 112; break;
case GLFW_KEY_F2: key = 113; break;
case GLFW_KEY_F3: key = 114; break;
case GLFW_KEY_F4: key = 115; break;
case GLFW_KEY_F5: key = 116; break;
case GLFW_KEY_F6: key = 117; break;
case GLFW_KEY_F7: key = 118; break;
case GLFW_KEY_F8: key = 119; break;
case GLFW_KEY_F9: key = 120; break;
case GLFW_KEY_F10: key = 121; break;
case GLFW_KEY_F11: key = 122; break;
case GLFW_KEY_F12: key = 123; break;
case GLFW_KEY_F13: key = 123; break; /* unknown */
case GLFW_KEY_F14: key = 123; break; /* unknown */
case GLFW_KEY_F15: key = 123; break; /* unknown */
case GLFW_KEY_F16: key = 123; break; /* unknown */
case GLFW_KEY_F17: key = 123; break; /* unknown */
case GLFW_KEY_F18: key = 123; break; /* unknown */
case GLFW_KEY_F19: key = 123; break; /* unknown */
case GLFW_KEY_F20: key = 123; break; /* unknown */
case GLFW_KEY_F21: key = 123; break; /* unknown */
case GLFW_KEY_F22: key = 123; break; /* unknown */
case GLFW_KEY_F23: key = 123; break; /* unknown */
case GLFW_KEY_F24: key = 123; break; /* unknown */
case GLFW_KEY_F25: key = 123; break; /* unknown */
case GLFW_KEY_KP_0: key = 96; break;
case GLFW_KEY_KP_1: key = 97; break;
case GLFW_KEY_KP_2: key = 98; break;
case GLFW_KEY_KP_3: key = 99; break;
case GLFW_KEY_KP_4: key = 100; break;
case GLFW_KEY_KP_5: key = 101; break;
case GLFW_KEY_KP_6: key = 102; break;
case GLFW_KEY_KP_7: key = 103; break;
case GLFW_KEY_KP_8: key = 104; break;
case GLFW_KEY_KP_9: key = 105; break;
case GLFW_KEY_KP_DECIMAL: key = 110; break;
case GLFW_KEY_KP_DIVIDE: key = 111; break;
case GLFW_KEY_KP_MULTIPLY: key = 106; break;
case GLFW_KEY_KP_SUBTRACT: key = 109; break;
case GLFW_KEY_KP_ADD: key = 107; break;
case GLFW_KEY_KP_ENTER: key = 13; break;
case GLFW_KEY_KP_EQUAL: key = 187; break;
case GLFW_KEY_LEFT_SHIFT: key = 16; break;
case GLFW_KEY_LEFT_CONTROL: key = 17; break;
case GLFW_KEY_LEFT_ALT: key = 18; break;
case GLFW_KEY_LEFT_SUPER: key = 91; break;
case GLFW_KEY_RIGHT_SHIFT: key = 16; break;
case GLFW_KEY_RIGHT_CONTROL: key = 17; break;
case GLFW_KEY_RIGHT_ALT: key = 18; break;
case GLFW_KEY_RIGHT_SUPER: key = 93; break;
case GLFW_KEY_MENU: key = 18; break;
}
if (
action == 2 && // keypress
key >= 65 && // A
key <= 90 // Z
) {
key += 32;
}
int which = key;
QueueEvent(window, [=](std::function<void(int, Local<Value> *)> eventHandlerFn) -> void {
Local<Object> evt = Nan::New<Object>();
evt->Set(JS_STR("type"), JS_STR(&actionNames[action << 3]));
evt->Set(JS_STR("ctrlKey"), JS_BOOL(mods & GLFW_MOD_CONTROL));
evt->Set(JS_STR("shiftKey"), JS_BOOL(mods & GLFW_MOD_SHIFT));
evt->Set(JS_STR("altKey"), JS_BOOL(mods & GLFW_MOD_ALT));
evt->Set(JS_STR("metaKey"), JS_BOOL(mods & GLFW_MOD_SUPER));
evt->Set(JS_STR("which"), JS_INT(which));
evt->Set(JS_STR("keyCode"), JS_INT(key));
evt->Set(JS_STR("charCode"), JS_INT(charCode));
// evt->Set(JS_STR("windowHandle"), pointerToArray(window));
Local<Value> argv[] = {
JS_STR(&actionNames[action << 3]), // event name
evt,
};
eventHandlerFn(sizeof(argv)/sizeof(argv[0]), argv);
});
if (action == GLFW_PRESS && isPrintable) {
keyCB(window, charCode, scancode, GLFW_REPEAT, mods);
}
}
}
void APIENTRY cursorPosCB(NATIVEwindow* window, double x, double y) {
int w, h;
glfwGetWindowSize(window, &w, &h);
if(x<0 || x>=w) return;
if(y<0 || y>=h) return;
int xi = static_cast<int>(x);
int yi = static_cast<int>(y);
int movementX, movementY;
int mode = glfwGetInputMode(window, GLFW_CURSOR);
if (mode == GLFW_CURSOR_DISABLED) {
movementX = xi - (w / 2);
movementY = yi - (h / 2);
glfwSetCursorPos(window, w / 2, h / 2);
} else {
if (lastX != -1 && lastY != -1) {
movementX = xi - lastX;
movementY = yi - lastY;
} else {
movementX = 0;
movementY = 0;
}
}
lastX = xi;
lastY = yi;
QueueEvent(window, [=](std::function<void(int, Local<Value> *)> eventHandlerFn) -> void {
Local<Object> evt = Nan::New<Object>();
evt->Set(JS_STR("type"),JS_STR("mousemove"));
evt->Set(JS_STR("clientX"),JS_NUM(x));
evt->Set(JS_STR("clientY"),JS_NUM(y));
evt->Set(JS_STR("pageX"),JS_NUM(x));
evt->Set(JS_STR("pageY"),JS_NUM(y));
evt->Set(JS_STR("offsetX"),JS_NUM(x));
evt->Set(JS_STR("offsetY"),JS_NUM(y));
evt->Set(JS_STR("screenX"),JS_NUM(x));
evt->Set(JS_STR("screenY"),JS_NUM(y));
evt->Set(JS_STR("movementX"),JS_NUM(movementX));
evt->Set(JS_STR("movementY"),JS_NUM(movementY));
evt->Set(JS_STR("ctrlKey"),JS_BOOL(glfwGetKey(window, GLFW_KEY_LEFT_CONTROL) == GLFW_PRESS || glfwGetKey(window, GLFW_KEY_RIGHT_CONTROL) == GLFW_PRESS));
evt->Set(JS_STR("shiftKey"),JS_BOOL(glfwGetKey(window, GLFW_KEY_LEFT_SHIFT) == GLFW_PRESS || glfwGetKey(window, GLFW_KEY_RIGHT_SHIFT) == GLFW_PRESS));
evt->Set(JS_STR("altKey"),JS_BOOL(glfwGetKey(window, GLFW_KEY_LEFT_ALT) == GLFW_PRESS || glfwGetKey(window, GLFW_KEY_RIGHT_ALT) == GLFW_PRESS));
evt->Set(JS_STR("metaKey"),JS_BOOL(glfwGetKey(window, GLFW_KEY_LEFT_SUPER) == GLFW_PRESS || glfwGetKey(window, GLFW_KEY_RIGHT_SUPER) == GLFW_PRESS));
// evt->Set(JS_STR("windowHandle"), pointerToArray(window));
Local<Value> argv[] = {
JS_STR("mousemove"), // event name
evt,
};
eventHandlerFn(sizeof(argv)/sizeof(argv[0]), argv);
});
}
void APIENTRY cursorEnterCB(NATIVEwindow* window, int entered) {
QueueEvent(window, [=](std::function<void(int, Local<Value> *)> eventHandlerFn) -> void {
Local<Object> evt = Nan::New<Object>();
evt->Set(JS_STR("type"),JS_STR("mouseenter"));
evt->Set(JS_STR("entered"),JS_INT(entered));
// evt->Set(JS_STR("windowHandle"), pointerToArray(window));
Local<Value> argv[] = {
JS_STR("mouseenter"), // event name
evt,
};
eventHandlerFn(sizeof(argv)/sizeof(argv[0]), argv);
});
}
void APIENTRY mouseButtonCB(NATIVEwindow *window, int button, int action, int mods) {
QueueEvent(window, [=](std::function<void(int, Local<Value> *)> eventHandlerFn) -> void {
double xpos, ypos;
glfwGetCursorPos(window, &xpos, &ypos);
int localButton = button;
if (localButton == 2) {
localButton = 1;
} else if (localButton == 1) {
localButton = 2;
}
{
Local<Object> evt = Nan::New<Object>();
evt->Set(JS_STR("type"),JS_STR(action ? "mousedown" : "mouseup"));
evt->Set(JS_STR("button"),JS_INT(localButton));
evt->Set(JS_STR("which"),JS_INT(localButton + 1));
evt->Set(JS_STR("clientX"),JS_NUM(xpos));
evt->Set(JS_STR("clientY"),JS_NUM(ypos));
evt->Set(JS_STR("pageX"),JS_NUM(xpos));
evt->Set(JS_STR("pageY"),JS_NUM(ypos));
evt->Set(JS_STR("offsetX"),JS_NUM(xpos));
evt->Set(JS_STR("offsetY"),JS_NUM(ypos));
evt->Set(JS_STR("screenX"),JS_NUM(xpos));
evt->Set(JS_STR("screenY"),JS_NUM(ypos));
evt->Set(JS_STR("shiftKey"),JS_BOOL(mods & GLFW_MOD_SHIFT));
evt->Set(JS_STR("ctrlKey"),JS_BOOL(mods & GLFW_MOD_CONTROL));
evt->Set(JS_STR("altKey"),JS_BOOL(mods & GLFW_MOD_ALT));
evt->Set(JS_STR("metaKey"),JS_BOOL(mods & GLFW_MOD_SUPER));
// evt->Set(JS_STR("windowHandle"), pointerToArray(window));
Local<Value> argv[] = {
JS_STR(action ? "mousedown" : "mouseup"), // event name
evt
};
eventHandlerFn(sizeof(argv)/sizeof(argv[0]), argv);
}
if (!action) {
Local<Object> evt = Nan::New<Object>();
evt->Set(JS_STR("type"),JS_STR("click"));
evt->Set(JS_STR("button"),JS_INT(localButton));
evt->Set(JS_STR("which"),JS_INT(localButton + 1));
evt->Set(JS_STR("clientX"),JS_NUM(xpos));
evt->Set(JS_STR("clientY"),JS_NUM(ypos));
evt->Set(JS_STR("pageX"),JS_NUM(xpos));
evt->Set(JS_STR("pageY"),JS_NUM(ypos));
evt->Set(JS_STR("offsetX"),JS_NUM(xpos));
evt->Set(JS_STR("offsetY"),JS_NUM(ypos));
evt->Set(JS_STR("screenX"),JS_NUM(xpos));
evt->Set(JS_STR("screenY"),JS_NUM(ypos));
evt->Set(JS_STR("shiftKey"),JS_BOOL(mods & GLFW_MOD_SHIFT));
evt->Set(JS_STR("ctrlKey"),JS_BOOL(mods & GLFW_MOD_CONTROL));
evt->Set(JS_STR("altKey"),JS_BOOL(mods & GLFW_MOD_ALT));
evt->Set(JS_STR("metaKey"),JS_BOOL(mods & GLFW_MOD_SUPER));
// evt->Set(JS_STR("windowHandle"), pointerToArray(window));
Local<Value> argv[] = {
JS_STR("click"), // event name
evt,
};
eventHandlerFn(sizeof(argv)/sizeof(argv[0]), argv);
uint64_t now = glfwGetTimerValue();
uint64_t timeDiffTicks = now - lastClickTime;
uint64_t frequency = glfwGetTimerFrequency();
double timeDiffSeconds = (double)timeDiffTicks / (double)frequency;
if (timeDiffSeconds < 0.2) {
evt->Set(JS_STR("type"),JS_STR("dblclick"));
Local<Value> argv[] = {
JS_STR("dblclick"), // event name
evt,
};
eventHandlerFn(sizeof(argv)/sizeof(argv[0]), argv);
}
lastClickTime = now;
}
});
}
void APIENTRY scrollCB(NATIVEwindow *window, double xoffset, double yoffset) {
QueueEvent(window, [=](std::function<void(int, Local<Value> *)> eventHandlerFn) -> void {
double xpos, ypos;
glfwGetCursorPos(window, &xpos, &ypos);
Local<Object> evt = Nan::New<Object>();
evt->Set(JS_STR("type"),JS_STR("wheel"));
evt->Set(JS_STR("clientX"),JS_NUM(xpos));
evt->Set(JS_STR("clientY"),JS_NUM(ypos));
evt->Set(JS_STR("deltaX"),JS_NUM(-xoffset*120));
evt->Set(JS_STR("deltaY"),JS_NUM(-yoffset*120));
evt->Set(JS_STR("deltaZ"),JS_INT(0));
evt->Set(JS_STR("deltaMode"),JS_INT(0));
// evt->Set(JS_STR("windowHandle"), pointerToArray(window));
Local<Value> argv[] = {
JS_STR("wheel"), // event name
evt,
};
eventHandlerFn(sizeof(argv)/sizeof(argv[0]), argv);
});
}
NAN_METHOD(BlitTopFrameBuffer) {
GLuint fbo1 = TO_UINT32(info[0]);
GLuint fbo2 = TO_UINT32(info[1]);
int sw = TO_UINT32(info[2]);
int sh = TO_UINT32(info[3]);
int dw = TO_UINT32(info[4]);
int dh = TO_UINT32(info[5]);
bool color = TO_BOOL(info[6]);
bool depth = TO_BOOL(info[7]);
bool stencil = TO_BOOL(info[8]);
glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo1);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo2);
glBlitFramebuffer(
0, 0,
sw, sh,
0, 0,
dw, dh,
(color ? GL_COLOR_BUFFER_BIT : 0) |
(depth ? GL_DEPTH_BUFFER_BIT : 0) |
(stencil ? GL_STENCIL_BUFFER_BIT : 0),
(depth || stencil) ? GL_NEAREST : GL_LINEAR
);
}
NAN_METHOD(BlitChildFrameBuffer) {
Local<Object> glObj = Local<Object>::Cast(info[0]);
GLuint srcTex = TO_UINT32(info[1]);
GLuint srcDepthTex = TO_UINT32(info[2]);
bool isMultisampleSrc = Local<Boolean>::Cast(info[3])->Value();
GLuint tex = TO_UINT32(info[4]);
GLuint depthTex = TO_UINT32(info[5]);
bool isMultisampleDst = Local<Boolean>::Cast(info[6])->Value();
int sw = TO_UINT32(info[7]);
int sh = TO_UINT32(info[8]);
int dw = TO_UINT32(info[9]);
int dh = TO_UINT32(info[10]);
GLuint readFbo;
glGenFramebuffers(1, &readFbo);
glBindFramebuffer(GL_READ_FRAMEBUFFER, readFbo);
glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, isMultisampleSrc ? GL_TEXTURE_2D_MULTISAMPLE : GL_TEXTURE_2D, srcTex, 0);
if (srcDepthTex != 0) {
glFramebufferTexture2D(GL_READ_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, isMultisampleSrc ? GL_TEXTURE_2D_MULTISAMPLE : GL_TEXTURE_2D, srcDepthTex, 0);
}
GLuint drawFbo = 0;
if (tex != 0) {
glGenFramebuffers(1, &drawFbo);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, drawFbo);
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, isMultisampleDst ? GL_TEXTURE_2D_MULTISAMPLE : GL_TEXTURE_2D, tex, 0);
if (depthTex != 0) {
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, isMultisampleDst ? GL_TEXTURE_2D_MULTISAMPLE : GL_TEXTURE_2D, depthTex, 0);
}
} else {
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
}
glBlitFramebuffer(
0, 0,
sw, sh,
0, 0,
dw, dh,
GL_COLOR_BUFFER_BIT | (srcDepthTex ? (GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT) : 0),
srcDepthTex ? GL_NEAREST : GL_LINEAR
);
glDeleteFramebuffers(1, &readFbo);
if (drawFbo != 0) {
glDeleteFramebuffers(1, &drawFbo);
}
WebGLRenderingContext *gl = ObjectWrap::Unwrap<WebGLRenderingContext>(glObj);
if (gl->HasFramebufferBinding(GL_READ_FRAMEBUFFER)) {
glBindFramebuffer(GL_READ_FRAMEBUFFER, gl->GetFramebufferBinding(GL_READ_FRAMEBUFFER));
} else {
glBindFramebuffer(GL_READ_FRAMEBUFFER, gl->defaultFramebuffer);
}
if (gl->HasFramebufferBinding(GL_DRAW_FRAMEBUFFER)) {
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, gl->GetFramebufferBinding(GL_DRAW_FRAMEBUFFER));
} else {
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, gl->defaultFramebuffer);
}
}
NATIVEwindow *GetCurrentWindowContext() {
return currentWindow;
}
void SetCurrentWindowContext(NATIVEwindow *window) {
if (currentWindow != window) {
glfwMakeContextCurrent(window);
currentWindow = window;
}
}
void ReadPixels(WebGLRenderingContext *gl, unsigned int fbo, int x, int y, int width, int height, unsigned int format, unsigned int type, unsigned char *data) {
glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo);
glReadPixels(0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, data);
if (gl->HasFramebufferBinding(GL_READ_FRAMEBUFFER)) {
glBindFramebuffer(GL_READ_FRAMEBUFFER, gl->GetFramebufferBinding(GL_READ_FRAMEBUFFER));
} else {
glBindFramebuffer(GL_READ_FRAMEBUFFER, gl->defaultFramebuffer);
}
}
NAN_METHOD(HasCurrentWindowContext) {
info.GetReturnValue().Set(JS_BOOL(currentWindow != nullptr));
}
NAN_METHOD(GetCurrentWindowContext) {
if (currentWindow != nullptr) {
info.GetReturnValue().Set(pointerToArray(currentWindow));
} else {
info.GetReturnValue().Set(Nan::Null());
}
}
NAN_METHOD(SetCurrentWindowContext) {
NATIVEwindow *window = (NATIVEwindow *)arrayToPointer(Local<Array>::Cast(info[0]));
SetCurrentWindowContext(window);
}
bool SetNativeWindowIcon(NATIVEwindow* window, const char* filename) {
GLFWimage icon;
int components;
icon.pixels = stbi_load(filename, &icon.width, &icon.height, &components, STBI_rgb_alpha);
if (icon.pixels != nullptr) {
glfwSetWindowIcon(window, 1, &icon);
stbi_image_free(icon.pixels);
return true;
}
return false;
}
NATIVEwindow *CreateNativeWindow(unsigned int width, unsigned int height, bool visible) {
glfwWindowHint(GLFW_VISIBLE, visible);
{
std::lock_guard<std::mutex> lock(windowHandleMutex);
if (!sharedWindow) {
sharedWindow = glfwCreateWindow(1, 1, "Exokit", nullptr, nullptr);
if (sharedWindow) {
glfwSetWindowUserPointer(sharedWindow, new WindowState());
} else {
exerr << "Can't create GLFW window" << std::endl;
abort();
return nullptr;
}
}
}
NATIVEwindow *window = glfwCreateWindow(width, height, "Exokit", nullptr, sharedWindow);
if (window) {
glfwSetWindowUserPointer(window, new WindowState());
SetNativeWindowIcon(window, "assets/icon.png");
return window;
} else {
exerr << "Can't create GLFW window" << std::endl;
abort();
return nullptr;
}
}
void DestroyNativeWindow(NATIVEwindow *window) {
WindowState *windowState = (WindowState *)glfwGetWindowUserPointer(window);
delete windowState;
glfwDestroyWindow(window);
}
NAN_METHOD(SetWindowTitle) {
NATIVEwindow *window = (NATIVEwindow *)arrayToPointer(Local<Array>::Cast(info[0]));
Nan::Utf8String str(Local<String>::Cast(info[1]));
glfwSetWindowTitle(window, *str);
}
void GetWindowSize(NATIVEwindow *window, int *width, int *height) {
glfwGetWindowSize(window, width, height);
}
NAN_METHOD(GetWindowSize) {
NATIVEwindow *window = (NATIVEwindow *)arrayToPointer(Local<Array>::Cast(info[0]));
int w, h;
GetWindowSize(window, &w, &h);
Local<Object> result = Nan::New<Object>();
result->Set(JS_STR("width"),JS_INT(w));
result->Set(JS_STR("height"),JS_INT(h));
info.GetReturnValue().Set(result);
}
NAN_METHOD(SetWindowSize) {
NATIVEwindow *window = (NATIVEwindow *)arrayToPointer(Local<Array>::Cast(info[0]));
glfwSetWindowSize(window, TO_UINT32(info[1]), TO_UINT32(info[2]));
}
NAN_METHOD(SetWindowPos) {
NATIVEwindow *window = (NATIVEwindow *)arrayToPointer(Local<Array>::Cast(info[0]));
glfwSetWindowPos(window, TO_UINT32(info[1]), TO_UINT32(info[2]));
}
NAN_METHOD(GetWindowPos) {
NATIVEwindow *window = (NATIVEwindow *)arrayToPointer(Local<Array>::Cast(info[0]));
int xpos, ypos;
glfwGetWindowPos(window, &xpos, &ypos);
Local<Object> result = Nan::New<Object>();
result->Set(JS_STR("xpos"),JS_INT(xpos));
result->Set(JS_STR("ypos"),JS_INT(ypos));
info.GetReturnValue().Set(result);
}
void GetFramebufferSize(NATIVEwindow *window, int *width, int *height) {
glfwGetFramebufferSize(window, width, height);
}
NAN_METHOD(GetFramebufferSize) {
NATIVEwindow *window = (NATIVEwindow *)arrayToPointer(Local<Array>::Cast(info[0]));
int width, height;
GetFramebufferSize(window, &width, &height);
Local<Object> result = Nan::New<Object>();
result->Set(JS_STR("width"),JS_INT(width));
result->Set(JS_STR("height"),JS_INT(height));
info.GetReturnValue().Set(result);
}
double GetDevicePixelRatio() {
int width, height;
uv_sem_t sem;
uv_sem_init(&sem, 0);
QueueInjection([&](InjectionHandler *injectionHandler) -> void {
NATIVEwindow *window = CreateNativeWindow(100, 100, false);
glfwGetFramebufferSize(window, &width, &height);
DestroyNativeWindow(window);
uv_sem_post(&sem);
});
uv_sem_wait(&sem);
uv_sem_destroy(&sem);
return static_cast<double>(width)/100.0;
}
NAN_METHOD(GetDevicePixelRatio) {
double devicePixelRatio = GetDevicePixelRatio();
info.GetReturnValue().Set(JS_NUM(devicePixelRatio));
}
NATIVEwindow *GetGLContext(NATIVEwindow *window) {
return window;
}
NAN_METHOD(IconifyWindow) {
NATIVEwindow *window = (NATIVEwindow *)arrayToPointer(Local<Array>::Cast(info[0]));
glfwIconifyWindow(window);
}
NAN_METHOD(RestoreWindow) {
NATIVEwindow *window = (NATIVEwindow *)arrayToPointer(Local<Array>::Cast(info[0]));
glfwRestoreWindow(window);
}
NAN_METHOD(SetVisibility) {
NATIVEwindow *window = (NATIVEwindow *)arrayToPointer(Local<Array>::Cast(info[0]));
bool visible = TO_BOOL(info[1]);
QueueInjection([window, visible](InjectionHandler *injectionHandler) -> void {
if (visible) {
glfwShowWindow(window);
} else {
glfwHideWindow(window);
}
});
}
NAN_METHOD(SetWindowFocus) {
NATIVEwindow *window = (NATIVEwindow *)arrayToPointer(Local<Array>::Cast(info[0]));
glfwFocusWindow(window);
}
NAN_METHOD(IsVisible) {
NATIVEwindow *window = (NATIVEwindow *)arrayToPointer(Local<Array>::Cast(info[0]));
bool visible = glfwGetWindowAttrib(window, GLFW_VISIBLE);
info.GetReturnValue().Set(JS_BOOL(visible));
}
const GLFWvidmode *getBestVidMode(NATIVEwindow *window, GLFWmonitor *monitor) {
int numVidModes;
const GLFWvidmode *vidModes = glfwGetVideoModes(monitor, &numVidModes);
const GLFWvidmode *bestVidMode = nullptr;
for (int i = 0; i < numVidModes; i++) {
const GLFWvidmode *vidMode = &vidModes[i];
if (bestVidMode == nullptr || vidMode->width > bestVidMode->width) {
bestVidMode = vidMode;
}
}
return bestVidMode;
}
NAN_METHOD(SetFullscreen) {
NATIVEwindow *window = (NATIVEwindow *)arrayToPointer(Local<Array>::Cast(info[0]));
bool enabled = TO_BOOL(info[1]);
QueueInjection([window, enabled](InjectionHandler *injectionHandler) -> void {
GLFWmonitor *monitor = getMonitor();
if (enabled) {
const GLFWvidmode *vidMode = getBestVidMode(window, monitor);
if (vidMode != nullptr) {
glfwSetWindowMonitor(window, monitor, 0, 0, vidMode->width, vidMode->height, 0);
}
} else {
const GLFWvidmode *vidMode = getBestVidMode(window, monitor);
glfwSetWindowMonitor(window, nullptr, vidMode->width/2 - 1280/2, vidMode->height/2 - 1024/2, 1280, 1024, 0);
}
});
}
NAN_METHOD(InitWindow3D) {
NATIVEwindow *windowHandle = (NATIVEwindow *)arrayToPointer(Local<Array>::Cast(info[0]));
WebGLRenderingContext *gl = ObjectWrap::Unwrap<WebGLRenderingContext>(Local<Object>::Cast(info[1]));
SetCurrentWindowContext(windowHandle);
GLuint vao;
glGenVertexArrays(1, &vao);
glBindVertexArray(vao);
#ifdef GL_VERTEX_PROGRAM_POINT_SIZE
glEnable(GL_VERTEX_PROGRAM_POINT_SIZE);
#endif
#ifdef GL_PROGRAM_POINT_SIZE
glEnable(GL_PROGRAM_POINT_SIZE);
#endif
Local<Array> result = Nan::New<Array>(2);
result->Set(0, pointerToArray(windowHandle));
result->Set(1, JS_INT(vao));
info.GetReturnValue().Set(result);
}
NATIVEwindow *CreateWindowHandle(unsigned int width, unsigned int height, bool initialVisible) {
NATIVEwindow *windowHandle;
uv_sem_t sem;
uv_sem_init(&sem, 0);
QueueInjection([&](InjectionHandler *injectionHandler) -> void {
windowHandle = CreateNativeWindow(width, height, initialVisible);
SetCurrentWindowContext(windowHandle);
GLenum err = glewInit();
if (!err) {
// swap interval
glfwSwapInterval(0);
// input mode
// glfwSetInputMode(windowHandle, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
// window callbacks
glfwSetWindowPosCallback(windowHandle, windowPosCB);
glfwSetWindowSizeCallback(windowHandle, windowSizeCB);
glfwSetWindowCloseCallback(windowHandle, windowCloseCB);
glfwSetWindowRefreshCallback(windowHandle, windowRefreshCB);
glfwSetWindowFocusCallback(windowHandle, windowFocusCB);
glfwSetWindowMaximizeCallback(windowHandle, windowMaximizeCB);
glfwSetWindowIconifyCallback(windowHandle, windowIconifyCB);
glfwSetFramebufferSizeCallback(windowHandle, windowFramebufferSizeCB);
glfwSetDropCallback(windowHandle, windowDropCB);
// input callbacks
glfwSetKeyCallback(windowHandle, keyCB);
glfwSetMouseButtonCallback(windowHandle, mouseButtonCB);
glfwSetCursorPosCallback(windowHandle, cursorPosCB);
glfwSetCursorEnterCallback(windowHandle, cursorEnterCB);
glfwSetScrollCallback(windowHandle, scrollCB);
// size setting
glfwSetWindowSizeLimits(windowHandle, 1, 1, GLFW_DONT_CARE, GLFW_DONT_CARE);
} else {
/* Problem: glewInit failed, something is seriously wrong. */
exerr << "Can't init GLEW (glew error " << (const char *)glewGetErrorString(err) << ")" << std::endl;
DestroyNativeWindow(windowHandle);
windowHandle = nullptr;
}
SetCurrentWindowContext(nullptr);
uv_sem_post(&sem);
});
uv_sem_wait(&sem);
uv_sem_destroy(&sem);
return windowHandle;
}
NAN_METHOD(CreateWindowHandle) {
unsigned int width = info[0]->IsNumber() ? TO_UINT32(info[0]) : 1;
unsigned int height = info[1]->IsNumber() ? TO_UINT32(info[1]) : 1;
bool initialVisible = TO_BOOL(info[2]);
NATIVEwindow *windowHandle = CreateWindowHandle(width, height, initialVisible);
if (windowHandle) {
info.GetReturnValue().Set(pointerToArray(windowHandle));
} else {
info.GetReturnValue().Set(Nan::Null());
}
}
NAN_METHOD(DestroyWindowHandle) {
NATIVEwindow *window = (NATIVEwindow *)arrayToPointer(Local<Array>::Cast(info[0]));
uv_sem_t sem;
uv_sem_init(&sem, 0);
QueueInjection([&](InjectionHandler *injectionHandler) -> void {
DestroyNativeWindow(window);
uv_sem_post(&sem);
});
uv_sem_wait(&sem);
uv_sem_destroy(&sem);
}
NAN_METHOD(SetEventHandler) {
if (info[0]->IsArray() && info[1]->IsFunction()) {
Local<Array> windowHandle = Local<Array>::Cast(info[0]);
Local<Function> handlerFn = Local<Function>::Cast(info[1]);
NATIVEwindow *window = (NATIVEwindow *)arrayToPointer(windowHandle);
WindowState *windowState = (WindowState *)glfwGetWindowUserPointer(window);
uv_loop_t *loop = windowsystembase::GetEventLoop();
EventHandler *handler = new EventHandler(loop, handlerFn);
windowState->handler.reset(handler);
} else {
Nan::ThrowError("SetEventHandler: invalid arguments");
}
}
NAN_METHOD(SwapBuffers) {
NATIVEwindow *window = (NATIVEwindow *)arrayToPointer(Local<Array>::Cast(info[0]));
glfwSwapBuffers(window);
}
NAN_METHOD(GetRefreshRate) {
int refreshRate;
GLFWmonitor *monitor = getMonitor();
if (monitor) {
const GLFWvidmode *mode = glfwGetVideoMode(monitor);
refreshRate = mode->refreshRate;
} else {
refreshRate = 60;
}
info.GetReturnValue().Set(refreshRate);
}
NAN_METHOD(SetCursorMode) {
NATIVEwindow *window = (NATIVEwindow *)arrayToPointer(Local<Array>::Cast(info[0]));
bool enabled = TO_BOOL(info[1]);
QueueInjection([window, enabled](InjectionHandler *injectionHandler) -> void {
if (enabled) {
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
} else {
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
int w, h;
glfwGetWindowSize(window, &w, &h);
int centerX = w/2;
int centerY = h/2;
glfwSetCursorPos(window, centerX, centerY);
/* lastX = centerX;
lastY = centerY; */
}
});
}
NAN_METHOD(SetCursorPosition) {
NATIVEwindow *window = (NATIVEwindow *)arrayToPointer(Local<Array>::Cast(info[0]));
int x = TO_INT32(info[1]);
int y = TO_INT32(info[2]);
glfwSetCursorPos(window, x, y);
}
NAN_METHOD(GetClipboard) {
NATIVEwindow *window = GetCurrentWindowContext();
const char *clipboardContents = glfwGetClipboardString(window);
if (clipboardContents != nullptr) {
info.GetReturnValue().Set(JS_STR(clipboardContents));
} else {
info.GetReturnValue().Set(Nan::Null());
}
}
NAN_METHOD(SetClipboard) {
if (info[0]->IsString()) {
NATIVEwindow *window = GetCurrentWindowContext();
Nan::Utf8String utf8_value(info[0]);
glfwSetClipboardString(window, *utf8_value);
} else {
Nan::ThrowTypeError("Invalid arguments");
}
}
#ifdef MAIN_THREAD_POLLING
NAN_METHOD(PollEvents) {
glfwPollEvents();
handleInjections();
}
#endif
}
///////////////////////////////////////////////////////////////////////////////
//
// bindings
//
///////////////////////////////////////////////////////////////////////////////
#define JS_GLFW_CONSTANT(name) target->Set(JS_STR( #name ), JS_INT(GLFW_ ## name))
#define JS_GLFW_SET_METHOD(name) Nan::SetMethod(target, #name , glfw::name);
/* Local<Object> makeGlfw() {
glfwInit();
glewInit();
atexit([]() {
glfwTerminate();
});
Isolate *isolate = Isolate::GetCurrent();
v8::EscapableHandleScope scope(isolate);
Local<Object> target = Object::New(isolate);
// GLFW initialization, termination and version querying
JS_GLFW_SET_METHOD(GetVersion);
JS_GLFW_SET_METHOD(GetVersionString);
// Time
JS_GLFW_SET_METHOD(GetTime);
JS_GLFW_SET_METHOD(SetTime);
// Monitor handling
JS_GLFW_SET_METHOD(GetMonitors);
// Window handling
//JS_GLFW_SET_METHOD(CreateWindow);
Nan::SetMethod(target, "CreateWindow", glfw::glfw_CreateWindow);
Nan::SetMethod(target, "GetRenderTarget", glfw::GetRenderTarget);
Nan::SetMethod(target, "BindFrameBuffer", glfw::BindFrameBuffer);
Nan::SetMethod(target, "BlitFrameBuffer", glfw::BlitFrameBuffer);
JS_GLFW_SET_METHOD(WindowHint);
JS_GLFW_SET_METHOD(DefaultWindowHints);
JS_GLFW_SET_METHOD(DestroyWindow);
JS_GLFW_SET_METHOD(SetWindowShouldClose);
JS_GLFW_SET_METHOD(WindowShouldClose);
JS_GLFW_SET_METHOD(SetWindowTitle);
JS_GLFW_SET_METHOD(GetWindowSize);
JS_GLFW_SET_METHOD(SetWindowSize);
JS_GLFW_SET_METHOD(SetWindowPos);
JS_GLFW_SET_METHOD(GetWindowPos);
JS_GLFW_SET_METHOD(GetFramebufferSize);
JS_GLFW_SET_METHOD(IconifyWindow);
JS_GLFW_SET_METHOD(RestoreWindow);
JS_GLFW_SET_METHOD(ShowWindow);
JS_GLFW_SET_METHOD(HideWindow);
JS_GLFW_SET_METHOD(GetWindowAttrib);
JS_GLFW_SET_METHOD(SetInputMode);
JS_GLFW_SET_METHOD(PollEvents);
JS_GLFW_SET_METHOD(WaitEvents);
// Input handling
JS_GLFW_SET_METHOD(GetKey);
JS_GLFW_SET_METHOD(GetMouseButton);
JS_GLFW_SET_METHOD(GetCursorPos);
JS_GLFW_SET_METHOD(SetCursorPos);
// Context handling
JS_GLFW_SET_METHOD(MakeContextCurrent);
JS_GLFW_SET_METHOD(GetCurrentContext);
JS_GLFW_SET_METHOD(SwapBuffers);
JS_GLFW_SET_METHOD(SwapInterval);
JS_GLFW_SET_METHOD(ExtensionSupported);
// Joystick
JS_GLFW_SET_METHOD(JoystickPresent);
JS_GLFW_SET_METHOD(GetJoystickAxes);
JS_GLFW_SET_METHOD(GetJoystickButtons);
JS_GLFW_SET_METHOD(GetJoystickName);
// GLFW version
JS_GLFW_CONSTANT(VERSION_MAJOR);
JS_GLFW_CONSTANT(VERSION_MINOR);
JS_GLFW_CONSTANT(VERSION_REVISION);
// Input handling definitions
// Key and button state/action definitions
JS_GLFW_CONSTANT(RELEASE);
JS_GLFW_CONSTANT(PRESS);
JS_GLFW_CONSTANT(REPEAT);
// These key codes are inspired by the *USB HID Usage Tables v1.12* (p. 53-60),
// but re-arranged to map to 7-bit ASCII for printable keys (function keys are
// put in the 256+ range).
//
// The naming of the key codes follow these rules:
// - The US keyboard layout is used
// - Names of printable alpha-numeric characters are used (e.g. "A", "R",
// "3", etc.)
// - For non-alphanumeric characters, Unicode:ish names are used (e.g.
// "COMMA", "LEFT_SQUARE_BRACKET", etc.). Note that some names do not
// correspond to the Unicode standard (usually for brevity)
// - Keys that lack a clear US mapping are named "WORLD_x"
// - For non-printable keys, custom names are used (e.g. "F4",
// "BACKSPACE", etc.)
// The unknown key
JS_GLFW_CONSTANT(KEY_UNKNOWN);
// Printable keys
JS_GLFW_CONSTANT(KEY_SPACE);
JS_GLFW_CONSTANT(KEY_APOSTROPHE);
JS_GLFW_CONSTANT(KEY_COMMA);
JS_GLFW_CONSTANT(KEY_MINUS);
JS_GLFW_CONSTANT(KEY_PERIOD);
JS_GLFW_CONSTANT(KEY_SLASH);
JS_GLFW_CONSTANT(KEY_0);
JS_GLFW_CONSTANT(KEY_1);
JS_GLFW_CONSTANT(KEY_2);
JS_GLFW_CONSTANT(KEY_3);
JS_GLFW_CONSTANT(KEY_4);
JS_GLFW_CONSTANT(KEY_5);
JS_GLFW_CONSTANT(KEY_6);
JS_GLFW_CONSTANT(KEY_7);
JS_GLFW_CONSTANT(KEY_8);
JS_GLFW_CONSTANT(KEY_9);
JS_GLFW_CONSTANT(KEY_SEMICOLON);
JS_GLFW_CONSTANT(KEY_EQUAL);
JS_GLFW_CONSTANT(KEY_A);
JS_GLFW_CONSTANT(KEY_B);
JS_GLFW_CONSTANT(KEY_C);
JS_GLFW_CONSTANT(KEY_D);
JS_GLFW_CONSTANT(KEY_E);
JS_GLFW_CONSTANT(KEY_F);
JS_GLFW_CONSTANT(KEY_G);
JS_GLFW_CONSTANT(KEY_H);
JS_GLFW_CONSTANT(KEY_I);
JS_GLFW_CONSTANT(KEY_J);
JS_GLFW_CONSTANT(KEY_K);
JS_GLFW_CONSTANT(KEY_L);
JS_GLFW_CONSTANT(KEY_M);
JS_GLFW_CONSTANT(KEY_N);
JS_GLFW_CONSTANT(KEY_O);
JS_GLFW_CONSTANT(KEY_P);
JS_GLFW_CONSTANT(KEY_Q);
JS_GLFW_CONSTANT(KEY_R);
JS_GLFW_CONSTANT(KEY_S);
JS_GLFW_CONSTANT(KEY_T);
JS_GLFW_CONSTANT(KEY_U);
JS_GLFW_CONSTANT(KEY_V);
JS_GLFW_CONSTANT(KEY_W);
JS_GLFW_CONSTANT(KEY_X);
JS_GLFW_CONSTANT(KEY_Y);
JS_GLFW_CONSTANT(KEY_Z);
JS_GLFW_CONSTANT(KEY_LEFT_BRACKET);
JS_GLFW_CONSTANT(KEY_BACKSLASH);
JS_GLFW_CONSTANT(KEY_RIGHT_BRACKET);
JS_GLFW_CONSTANT(KEY_GRAVE_ACCENT);
JS_GLFW_CONSTANT(KEY_WORLD_1);
JS_GLFW_CONSTANT(KEY_WORLD_2);
// Function keys
JS_GLFW_CONSTANT(KEY_ESCAPE);
JS_GLFW_CONSTANT(KEY_ENTER);
JS_GLFW_CONSTANT(KEY_TAB);
JS_GLFW_CONSTANT(KEY_BACKSPACE);
JS_GLFW_CONSTANT(KEY_INSERT);
JS_GLFW_CONSTANT(KEY_DELETE);
JS_GLFW_CONSTANT(KEY_RIGHT);
JS_GLFW_CONSTANT(KEY_LEFT);
JS_GLFW_CONSTANT(KEY_DOWN);
JS_GLFW_CONSTANT(KEY_UP);
JS_GLFW_CONSTANT(KEY_PAGE_UP);
JS_GLFW_CONSTANT(KEY_PAGE_DOWN);
JS_GLFW_CONSTANT(KEY_HOME);
JS_GLFW_CONSTANT(KEY_END);
JS_GLFW_CONSTANT(KEY_CAPS_LOCK);
JS_GLFW_CONSTANT(KEY_SCROLL_LOCK);
JS_GLFW_CONSTANT(KEY_NUM_LOCK);
JS_GLFW_CONSTANT(KEY_PRINT_SCREEN);
JS_GLFW_CONSTANT(KEY_PAUSE);
JS_GLFW_CONSTANT(KEY_F1);
JS_GLFW_CONSTANT(KEY_F2);
JS_GLFW_CONSTANT(KEY_F3);
JS_GLFW_CONSTANT(KEY_F4);
JS_GLFW_CONSTANT(KEY_F5);
JS_GLFW_CONSTANT(KEY_F6);
JS_GLFW_CONSTANT(KEY_F7);
JS_GLFW_CONSTANT(KEY_F8);
JS_GLFW_CONSTANT(KEY_F9);
JS_GLFW_CONSTANT(KEY_F10);
JS_GLFW_CONSTANT(KEY_F11);
JS_GLFW_CONSTANT(KEY_F12);
JS_GLFW_CONSTANT(KEY_F13);
JS_GLFW_CONSTANT(KEY_F14);
JS_GLFW_CONSTANT(KEY_F15);
JS_GLFW_CONSTANT(KEY_F16);
JS_GLFW_CONSTANT(KEY_F17);
JS_GLFW_CONSTANT(KEY_F18);
JS_GLFW_CONSTANT(KEY_F19);
JS_GLFW_CONSTANT(KEY_F20);
JS_GLFW_CONSTANT(KEY_F21);
JS_GLFW_CONSTANT(KEY_F22);
JS_GLFW_CONSTANT(KEY_F23);
JS_GLFW_CONSTANT(KEY_F24);
JS_GLFW_CONSTANT(KEY_F25);
JS_GLFW_CONSTANT(KEY_KP_0);
JS_GLFW_CONSTANT(KEY_KP_1);
JS_GLFW_CONSTANT(KEY_KP_2);
JS_GLFW_CONSTANT(KEY_KP_3);
JS_GLFW_CONSTANT(KEY_KP_4);
JS_GLFW_CONSTANT(KEY_KP_5);
JS_GLFW_CONSTANT(KEY_KP_6);
JS_GLFW_CONSTANT(KEY_KP_7);
JS_GLFW_CONSTANT(KEY_KP_8);
JS_GLFW_CONSTANT(KEY_KP_9);
JS_GLFW_CONSTANT(KEY_KP_DECIMAL);
JS_GLFW_CONSTANT(KEY_KP_DIVIDE);
JS_GLFW_CONSTANT(KEY_KP_MULTIPLY);
JS_GLFW_CONSTANT(KEY_KP_SUBTRACT);
JS_GLFW_CONSTANT(KEY_KP_ADD);
JS_GLFW_CONSTANT(KEY_KP_ENTER);
JS_GLFW_CONSTANT(KEY_KP_EQUAL);
JS_GLFW_CONSTANT(KEY_LEFT_SHIFT);
JS_GLFW_CONSTANT(KEY_LEFT_CONTROL);
JS_GLFW_CONSTANT(KEY_LEFT_ALT);
JS_GLFW_CONSTANT(KEY_LEFT_SUPER);
JS_GLFW_CONSTANT(KEY_RIGHT_SHIFT);
JS_GLFW_CONSTANT(KEY_RIGHT_CONTROL);
JS_GLFW_CONSTANT(KEY_RIGHT_ALT);
JS_GLFW_CONSTANT(KEY_RIGHT_SUPER);
JS_GLFW_CONSTANT(KEY_MENU);
JS_GLFW_CONSTANT(KEY_LAST);
// Modifier key flags
// If this bit is set one or more Shift keys were held down.
JS_GLFW_CONSTANT(MOD_SHIFT);
// If this bit is set one or more Control keys were held down.
JS_GLFW_CONSTANT(MOD_CONTROL);
// If this bit is set one or more Alt keys were held down.
JS_GLFW_CONSTANT(MOD_ALT);
// If this bit is set one or more Super keys were held down.
JS_GLFW_CONSTANT(MOD_SUPER);
// Mouse buttons
JS_GLFW_CONSTANT(MOUSE_BUTTON_1);
JS_GLFW_CONSTANT(MOUSE_BUTTON_2);
JS_GLFW_CONSTANT(MOUSE_BUTTON_3);
JS_GLFW_CONSTANT(MOUSE_BUTTON_4);
JS_GLFW_CONSTANT(MOUSE_BUTTON_5);
JS_GLFW_CONSTANT(MOUSE_BUTTON_6);
JS_GLFW_CONSTANT(MOUSE_BUTTON_7);
JS_GLFW_CONSTANT(MOUSE_BUTTON_8);
JS_GLFW_CONSTANT(MOUSE_BUTTON_LAST);
JS_GLFW_CONSTANT(MOUSE_BUTTON_LEFT);
JS_GLFW_CONSTANT(MOUSE_BUTTON_RIGHT);
JS_GLFW_CONSTANT(MOUSE_BUTTON_MIDDLE);
// Joysticks
JS_GLFW_CONSTANT(JOYSTICK_1);
JS_GLFW_CONSTANT(JOYSTICK_2);
JS_GLFW_CONSTANT(JOYSTICK_3);
JS_GLFW_CONSTANT(JOYSTICK_4);
JS_GLFW_CONSTANT(JOYSTICK_5);
JS_GLFW_CONSTANT(JOYSTICK_6);
JS_GLFW_CONSTANT(JOYSTICK_7);
JS_GLFW_CONSTANT(JOYSTICK_8);
JS_GLFW_CONSTANT(JOYSTICK_9);
JS_GLFW_CONSTANT(JOYSTICK_10);
JS_GLFW_CONSTANT(JOYSTICK_11);
JS_GLFW_CONSTANT(JOYSTICK_12);
JS_GLFW_CONSTANT(JOYSTICK_13);
JS_GLFW_CONSTANT(JOYSTICK_14);
JS_GLFW_CONSTANT(JOYSTICK_15);
JS_GLFW_CONSTANT(JOYSTICK_16);
JS_GLFW_CONSTANT(JOYSTICK_LAST);
// errors Error codes
// GLFW has not been initialized.
JS_GLFW_CONSTANT(NOT_INITIALIZED);
// No context is current for this thread.
JS_GLFW_CONSTANT(NO_CURRENT_CONTEXT);
// One of the enum parameters for the function was given an invalid enum.
JS_GLFW_CONSTANT(INVALID_ENUM);
// One of the parameters for the function was given an invalid value.
JS_GLFW_CONSTANT(INVALID_VALUE);
// A memory allocation failed.
JS_GLFW_CONSTANT(OUT_OF_MEMORY);
// GLFW could not find support for the requested client API on the system.
JS_GLFW_CONSTANT(API_UNAVAILABLE);
// The requested client API version is not available.
JS_GLFW_CONSTANT(VERSION_UNAVAILABLE);
// A platform-specific error occurred that does not match any of the more specific categories.
JS_GLFW_CONSTANT(PLATFORM_ERROR);
// The clipboard did not contain data in the requested format.
JS_GLFW_CONSTANT(FORMAT_UNAVAILABLE);
JS_GLFW_CONSTANT(FOCUSED);
JS_GLFW_CONSTANT(ICONIFIED);
JS_GLFW_CONSTANT(RESIZABLE);
JS_GLFW_CONSTANT(VISIBLE);
JS_GLFW_CONSTANT(DECORATED);
JS_GLFW_CONSTANT(RED_BITS);
JS_GLFW_CONSTANT(GREEN_BITS);
JS_GLFW_CONSTANT(BLUE_BITS);
JS_GLFW_CONSTANT(ALPHA_BITS);
JS_GLFW_CONSTANT(DEPTH_BITS);
JS_GLFW_CONSTANT(STENCIL_BITS);
JS_GLFW_CONSTANT(ACCUM_RED_BITS);
JS_GLFW_CONSTANT(ACCUM_GREEN_BITS);
JS_GLFW_CONSTANT(ACCUM_BLUE_BITS);
JS_GLFW_CONSTANT(ACCUM_ALPHA_BITS);
JS_GLFW_CONSTANT(AUX_BUFFERS);
JS_GLFW_CONSTANT(STEREO);
JS_GLFW_CONSTANT(SAMPLES);
JS_GLFW_CONSTANT(SRGB_CAPABLE);
JS_GLFW_CONSTANT(REFRESH_RATE);
JS_GLFW_CONSTANT(DOUBLEBUFFER);
JS_GLFW_CONSTANT(TRUE);
JS_GLFW_CONSTANT(FALSE);
JS_GLFW_CONSTANT(CLIENT_API);
JS_GLFW_CONSTANT(CONTEXT_VERSION_MAJOR);
JS_GLFW_CONSTANT(CONTEXT_VERSION_MINOR);
JS_GLFW_CONSTANT(CONTEXT_REVISION);
JS_GLFW_CONSTANT(CONTEXT_ROBUSTNESS);
JS_GLFW_CONSTANT(OPENGL_FORWARD_COMPAT);
JS_GLFW_CONSTANT(OPENGL_DEBUG_CONTEXT);
JS_GLFW_CONSTANT(OPENGL_PROFILE);
JS_GLFW_CONSTANT(OPENGL_API);
JS_GLFW_CONSTANT(OPENGL_ES_API);
JS_GLFW_CONSTANT(NO_ROBUSTNESS);
JS_GLFW_CONSTANT(NO_RESET_NOTIFICATION);
JS_GLFW_CONSTANT(LOSE_CONTEXT_ON_RESET);
JS_GLFW_CONSTANT(OPENGL_ANY_PROFILE);
JS_GLFW_CONSTANT(OPENGL_CORE_PROFILE);
JS_GLFW_CONSTANT(OPENGL_COMPAT_PROFILE);
JS_GLFW_CONSTANT(CURSOR);
JS_GLFW_CONSTANT(STICKY_KEYS);
JS_GLFW_CONSTANT(STICKY_MOUSE_BUTTONS);
JS_GLFW_CONSTANT(CURSOR_NORMAL);
JS_GLFW_CONSTANT(CURSOR_HIDDEN);
JS_GLFW_CONSTANT(CURSOR_DISABLED);
JS_GLFW_CONSTANT(CONNECTED);
JS_GLFW_CONSTANT(DISCONNECTED);
// test scene
JS_GLFW_SET_METHOD(testScene);
JS_GLFW_SET_METHOD(testJoystick);
return scope.Escape(target);
} */
Local<Object> makeWindow() {
#ifdef MAIN_THREAD_POLLING
if (!glfw::hasMainThreadId) {
glfw::mainThreadId = std::this_thread::get_id();
glfw::hasMainThreadId = true;
}
#endif
Isolate *isolate = Isolate::GetCurrent();
v8::EscapableHandleScope scope(isolate);
Local<Object> target = Object::New(isolate);
windowsystembase::Decorate(target);
Nan::SetMethod(target, "initWindow3D", glfw::InitWindow3D);
Nan::SetMethod(target, "createWindowHandle", glfw::CreateWindowHandle);
Nan::SetMethod(target, "destroyWindowHandle", glfw::DestroyWindowHandle);
Nan::SetMethod(target, "setVisibility", glfw::SetVisibility);
Nan::SetMethod(target, "isVisible", glfw::IsVisible);
Nan::SetMethod(target, "setFullscreen", glfw::SetFullscreen);
Nan::SetMethod(target, "getMonitors", glfw::GetMonitors);
Nan::SetMethod(target, "setMonitor", glfw::SetMonitor);
Nan::SetMethod(target, "getScreenSize", glfw::GetScreenSize);
Nan::SetMethod(target, "setWindowTitle", glfw::SetWindowTitle);
Nan::SetMethod(target, "getWindowSize", glfw::GetWindowSize);
Nan::SetMethod(target, "setWindowSize", glfw::SetWindowSize);
Nan::SetMethod(target, "setWindowPos", glfw::SetWindowPos);
Nan::SetMethod(target, "getWindowPos", glfw::GetWindowPos);
Nan::SetMethod(target, "setWindowFocus", glfw::SetWindowFocus);
Nan::SetMethod(target, "getFramebufferSize", glfw::GetFramebufferSize);
Nan::SetMethod(target, "getDevicePixelRatio", glfw::GetDevicePixelRatio);
Nan::SetMethod(target, "iconifyWindow", glfw::IconifyWindow);
Nan::SetMethod(target, "restoreWindow", glfw::RestoreWindow);
Nan::SetMethod(target, "setEventHandler", glfw::SetEventHandler);
Nan::SetMethod(target, "swapBuffers", glfw::SwapBuffers);
Nan::SetMethod(target, "getRefreshRate", glfw::GetRefreshRate);
Nan::SetMethod(target, "setCursorMode", glfw::SetCursorMode);
Nan::SetMethod(target, "setCursorPosition", glfw::SetCursorPosition);
Nan::SetMethod(target, "getClipboard", glfw::GetClipboard);
Nan::SetMethod(target, "setClipboard", glfw::SetClipboard);
Nan::SetMethod(target, "blitTopFrameBuffer", glfw::BlitTopFrameBuffer);
Nan::SetMethod(target, "blitChildFrameBuffer", glfw::BlitChildFrameBuffer);
Nan::SetMethod(target, "hasCurrentWindowContext", glfw::HasCurrentWindowContext);
Nan::SetMethod(target, "getCurrentWindowContext", glfw::GetCurrentWindowContext);
Nan::SetMethod(target, "setCurrentWindowContext", glfw::SetCurrentWindowContext);
#ifdef MAIN_THREAD_POLLING
Nan::SetMethod(target, "pollEvents", glfw::PollEvents);
#endif
return scope.Escape(target);
}
| 33.074819
| 160
| 0.68258
|
Palmer-JC
|
43116fbcfeff073fa6844712bf33c37cbe5fb7b9
| 955
|
cpp
|
C++
|
codeforces/B - Equalize Prices/Accepted.cpp
|
kzvd4729/Problem-Solving
|
13b105e725a4c2f8db7fecc5d7a8f932b9fef4ab
|
[
"MIT"
] | 1
|
2022-02-11T16:55:36.000Z
|
2022-02-11T16:55:36.000Z
|
codeforces/B - Equalize Prices/Accepted.cpp
|
kzvd4729/Problem-Solving
|
13b105e725a4c2f8db7fecc5d7a8f932b9fef4ab
|
[
"MIT"
] | null | null | null |
codeforces/B - Equalize Prices/Accepted.cpp
|
kzvd4729/Problem-Solving
|
13b105e725a4c2f8db7fecc5d7a8f932b9fef4ab
|
[
"MIT"
] | null | null | null |
/****************************************************************************************
* @author: kzvd4729 created: Jun/28/2019 19:22
* solution_verdict: Accepted language: GNU C++14
* run_time: 31 ms memory_used: 0 KB
* problem: https://codeforces.com/contest/1183/problem/B
****************************************************************************************/
#include<bits/stdc++.h>
#define long long long
using namespace std;
const int N=1e6;
int main()
{
ios_base::sync_with_stdio(0);cin.tie(0);
int q;cin>>q;
while(q--)
{
int n,k;cin>>n>>k;int mn=1e9,mx=0;
for(int i=1;i<=n;i++)
{
int x;cin>>x;
mn=min(mn,x);mx=max(mx,x);
}
if(mx-mn>k+k)cout<<-1<<"\n";
else cout<<mn+k<<"\n";
}
return 0;
}
| 35.37037
| 111
| 0.362304
|
kzvd4729
|
4311f01e8f60a4175d2a28cac58ba646f99f0974
| 1,120
|
cpp
|
C++
|
src/tutorial07/Maths.cpp
|
ksoderbl/thinmatrix-opengl-3d-game-tutorial-cpp-sdl2
|
c6d8e79c11a09284ee262fb44439e58cc9d7d906
|
[
"MIT"
] | 9
|
2018-07-15T23:09:10.000Z
|
2021-05-14T16:45:03.000Z
|
src/tutorial07/Maths.cpp
|
ksoderbl/thinmatrix-opengl-3d-game-tutorial-cpp-sdl2
|
c6d8e79c11a09284ee262fb44439e58cc9d7d906
|
[
"MIT"
] | null | null | null |
src/tutorial07/Maths.cpp
|
ksoderbl/thinmatrix-opengl-3d-game-tutorial-cpp-sdl2
|
c6d8e79c11a09284ee262fb44439e58cc9d7d906
|
[
"MIT"
] | 5
|
2019-11-24T02:44:42.000Z
|
2022-01-07T14:49:33.000Z
|
//package toolbox
#include "Maths.h"
/*
static void printMatrix(glm::mat4& m, string name)
{
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
cout << name << "[" << i << "," << j << "] = " << m[j][i] << " ";
}
cout << endl;
}
cout << endl;
}
*/
glm::mat4 createTransformationMatrix(glm::vec3& translation,
GLfloat rx, GLfloat ry, GLfloat rz, GLfloat scale)
{
glm::mat4 unit = glm::mat4(1.0f); // identity matrix
glm::mat4 t = glm::translate(unit, glm::vec3(translation[0], translation[1], translation[2]));
//printMatrix(t, "t");
glm::mat4 rotx = glm::rotate(unit, glm::radians(rx), glm::vec3(1.0f, 0.0f, 0.0f));
//printMatrix(rotx, "rotx");
glm::mat4 roty = glm::rotate(unit, glm::radians(ry), glm::vec3(0.0f, 1.0f, 0.0f));
//printMatrix(roty, "roty");
glm::mat4 rotz = glm::rotate(unit, glm::radians(rz), glm::vec3(0.0f, 0.0f, 1.0f));
//printMatrix(rotz, "rotz");
glm::mat4 r = rotx * roty * rotz;
//printMatrix(r, "r");
glm::mat4 s = glm::scale(unit, glm::vec3(scale));
//printMatrix(s, "s");
glm::mat4 m = s * r * t;
//printMatrix(m, "m");
return m;
}
| 23.333333
| 95
| 0.575
|
ksoderbl
|
431a5b8000d10f0b0fd856d9f9bb0d8678094693
| 9,870
|
cpp
|
C++
|
src/mongo/db/s/cleanup_orphaned_cmd.cpp
|
benety/mongo
|
203430ac9559f82ca01e3cbb3b0e09149fec0835
|
[
"Apache-2.0"
] | null | null | null |
src/mongo/db/s/cleanup_orphaned_cmd.cpp
|
benety/mongo
|
203430ac9559f82ca01e3cbb3b0e09149fec0835
|
[
"Apache-2.0"
] | null | null | null |
src/mongo/db/s/cleanup_orphaned_cmd.cpp
|
benety/mongo
|
203430ac9559f82ca01e3cbb3b0e09149fec0835
|
[
"Apache-2.0"
] | null | null | null |
/**
* Copyright (C) 2018-present MongoDB, Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the Server Side Public License, version 1,
* as published by MongoDB, Inc.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* Server Side Public License for more details.
*
* You should have received a copy of the Server Side Public License
* along with this program. If not, see
* <http://www.mongodb.com/licensing/server-side-public-license>.
*
* As a special exception, the copyright holders give permission to link the
* code of portions of this program with the OpenSSL library under certain
* conditions as described in each individual source file and distribute
* linked combinations including the program with the OpenSSL library. You
* must comply with the Server Side Public License in all respects for
* all of the code used other than as permitted herein. If you modify file(s)
* with this exception, you may extend this exception to your version of the
* file(s), but you are not obligated to do so. If you do not wish to do so,
* delete this exception statement from your version. If you delete this
* exception statement from all source files in the program, then also delete
* it in the license file.
*/
#include "mongo/platform/basic.h"
#include <boost/optional.hpp>
#include <string>
#include "mongo/db/auth/action_type.h"
#include "mongo/db/auth/authorization_session.h"
#include "mongo/db/auth/privilege.h"
#include "mongo/db/catalog_raii.h"
#include "mongo/db/commands.h"
#include "mongo/db/field_parser.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/namespace_string.h"
#include "mongo/db/range_arithmetic.h"
#include "mongo/db/s/chunk_move_write_concern_options.h"
#include "mongo/db/s/collection_sharding_runtime.h"
#include "mongo/db/s/migration_util.h"
#include "mongo/db/s/shard_filtering_metadata_refresh.h"
#include "mongo/db/s/sharding_runtime_d_params_gen.h"
#include "mongo/db/s/sharding_state.h"
#include "mongo/db/service_context.h"
#include "mongo/logv2/log.h"
#include "mongo/s/request_types/migration_secondary_throttle_options.h"
#define MONGO_LOGV2_DEFAULT_COMPONENT ::mongo::logv2::LogComponent::kCommand
namespace mongo {
namespace {
enum class CleanupResult { kDone, kContinue, kError };
/**
* Waits for all possibly orphaned ranges on 'nss' to be cleaned up.
*
* @return CleanupResult::kDone if no orphaned ranges remain
* @return CleanupResult::kError and 'errMsg' if an error occurred
*
* If the collection is not sharded, returns CleanupResult::kDone.
*/
CleanupResult cleanupOrphanedData(OperationContext* opCtx,
const NamespaceString& ns,
const BSONObj& startingFromKeyConst,
std::string* errMsg) {
boost::optional<ChunkRange> range;
boost::optional<UUID> collectionUuid;
{
AutoGetCollection autoColl(opCtx, ns, MODE_IX);
if (!autoColl.getCollection()) {
LOGV2(4416000,
"cleanupOrphaned skipping waiting for orphaned data cleanup because "
"{namespace} does not exist",
"cleanupOrphaned skipping waiting for orphaned data cleanup because "
"collection does not exist",
"namespace"_attr = ns.ns());
return CleanupResult::kDone;
}
collectionUuid.emplace(autoColl.getCollection()->uuid());
auto* const csr = CollectionShardingRuntime::get(opCtx, ns);
const auto optCollDescr = csr->getCurrentMetadataIfKnown();
if (!optCollDescr || !optCollDescr->isSharded()) {
LOGV2(4416001,
"cleanupOrphaned skipping waiting for orphaned data cleanup because "
"{namespace} is not sharded",
"cleanupOrphaned skipping waiting for orphaned data cleanup because "
"collection is not sharded",
"namespace"_attr = ns.ns());
return CleanupResult::kDone;
}
range.emplace(optCollDescr->getMinKey(), optCollDescr->getMaxKey());
// Though the 'startingFromKey' parameter is not used as the min key of the range to
// wait for, we still validate that 'startingFromKey' in the same way as the original
// cleanupOrphaned logic did if 'startingFromKey' is present.
BSONObj keyPattern = optCollDescr->getKeyPattern();
if (!startingFromKeyConst.isEmpty() && !optCollDescr->isValidKey(startingFromKeyConst)) {
LOGV2_ERROR_OPTIONS(
4416002,
{logv2::UserAssertAfterLog(ErrorCodes::OrphanedRangeCleanUpFailed)},
"Could not cleanup orphaned data because start key does not match shard key "
"pattern",
"startKey"_attr = redact(startingFromKeyConst),
"shardKeyPattern"_attr = keyPattern);
}
}
// We actually want to wait until there are no range deletion tasks for this namespace/UUID,
// but we don't have a good way to wait for that event, so instead we wait for there to be
// no tasks being processed in memory for this namespace/UUID.
// However, it's possible this node has recently stepped up, and the stepup recovery task to
// resubmit range deletion tasks for processing has not yet completed. In that case,
// waitForClean will return though there are still tasks in config.rangeDeletions, so we
// sleep for a short time and then try waitForClean again.
while (auto numRemainingDeletionTasks =
migrationutil::checkForConflictingDeletions(opCtx, *range, *collectionUuid)) {
uassert(ErrorCodes::ResumableRangeDeleterDisabled,
"Failing cleanupOrphaned because the disableResumableRangeDeleter server parameter "
"is set to true and this shard contains range deletion tasks for the collection.",
!disableResumableRangeDeleter.load());
LOGV2(4416003,
"cleanupOrphaned going to wait for range deletion tasks to complete",
"namespace"_attr = ns.ns(),
"collectionUUID"_attr = *collectionUuid,
"numRemainingDeletionTasks"_attr = numRemainingDeletionTasks);
auto status = CollectionShardingRuntime::waitForClean(
opCtx, ns, *collectionUuid, *range, Date_t::max());
if (!status.isOK()) {
*errMsg = status.reason();
return CleanupResult::kError;
}
opCtx->sleepFor(Milliseconds(1000));
}
return CleanupResult::kDone;
}
/**
* Called on a particular namespace, and if the collection is sharded will wait for the number of
* range deletion tasks on the collection on this shard to reach zero.
*
* Since the sharding state may change after this call returns, there is no guarantee that orphans
* won't re-appear as a result of migrations that commit after this call returns.
*
* Safe to call with the balancer on.
*/
class CleanupOrphanedCommand : public ErrmsgCommandDeprecated {
public:
CleanupOrphanedCommand() : ErrmsgCommandDeprecated("cleanupOrphaned") {}
AllowedOnSecondary secondaryAllowed(ServiceContext*) const override {
return AllowedOnSecondary::kNever;
}
bool adminOnly() const override {
return true;
}
Status checkAuthForCommand(Client* client,
const std::string& dbname,
const BSONObj& cmdObj) const override {
if (!AuthorizationSession::get(client)->isAuthorizedForActionsOnResource(
ResourcePattern::forClusterResource(), ActionType::cleanupOrphaned)) {
return Status(ErrorCodes::Unauthorized, "Not authorized for cleanupOrphaned command.");
}
return Status::OK();
}
bool supportsWriteConcern(const BSONObj& cmd) const override {
return true;
}
// Input
static BSONField<std::string> nsField;
static BSONField<BSONObj> startingFromKeyField;
bool errmsgRun(OperationContext* opCtx,
std::string const& db,
const BSONObj& cmdObj,
std::string& errmsg,
BSONObjBuilder& result) override {
std::string ns;
if (!FieldParser::extract(cmdObj, nsField, &ns, &errmsg)) {
return false;
}
const NamespaceString nss(ns);
uassert(ErrorCodes::InvalidNamespace,
str::stream() << "Invalid namespace: " << nss.ns(),
nss.isValid());
BSONObj startingFromKey;
if (!FieldParser::extract(cmdObj, startingFromKeyField, &startingFromKey, &errmsg)) {
return false;
}
ShardingState* const shardingState = ShardingState::get(opCtx);
if (!shardingState->enabled()) {
errmsg = str::stream() << "server is not part of a sharded cluster or "
<< "the sharding metadata is not yet initialized.";
return false;
}
onShardVersionMismatch(opCtx, nss, boost::none);
CleanupResult cleanupResult = cleanupOrphanedData(opCtx, nss, startingFromKey, &errmsg);
if (cleanupResult == CleanupResult::kError) {
return false;
}
dassert(cleanupResult == CleanupResult::kDone);
return true;
}
} cleanupOrphanedCmd;
BSONField<std::string> CleanupOrphanedCommand::nsField("cleanupOrphaned");
BSONField<BSONObj> CleanupOrphanedCommand::startingFromKeyField("startingFromKey");
} // namespace
} // namespace mongo
| 41.470588
| 100
| 0.664134
|
benety
|
431aacf087ffb4c503bb5dbc70f411331c928c8b
| 4,161
|
cc
|
C++
|
third_party/blink/renderer/modules/plugins/dom_mime_type_array.cc
|
mghgroup/Glide-Browser
|
6a4c1eaa6632ec55014fee87781c6bbbb92a2af5
|
[
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null |
third_party/blink/renderer/modules/plugins/dom_mime_type_array.cc
|
mghgroup/Glide-Browser
|
6a4c1eaa6632ec55014fee87781c6bbbb92a2af5
|
[
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null |
third_party/blink/renderer/modules/plugins/dom_mime_type_array.cc
|
mghgroup/Glide-Browser
|
6a4c1eaa6632ec55014fee87781c6bbbb92a2af5
|
[
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 2
|
2021-01-05T23:43:46.000Z
|
2021-01-07T23:36:34.000Z
|
/*
* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
* Copyright (C) 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*/
#include "third_party/blink/renderer/modules/plugins/dom_mime_type_array.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/core/page/plugin_data.h"
#include "third_party/blink/renderer/platform/wtf/text/atomic_string.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"
namespace blink {
DOMMimeTypeArray::DOMMimeTypeArray(LocalFrame* frame)
: ExecutionContextLifecycleObserver(frame ? frame->DomWindow() : nullptr),
PluginsChangedObserver(frame ? frame->GetPage() : nullptr) {
UpdatePluginData();
}
void DOMMimeTypeArray::Trace(Visitor* visitor) const {
visitor->Trace(dom_mime_types_);
ScriptWrappable::Trace(visitor);
ExecutionContextLifecycleObserver::Trace(visitor);
}
unsigned DOMMimeTypeArray::length() const {
return dom_mime_types_.size();
}
DOMMimeType* DOMMimeTypeArray::item(unsigned index) {
if (index >= dom_mime_types_.size())
return nullptr;
if (!dom_mime_types_[index]) {
dom_mime_types_[index] = MakeGarbageCollected<DOMMimeType>(
GetFrame(), *GetPluginData()->Mimes()[index]);
}
return dom_mime_types_[index];
}
DOMMimeType* DOMMimeTypeArray::namedItem(const AtomicString& property_name) {
PluginData* data = GetPluginData();
if (!data)
return nullptr;
for (const Member<MimeClassInfo>& mime : data->Mimes()) {
if (mime->Type() == property_name) {
unsigned index = static_cast<unsigned>(&mime - &data->Mimes()[0]);
return item(index);
}
}
return nullptr;
}
void DOMMimeTypeArray::NamedPropertyEnumerator(Vector<String>& property_names,
ExceptionState&) const {
PluginData* data = GetPluginData();
if (!data)
return;
property_names.ReserveInitialCapacity(data->Mimes().size());
for (const MimeClassInfo* mime_info : data->Mimes()) {
property_names.UncheckedAppend(mime_info->Type());
}
}
bool DOMMimeTypeArray::NamedPropertyQuery(const AtomicString& property_name,
ExceptionState&) const {
PluginData* data = GetPluginData();
if (!data)
return false;
return data->SupportsMimeType(property_name);
}
PluginData* DOMMimeTypeArray::GetPluginData() const {
if (!GetFrame())
return nullptr;
return GetFrame()->GetPluginData();
}
void DOMMimeTypeArray::UpdatePluginData() {
PluginData* data = GetPluginData();
if (!data) {
dom_mime_types_.clear();
return;
}
HeapVector<Member<DOMMimeType>> old_dom_mime_types(
std::move(dom_mime_types_));
dom_mime_types_.clear();
dom_mime_types_.resize(data->Mimes().size());
for (Member<DOMMimeType>& mime : old_dom_mime_types) {
if (mime) {
for (const Member<MimeClassInfo>& mime_info : data->Mimes()) {
if (mime->type() == mime_info->Type()) {
unsigned index =
static_cast<unsigned>(&mime_info - &data->Mimes()[0]);
dom_mime_types_[index] = mime;
}
}
}
}
}
void DOMMimeTypeArray::ContextDestroyed() {
dom_mime_types_.clear();
}
void DOMMimeTypeArray::PluginsChanged() {
UpdatePluginData();
}
} // namespace blink
| 31.522727
| 78
| 0.702716
|
mghgroup
|
431ab68876afb9cf207bcc50cf1ff1f6742aed31
| 895
|
cpp
|
C++
|
sycl/test/basic_tests/id_ctad.cpp
|
mkinsner/llvm
|
589d48844edb12cd357b3024248b93d64b6760bf
|
[
"Apache-2.0"
] | 653
|
2018-12-27T15:00:01.000Z
|
2022-03-30T11:52:23.000Z
|
sycl/test/basic_tests/id_ctad.cpp
|
mkinsner/llvm
|
589d48844edb12cd357b3024248b93d64b6760bf
|
[
"Apache-2.0"
] | 3,740
|
2019-01-23T15:36:48.000Z
|
2022-03-31T22:01:13.000Z
|
sycl/test/basic_tests/id_ctad.cpp
|
mkinsner/llvm
|
589d48844edb12cd357b3024248b93d64b6760bf
|
[
"Apache-2.0"
] | 500
|
2019-01-23T07:49:22.000Z
|
2022-03-30T02:59:37.000Z
|
// RUN: %clangxx -fsycl -fsyntax-only -Xclang -verify %s -Xclang -verify-ignore-unexpected=note,warning
// expected-no-diagnostics
//==--------------- id_ctad.cpp - SYCL id CTAD test ----------------------==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include <CL/sycl.hpp>
using namespace std;
int main() {
cl::sycl::id one_dim_id(64);
cl::sycl::id two_dim_id(64, 1);
cl::sycl::id three_dim_id(64, 1, 2);
static_assert(std::is_same<decltype(one_dim_id), cl::sycl::id<1>>::value);
static_assert(std::is_same<decltype(two_dim_id), cl::sycl::id<2>>::value);
static_assert(std::is_same<decltype(three_dim_id), cl::sycl::id<3>>::value);
}
| 42.619048
| 103
| 0.613408
|
mkinsner
|
431f78c3ee6a0993d2cc8ef0de3a55972afe13a5
| 5,183
|
cpp
|
C++
|
JCDT/src/internal/ast/CompilationUnitDeclaration_def.cpp
|
kuafuwang/JCDT
|
2b009ea887b4816303fed9e6e1dc104a90c67d16
|
[
"MIT"
] | 1
|
2021-04-17T01:55:27.000Z
|
2021-04-17T01:55:27.000Z
|
JCDT/src/internal/ast/CompilationUnitDeclaration_def.cpp
|
kuafuwang/JCDT
|
2b009ea887b4816303fed9e6e1dc104a90c67d16
|
[
"MIT"
] | null | null | null |
JCDT/src/internal/ast/CompilationUnitDeclaration_def.cpp
|
kuafuwang/JCDT
|
2b009ea887b4816303fed9e6e1dc104a90c67d16
|
[
"MIT"
] | 1
|
2022-02-18T12:02:00.000Z
|
2022-02-18T12:02:00.000Z
|
#include <JCDT_Lib/internal/ast/AstImportDeclaration.h>
#include <JCDT_Lib/internal/ast/AstAnnotationDeclaration.h>
#include <JCDT_Lib/internal/ast/AstPackageDeclaration.h>
#ifndef AstCompilationUnit_def_INCLUDED
#define AstCompilationUnit_def_INCLUDED
#include "JCDT_Lib/internal/ast/CompilationUnitDeclaration.h"
#include <JCDT_Lib/internal/lex/LexStream.h>
#include <JCDT_Lib/internal/lookup/ASTVisitor.h>
#include <JCDT_Lib/internal/ast/AstStoragePool.h>
namespace Jikes { // Open namespace Jikes block
void CompilationUnitDeclaration::Unparse(Ostream& os, LexStream* lex_stream)
{
unsigned i;
if (debug_unparse)
os << "/*CompilationUnitDeclaration:#" << id << "*/";
os << "// " << lex_stream -> FileName() << endl;
if (package_declaration_opt)
package_declaration_opt -> Unparse(os, lex_stream);
for (i = 0; i < NumImportDeclarations(); i++)
ImportDeclaration(i) -> Unparse(os, lex_stream);
for (i = 0; i < NumTypeDeclarations(); i++)
GetTypeDeclaration(i) -> Unparse(os, lex_stream);
if (debug_unparse)
os << "/*:CompilationUnitDeclaration#" << id << "*/";
}
bool CompilationUnitDeclaration::IsEmpty()
{
if (package_declaration_opt)
return false;
if (NumImportDeclarations())
return false;
if (NumTypeDeclarations())
return false;
return true;
}
CompilationUnitDeclaration::CompilationUnitDeclaration(AstStoragePool* p)
: Ast(COMPILATION), import_declarations(nullptr),
type_declarations(nullptr) ,
ast_pool(p), package_declaration_opt(nullptr), state(HEAD_PARSE)
{}
void CompilationUnitDeclaration::FreeAst()
{
delete ast_pool;
ast_pool = nullptr;
}
Ast* CompilationUnitDeclaration::Clone(AstStoragePool* ast_pool)
{
unsigned i;
CompilationUnitDeclaration* clone = ast_pool->GenCompilationUnit();
clone->other_tag = other_tag;
if (package_declaration_opt)
clone->package_declaration_opt = (AstPackageDeclaration*)
package_declaration_opt->Clone(ast_pool);
clone->AllocateImportDeclarations(NumImportDeclarations());
for (i = 0; i < NumImportDeclarations(); i++)
clone->AddImportDeclaration((AstImportDeclaration*)
ImportDeclaration(i)->Clone(ast_pool));
clone->AllocateTypeDeclarations(NumTypeDeclarations());
for (i = 0; i < NumTypeDeclarations(); i++)
clone->AddTypeDeclaration((TypeDeclaration*)GetTypeDeclaration(i) ->
Clone(ast_pool));
return clone;
}
void CompilationUnitDeclaration::traverse(ASTVisitor* visitor,AstNodeScope* scope)
{
if (visitor->visit(this, this)) {
unsigned i;
if (package_declaration_opt)
package_declaration_opt->traverse(visitor, this);
unsigned num = NumImportDeclarations();
for (i = 0; i < num; i++)
(*import_declarations)[i]->traverse(visitor, this);
num = NumTypeDeclarations();
for (i = 0; i < num; i++)
(*type_declarations)[i]->traverse(visitor, this);
}
visitor->endVisit(this, this);
}
void CompilationUnitDeclaration::Print(Ostream& os,LexStream& lex_stream)
{
unsigned i;
os << endl << "AST structure for "
<< lex_stream.FileName()
<< ':' << endl << endl
<< '#' << id << " (CompilationUnit): #"
<< (package_declaration_opt ? package_declaration_opt -> id : 0)
<< " (";
for (i = 0; i < NumImportDeclarations(); i++)
os << " #" << ImportDeclaration(i) -> id;
os << " ) (";
for (i = 0; i < NumTypeDeclarations(); i++)
os << " #" << GetTypeDeclaration(i) -> id;
os << ')' << endl;
if (package_declaration_opt)
package_declaration_opt -> Print(os, lex_stream);
for (i = 0; i < NumImportDeclarations(); i++)
ImportDeclaration(i) -> Print(os, lex_stream);
for (i = 0; i < NumTypeDeclarations(); i++)
GetTypeDeclaration(i) -> Print(os, lex_stream);
}
Token* CompilationUnitDeclaration::LeftToken()
{
if (package_declaration_opt)
return package_declaration_opt->package_token;
if (NumImportDeclarations())
return ImportDeclaration(0)->import_token;
if (NumTypeDeclarations())
return GetTypeDeclaration(0)->LeftToken();
return 0;
}
// Special top-level form
void CompilationUnitDeclaration::Unparse(LexStream* lex_stream,
const char* const directory)
{
auto in_file_name = lex_stream->FileName();
// const char* suffix = ".unparse";
const char* suffix = "";
char* out_file_name = strcat3(directory, in_file_name, suffix);
// Create the directory if necessary
SystemMkdirhierForFile(out_file_name);
ofstream os_base(out_file_name);
if (!os_base)
{
Ostream() << "Cannot open output file " << out_file_name << endl;
::abort();
}
Ostream os(&os_base);
Unparse(os, lex_stream);
delete[] out_file_name;
}
Token* CompilationUnitDeclaration::RightToken()
{
if (NumTypeDeclarations())
return GetTypeDeclaration(NumTypeDeclarations() - 1)->RightToken();
if (NumImportDeclarations())
return ImportDeclaration(NumImportDeclarations() - 1) ->
semicolon_token;
if (package_declaration_opt)
return package_declaration_opt->semicolon_token;
return 0;
}
} // Close namespace Jikes block
#endif // AstCompilationUnit_def_INCLUDED
| 31.412121
| 84
| 0.692456
|
kuafuwang
|
431f84898cb33403f707b0327838b7da410370a8
| 323
|
cpp
|
C++
|
code/ch_2-TECHNIQUES/01-compile_time_assertions/02-compile_time_assertion.cpp
|
ordinary-developer/book_modern_cpp_design_a_alexandrescu
|
7c40a13309d280443668b0c20ae1572e3dff2989
|
[
"MIT"
] | 1
|
2017-05-04T08:23:46.000Z
|
2017-05-04T08:23:46.000Z
|
books/techno/cpp/_upper-intermediate/modern_cpp_design_a_alexandrescu/code/ch_2-TECHNIQUES/01-compile_time_assertions/02-compile_time_assertion.cpp
|
ordinary-developer/lin_education
|
13d65b20cdbc3e5467b2383e5c09c73bbcdcb227
|
[
"MIT"
] | null | null | null |
books/techno/cpp/_upper-intermediate/modern_cpp_design_a_alexandrescu/code/ch_2-TECHNIQUES/01-compile_time_assertions/02-compile_time_assertion.cpp
|
ordinary-developer/lin_education
|
13d65b20cdbc3e5467b2383e5c09c73bbcdcb227
|
[
"MIT"
] | null | null | null |
#define STATIC_CHECK(expr) { char unamed[(expr) ? 1 : 0]; }
template <class To, class From>
To safe_reinterpret_cast(From from)
{
STATIC_CHECK(sizeof(From) <= sizeof(To));
return reinterpret_cast<To>(from);
}
int main() {
int intValue = 5;
char c = safe_reinterpret_cast<char>(intValue);
return 0;
}
| 20.1875
| 59
| 0.665635
|
ordinary-developer
|
4323ae1e55c975972ce0e40f3dd94e4413e2ae15
| 11,278
|
cpp
|
C++
|
FEM_2D_Plane_Stress.cpp
|
JoshuaSimon/2D-FEM-Solver
|
9f3c19b760350338a33445e9817e1c077f4718d5
|
[
"MIT"
] | 3
|
2019-03-27T12:45:51.000Z
|
2019-08-25T09:41:56.000Z
|
FEM_2D_Plane_Stress.cpp
|
JoshuaSimon/2D-FEM-Solver
|
9f3c19b760350338a33445e9817e1c077f4718d5
|
[
"MIT"
] | null | null | null |
FEM_2D_Plane_Stress.cpp
|
JoshuaSimon/2D-FEM-Solver
|
9f3c19b760350338a33445e9817e1c077f4718d5
|
[
"MIT"
] | null | null | null |
// FEM_2D_Plane_Stress.cpp (Main)
#include "pch.h"
#include "FEM_Input.h"
#include "FEM_GNUPlot.h"
#include <Eigen/Dense>
#include <Eigen/Sparse>
#include <string>
#include <vector>
#include <iostream>
#include <fstream>
//Element data type
struct Element
{
void CalculateStiffnessMatrix(const Eigen::Matrix3f& D, std::vector<Eigen::Triplet<float> >& triplets);
Eigen::Matrix<float, 3, 6> B;
int nodesIds[3];
};
//Boundary constraint data type
struct Constraint
{
enum Type
{
UX = 1 << 0,
UY = 1 << 1,
UXY = UX | UY
};
int node;
Type type;
};
//Globals
int nodesCount;
Eigen::VectorXf nodesX;
Eigen::VectorXf nodesY;
Eigen::VectorXf loads;
std::vector< Element > elements;
std::vector< Constraint > constraints;
//Function for calculating the element stiffness matrix.
void Element::CalculateStiffnessMatrix(const Eigen::Matrix3f& D, std::vector<Eigen::Triplet<float> >& triplets)
{
Eigen::Vector3f x, y;
x << nodesX[nodesIds[0]], nodesX[nodesIds[1]], nodesX[nodesIds[2]];
y << nodesY[nodesIds[0]], nodesY[nodesIds[1]], nodesY[nodesIds[2]];
Eigen::Matrix3f C;
C << Eigen::Vector3f(1.0f, 1.0f, 1.0f), x, y;
//Calculating coefficients for shape functions (a1, a2, a3).
//These are relevant for interpolation.
Eigen::Matrix3f IC = C.inverse();
//Assemble B matrix
for (int i = 0; i < 3; i++)
{
B(0, 2 * i + 0) = IC(1, i);
B(0, 2 * i + 1) = 0.0f;
B(1, 2 * i + 0) = 0.0f;
B(1, 2 * i + 1) = IC(2, i);
B(2, 2 * i + 0) = IC(2, i);
B(2, 2 * i + 1) = IC(1, i);
}
//Calculate element stiffness (det(C)/2 = area of triangle).
Eigen::Matrix<float, 6, 6> K = B.transpose() * D * B * C.determinant() / 2.0f;
//Store values of element stiffness matrix with corresponding indices in global stiffness matrix in triplets.
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
Eigen::Triplet<float> trplt11(2 * nodesIds[i] + 0, 2 * nodesIds[j] + 0, K(2 * i + 0, 2 * j + 0));
Eigen::Triplet<float> trplt12(2 * nodesIds[i] + 0, 2 * nodesIds[j] + 1, K(2 * i + 0, 2 * j + 1));
Eigen::Triplet<float> trplt21(2 * nodesIds[i] + 1, 2 * nodesIds[j] + 0, K(2 * i + 1, 2 * j + 0));
Eigen::Triplet<float> trplt22(2 * nodesIds[i] + 1, 2 * nodesIds[j] + 1, K(2 * i + 1, 2 * j + 1));
triplets.push_back(trplt11);
triplets.push_back(trplt12);
triplets.push_back(trplt21);
triplets.push_back(trplt22);
}
}
}
//Function for setting constraints.
void SetConstraints(Eigen::SparseMatrix<float>::InnerIterator& it, int index)
{
if (it.row() == index || it.col() == index)
{
it.valueRef() = it.row() == it.col() ? 1.0f : 0.0f;
}
}
//Function for applying constraints in stiffness matrix.
void ApplyConstraints(Eigen::SparseMatrix<float>& K, const std::vector<Constraint>& constraints)
{
std::vector<int> indicesToConstraint;
for (std::vector<Constraint>::const_iterator it = constraints.begin(); it != constraints.end(); ++it)
{
if (it->type & Constraint::UX)
{
indicesToConstraint.push_back(2 * it->node + 0);
}
if (it->type & Constraint::UY)
{
indicesToConstraint.push_back(2 * it->node + 1);
}
}
for (int k = 0; k < K.outerSize(); ++k)
{
for (Eigen::SparseMatrix<float>::InnerIterator it(K, k); it; ++it)
{
for (std::vector<int>::iterator idit = indicesToConstraint.begin(); idit != indicesToConstraint.end(); ++idit)
{
SetConstraints(it, *idit);
}
}
}
}
int main(void)
{
std::cout << "---------------------- 2D FEM SOLVER ---------------------" << std::endl;
std::cout << "FEM software for solving elastic 2D plain stress problems." << std::endl;
std::cout << "Created by Joshua Simon. Date: 25.02.2019." << std::endl;
std::cout << std::endl;
//1. Paths and filenames
string mesh_data_file; //This filename is read from user input.
string solver_input_file = "Solver_Input.txt";
string displacement_plot_data = "GNUPlot_Input_displacement.txt";
string stress_plot_data = "GNUPlot_Input_contour.txt";
//User input of mesh data file
std::cout << "Enter the filename of the GiD mesh data file. If the data file is " << std::endl;
std::cout << "not in same folder as this application, than enter the whole path " << std::endl;
std::cout << "of the mesh data file with filename. Use \\\\ for \\ in address. " << std::endl;
std::cout << std::endl << "Filename >> ";
std::cin >> mesh_data_file;
std::cout << std::endl << std::endl;
//2. Pre Processing:
//Read GiD mesh Data and write solver input.
std::cout << "Pre Processor: Define boundary conditions and loads." << std::endl << std::endl;
generateSolverInput(mesh_data_file, solver_input_file);
std::cout << "Pre Processor: Solver input generated!" << std::endl << std::endl;
std::ifstream infile(solver_input_file);
std::ofstream outfile("Solution_Data.txt"); //This file contains solution data.
std::ofstream outfile_gnuplot(displacement_plot_data); //This file contains plot data.
std::ofstream outfile_gnuplot_contur(stress_plot_data); //This file contains plot data.
//3. Solution:
std::cout << "Solver: Creating mathematical model..." << std::endl;
//Read material specifications
float poissonRatio, youngModulus;
infile >> poissonRatio >> youngModulus;
//Assemble elasticity matrix D
Eigen::Matrix3f D;
D <<
1.0f, poissonRatio, 0.0f,
poissonRatio, 1.0, 0.0f,
0.0f, 0.0f, (1.0f - poissonRatio) / 2.0f;
D *= youngModulus / (1.0f - pow(poissonRatio, 2.0f));
//Read number of nodes and their coordinates
infile >> nodesCount;
nodesX.resize(nodesCount);
nodesY.resize(nodesCount);
for (int i = 0; i < nodesCount; ++i)
{
infile >> nodesX[i] >> nodesY[i];
}
//Read number of elements and their nodes
int elementCount;
infile >> elementCount;
for (int i = 0; i < elementCount; ++i)
{
Element element;
infile >> element.nodesIds[0] >> element.nodesIds[1] >> element.nodesIds[2];
elements.push_back(element);
}
//Read number of constraints and their node settings
int constraintCount;
infile >> constraintCount;
for (int i = 0; i < constraintCount; ++i)
{
Constraint constraint;
int type;
infile >> constraint.node >> type;
constraint.type = static_cast<Constraint::Type>(type);
constraints.push_back(constraint);
}
loads.resize(2 * nodesCount);
loads.setZero();
//Read number of nodal loads and nodal forces
int loadsCount;
infile >> loadsCount;
for (int i = 0; i < loadsCount; ++i)
{
int node;
float x, y;
infile >> node >> x >> y;
loads[2 * node + 0] = x;
loads[2 * node + 1] = y;
}
//Calculate stiffness matrix for each element
std::vector<Eigen::Triplet<float> > triplets;
for (std::vector<Element>::iterator it = elements.begin(); it != elements.end(); ++it)
{
it->CalculateStiffnessMatrix(D, triplets);
}
//Assemble global stiffness matirx
Eigen::SparseMatrix<float> globalK(2 * nodesCount, 2 * nodesCount);
globalK.setFromTriplets(triplets.begin(), triplets.end());
//Apply Constraints
ApplyConstraints(globalK, constraints);
std::cout << "Solver: Mathematical model created!" << std::endl;
//Solving
std::cout << "Solver: Solving in progress..." << std::endl;
Eigen::SimplicialLDLT<Eigen::SparseMatrix<float> > solver(globalK);
Eigen::VectorXf displacements = solver.solve(loads);
std::cout << "Solver: Solving done!" << std::endl << std::endl;
//Writing output and display on console
//std::cout << "Loads vector:" << std::endl << loads << std::endl << std::endl; //Loads
//std::cout << "Displacements vector:" << std::endl << displacements << std::endl; //Displaysments
outfile << displacements << std::endl;
//std::cout << "Stresses:" << std::endl; //Von Mises Stress
int m = 0;
float sigma_max = 0.0;
float *sigma_mises = new float[elementCount];
for (std::vector<Element>::iterator it = elements.begin(); it != elements.end(); ++it)
{
Eigen::Matrix<float, 6, 1> delta;
delta << displacements.segment<2>(2 * it->nodesIds[0]),
displacements.segment<2>(2 * it->nodesIds[1]),
displacements.segment<2>(2 * it->nodesIds[2]);
Eigen::Vector3f sigma = D * it->B * delta;
sigma_mises[m] = sqrt(sigma[0] * sigma[0] - sigma[0] * sigma[1] + sigma[1] * sigma[1] + 3.0f * sigma[2] * sigma[2]);
//Search for maximum stress
if (sigma_mises[m] > sigma_max) {
sigma_max = sigma_mises[m];
}
//std::cout << sigma_mises[m] << std::endl; //Von Mises Stress
outfile << sigma_mises[m] << std::endl;
m++;
}
//4. Post Processing:
//4.1 Writing GNUPlot output file for ploting mesh and mesh + displacements
for (std::vector<Element>::iterator it = elements.begin(); it != elements.end(); ++it)
{
//Prints x,y,dis-x,dis-y for every node of element in one line
for (int i = 0; i < 3; i++) {
outfile_gnuplot << nodesX(it->nodesIds[i]) << " " << nodesY(it->nodesIds[i]) \
<< " " << displacements(it->nodesIds[i] * 2) << " " << displacements(it->nodesIds[i] * 2 + 1) << std::endl;
}
//First node of element has to appear twice for plotting purpose
outfile_gnuplot << nodesX(it->nodesIds[0]) << " " << nodesY(it->nodesIds[0]) \
<< " " << displacements(it->nodesIds[0] * 2) << " " << displacements(it->nodesIds[0] * 2 + 1) << std::endl;
//Empty line to sperate between elements
outfile_gnuplot << std::endl;
}
//4.2 Writing GNUPlot output file for stress contour plot
outfile_gnuplot_contur << "unset xtics" << std::endl;
outfile_gnuplot_contur << "unset ytics" << std::endl;
outfile_gnuplot_contur << "set cbrange [0:1]" << std::endl << std::endl;
outfile_gnuplot_contur << "plot[-15:15][-15:15] \\" << std::endl;
//Write color information for every element
int mm = 0;
for (std::vector<Element>::iterator it = elements.begin(); it != (elements.end()-1); ++it) {
outfile_gnuplot_contur << "\"-\" title \"\" with filledcurve lt palette cb " \
<< sigma_mises[mm] / sigma_max << " \\" << std::endl;
outfile_gnuplot_contur << "fillstyle transparent solid 1.000000 ,\\" << std::endl;
mm++;
}
//Write color information for last element
outfile_gnuplot_contur << "\"-\" title \"\" with filledcurve lt palette cb " \
<< sigma_mises[elementCount-1] / sigma_max << " \\" << std::endl;
outfile_gnuplot_contur << "fillstyle transparent solid 1.000000 ;" << std::endl;
for (std::vector<Element>::iterator it = elements.begin(); it != elements.end(); ++it)
{
//Elements and their nodes:
//Prints x,y for every node of element in one line
for (int i = 0; i < 3; i++) {
outfile_gnuplot_contur << nodesX(it->nodesIds[i]) << " " << nodesY(it->nodesIds[i]) << std::endl;
}
//First node of element has to appear twice for plotting purpose
outfile_gnuplot_contur << nodesX(it->nodesIds[0]) << " " << nodesY(it->nodesIds[0]) << std::endl;
//'e' to sperate between elements
outfile_gnuplot_contur << "e" << std::endl;
}
std::cout << "Post Processor: Plotting solution..." << std::endl << std::endl;
//4.3 Plot results
plot(displacement_plot_data);
delete[] sigma_mises;
return 0;
}
| 32.976608
| 119
| 0.628835
|
JoshuaSimon
|
43260e5436187a85b10d6dd9b66d11ea9be07284
| 315
|
cpp
|
C++
|
tests/translation/test_extM2_wrap_bind.cpp
|
mingodad/nullc
|
e38246dbf41acd199c7d23b928633bf16eddc24f
|
[
"MIT"
] | 143
|
2015-03-16T20:38:09.000Z
|
2022-03-10T13:11:13.000Z
|
tests/translation/test_extM2_wrap_bind.cpp
|
mingodad/nullc
|
e38246dbf41acd199c7d23b928633bf16eddc24f
|
[
"MIT"
] | 17
|
2015-03-14T14:17:23.000Z
|
2022-01-06T10:55:57.000Z
|
tests/translation/test_extM2_wrap_bind.cpp
|
mingodad/nullc
|
e38246dbf41acd199c7d23b928633bf16eddc24f
|
[
"MIT"
] | 9
|
2015-03-15T02:00:13.000Z
|
2022-01-06T10:27:51.000Z
|
#include "runtime.h"
#include <math.h>
int Call_int_ref_double_double_double_double_int_(double x1, double x2, double x3, double x4, int y, void* __context)
{
#define fpart(x) (x - floor(x))
double xgap = fpart(x1 + 0.5);
return int(xgap * 10.0) == 1 && y && x2 == 2.0 && x3 == 3.0 && x4 == 4.0;
#undef fpart
}
| 26.25
| 117
| 0.64127
|
mingodad
|
4327c83bf405dcaa1f425f58c87aac4ecda0510b
| 30
|
cpp
|
C++
|
src/cpp/utils/GPUBasedProperty.cpp
|
Yukihito/alcube
|
8aac4e2dd2cb3871b672d92902cf15150c430a56
|
[
"MIT"
] | null | null | null |
src/cpp/utils/GPUBasedProperty.cpp
|
Yukihito/alcube
|
8aac4e2dd2cb3871b672d92902cf15150c430a56
|
[
"MIT"
] | null | null | null |
src/cpp/utils/GPUBasedProperty.cpp
|
Yukihito/alcube
|
8aac4e2dd2cb3871b672d92902cf15150c430a56
|
[
"MIT"
] | null | null | null |
#include "GPUBasedProperty.h"
| 15
| 29
| 0.8
|
Yukihito
|
43284a7fd3c9e1f4ccdf2ccee67e81a16209caba
| 1,971
|
cpp
|
C++
|
Kernel/src/Arch/x86_64/Keyboard.cpp
|
adi-g15/LemonOS
|
47a15ecc0efe47eeebde0b63d668fb70c9e22b57
|
[
"BSD-2-Clause"
] | null | null | null |
Kernel/src/Arch/x86_64/Keyboard.cpp
|
adi-g15/LemonOS
|
47a15ecc0efe47eeebde0b63d668fb70c9e22b57
|
[
"BSD-2-Clause"
] | null | null | null |
Kernel/src/Arch/x86_64/Keyboard.cpp
|
adi-g15/LemonOS
|
47a15ecc0efe47eeebde0b63d668fb70c9e22b57
|
[
"BSD-2-Clause"
] | null | null | null |
#include <Scheduler.h>
#include <System.h>
#include <IDT.h>
#include <Logging.h>
#include <APIC.h>
#include <Fs/Filesystem.h>
#include <Device.h>
#define KEY_QUEUE_SIZE 256
namespace Keyboard{
uint8_t keyQueue[KEY_QUEUE_SIZE];
unsigned short keyQueueEnd = 0;
unsigned short keyQueueStart = 0;
unsigned short keyCount = 0;
bool ReadKey(uint8_t* key){
if(keyCount <= 0) return false;
*key = keyQueue[keyQueueStart];
keyQueueStart++;
if(keyQueueStart >= KEY_QUEUE_SIZE) {
keyQueueStart = 0;
}
keyCount--;
return true;
}
class KeyboardDevice : public Device{
public:
DirectoryEntry dirent;
KeyboardDevice(char* name) : Device(name, DeviceTypeLegacyHID){
flags = FS_NODE_CHARDEVICE;
strcpy(dirent.name, name);
dirent.flags = flags;
dirent.node = this;
SetDeviceName("PS/2 Keyboard Device");
}
ssize_t Read(size_t offset, size_t size, uint8_t *buffer){
if(size > keyCount) size = keyCount;
if(!size) return 0;
unsigned short i = 0;
for(; i < size; i++){
if(!ReadKey(buffer++)) // Insert key and increment
break;
}
return i;
}
};
KeyboardDevice kbDev("keyboard0");
// Interrupt handler
void Handler(void*, RegisterContext* r)
{
// Read from the keyboard's data buffer
uint8_t key = inportb(0x60);
if(keyCount >= KEY_QUEUE_SIZE) return; // Drop key
// Add key to queue
keyQueue[keyQueueEnd] = key;
keyQueueEnd++;
if(keyQueueEnd >= KEY_QUEUE_SIZE) {
keyQueueEnd = 0;
}
keyCount++;
}
// Register interrupt handler
void Install() {
IDT::RegisterInterruptHandler(IRQ0 + 1, Handler);
APIC::IO::MapLegacyIRQ(1);
outportb(0xF0, 1); // Set scan code 1
}
}
| 21.423913
| 66
| 0.572806
|
adi-g15
|
4328e957fb7479b0a77f7dcadab32172d0f6d6e1
| 4,136
|
hpp
|
C++
|
include/boost/hana/detail/variadic/foldr1.hpp
|
rbock/hana
|
2b76377f91a5ebe037dea444e4eaabba6498d3a8
|
[
"BSL-1.0"
] | 2
|
2015-05-07T14:29:13.000Z
|
2015-07-04T10:59:46.000Z
|
include/boost/hana/detail/variadic/foldr1.hpp
|
rbock/hana
|
2b76377f91a5ebe037dea444e4eaabba6498d3a8
|
[
"BSL-1.0"
] | null | null | null |
include/boost/hana/detail/variadic/foldr1.hpp
|
rbock/hana
|
2b76377f91a5ebe037dea444e4eaabba6498d3a8
|
[
"BSL-1.0"
] | null | null | null |
/*!
@file
Defines `boost::hana::detail::variadic::foldr1`.
@copyright Louis Dionne 2014
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_HANA_DETAIL_VARIADIC_FOLDR1_HPP
#define BOOST_HANA_DETAIL_VARIADIC_FOLDR1_HPP
#include <boost/hana/core/datatype.hpp>
#include <boost/hana/detail/type_fwd.hpp>
namespace boost { namespace hana { namespace detail { namespace variadic {
template <unsigned int narg>
struct foldr1_impl;
template <>
struct foldr1_impl<1> {
template <template <typename ...> class F, typename X1>
using apply_t = X1;
template <typename F, typename X1>
static constexpr auto apply(F, X1 x1)
{ return x1; }
};
template <>
struct foldr1_impl<2> {
template <template <typename ...> class F, typename X1, typename X2>
using apply_t = typename F<X1, X2>::type;
template <typename F, typename X1, typename X2>
static constexpr auto apply(F f, X1 x1, X2 x2)
{ return f(x1, x2); }
};
template <>
struct foldr1_impl<3> {
template <template <typename ...> class F, typename X1, typename X2, typename X3>
using apply_t = typename F<X1, typename F<X2, X3>::type>::type;
template <typename F, typename X1, typename X2, typename X3>
static constexpr auto apply(F f, X1 x1, X2 x2, X3 x3)
{ return f(x1, f(x2, x3)); }
};
// Given a number of arguments left to process, returns the number with
// which the next call to `foldr1_impl` should be specialized.
constexpr unsigned int foldr1_next(unsigned int n)
{ return n > 4 ? 4 : n; }
template <>
struct foldr1_impl<4> {
template <template <typename ...> class F, typename X1, typename X2, typename X3, typename ...Xs>
using apply_t = typename F<X1, typename F<X2, typename F<X3,
typename foldr1_impl<foldr1_next(sizeof...(Xs))>::
template apply_t<F, Xs...>
>::type>::type>::type;
template <typename F, typename X1, typename X2, typename X3, typename ...Xs>
static constexpr auto apply(F f, X1 x1, X2 x2, X3 x3, Xs ...xs) {
return f(x1, f(x2, f(x3, foldr1_impl<foldr1_next(sizeof...(Xs))>::apply(f, xs...))));
}
};
template <typename ...Xs, typename F>
constexpr auto foldr1_helper(F f, ...) {
return foldr1_impl<foldr1_next(sizeof...(Xs))>::apply(f, type<Xs>...);
}
template <typename ...Xs, typename F>
constexpr auto foldr1_helper(F, Metafunction*) {
return type<
typename foldr1_impl<foldr1_next(sizeof...(Xs))>::
template apply_t<F::template apply, Xs...>
>;
}
template <typename ...Xs, typename F>
constexpr auto foldr1(F f) {
return foldr1_helper<Xs...>(f, (datatype_t<F>*)0);
}
template <typename F, typename ...Xs>
constexpr auto foldr1(F f, Xs ...xs) {
return foldr1_impl<foldr1_next(sizeof...(Xs))>::apply(f, xs...);
}
#if 0
template <typename F, typename X0>
constexpr auto foldr1_impl(F, X0 x0)
{ return x0; }
template <typename F, typename X0, typename X1>
constexpr auto foldr1_impl(F f, X0 x0, X1 x1)
{ return f(x0, x1); }
template <typename F, typename X0, typename X1, typename X2>
constexpr auto foldr1_impl(F f, X0 x0, X1 x1, X2 x2)
{ return f(x0, f(x1, x2)); }
template <typename F, typename X0, typename X1, typename X2, typename X3>
constexpr auto foldr1_impl(F f, X0 x0, X1 x1, X2 x2, X3 x3)
{ return f(x0, f(x1, f(x2, x3))); }
template <typename F, typename X0, typename X1, typename X2, typename X3, typename ...Xs>
constexpr auto foldr1_impl(F f, X0 x0, X1 x1, X2 x2, X3 x3, Xs ...xs)
{ return f(x0, f(x1, f(x2, f(x3, foldr1_impl(f, xs...))))); }
BOOST_HANA_CONSTEXPR_LAMBDA auto foldr1 = [](auto f, auto x, auto ...xs) {
return foldr1_impl(f, x, xs...);
};
#endif
}}}} // end namespace boost::hana::detail::variadic
#endif // !BOOST_HANA_DETAIL_VARIADIC_FOLDR1_HPP
| 34.181818
| 105
| 0.626692
|
rbock
|
43292ae2fa0c40ac72238dbd4ef74774a4d4a9e1
| 2,945
|
cc
|
C++
|
src/atlas/mesh/actions/ExtendNodesGlobal.cc
|
twsearle/atlas
|
a1916fd521f9935f846004e6194f80275de4de83
|
[
"Apache-2.0"
] | 67
|
2018-03-01T06:56:49.000Z
|
2022-03-08T18:44:47.000Z
|
src/atlas/mesh/actions/ExtendNodesGlobal.cc
|
twsearle/atlas
|
a1916fd521f9935f846004e6194f80275de4de83
|
[
"Apache-2.0"
] | 93
|
2018-12-07T17:38:04.000Z
|
2022-03-31T10:04:51.000Z
|
src/atlas/mesh/actions/ExtendNodesGlobal.cc
|
twsearle/atlas
|
a1916fd521f9935f846004e6194f80275de4de83
|
[
"Apache-2.0"
] | 33
|
2018-02-28T17:06:19.000Z
|
2022-01-20T12:12:27.000Z
|
/*
* (C) Copyright 2013 ECMWF.
*
* This software is licensed under the terms of the Apache Licence Version 2.0
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
* In applying this licence, ECMWF does not waive the privileges and immunities
* granted to it by virtue of its status as an intergovernmental organisation
* nor does it submit to any jurisdiction.
*/
#include "atlas/mesh/actions/ExtendNodesGlobal.h"
#include "atlas/array.h"
#include "atlas/field/Field.h"
#include "atlas/grid/Grid.h"
#include "atlas/grid/Iterator.h"
#include "atlas/mesh/Mesh.h"
#include "atlas/mesh/Nodes.h"
#include "atlas/runtime/Exception.h"
#include "atlas/util/CoordinateEnums.h"
#include "atlas/util/Earth.h"
namespace atlas {
namespace mesh {
namespace actions {
ExtendNodesGlobal::ExtendNodesGlobal(const std::string& gridname): gridname_(gridname) {}
void ExtendNodesGlobal::operator()(const Grid& grid, Mesh& mesh) const {
if (grid.domain().global()) {
return; // don't add virtual points to global domains
}
Grid O16("O16");
// virtual points
std::vector<PointXY> extended_pts;
extended_pts.reserve(grid.size());
// loop over the point and keep the ones that *don't* fall in the domain
for (const PointLonLat& lonlat : O16.lonlat()) {
PointXY xy = grid.projection().xy(lonlat);
if (not grid.domain().contains(xy)) {
extended_pts.push_back(xy);
}
}
mesh::Nodes& nodes = mesh.nodes();
const idx_t nb_real_pts = nodes.size();
const idx_t nb_extension_pts = extended_pts.size();
idx_t new_size = nodes.size() + extended_pts.size();
nodes.resize(new_size); // resizes the fields
const idx_t nb_total_pts = nodes.size();
ATLAS_ASSERT(nb_total_pts == nb_real_pts + nb_extension_pts);
nodes.metadata().set<idx_t>("NbRealPts", nb_real_pts);
nodes.metadata().set<idx_t>("NbVirtualPts", nb_extension_pts);
array::ArrayView<double, 2> xyz = array::make_view<double, 2>(nodes.field("xyz"));
array::ArrayView<double, 2> xy = array::make_view<double, 2>(nodes.xy());
array::ArrayView<double, 2> lonlat = array::make_view<double, 2>(nodes.lonlat());
array::ArrayView<gidx_t, 1> gidx = array::make_view<gidx_t, 1>(nodes.global_index());
for (idx_t i = 0; i < nb_extension_pts; ++i) {
const idx_t n = nb_real_pts + i;
const PointLonLat pLL = grid.projection().lonlat(extended_pts[i]);
PointXYZ pXYZ;
util::Earth::convertSphericalToCartesian(pLL, pXYZ);
xyz(n, XX) = pXYZ.x();
xyz(n, YY) = pXYZ.y();
xyz(n, ZZ) = pXYZ.z();
xy(n, XX) = extended_pts[i].x();
xy(n, YY) = extended_pts[i].y();
lonlat(n, LON) = pLL.lon();
lonlat(n, LAT) = pLL.lat();
gidx(n) = n + 1;
}
}
} // namespace actions
} // namespace mesh
} // namespace atlas
| 32.362637
| 91
| 0.64618
|
twsearle
|
43296c025e2beb4e20236c52797952fbcbe82bcf
| 7,251
|
cc
|
C++
|
tensorflow/cc/examples/mcts_test.cc
|
geligeli/tensorflow
|
9b13fff8c91a1294e8a4d0d1699cb55e0306122e
|
[
"Apache-2.0"
] | null | null | null |
tensorflow/cc/examples/mcts_test.cc
|
geligeli/tensorflow
|
9b13fff8c91a1294e8a4d0d1699cb55e0306122e
|
[
"Apache-2.0"
] | null | null | null |
tensorflow/cc/examples/mcts_test.cc
|
geligeli/tensorflow
|
9b13fff8c91a1294e8a4d0d1699cb55e0306122e
|
[
"Apache-2.0"
] | null | null | null |
#include "tensorflow/cc/examples/mcts.h"
#include <boost/coroutine2/coroutine.hpp>
#include <boost/fiber/all.hpp>
#include <chrono>
#include <list>
#include <thread>
#include "tensorflow/cc/saved_model/loader.h"
#include "tensorflow/cc/saved_model/tag_constants.h"
#include "tensorflow/core/platform/test.h"
namespace snake {
TEST(Mcts, SinglePredictionTest) {
Snake p1({
Point{0, 3},
Point{0, 2},
Point{0, 1},
Point{0, 0},
});
Snake p2({
Point{1, 5},
Point{1, 4},
Point{1, 3},
Point{1, 2},
});
SnakeBoard16 state(p1, p2, [](const SnakeBoard16&) { return Point{15, 15}; });
SnakeMctsAdapter adapter(state);
adapter.print();
Mcts mcts(random_rollout);
auto d = mcts.Search(adapter);
EXPECT_EQ(d, Direction::DOWN);
}
TEST(Mcts, MctsTest) {
Snake p1({
Point{0, 3},
Point{0, 2},
Point{0, 1},
Point{0, 0},
});
Snake p2({
Point{1, 5},
Point{1, 4},
Point{1, 3},
Point{1, 2},
});
SnakeBoard16 state(p1, p2, [](const SnakeBoard16&) { return Point{15, 15}; });
state.print();
SnakeMctsAdapter adapter(state);
Mcts mcts(random_rollout);
auto d = mcts.Search(adapter);
EXPECT_EQ(d, Direction::DOWN);
adapter.execute(d);
d = mcts.Search(adapter);
EXPECT_EQ(d, Direction::LEFT);
adapter.execute(d);
// adapter.print();
}
TEST(Mcts, MctsMultipleMoves) {
SnakeBoard16 state;
SnakeMctsAdapter adapter(state);
while (!adapter.is_terminal()) {
Mcts mcts(random_rollout);
auto d = mcts.Search(adapter);
adapter.execute(d);
d = mcts.Search(adapter);
adapter.execute(d);
adapter.print();
}
adapter.print();
}
TEST(Mcts, TestMctsStrategy) { RunGame(GreedyStrategy, Mcts::Strategy); }
TEST(Mcts, SavedModel) {
using namespace tensorflow;
// Load
SavedModelBundle model_bundle;
SessionOptions session_options = SessionOptions();
// (*session_options.config.mutable_device_count())["GPU"] = 0;
session_options.config.set_log_device_placement(true);
RunOptions run_options = RunOptions();
TF_CHECK_OK(LoadSavedModel(session_options, run_options,
"/home/geli/tmp/saved_model",
{kSavedModelTagServe}, &model_bundle));
// LOG(ERROR) << model_bundle.meta_graph_def.DebugString();
for (const auto& s : model_bundle.GetSignatures()) {
LOG(ERROR) << s.first;
LOG(ERROR) << s.second.DebugString();
}
Tensor input(DT_FLOAT, TensorShape{{4096, 16, 16, 3}});
for (int i = 0; i < input.NumElements(); ++i) {
input.flat<float>()(i) = 0;
}
std::vector<Tensor> output;
TF_CHECK_OK(model_bundle.session->Run({{"serving_default_board:0", input}},
{"StatefulPartitionedCall:0"}, {},
&output));
ASSERT_EQ(output.size(), 1);
auto begin = std::chrono::steady_clock::now();
for (int i = 0; i < 100; ++i) {
std::vector<Tensor> output;
TF_CHECK_OK(model_bundle.session->Run({{"serving_default_board:0", input}},
{"StatefulPartitionedCall:0"}, {},
&output));
ASSERT_EQ(output.size(), 1);
LOG(ERROR) << output[0].shape().DebugString();
LOG(ERROR) << output[0].DebugString(8);
}
std::cout << "Time difference = "
<< std::chrono::duration_cast<std::chrono::microseconds>(
std::chrono::steady_clock::now() - begin)
.count()
<< "[µs]" << std::endl;
// model_bundle.session->Run()
// bundle.session->Run({}, {"filename_tensor:0"}, {}, &path_outputs));
// Tensor
// Status runStatus = model_bundle.GetSession()->Run(
// {{"serving_default_input_tensor:0", input_tensor}}, outputLayer, {},
// &outputs);
// Inference
// outputLayer = {"StatefulPartitionedCall:0", "StatefulPartitionedCall:4",
// "StatefulPartitionedCall:1", "StatefulPartitionedCall:5",
// "StatefulPartitionedCall:3"};
// Status runStatus = model_bundle.GetSession()->Run(
// {{"serving_default_input_tensor:0", input_tensor}}, outputLayer, {},
// &outputs);
}
TEST(Coroutine, Test) {
boost::coroutines2::coroutine<int>::pull_type source(
[](boost::coroutines2::coroutine<int>::push_type& sink) {
int first = 1, second = 1;
sink(first);
sink(second);
for (int i = 0; i < 8; ++i) {
int third = first + second;
first = second;
second = third;
sink(third);
}
});
for (auto i : source) {
std::cout << i << " ";
}
std::cout << "\nDone" << std::endl;
}
template <typename INPUT, typename OUTPUT>
struct Batching {
struct Work {
INPUT input;
boost::fibers::promise<OUTPUT> r;
};
using ChannelType = boost::fibers::unbuffered_channel<Work>;
struct Closer {
void operator()(ChannelType* c) { c->close(); }
};
using Base = std::unique_ptr<ChannelType, Closer>;
struct Foo : public Base {
using Base::Base;
OUTPUT BatchProcess(INPUT input) const {
Work w;
w.input = input;
auto f = w.r.get_future();
Base::get()->push(std::move(w));
return f.get();
}
};
Foo new_channel() {
channels_.emplace_back();
return Foo{&channels_.back(), Closer()};
}
typename boost::coroutines2::coroutine<Work>::pull_type get_batch() {
return typename boost::coroutines2::coroutine<Work>::pull_type(
[this](typename boost::coroutines2::coroutine<Work>::push_type& sink) {
for (auto it = channels_.begin(); it != channels_.end();) {
Work w;
if (it->pop(w) != boost::fibers::channel_op_status::success) {
it = channels_.erase(it);
continue;
} else {
++it;
}
sink(std::move(w));
}
});
}
private:
std::list<ChannelType> channels_;
};
TEST(Fiber, Test) {
Batching<int, int> c;
auto batch_compute = [&c]() {
while (true) {
auto batch = c.get_batch();
std::vector<boost::fibers::promise<int>> results;
int result = 0;
int batch_size = 0;
for (auto&& w : batch) {
++batch_size;
result += w.input;
results.push_back(std::move(w.r));
}
if (batch_size == 0) {
break;
}
for (auto& r : results) {
r.set_value(result);
}
}
};
auto leaf_comp = [](const Batching<int, int>::Foo& f, int i) {
for (int j = 0; j < i; ++j) {
auto r = f.BatchProcess(j);
std::cout << i << ": f(" << j << ")=" << r << std::endl;
}
};
boost::fibers::fiber l1{[leaf_comp, f = std::move(c.new_channel()), i = 3]() {
leaf_comp(f, i);
}};
boost::fibers::fiber l2{[leaf_comp, f = std::move(c.new_channel()), i = 4]() {
leaf_comp(f, i);
}};
boost::fibers::fiber l3{[leaf_comp, f = std::move(c.new_channel()), i = 5]() {
leaf_comp(f, i);
}};
boost::fibers::fiber bc{batch_compute};
l1.join();
std::cout << "l1 joined" << std::endl;
l2.join();
std::cout << "l2 joined" << std::endl;
l3.join();
std::cout << "l3 joined" << std::endl;
bc.join();
}
} // namespace snake
| 27.781609
| 80
| 0.57399
|
geligeli
|
432ac8a7458ae9d20e6c64a01180ecb8d6d9d719
| 1,271
|
cpp
|
C++
|
OLD/Orario/orario.cpp
|
Maxelweb/PaO
|
7c9cb18366ed6a4730519e4275e4719ec9bf0cd2
|
[
"MIT"
] | 1
|
2020-02-01T10:15:31.000Z
|
2020-02-01T10:15:31.000Z
|
OLD/Orario/orario.cpp
|
Maxelweb/PaO
|
7c9cb18366ed6a4730519e4275e4719ec9bf0cd2
|
[
"MIT"
] | null | null | null |
OLD/Orario/orario.cpp
|
Maxelweb/PaO
|
7c9cb18366ed6a4730519e4275e4719ec9bf0cd2
|
[
"MIT"
] | null | null | null |
// INTERFACE / DEFINITION
#include "orario.h"
// ==== Costruttori
orario::orario(){
sec = 0;
}
orario::orario(int o){
if(o<0 || o>23) sec = 0; // Controllo di sanità
else sec = o*3600;
}
orario::orario(int o, int m){
if(o<0 || o>23 || m < 0 || m > 59) sec = 0; // "
else sec = o*3600 + m*60;
}
orario::orario(int o, int m, int s){
if(o<0 || o>23 || m < 0 || m > 59 || s < 0 || s > 59) sec = 0; // ""
else sec = o*3600 + m*60 + s;
}
// ==== Metodi
int orario::Ore() const { return sec / 3600; }
int orario::Minuti() const { return (sec/60) % 60;}
int orario::Secondi() const { return (sec%60);}
orario orario::AumentaUnOra() {
orario aux;
aux.sec = (sec + 3600) % 86400;
return aux;
}
void orario::PrintSec() const{
cout << "Secondi totali: " << sec << endl;
}
orario orario::OraDiPranzo() {
return orario(13,15,00);
}
// ==== Overloading operatori
orario orario::operator+(orario x){
orario aux;
aux.sec = (sec + x.sec) % 86400;
return aux;
}
bool orario::operator==(orario x) const {
return (sec == x.sec);
}
ostream& operator<<(ostream& os, const orario &o) {
return os << o.Ore() << ':' << o.Minuti() << ':' << o.Secondi();
} // Altrimenti mettevo using std::ostream sul .h;
// ==== Campi Dati
int orario::UnOra = 3600;
| 17.410959
| 69
| 0.573564
|
Maxelweb
|
432b1f628ff16b9334a774fc930ae615f341811f
| 405
|
cpp
|
C++
|
Dataset/Leetcode/test/70/150.cpp
|
kkcookies99/UAST
|
fff81885aa07901786141a71e5600a08d7cb4868
|
[
"MIT"
] | null | null | null |
Dataset/Leetcode/test/70/150.cpp
|
kkcookies99/UAST
|
fff81885aa07901786141a71e5600a08d7cb4868
|
[
"MIT"
] | null | null | null |
Dataset/Leetcode/test/70/150.cpp
|
kkcookies99/UAST
|
fff81885aa07901786141a71e5600a08d7cb4868
|
[
"MIT"
] | null | null | null |
class Solution {
public:
int XXX(int n) {
if (n == 1) {
return 1;
}
if (n == 2){
return 2;
}
int m1 = 1, m2 = 2;
int i = 3;
int sum = 0;
while (i <= n) {
sum = m1 + m2;
m1 = m2;
m2 = sum;
i++;
}
return sum;
}
};
| 15
| 27
| 0.259259
|
kkcookies99
|
432e5c2df7b0ea0380037b8c7691972f3e4e8c52
| 2,611
|
cpp
|
C++
|
higan/target-bsnes/settings/hotkeys.cpp
|
13824125580/higan
|
fbdd3f980b65412c362096579869ae76730e4118
|
[
"Intel",
"ISC"
] | 10
|
2019-12-19T01:19:41.000Z
|
2021-02-18T16:30:29.000Z
|
higan/target-bsnes/settings/hotkeys.cpp
|
13824125580/higan
|
fbdd3f980b65412c362096579869ae76730e4118
|
[
"Intel",
"ISC"
] | null | null | null |
higan/target-bsnes/settings/hotkeys.cpp
|
13824125580/higan
|
fbdd3f980b65412c362096579869ae76730e4118
|
[
"Intel",
"ISC"
] | null | null | null |
auto HotkeySettings::create() -> void {
setIcon(Icon::Device::Keyboard);
setText("Hotkeys");
layout.setPadding(5);
mappingList.setBatchable();
mappingList.setHeadered();
mappingList.onActivate([&] {
if(assignButton.enabled()) assignButton.doActivate();
});
mappingList.onChange([&] {
auto batched = mappingList.batched();
assignButton.setEnabled(batched.size() == 1);
clearButton.setEnabled(batched.size() >= 1);
});
mappingList.onSize([&] {
mappingList.resizeColumns();
});
assignButton.setText("Assign").onActivate([&] {
assignMapping();
});
clearButton.setText("Clear").onActivate([&] {
for(auto item : mappingList.batched()) {
inputManager.hotkeys[item.offset()].unbind();
}
refreshMappings();
});
}
auto HotkeySettings::reloadMappings() -> void {
mappingList.reset();
mappingList.append(TableViewColumn().setText("Name"));
mappingList.append(TableViewColumn().setText("Mapping").setExpandable());
for(auto& hotkey : inputManager.hotkeys) {
mappingList.append(TableViewItem()
.append(TableViewCell().setText(hotkey.name).setFont(Font().setBold()).setBackgroundColor({240, 240, 255}))
.append(TableViewCell())
);
}
refreshMappings();
mappingList.doChange();
}
auto HotkeySettings::refreshMappings() -> void {
uint index = 0;
for(auto& hotkey : inputManager.hotkeys) {
mappingList.item(index++).cell(1).setText(hotkey.displayName());
}
mappingList.resizeColumns();
}
auto HotkeySettings::assignMapping() -> void {
inputManager.poll(); //clear any pending events first
if(auto item = mappingList.selected()) {
activeMapping = inputManager.hotkeys[item.offset()];
settingsWindow.layout.setEnabled(false);
settingsWindow.statusBar.setText({"Press a key or button to map [", activeMapping->name, "] ..."});
settingsWindow.setDismissable(false);
}
}
auto HotkeySettings::cancelMapping() -> void {
activeMapping.reset();
settingsWindow.statusBar.setText();
settingsWindow.layout.setEnabled();
settingsWindow.doSize();
settingsWindow.setDismissable(true);
}
auto HotkeySettings::inputEvent(shared_pointer<HID::Device> device, uint group, uint input, int16 oldValue, int16 newValue) -> void {
if(!activeMapping) return;
if(device->isMouse()) return;
if(activeMapping->bind(device, group, input, oldValue, newValue)) {
activeMapping.reset();
settingsWindow.statusBar.setText("Mapping assigned.");
refreshMappings();
timer.onActivate([&] {
timer.setEnabled(false);
cancelMapping();
}).setInterval(200).setEnabled();
}
}
| 30.717647
| 133
| 0.692838
|
13824125580
|
432ebabcf62086404963b5b3d0bcd883448fcd26
| 5,214
|
hpp
|
C++
|
PathTracer/src/GDIWindow.hpp
|
Guarneri1743/PathTracer
|
2eb4297ddbc425771dde5575fc67c054395b240d
|
[
"MIT"
] | null | null | null |
PathTracer/src/GDIWindow.hpp
|
Guarneri1743/PathTracer
|
2eb4297ddbc425771dde5575fc67c054395b240d
|
[
"MIT"
] | null | null | null |
PathTracer/src/GDIWindow.hpp
|
Guarneri1743/PathTracer
|
2eb4297ddbc425771dde5575fc67c054395b240d
|
[
"MIT"
] | null | null | null |
#ifndef _GDI_WINDOW_
#define _GDI_WINDOW_
namespace Guarneri
{
static LRESULT event_callback(HWND, UINT, WPARAM, LPARAM);
static bool closed;
class GDIWindow
{
public:
void* framebuffer;
int width;
int height;
float aspect;
LPCSTR title;
LPCSTR name;
bool initialized;
int buffer_size;
HWND window_handle;
HDC window_device_context;
HBITMAP bitmap_handle;
HBITMAP original_handle;
int text_start = 16;
public:
void initialize(int w, int h, LPCSTR title_str, LRESULT(*event_callback)(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam));
void set_title(LPCSTR _title);
void draw_text(const int& w, const int& h, LPCSTR text);
bool is_valid();
void flush();
void get_mouse_position(float& x, float& y, int& xi, int& yi);
RECT get_rect();
void dispose();
void send_message();
};
void GDIWindow::initialize(int w, int h, LPCSTR title_str, LRESULT(*event_callback)(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam))
{
if (initialized)
{
return;
}
this->width = w;
this->height = h;
this->aspect = (float)w / (float)h;
this->title = title_str;
this->name = title_str;
buffer_size = width * height * 4;
window_handle = nullptr;
window_device_context = nullptr;
framebuffer = nullptr;
bitmap_handle = nullptr;
closed = false;
WNDCLASS win_class;
win_class.style = CS_BYTEALIGNCLIENT;
win_class.lpfnWndProc = (WNDPROC)event_callback;
win_class.cbClsExtra = 0;
win_class.cbWndExtra = 0;
win_class.hInstance = GetModuleHandle(nullptr);
win_class.hIcon = nullptr;
win_class.hCursor = LoadCursor(nullptr, IDC_ARROW);
win_class.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
win_class.lpszMenuName = title;
win_class.lpszClassName = name;
BITMAPINFO bitmap_info;
BITMAPINFOHEADER bitmap_header;
bitmap_header.biSize = sizeof(BITMAPINFOHEADER);
bitmap_header.biWidth = width;
bitmap_header.biHeight = height;
bitmap_header.biPlanes = 1;
bitmap_header.biBitCount = 32;
bitmap_header.biCompression = BI_RGB;
bitmap_header.biSizeImage = buffer_size;
bitmap_header.biXPelsPerMeter = 0;
bitmap_header.biYPelsPerMeter = 0;
bitmap_header.biClrUsed = 0;
bitmap_header.biClrImportant = 0;
bitmap_info.bmiHeader = bitmap_header;
RegisterClass(&win_class);
window_handle = CreateWindow(name, title, WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX, 0, 0, 0, 0, nullptr, nullptr, win_class.hInstance, nullptr);
HDC hDC = GetDC(window_handle);
window_device_context = CreateCompatibleDC(hDC);
ReleaseDC(window_handle, hDC);
LPVOID buffer;
bitmap_handle = CreateDIBSection(window_device_context, &bitmap_info, DIB_RGB_COLORS, &buffer, 0, 0);
if (bitmap_handle != nullptr)
{
original_handle = (HBITMAP)SelectObject(window_device_context, bitmap_handle);
}
framebuffer = (void*)buffer;
memset(framebuffer, 0, buffer_size);
RECT rect = { 0, 0, width, height };
AdjustWindowRect(&rect, GetWindowLong(window_handle, GWL_STYLE), 0);
int real_width = rect.right - rect.left;
int real_height = rect.bottom - rect.top;
int window_x = (GetSystemMetrics(SM_CXSCREEN) - real_width) / 2;
int window_y = (GetSystemMetrics(SM_CYSCREEN) - real_height) / 2;
SetWindowPos(window_handle, nullptr, window_x, window_y, real_width, real_height, (SWP_NOCOPYBITS | SWP_NOZORDER | SWP_SHOWWINDOW));
SetForegroundWindow(window_handle);
ShowWindow(window_handle, SW_NORMAL);
// window initialized
initialized = true;
}
void GDIWindow::set_title(LPCSTR _title)
{
SetWindowText(window_handle, _title);
}
void GDIWindow::draw_text(const int& w, const int& h, LPCSTR text)
{
RECT rect;
rect.left = 1;
rect.right = 1 + w;
rect.bottom = text_start - h;
rect.top = text_start;
DrawText(window_device_context, text, -1, &rect, DT_SINGLELINE | DT_LEFT | DT_VCENTER);
text_start += h - 4;
}
bool GDIWindow::is_valid()
{
return !closed;
}
void GDIWindow::flush()
{
text_start = 16;
HDC hDC = GetDC(window_handle);
BitBlt(hDC, 0, 0, width, height, window_device_context, 0, 0, SRCCOPY);
ReleaseDC(window_handle, hDC);
send_message();
}
void GDIWindow::get_mouse_position(float& x, float& y, int& xi, int& yi)
{
POINT pt;
if (GetCursorPos(&pt))
{
ScreenToClient(window_handle, &pt);
xi = (int)pt.x;
yi = (int)pt.y;
x = (float)pt.x / (float)this->width;
y = (float)pt.y / (float)this->height;
}
}
RECT GDIWindow::get_rect()
{
RECT rect;
if (GetWindowRect(window_handle, &rect))
{
return rect;
}
return rect;
}
void GDIWindow::dispose()
{
if (original_handle)
{
SelectObject(window_device_context, original_handle);
original_handle = nullptr;
}
if (window_device_context)
{
DeleteDC(window_device_context);
window_device_context = nullptr;
}
if (bitmap_handle)
{
DeleteObject(bitmap_handle);
bitmap_handle = nullptr;
}
if (window_handle)
{
CloseWindow(window_handle);
window_handle = nullptr;
}
closed = true;
}
void GDIWindow::send_message()
{
MSG msg;
while (1)
{
if (!PeekMessage(&msg, nullptr, 0, 0, PM_NOREMOVE))
break;
if (!GetMessage(&msg, nullptr, 0, 0))
break;
DispatchMessage(&msg);
}
}
}
#endif
| 25.684729
| 162
| 0.71097
|
Guarneri1743
|
432f3d25a1dc81fab25c7e663e92e05d21de5d10
| 1,006
|
cpp
|
C++
|
mIon/Engine.cpp
|
Svensational/mIon
|
e72aec811a60592b9e7f5bf456bede83fc8ef509
|
[
"MIT"
] | null | null | null |
mIon/Engine.cpp
|
Svensational/mIon
|
e72aec811a60592b9e7f5bf456bede83fc8ef509
|
[
"MIT"
] | null | null | null |
mIon/Engine.cpp
|
Svensational/mIon
|
e72aec811a60592b9e7f5bf456bede83fc8ef509
|
[
"MIT"
] | null | null | null |
#include "Engine.h"
#include <thread>
namespace mion
{
Engine * Engine::s_pInstance = nullptr;
Engine::Engine() :
m_bRunning( false ),
m_pWindow( nullptr )
{
}
Engine::~Engine()
{
}
Engine * const Engine::getInstance()
{
return s_pInstance;
}
void Engine::renderLoop()
{
const std::chrono::high_resolution_clock::duration dur = std::chrono::nanoseconds( 1000000000 / 60 );
std::chrono::high_resolution_clock::time_point tp;
while ( m_bRunning )
{
tp = std::chrono::high_resolution_clock::now() + dur;
// do stuff!
std::this_thread::sleep_until( tp );
}
}
void Engine::logicLoop()
{
const std::chrono::high_resolution_clock::duration dur = std::chrono::nanoseconds( 1000000000 / ( 60 * 4 ) );
std::chrono::high_resolution_clock::time_point tp;
while ( m_bRunning )
{
tp = std::chrono::high_resolution_clock::now() + dur;
// do stuff!
std::this_thread::sleep_until( tp );
}
}
} // namespace mion
| 18.981132
| 113
| 0.633201
|
Svensational
|
4330e4c3e9d1c8ba9459d26ad4bd280fb84c872f
| 1,688
|
cpp
|
C++
|
src/mugen/mugen_exception.cpp
|
marstau/shinsango
|
d9468787ae8e18fa478f936770d88e9bf93c11c0
|
[
"BSD-3-Clause"
] | 1
|
2021-06-16T15:25:47.000Z
|
2021-06-16T15:25:47.000Z
|
src/mugen/mugen_exception.cpp
|
marstau/shinsango
|
d9468787ae8e18fa478f936770d88e9bf93c11c0
|
[
"BSD-3-Clause"
] | null | null | null |
src/mugen/mugen_exception.cpp
|
marstau/shinsango
|
d9468787ae8e18fa478f936770d88e9bf93c11c0
|
[
"BSD-3-Clause"
] | null | null | null |
#include <string>
#include <sstream>
#include "exception.h"
MugenException::MugenException():
Exception::Base("", -1),
reason("unspecified"),
where("?"),
line(0){
}
MugenException::MugenException(const std::string & reason, const std::string & where, int line):
Exception::Base(where, line),
reason(reason),
where(where),
line(line){
}
Exception::Base * MugenException::copy() const {
return new MugenException(reason, where, line);
}
const std::string MugenException::getFullReason() const {
std::ostringstream out;
out << where << ":" << line << " " << reason;
return out.str();
}
MugenException::~MugenException() throw() {
}
ReloadMugenException::ReloadMugenException(){
}
ReloadMugenException::~ReloadMugenException() throw(){
}
CanceledException::CanceledException(){
}
CanceledException::~CanceledException() throw(){
}
QuitGameException::QuitGameException():
MugenException("Quit game", __FILE__, __LINE__){
}
QuitGameException::~QuitGameException() throw (){
}
MugenRuntimeException::MugenRuntimeException(){
}
MugenRuntimeException::MugenRuntimeException(const std::string & reason, const std::string & where, int line):
MugenException(reason, where, line){
}
MugenNormalRuntimeException::MugenNormalRuntimeException(){
}
MugenNormalRuntimeException::MugenNormalRuntimeException(const std::string & reason, const std::string & where, int line):
MugenRuntimeException(reason, where, line){
}
MugenFatalRuntimeException::MugenFatalRuntimeException(){
}
MugenFatalRuntimeException::MugenFatalRuntimeException(const std::string & reason, const std::string & where, int line):
MugenRuntimeException(reason, where, line){
}
| 23.444444
| 122
| 0.737559
|
marstau
|
43312442df6f0bbff4cb5241d5bf75a40851a09a
| 5,420
|
cpp
|
C++
|
Examples/Graph.cpp
|
haskellstudio/belle_old
|
a5ce86954b61dbacde1d1bf24472d95246be45e5
|
[
"BSD-2-Clause"
] | null | null | null |
Examples/Graph.cpp
|
haskellstudio/belle_old
|
a5ce86954b61dbacde1d1bf24472d95246be45e5
|
[
"BSD-2-Clause"
] | null | null | null |
Examples/Graph.cpp
|
haskellstudio/belle_old
|
a5ce86954b61dbacde1d1bf24472d95246be45e5
|
[
"BSD-2-Clause"
] | null | null | null |
/*
==============================================================================
Copyright 2007-2013 William Andrew Burnson. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY WILLIAM ANDREW BURNSON ''AS IS'' AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL WILLIAM ANDREW BURNSON OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
------------------------------------------------------------------------------
This file is part of Belle, Bonne, Sage --
The 'Beautiful, Good, Wise' C++ Vector-Graphics Library for Music Notation
==============================================================================
*/
/*Include Belle, Bonne, Sage and compile it in this .cpp file. See the previous
tutorials for an explanation.*/
#define BELLE_COMPILE_INLINE
#include "Belle.h"
int main()
{
//Helper namespaces
using namespace prim;
using namespace belle;
using namespace belle::graph;
//Create an empty music graph.
Music g;
//----------------//
//Treble Clef Part//
//----------------//
/*Create barline, clef, key signature, and time signature tokens. Each token
is created and added to its own island (which is a container for tokens).*/
MusicNode b = g.CreateAndAddBarline();
MusicNode c = g.CreateAndAddClef(mica::TrebleClef);
MusicNode k = g.CreateAndAddKeySignature(mica::TwoSharps, mica::Major);
MusicNode t = g.CreateAndAddTimeSignature(3, prim::Ratio(1, 4));
//Link the clef island from the barline island
g.Connect(b, c)->Set(mica::Type) = mica::Partwise;
//Link the key signature island from the clef island.
g.Connect(c, k)->Set(mica::Type) =
mica::Partwise;
//Link the time signature island from the key signature island.
g.Connect(k, t)->Set(mica::Type) = mica::Partwise;
/*Create a quarter-note chord and link its island partwise from the time
signature island.*/
MusicNode chord = g.CreateChord(prim::Ratio(3, 4));
g.CreateAndAddNote(chord, mica::D4);
g.CreateAndAddNote(chord, mica::FSharp4);
MusicNode chordIsland = g.AddChordToNewIsland(chord);
g.Connect(t, chordIsland)->Set(mica::Type) = mica::Partwise;
//Create a final barline.
MusicNode f = g.CreateAndAddBarline(mica::EndBarline);
g.Connect(chordIsland, f)->Set(mica::Type) = mica::Partwise;
//--------------//
//Bass Clef Part//
//--------------//
/*Create barline, clef, key signature, and time signature tokens. Each token
is created and added to its own island (which is a container for tokens).*/
MusicNode b2 = g.CreateAndAddBarline();
MusicNode c2 = g.CreateAndAddClef(mica::BassClef);
MusicNode k2 = g.CreateAndAddKeySignature(mica::TwoSharps, mica::Major);
MusicNode t2 = g.CreateAndAddTimeSignature(3, prim::Ratio(1, 4));
//Link the clef island from the barline island
g.Connect(b2, c2)->Set(mica::Type) = mica::Partwise;
//Link the key signature island from the clef island.
g.Connect(c2, k2)->Set(mica::Type) = mica::Partwise;
//Link the time signature island from the key signature island.
g.Connect(k2, t2)->Set(mica::Type) = mica::Partwise;
/*Create a quarter-note chord and link its island partwise from the time
signature island.*/
MusicNode chord2 = g.CreateChord(prim::Ratio(3, 4));
g.CreateAndAddNote(chord2, mica::D3);
g.CreateAndAddNote(chord2, mica::A3);
MusicNode chordIsland2= g.AddChordToNewIsland(chord2);
g.Connect(t2, chordIsland2)->Set(mica::Type) = mica::Partwise;
//Create a final barline.
MusicNode f2 = g.CreateAndAddBarline(mica::EndBarline);
g.Connect(chordIsland2, f2)->Set(mica::Type) = mica::Partwise;
//-------------------------------//
//Link Parts Together Instantwise//
//-------------------------------//
g.Connect(b, b2)->Set(mica::Type) = mica::Instantwise;
g.Connect(c, c2)->Set(mica::Type) = mica::Instantwise;
g.Connect(k, k2)->Set(mica::Type) = mica::Instantwise;
g.Connect(t, t2)->Set(mica::Type) = mica::Instantwise;
g.Connect(chordIsland, chordIsland2)->Set(mica::Type) = mica::Instantwise;
g.Connect(f, f2)->Set(mica::Type) = mica::Instantwise;
/*Export the graph, reimport the graph (as a test of serialization), and
show a visualization of it.*/
Music h;
h.ImportXML(g.ExportXML());
Utility::OpenGraphVisualization(h);
prim::c >> h.ExportXML();
prim::c >> h;
return prim::c.Finish();
}
| 40.75188
| 80
| 0.670295
|
haskellstudio
|
4331717305b8ac1f93dfea037084fb024e9e1bc2
| 1,794
|
cpp
|
C++
|
cpp/rom_field_F384PM.cpp
|
zerjioang/core
|
ae092583a4b333dd975438a720da7cccfcd27707
|
[
"Apache-2.0"
] | 133
|
2019-09-04T14:42:38.000Z
|
2022-03-24T12:21:32.000Z
|
cpp/rom_field_F384PM.cpp
|
zerjioang/core
|
ae092583a4b333dd975438a720da7cccfcd27707
|
[
"Apache-2.0"
] | 40
|
2019-10-02T15:01:38.000Z
|
2022-03-16T13:35:43.000Z
|
cpp/rom_field_F384PM.cpp
|
zerjioang/core
|
ae092583a4b333dd975438a720da7cccfcd27707
|
[
"Apache-2.0"
] | 53
|
2019-09-09T18:50:20.000Z
|
2022-03-22T07:17:08.000Z
|
/*
* Copyright (c) 2012-2020 MIRACL UK Ltd.
*
* This file is part of MIRACL Core
* (see https://github.com/miracl/core).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "arch.h"
#include "fp_F384PM.h"
namespace F384PM {
/* NUMS 384-bit modulus */
#if CHUNK==16
#error Not supported
#endif
#if CHUNK==32
using namespace B384_29;
// Base Bits= 29
const BIG Modulus= {0x1FFFFEC3,0x1FFFFFFF,0x1FFFFFFF,0x1FFFFFFF,0x1FFFFFFF,0x1FFFFFFF,0x1FFFFFFF,0x1FFFFFFF,0x1FFFFFFF,0x1FFFFFFF,0x1FFFFFFF,0x1FFFFFFF,0x1FFFFFFF,0x7F};
const BIG ROI= {0x1FFFFEC2,0x1FFFFFFF,0x1FFFFFFF,0x1FFFFFFF,0x1FFFFFFF,0x1FFFFFFF,0x1FFFFFFF,0x1FFFFFFF,0x1FFFFFFF,0x1FFFFFFF,0x1FFFFFFF,0x1FFFFFFF,0x1FFFFFFF,0x7F};
const BIG R2modp= {0x0,0x4448000,0x6,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0};
const chunk MConst= 0x13D;
#endif
#if CHUNK==64
using namespace B384_58;
// Base Bits= 58
const BIG Modulus= {0x3FFFFFFFFFFFEC3L,0x3FFFFFFFFFFFFFFL,0x3FFFFFFFFFFFFFFL,0x3FFFFFFFFFFFFFFL,0x3FFFFFFFFFFFFFFL,0x3FFFFFFFFFFFFFFL,0xFFFFFFFFFL};
const BIG R2modp= {0x88900000000000L,0x6L,0x0L,0x0L,0x0L,0x0L,0x0L};
const BIG ROI= {0x3FFFFFFFFFFFEC2L,0x3FFFFFFFFFFFFFFL,0x3FFFFFFFFFFFFFFL,0x3FFFFFFFFFFFFFFL,0x3FFFFFFFFFFFFFFL,0x3FFFFFFFFFFFFFFL,0xFFFFFFFFFL};
const chunk MConst= 0x13DL;
#endif
}
| 32.035714
| 169
| 0.780379
|
zerjioang
|
4332a04f349395c20e332b3a784516a73c4a3acf
| 5,177
|
cpp
|
C++
|
source/System/CPUInfo/CPUInfo_Private.cpp
|
Praxinos/ULIS3
|
98eb48293fdd3b45fcfe4b659d471572100d1623
|
[
"RSA-MD"
] | 30
|
2020-09-16T17:39:36.000Z
|
2022-02-17T08:32:53.000Z
|
source/System/CPUInfo/CPUInfo_Private.cpp
|
Praxinos/ULIS3
|
98eb48293fdd3b45fcfe4b659d471572100d1623
|
[
"RSA-MD"
] | 7
|
2020-11-23T14:37:15.000Z
|
2022-01-17T11:35:32.000Z
|
source/System/CPUInfo/CPUInfo_Private.cpp
|
Praxinos/ULIS3
|
98eb48293fdd3b45fcfe4b659d471572100d1623
|
[
"RSA-MD"
] | 5
|
2020-09-17T00:39:14.000Z
|
2021-08-30T16:14:07.000Z
|
/*
* kaze
*__________________
* @file CPUInfo_Private.cpp
* @author Clement Berthaud
* @brief This file provides the definition for the FCPUInfo_Private tools.
* @copyright Copyright 2021 Clement Berthaud.
* @license Please refer to LICENSE.md
*/
#include "System/CPUInfo/CPUInfo_Private.h"
#include "System/CPUInfo/CPUInfoHelpers.h"
#if defined( ULIS_WIN )
#include "System/CPUInfo/CPUInfo_Windows.inl"
#elif defined( ULIS_MACOS )
#include "System/CPUInfo/CPUInfo_macOS.inl"
#elif defined( ULIS_LINUX )
#include "System/CPUInfo/CPUInfo_Linux.inl"
#else
#include "System/CPUInfo/CPUInfo_Generic.inl"
#endif
ULIS_NAMESPACE_BEGIN
FCPUInfo_Private::FCPUInfo_Private()
: features_bitfield( 0 )
, max_workers( static_cast< uint32 >( detail::num_workers() ) )
, l1_cache_size( 65536 )
, l1_cache_line_size( 64 )
{
detail::cache_info( 1, &l1_cache_size, &l1_cache_line_size );
features_bitfield |= ULIS_W_OS_X64( uint64( detail::detect_OS_x64() ) );
features_bitfield |= ULIS_W_OS_AVX( uint64( detail::detect_OS_AVX() ) );
features_bitfield |= ULIS_W_OS_AVX512( uint64( detail::detect_OS_AVX512() ) );
std::string vendor( detail::get_vendor_string() );
if( vendor == "GenuineIntel" )
features_bitfield |= ULIS_R_HW_INTEL( 1 );
else if( vendor == "AuthenticAMD")
features_bitfield |= ULIS_R_HW_AMD( 1 );
int info[4] { 0, 0, 0, 0 };
detail::cpuid( info, 0 );
int nIds = info[0];
detail::cpuid( info, 0x80000000 );
uint32_t nExIds = info[0];
if( nIds >= 0x00000001 ) {
detail::cpuid( info, 0x00000001 );
features_bitfield |= ULIS_W_HW_MMX( uint64( ( info[3] & ( uint64( 1 ) << 23 ) ) != 0 ) );
features_bitfield |= ULIS_W_HW_SSE( uint64( ( info[3] & ( uint64( 1 ) << 25 ) ) != 0 ) );
features_bitfield |= ULIS_W_HW_SSE2( uint64( ( info[3] & ( uint64( 1 ) << 26 ) ) != 0 ) );
features_bitfield |= ULIS_W_HW_SSE3( uint64( ( info[2] & ( uint64( 1 ) << 0 ) ) != 0 ) );
features_bitfield |= ULIS_W_HW_SSSE3( uint64( ( info[2] & ( uint64( 1 ) << 9 ) ) != 0 ) );
features_bitfield |= ULIS_W_HW_SSE41( uint64( ( info[2] & ( uint64( 1 ) << 19 ) ) != 0 ) );
features_bitfield |= ULIS_W_HW_SSE42( uint64( ( info[2] & ( uint64( 1 ) << 20 ) ) != 0 ) );
features_bitfield |= ULIS_W_HW_AES( uint64( ( info[2] & ( uint64( 1 ) << 25 ) ) != 0 ) );
features_bitfield |= ULIS_W_HW_AVX( uint64( ( info[2] & ( uint64( 1 ) << 28 ) ) != 0 ) );
features_bitfield |= ULIS_W_HW_FMA3( uint64( ( info[2] & ( uint64( 1 ) << 12 ) ) != 0 ) );
features_bitfield |= ULIS_W_HW_RDRAND( uint64( ( info[2] & ( uint64( 1 ) << 30 ) ) != 0 ) );
}
if( nIds >= 0x00000007 ) {
detail::cpuid( info, 0x00000007 );
features_bitfield |= ULIS_W_HW_AVX2( uint64( ( info[1] & ( uint64( 1 ) << 5 ) ) != 0 ) );
features_bitfield |= ULIS_W_HW_BMI1( uint64( ( info[1] & ( uint64( 1 ) << 3 ) ) != 0 ) );
features_bitfield |= ULIS_W_HW_BMI2( uint64( ( info[1] & ( uint64( 1 ) << 8 ) ) != 0 ) );
features_bitfield |= ULIS_W_HW_ADX( uint64( ( info[1] & ( uint64( 1 ) << 19 ) ) != 0 ) );
features_bitfield |= ULIS_W_HW_MPX( uint64( ( info[1] & ( uint64( 1 ) << 14 ) ) != 0 ) );
features_bitfield |= ULIS_W_HW_SHA( uint64( ( info[1] & ( uint64( 1 ) << 29 ) ) != 0 ) );
features_bitfield |= ULIS_W_HW_PREFETCHWT1( uint64( ( info[2] & ( uint64( 1 ) << 0 ) ) != 0 ) );
features_bitfield |= ULIS_W_HW_AVX512_F( uint64( ( info[1] & ( uint64( 1 ) << 16 ) ) != 0 ) );
features_bitfield |= ULIS_W_HW_AVX512_CD( uint64( ( info[1] & ( uint64( 1 ) << 28 ) ) != 0 ) );
features_bitfield |= ULIS_W_HW_AVX512_PF( uint64( ( info[1] & ( uint64( 1 ) << 26 ) ) != 0 ) );
features_bitfield |= ULIS_W_HW_AVX512_ER( uint64( ( info[1] & ( uint64( 1 ) << 27 ) ) != 0 ) );
features_bitfield |= ULIS_W_HW_AVX512_VL( uint64( ( info[1] & ( uint64( 1 ) << 31 ) ) != 0 ) );
features_bitfield |= ULIS_W_HW_AVX512_BW( uint64( ( info[1] & ( uint64( 1 ) << 30 ) ) != 0 ) );
features_bitfield |= ULIS_W_HW_AVX512_DQ( uint64( ( info[1] & ( uint64( 1 ) << 17 ) ) != 0 ) );
features_bitfield |= ULIS_W_HW_AVX512_IFMA( uint64( ( info[1] & ( uint64( 1 ) << 21 ) ) != 0 ) );
features_bitfield |= ULIS_W_HW_AVX512_VBMI( uint64( ( info[2] & ( uint64( 1 ) << 1 ) ) != 0 ) );
}
if( nExIds >= 0x80000001 ) {
detail::cpuid( info, 0x80000001 );
features_bitfield |= ULIS_W_HW_X64( uint64( ( info[3] & ( uint64( 1 ) << 29 ) ) != 0 ) );
features_bitfield |= ULIS_W_HW_ABM( uint64( ( info[2] & ( uint64( 1 ) << 5 ) ) != 0 ) );
features_bitfield |= ULIS_W_HW_SSE4A( uint64( ( info[2] & ( uint64( 1 ) << 6 ) ) != 0 ) );
features_bitfield |= ULIS_W_HW_FMA4( uint64( ( info[2] & ( uint64( 1 ) << 16 ) ) != 0 ) );
features_bitfield |= ULIS_W_HW_XOP( uint64( ( info[2] & ( uint64( 1 ) << 11 ) ) != 0 ) );
}
}
ULIS_NAMESPACE_END
| 53.927083
| 108
| 0.565965
|
Praxinos
|
43354a170b1c217ee5bb68cebe6fab6e2b7b871c
| 584
|
cpp
|
C++
|
CC/CF/UniqueNumber.cpp
|
MrRobo24/Codes
|
9513f42b61e898577123d5b996e43ba7a067a019
|
[
"MIT"
] | 1
|
2020-10-12T08:03:20.000Z
|
2020-10-12T08:03:20.000Z
|
CC/CF/UniqueNumber.cpp
|
MrRobo24/Codes
|
9513f42b61e898577123d5b996e43ba7a067a019
|
[
"MIT"
] | null | null | null |
CC/CF/UniqueNumber.cpp
|
MrRobo24/Codes
|
9513f42b61e898577123d5b996e43ba7a067a019
|
[
"MIT"
] | null | null | null |
//AC
#include <bits/stdc++.h>
#define LLI long long
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
LLI t;
cin >> t;
while (t--) {
LLI x;
cin >> x;
if (x > 45) {
cout << -1 << "\n";
continue;
}
string ans = "";
LLI s = 9;
while (x > 0) {
if (x < s) {
s = x;
}
x -= s;
ans = (char)('0' + s) + ans;
s--;
}
cout << ans << "\n";
}
return 0;
}
| 14.6
| 40
| 0.333904
|
MrRobo24
|
433616b4fd14a9773fcbc76963fa29ec69c08b56
| 836
|
cpp
|
C++
|
storm/dp_knapsack_bottom-up.cpp
|
italo-batista/problems-solving
|
f83ad34f0abebd52925c4020635556f20743ba06
|
[
"MIT"
] | null | null | null |
storm/dp_knapsack_bottom-up.cpp
|
italo-batista/problems-solving
|
f83ad34f0abebd52925c4020635556f20743ba06
|
[
"MIT"
] | null | null | null |
storm/dp_knapsack_bottom-up.cpp
|
italo-batista/problems-solving
|
f83ad34f0abebd52925c4020635556f20743ba06
|
[
"MIT"
] | null | null | null |
#include <bits/stdc++.h>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <cstdlib>
#include <algorithm>
#define MAX 4000
using namespace std;
int n, s, peso[MAX], valor[MAX], dp[MAX][MAX];
int main() {
memset(dp, -1, sizeof(dp)); // dp[all i] = -1
cin >> s >> n;
for (int i=1; i<=n; i++) {
cin >> peso[i] >> valor[i];
}
// knapsack algo
for (int i=0; i<=n; i++) {
int obj = i;
for (int j=0; j<=s; j++) {
if (i == 0 || j == 0) dp[obj][j] = 0;
else {
int aguenta = j;
int n_coloca = dp[obj-1][aguenta];
if (peso[obj] <= aguenta) {
int coloca = valor[obj] + dp[obj-1][aguenta-peso[obj]];
dp[obj][aguenta] = max(coloca, n_coloca);
} else {
dp[obj][aguenta] = n_coloca;
}
}
}
}
cout << dp[n][s];
return 0;
}
| 15.481481
| 60
| 0.503589
|
italo-batista
|
433665e9296f999511098d4171f36eb6d3552a6e
| 38,083
|
cpp
|
C++
|
src/asdxShader.cpp
|
ProjectAsura/asdx11
|
67c3d4129f3e6d32e66c64ee9354d873f99d0eaf
|
[
"MIT"
] | null | null | null |
src/asdxShader.cpp
|
ProjectAsura/asdx11
|
67c3d4129f3e6d32e66c64ee9354d873f99d0eaf
|
[
"MIT"
] | null | null | null |
src/asdxShader.cpp
|
ProjectAsura/asdx11
|
67c3d4129f3e6d32e66c64ee9354d873f99d0eaf
|
[
"MIT"
] | null | null | null |
//-----------------------------------------------------------------------------
// File : asdxShader.h
// Desc : Shader Set Module.
// Copyright(c) Project Asura. ALl right reserved.
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// Includes
//-----------------------------------------------------------------------------
#include <asdxShader.h>
#include <asdxLogger.h>
namespace asdx {
///////////////////////////////////////////////////////////////////////////////
// ShaderCBV class
///////////////////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
// コンストラクタです.
//-----------------------------------------------------------------------------
ShaderCBV::ShaderCBV()
{ /* DO_NOTHING */ }
//-----------------------------------------------------------------------------
// デストラクタです.
//-----------------------------------------------------------------------------
ShaderCBV::~ShaderCBV()
{ Term(); }
//-----------------------------------------------------------------------------
// 初期化処理を行います.
//-----------------------------------------------------------------------------
bool ShaderCBV::Init
(
ID3D11Device* pDevice,
ID3D11ShaderReflectionConstantBuffer* pReflection
)
{
if (pDevice == nullptr || pReflection == nullptr)
{
ELOG("Error : Invalid Argument.");
return false;
}
D3D11_SHADER_BUFFER_DESC buf_desc;
auto hr = pReflection->GetDesc(&buf_desc);
if (FAILED(hr))
{
ELOG("Error : ID3D11ShaderReflectionConstantBuffer::GetDesc() Failed. recode = 0x%x", hr);
return false;
}
auto size = buf_desc.Size;
m_Memory.resize(size);
D3D11_BUFFER_DESC cb_desc = {};
cb_desc.Usage = D3D11_USAGE_DEFAULT;
cb_desc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
cb_desc.ByteWidth = size;
cb_desc.CPUAccessFlags = 0;
hr = pDevice->CreateBuffer(&cb_desc, nullptr, m_CB.GetAddress());
if (FAILED(hr))
{
ELOG("Error : ID3D11Device::CreateBuffer() Failed");
return false;
}
for(auto i=0u; i<buf_desc.Variables; ++i)
{
auto pVar = pReflection->GetVariableByIndex(i);
if (pVar == nullptr)
{ continue; }
D3D11_SHADER_VARIABLE_DESC var_desc;
hr = pVar->GetDesc(&var_desc);
if (FAILED(hr))
{ continue; }
BufferParam param;
param.Offset = var_desc.StartOffset;
param.Size = var_desc.Size;
if (!Contain(var_desc.Name))
{ m_ParamMap[var_desc.Name] = param; }
auto head = m_Memory.data();
memcpy(head + var_desc.StartOffset, var_desc.DefaultValue, var_desc.Size);
}
return true;
}
//-----------------------------------------------------------------------------
// 終了処理を行います.
//-----------------------------------------------------------------------------
void ShaderCBV::Term()
{
m_CB.Reset();
m_ParamMap.clear();
m_Memory .clear();
}
//-----------------------------------------------------------------------------
// パラメータを設定します.
//-----------------------------------------------------------------------------
bool ShaderCBV::SetParam(const char* name, const void* ptr, size_t size)
{
if (!Contain(name))
{ return false; }
auto param = m_ParamMap[name];
if (param.Size != size)
{ return false; }
auto head = m_Memory.data();
memcpy(head + param.Offset, ptr, param.Size);
return true;
}
//-----------------------------------------------------------------------------
// パラメータを取得します.
//-----------------------------------------------------------------------------
bool ShaderCBV::GetParam(const char* name, void* ptr, size_t size) const
{
if (!Contain(name))
{ return false; }
auto param = m_ParamMap.at(name);
if (param.Size != size)
{ return false; }
auto head = m_Memory.data();
memcpy(ptr, head + param.Offset, param.Size);
return true;
}
//-----------------------------------------------------------------------------
// 指定されたパラメータ名が含まれるかチェックします.
//-----------------------------------------------------------------------------
bool ShaderCBV::Contain(const char* name) const
{ return m_ParamMap.find(name) != m_ParamMap.end(); }
//-----------------------------------------------------------------------------
// サブリソースを更新します.
//-----------------------------------------------------------------------------
void ShaderCBV::UpdateSubresource(ID3D11DeviceContext* pContext)
{ pContext->UpdateSubresource(m_CB.GetPtr(), 0, nullptr, m_Memory.data(), 0, 0); }
//-----------------------------------------------------------------------------
// バッファを返却します
//-----------------------------------------------------------------------------
ID3D11Buffer* ShaderCBV::GetPtr() const
{ return m_CB.GetPtr(); }
///////////////////////////////////////////////////////////////////////////////
// VertexShader class
///////////////////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
// コンストラクタです.
//-----------------------------------------------------------------------------
VertexShader::VertexShader()
{ /* DO_NOTHING */ }
//-----------------------------------------------------------------------------
// デストラクタです.
//-----------------------------------------------------------------------------
VertexShader::~VertexShader()
{ Term(); }
//-----------------------------------------------------------------------------
// 初期化処理を行います.
//-----------------------------------------------------------------------------
bool VertexShader::Init
(
ID3D11Device* pDevice,
const uint8_t* pBinary,
size_t binarySize,
uint32_t elementCount,
const D3D11_INPUT_ELEMENT_DESC* pElements
)
{
auto hr = pDevice->CreateVertexShader(pBinary, binarySize, nullptr, m_VS.GetAddress());
if (FAILED(hr))
{
ELOG("Error : ID3D11Device::CreateVertexShader() Failed.");
Term();
return false;
}
hr = pDevice->CreateInputLayout(pElements, elementCount, pBinary, binarySize, m_IL.GetAddress());
if (FAILED(hr))
{
ELOG("Error : ID3D11Device::CreateInputLayout() Failed.");
Term();
return false;
}
hr = D3DReflect(pBinary, binarySize, IID_PPV_ARGS(m_Reflection.GetAddress()));
if (FAILED(hr))
{
ELOG("Error : D3DReflect() Failed.");
Term();
return false;
}
return true;
}
//-----------------------------------------------------------------------------
// ソースコードから初期化処理を行います.
//-----------------------------------------------------------------------------
bool VertexShader::Init
(
ID3D11Device* pDevice,
const wchar_t* path,
const char* entryPoint,
const char* shaderModel,
uint32_t elementCount,
const D3D11_INPUT_ELEMENT_DESC* pElements
)
{
DWORD flag = D3DCOMPILE_ENABLE_STRICTNESS;
#if defined(DEBUG) || defined(_DEBUG)
flag |= D3DCOMPILE_DEBUG;
#else
flag |= D3DCOMPILE_OPTIMIZATION_LEVEL3;
#endif
RefPtr<ID3DBlob> pBlob;
RefPtr<ID3DBlob> pErrorBlob;
auto hr = D3DCompileFromFile(
path,
nullptr,
D3D_COMPILE_STANDARD_FILE_INCLUDE,
entryPoint,
shaderModel,
flag,
0,
pBlob.GetAddress(),
pErrorBlob.GetAddress());
if (FAILED(hr))
{
if (pErrorBlob.GetPtr() != nullptr)
{ ELOGA("Error : D3DCompileFromFile() Failed. msg = %s", pErrorBlob->GetBufferPointer()); }
ELOGA("Error : D3DCompileFromFile() errcode = 0x%x", hr);
Term();
return false;
}
return Init(
pDevice,
reinterpret_cast<uint8_t*>(pBlob->GetBufferPointer()),
pBlob->GetBufferSize(),
elementCount,
pElements);
}
//-----------------------------------------------------------------------------
// ソースコードから初期化処理を行います.
//-----------------------------------------------------------------------------
bool VertexShader::Init
(
ID3D11Device* pDevice,
const char* sourceCode,
size_t sourceCodeSize,
const char* entryPoint,
const char* shaderModel,
uint32_t elementCount,
const D3D11_INPUT_ELEMENT_DESC* pElements
)
{
DWORD flag = D3DCOMPILE_ENABLE_STRICTNESS;
#if defined(DEBUG) || defined(_DEBUG)
flag |= D3DCOMPILE_DEBUG;
#else
flag |= D3DCOMPILE_OPTIMIZATION_LEVEL3;
#endif
RefPtr<ID3DBlob> pBlob;
RefPtr<ID3DBlob> pErrorBlob;
auto hr = D3DCompile(
sourceCode,
sourceCodeSize,
"vertex_shader",
nullptr,
D3D_COMPILE_STANDARD_FILE_INCLUDE,
entryPoint,
shaderModel,
flag,
0,
pBlob.GetAddress(),
pErrorBlob.GetAddress());
if (FAILED(hr))
{
if (pErrorBlob.GetPtr() != nullptr)
{ ELOGA("Error : D3DCompileFromFile() Failed. msg = %s", pErrorBlob->GetBufferPointer()); }
ELOGA("Error : D3DCompileFromFile() errcode = 0x%x", hr);
Term();
return false;
}
return Init(
pDevice,
reinterpret_cast<uint8_t*>(pBlob->GetBufferPointer()),
pBlob->GetBufferSize(),
elementCount,
pElements);
}
//-----------------------------------------------------------------------------
// 終了処理を行います.
//-----------------------------------------------------------------------------
void VertexShader::Term()
{
m_VS.Reset();
m_IL.Reset();
m_Reflection.Reset();
}
//-----------------------------------------------------------------------------
// シェーダを設定します.
//-----------------------------------------------------------------------------
void VertexShader::Bind(ID3D11DeviceContext* pContext)
{
pContext->IASetInputLayout(m_IL.GetPtr());
pContext->VSSetShader(m_VS.GetPtr(), nullptr, 0);
}
//-----------------------------------------------------------------------------
// シェーダの設定を解除します.
//-----------------------------------------------------------------------------
void VertexShader::UnBind(ID3D11DeviceContext* pContext)
{
pContext->IASetInputLayout(nullptr);
pContext->VSSetShader(nullptr, nullptr, 0);
}
//-----------------------------------------------------------------------------
// シェーダリフレクションを取得します.
//-----------------------------------------------------------------------------
ID3D11ShaderReflection* VertexShader::GetReflection() const
{
return m_Reflection.GetPtr();
}
///////////////////////////////////////////////////////////////////////////////
// PixelShader class
///////////////////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
// コンストラクタです.
//-----------------------------------------------------------------------------
PixelShader::PixelShader()
{ /* DO_NOTHING */ }
//-----------------------------------------------------------------------------
// デストラクタです.
//-----------------------------------------------------------------------------
PixelShader::~PixelShader()
{ Term(); }
//-----------------------------------------------------------------------------
// 初期化処理を行います.
//-----------------------------------------------------------------------------
bool PixelShader::Init(ID3D11Device* pDevice, const uint8_t* pBinary, size_t binarySize)
{
auto hr = pDevice->CreatePixelShader(pBinary, binarySize, nullptr, m_PS.GetAddress());
if (FAILED(hr))
{
ELOG("Error : ID3D11Device::CreatePixelShader() Failed.");
Term();
return false;
}
hr = D3DReflect(pBinary, binarySize, IID_PPV_ARGS(m_Reflection.GetAddress()));
if (FAILED(hr))
{
ELOG("Error : D3DReflect() Failed.");
Term();
return false;
}
return true;
}
//-----------------------------------------------------------------------------
// ソースコードから初期化処理を行います.
//-----------------------------------------------------------------------------
bool PixelShader::Init
(
ID3D11Device* pDevice,
const wchar_t* path,
const char* entryPoint,
const char* shaderModel
)
{
DWORD flag = D3DCOMPILE_ENABLE_STRICTNESS;
#if defined(DEBUG) || defined(_DEBUG)
flag |= D3DCOMPILE_DEBUG;
#else
flag |= D3DCOMPILE_OPTIMIZATION_LEVEL3;
#endif
RefPtr<ID3DBlob> pBlob;
RefPtr<ID3DBlob> pErrorBlob;
auto hr = D3DCompileFromFile(
path,
nullptr,
D3D_COMPILE_STANDARD_FILE_INCLUDE,
entryPoint,
shaderModel,
flag,
0,
pBlob.GetAddress(),
pErrorBlob.GetAddress());
if (FAILED(hr))
{
if (pErrorBlob.GetPtr() != nullptr)
{ ELOGA("Error : D3DCompileFromFile() Failed. msg = %s", pErrorBlob->GetBufferPointer()); }
ELOGA("Error : D3DCompileFromFile() errcode = 0x%x", hr);
Term();
return false;
}
return Init(
pDevice,
reinterpret_cast<uint8_t*>(pBlob->GetBufferPointer()),
pBlob->GetBufferSize());
}
//-----------------------------------------------------------------------------
// ソースコードから初期化処理を行います.
//-----------------------------------------------------------------------------
bool PixelShader::Init
(
ID3D11Device* pDevice,
const char* sourceCode,
size_t sourceCodeSize,
const char* entryPoint,
const char* shaderModel
)
{
DWORD flag = D3DCOMPILE_ENABLE_STRICTNESS;
#if defined(DEBUG) || defined(_DEBUG)
flag |= D3DCOMPILE_DEBUG;
#else
flag |= D3DCOMPILE_OPTIMIZATION_LEVEL3;
#endif
RefPtr<ID3DBlob> pBlob;
RefPtr<ID3DBlob> pErrorBlob;
auto hr = D3DCompile(
sourceCode,
sourceCodeSize,
"pixel_shader",
nullptr,
D3D_COMPILE_STANDARD_FILE_INCLUDE,
entryPoint,
shaderModel,
flag,
0,
pBlob.GetAddress(),
pErrorBlob.GetAddress());
if (FAILED(hr))
{
if (pErrorBlob.GetPtr() != nullptr)
{ ELOGA("Error : D3DCompileFromFile() Failed. msg = %s", pErrorBlob->GetBufferPointer()); }
ELOGA("Error : D3DCompileFromFile() errcode = 0x%x", hr);
Term();
return false;
}
return Init(
pDevice,
reinterpret_cast<uint8_t*>(pBlob->GetBufferPointer()),
pBlob->GetBufferSize());
}
//-----------------------------------------------------------------------------
// 終了処理を行います.
//-----------------------------------------------------------------------------
void PixelShader::Term()
{
m_PS.Reset();
m_Reflection.Reset();
}
//-----------------------------------------------------------------------------
// シェーダを設定します.
//-----------------------------------------------------------------------------
void PixelShader::Bind(ID3D11DeviceContext* pContext)
{
pContext->PSSetShader(m_PS.GetPtr(), nullptr, 0);
}
//-----------------------------------------------------------------------------
// シェーダの設定を解除します.
//-----------------------------------------------------------------------------
void PixelShader::UnBind(ID3D11DeviceContext* pContext)
{
pContext->PSSetShader(nullptr, nullptr, 0);
}
//-----------------------------------------------------------------------------
// シェーダリフレクションを取得します.
//-----------------------------------------------------------------------------
ID3D11ShaderReflection* PixelShader::GetReflection() const
{
return m_Reflection.GetPtr();
}
///////////////////////////////////////////////////////////////////////////////
// GeometryShader class
///////////////////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
// コンストラクタです.
//-----------------------------------------------------------------------------
GeometryShader::GeometryShader()
{ /* DO_NOTHING */ }
//-----------------------------------------------------------------------------
// デストラクタです.
//-----------------------------------------------------------------------------
GeometryShader::~GeometryShader()
{ Term(); }
//-----------------------------------------------------------------------------
// 初期化処理を行います.
//-----------------------------------------------------------------------------
bool GeometryShader::Init(ID3D11Device* pDevice, const uint8_t* pBinary, size_t binarySize)
{
auto hr = pDevice->CreateGeometryShader(pBinary, binarySize, nullptr, m_GS.GetAddress());
if (FAILED(hr))
{
ELOG("Error : ID3D11Device::CreateGeometryShader() Failed.");
Term();
return false;
}
hr = D3DReflect(pBinary, binarySize, IID_PPV_ARGS(m_Reflection.GetAddress()));
if (FAILED(hr))
{
ELOG("Error : D3DReflect() Failed.");
Term();
return false;
}
return true;
}
//-----------------------------------------------------------------------------
// ソースコードから初期化処理を行います.
//-----------------------------------------------------------------------------
bool GeometryShader::Init
(
ID3D11Device* pDevice,
const wchar_t* path,
const char* entryPoint,
const char* shaderModel
)
{
DWORD flag = D3DCOMPILE_ENABLE_STRICTNESS;
#if defined(DEBUG) || defined(_DEBUG)
flag |= D3DCOMPILE_DEBUG;
#else
flag |= D3DCOMPILE_OPTIMIZATION_LEVEL3;
#endif
RefPtr<ID3DBlob> pBlob;
RefPtr<ID3DBlob> pErrorBlob;
auto hr = D3DCompileFromFile(
path,
nullptr,
D3D_COMPILE_STANDARD_FILE_INCLUDE,
entryPoint,
shaderModel,
flag,
0,
pBlob.GetAddress(),
pErrorBlob.GetAddress());
if (FAILED(hr))
{
if (pErrorBlob.GetPtr() != nullptr)
{ ELOGA("Error : D3DCompileFromFile() Failed. msg = %s", pErrorBlob->GetBufferPointer()); }
ELOGA("Error : D3DCompileFromFile() errcode = 0x%x", hr);
Term();
return false;
}
return Init(
pDevice,
reinterpret_cast<uint8_t*>(pBlob->GetBufferPointer()),
pBlob->GetBufferSize());
}
//-----------------------------------------------------------------------------
// ソースコードから初期化処理を行います.
//-----------------------------------------------------------------------------
bool GeometryShader::Init
(
ID3D11Device* pDevice,
const char* sourceCode,
size_t sourceCodeSize,
const char* entryPoint,
const char* shaderModel
)
{
DWORD flag = D3DCOMPILE_ENABLE_STRICTNESS;
#if defined(DEBUG) || defined(_DEBUG)
flag |= D3DCOMPILE_DEBUG;
#else
flag |= D3DCOMPILE_OPTIMIZATION_LEVEL3;
#endif
RefPtr<ID3DBlob> pBlob;
RefPtr<ID3DBlob> pErrorBlob;
auto hr = D3DCompile(
sourceCode,
sourceCodeSize,
"geometry_shader",
nullptr,
D3D_COMPILE_STANDARD_FILE_INCLUDE,
entryPoint,
shaderModel,
flag,
0,
pBlob.GetAddress(),
pErrorBlob.GetAddress());
if (FAILED(hr))
{
if (pErrorBlob.GetPtr() != nullptr)
{ ELOGA("Error : D3DCompileFromFile() Failed. msg = %s", pErrorBlob->GetBufferPointer()); }
ELOGA("Error : D3DCompileFromFile() errcode = 0x%x", hr);
Term();
return false;
}
return Init(
pDevice,
reinterpret_cast<uint8_t*>(pBlob->GetBufferPointer()),
pBlob->GetBufferSize());
}
//-----------------------------------------------------------------------------
// 終了処理を行います.
//-----------------------------------------------------------------------------
void GeometryShader::Term()
{
m_GS.Reset();
m_Reflection.Reset();
}
//-----------------------------------------------------------------------------
// シェーダを設定します.
//-----------------------------------------------------------------------------
void GeometryShader::Bind(ID3D11DeviceContext* pContext)
{
pContext->GSSetShader(m_GS.GetPtr(), nullptr, 0);
}
//-----------------------------------------------------------------------------
// シェーダの設定を解除します.
//-----------------------------------------------------------------------------
void GeometryShader::UnBind(ID3D11DeviceContext* pContext)
{
pContext->GSSetShader(nullptr, nullptr, 0);
}
//-----------------------------------------------------------------------------
// シェーダリフレクションを取得します.
//-----------------------------------------------------------------------------
ID3D11ShaderReflection* GeometryShader::GetReflection() const
{
return m_Reflection.GetPtr();
}
///////////////////////////////////////////////////////////////////////////////
// HullShader class
///////////////////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
// コンストラクタです.
//-----------------------------------------------------------------------------
HullShader::HullShader()
{ /* DO_NOTHING */ }
//-----------------------------------------------------------------------------
// デストラクタです.
//-----------------------------------------------------------------------------
HullShader::~HullShader()
{ Term(); }
//-----------------------------------------------------------------------------
// 初期化処理を行います.
//-----------------------------------------------------------------------------
bool HullShader::Init(ID3D11Device* pDevice, const uint8_t* pBinary, size_t binarySize)
{
auto hr = pDevice->CreateHullShader(pBinary, binarySize, nullptr, m_HS.GetAddress());
if (FAILED(hr))
{
ELOG("Error : ID3D11Device::CreatePixelShader() Failed.");
Term();
return false;
}
hr = D3DReflect(pBinary, binarySize, IID_PPV_ARGS(m_Reflection.GetAddress()));
if (FAILED(hr))
{
ELOG("Error : D3DReflect() Failed.");
Term();
return false;
}
return true;
}
//-----------------------------------------------------------------------------
// ソースコードから初期化処理を行います.
//-----------------------------------------------------------------------------
bool HullShader::Init
(
ID3D11Device* pDevice,
const wchar_t* path,
const char* entryPoint,
const char* shaderModel
)
{
DWORD flag = D3DCOMPILE_ENABLE_STRICTNESS;
#if defined(DEBUG) || defined(_DEBUG)
flag |= D3DCOMPILE_DEBUG;
#else
flag |= D3DCOMPILE_OPTIMIZATION_LEVEL3;
#endif
RefPtr<ID3DBlob> pBlob;
RefPtr<ID3DBlob> pErrorBlob;
auto hr = D3DCompileFromFile(
path,
nullptr,
D3D_COMPILE_STANDARD_FILE_INCLUDE,
entryPoint,
shaderModel,
flag,
0,
pBlob.GetAddress(),
pErrorBlob.GetAddress());
if (FAILED(hr))
{
if (pErrorBlob.GetPtr() != nullptr)
{ ELOGA("Error : D3DCompileFromFile() Failed. msg = %s", pErrorBlob->GetBufferPointer()); }
ELOGA("Error : D3DCompileFromFile() errcode = 0x%x", hr);
Term();
return false;
}
return Init(
pDevice,
reinterpret_cast<uint8_t*>(pBlob->GetBufferPointer()),
pBlob->GetBufferSize());
}
//-----------------------------------------------------------------------------
// ソースコードから初期化処理を行います.
//-----------------------------------------------------------------------------
bool HullShader::Init
(
ID3D11Device* pDevice,
const char* sourceCode,
size_t sourceCodeSize,
const char* entryPoint,
const char* shaderModel
)
{
DWORD flag = D3DCOMPILE_ENABLE_STRICTNESS;
#if defined(DEBUG) || defined(_DEBUG)
flag |= D3DCOMPILE_DEBUG;
#else
flag |= D3DCOMPILE_OPTIMIZATION_LEVEL3;
#endif
RefPtr<ID3DBlob> pBlob;
RefPtr<ID3DBlob> pErrorBlob;
auto hr = D3DCompile(
sourceCode,
sourceCodeSize,
"hull_shader",
nullptr,
D3D_COMPILE_STANDARD_FILE_INCLUDE,
entryPoint,
shaderModel,
flag,
0,
pBlob.GetAddress(),
pErrorBlob.GetAddress());
if (FAILED(hr))
{
if (pErrorBlob.GetPtr() != nullptr)
{ ELOGA("Error : D3DCompileFromFile() Failed. msg = %s", pErrorBlob->GetBufferPointer()); }
ELOGA("Error : D3DCompileFromFile() errcode = 0x%x", hr);
Term();
return false;
}
return Init(
pDevice,
reinterpret_cast<uint8_t*>(pBlob->GetBufferPointer()),
pBlob->GetBufferSize());
}
//-----------------------------------------------------------------------------
// 終了処理を行います.
//-----------------------------------------------------------------------------
void HullShader::Term()
{
m_HS.Reset();
m_Reflection.Reset();
}
//-----------------------------------------------------------------------------
// シェーダを設定します.
//-----------------------------------------------------------------------------
void HullShader::Bind(ID3D11DeviceContext* pContext)
{
pContext->HSSetShader(m_HS.GetPtr(), nullptr, 0);
}
//-----------------------------------------------------------------------------
// シェーダの設定を解除します.
//-----------------------------------------------------------------------------
void HullShader::UnBind(ID3D11DeviceContext* pContext)
{
pContext->HSSetShader(nullptr, nullptr, 0);
}
//-----------------------------------------------------------------------------
// シェーダリフレクションを取得します.
//-----------------------------------------------------------------------------
ID3D11ShaderReflection* HullShader::GetReflection() const
{
return m_Reflection.GetPtr();
}
///////////////////////////////////////////////////////////////////////////////
// DomainShader class
///////////////////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
// コンストラクタです.
//-----------------------------------------------------------------------------
DomainShader::DomainShader()
{ /* DO_NOTHING */ }
//-----------------------------------------------------------------------------
// デストラクタです.
//-----------------------------------------------------------------------------
DomainShader::~DomainShader()
{ Term(); }
//-----------------------------------------------------------------------------
// 初期化処理を行います.
//-----------------------------------------------------------------------------
bool DomainShader::Init(ID3D11Device* pDevice, const uint8_t* pBinary, size_t binarySize)
{
auto hr = pDevice->CreateDomainShader(pBinary, binarySize, nullptr, m_DS.GetAddress());
if (FAILED(hr))
{
ELOG("Error : ID3D11Device::CreateDomainShader() Failed.");
Term();
return false;
}
hr = D3DReflect(pBinary, binarySize, IID_PPV_ARGS(m_Reflection.GetAddress()));
if (FAILED(hr))
{
ELOG("Error : D3DReflect() Failed.");
Term();
return false;
}
return true;
}
//-----------------------------------------------------------------------------
// ソースコードから初期化処理を行います.
//-----------------------------------------------------------------------------
bool DomainShader::Init
(
ID3D11Device* pDevice,
const wchar_t* path,
const char* entryPoint,
const char* shaderModel
)
{
DWORD flag = D3DCOMPILE_ENABLE_STRICTNESS;
#if defined(DEBUG) || defined(_DEBUG)
flag |= D3DCOMPILE_DEBUG;
#else
flag |= D3DCOMPILE_OPTIMIZATION_LEVEL3;
#endif
RefPtr<ID3DBlob> pBlob;
RefPtr<ID3DBlob> pErrorBlob;
auto hr = D3DCompileFromFile(
path,
nullptr,
D3D_COMPILE_STANDARD_FILE_INCLUDE,
entryPoint,
shaderModel,
flag,
0,
pBlob.GetAddress(),
pErrorBlob.GetAddress());
if (FAILED(hr))
{
if (pErrorBlob.GetPtr() != nullptr)
{ ELOGA("Error : D3DCompileFromFile() Failed. msg = %s", pErrorBlob->GetBufferPointer()); }
ELOGA("Error : D3DCompileFromFile() errcode = 0x%x", hr);
Term();
return false;
}
return Init(
pDevice,
reinterpret_cast<uint8_t*>(pBlob->GetBufferPointer()),
pBlob->GetBufferSize());
}
//-----------------------------------------------------------------------------
// ソースコードから初期化処理を行います.
//-----------------------------------------------------------------------------
bool DomainShader::Init
(
ID3D11Device* pDevice,
const char* sourceCode,
size_t sourceCodeSize,
const char* entryPoint,
const char* shaderModel
)
{
DWORD flag = D3DCOMPILE_ENABLE_STRICTNESS;
#if defined(DEBUG) || defined(_DEBUG)
flag |= D3DCOMPILE_DEBUG;
#else
flag |= D3DCOMPILE_OPTIMIZATION_LEVEL3;
#endif
RefPtr<ID3DBlob> pBlob;
RefPtr<ID3DBlob> pErrorBlob;
auto hr = D3DCompile(
sourceCode,
sourceCodeSize,
"domain_shader",
nullptr,
D3D_COMPILE_STANDARD_FILE_INCLUDE,
entryPoint,
shaderModel,
flag,
0,
pBlob.GetAddress(),
pErrorBlob.GetAddress());
if (FAILED(hr))
{
if (pErrorBlob.GetPtr() != nullptr)
{ ELOGA("Error : D3DCompileFromFile() Failed. msg = %s", pErrorBlob->GetBufferPointer()); }
ELOGA("Error : D3DCompileFromFile() errcode = 0x%x", hr);
Term();
return false;
}
return Init(
pDevice,
reinterpret_cast<uint8_t*>(pBlob->GetBufferPointer()),
pBlob->GetBufferSize());
}
//-----------------------------------------------------------------------------
// 終了処理を行います.
//-----------------------------------------------------------------------------
void DomainShader::Term()
{
m_DS.Reset();
m_Reflection.Reset();
}
//-----------------------------------------------------------------------------
// シェーダを設定します.
//-----------------------------------------------------------------------------
void DomainShader::Bind(ID3D11DeviceContext* pContext)
{
pContext->DSSetShader(m_DS.GetPtr(), nullptr, 0);
}
//-----------------------------------------------------------------------------
// シェーダの設定を解除します.
//-----------------------------------------------------------------------------
void DomainShader::UnBind(ID3D11DeviceContext* pContext)
{
pContext->DSSetShader(nullptr, nullptr, 0);
}
//-----------------------------------------------------------------------------
// シェーダリフレクションを取得します.
//-----------------------------------------------------------------------------
ID3D11ShaderReflection* DomainShader::GetReflection() const
{
return m_Reflection.GetPtr();
}
///////////////////////////////////////////////////////////////////////////////
// ComputeShader class
///////////////////////////////////////////////////////////////////////////////
//-----------------------------------------------------------------------------
// コンストラクタです.
//-----------------------------------------------------------------------------
ComputeShader::ComputeShader()
: m_ThreadX(0)
, m_ThreadY(0)
, m_ThreadZ(0)
{ /* DO_NOTHING */ }
//-----------------------------------------------------------------------------
// デストラクタです.
//-----------------------------------------------------------------------------
ComputeShader::~ComputeShader()
{ Term(); }
//-----------------------------------------------------------------------------
// 初期化処理を行います.
//-----------------------------------------------------------------------------
bool ComputeShader::Init(ID3D11Device* pDevice, const uint8_t* pBinary, size_t binarySize)
{
auto hr = pDevice->CreateComputeShader(pBinary, binarySize, nullptr, m_CS.GetAddress());
if (FAILED(hr))
{
ELOG("Error : ID3D11Device::CreatePixelShader() Failed.");
Term();
return false;
}
hr = D3DReflect(pBinary, binarySize, IID_PPV_ARGS(m_Reflection.GetAddress()));
if (FAILED(hr))
{
ELOG("Error : D3DReflect() Failed.");
Term();
return false;
}
m_Reflection->GetThreadGroupSize(&m_ThreadX, &m_ThreadY, &m_ThreadZ);
return true;
}
//-----------------------------------------------------------------------------
// ソースコードから初期化処理を行います.
//-----------------------------------------------------------------------------
bool ComputeShader::Init
(
ID3D11Device* pDevice,
const wchar_t* path,
const char* entryPoint,
const char* shaderModel
)
{
DWORD flag = D3DCOMPILE_ENABLE_STRICTNESS;
#if defined(DEBUG) || defined(_DEBUG)
flag |= D3DCOMPILE_DEBUG;
#else
flag |= D3DCOMPILE_OPTIMIZATION_LEVEL3;
#endif
RefPtr<ID3DBlob> pBlob;
RefPtr<ID3DBlob> pErrorBlob;
auto hr = D3DCompileFromFile(
path,
nullptr,
D3D_COMPILE_STANDARD_FILE_INCLUDE,
entryPoint,
shaderModel,
flag,
0,
pBlob.GetAddress(),
pErrorBlob.GetAddress());
if (FAILED(hr))
{
if (pErrorBlob.GetPtr() != nullptr)
{ ELOGA("Error : D3DCompileFromFile() Failed. msg = %s", pErrorBlob->GetBufferPointer()); }
ELOGA("Error : D3DCompileFromFile() errcode = 0x%x", hr);
Term();
return false;
}
return Init(
pDevice,
reinterpret_cast<uint8_t*>(pBlob->GetBufferPointer()),
pBlob->GetBufferSize());
}
//-----------------------------------------------------------------------------
// ソースコードから初期化処理を行います.
//-----------------------------------------------------------------------------
bool ComputeShader::Init
(
ID3D11Device* pDevice,
const char* sourceCode,
size_t sourceCodeSize,
const char* entryPoint,
const char* shaderModel
)
{
DWORD flag = D3DCOMPILE_ENABLE_STRICTNESS;
#if defined(DEBUG) || defined(_DEBUG)
flag |= D3DCOMPILE_DEBUG;
#else
flag |= D3DCOMPILE_OPTIMIZATION_LEVEL3;
#endif
RefPtr<ID3DBlob> pBlob;
RefPtr<ID3DBlob> pErrorBlob;
auto hr = D3DCompile(
sourceCode,
sourceCodeSize,
"compute_shader",
nullptr,
D3D_COMPILE_STANDARD_FILE_INCLUDE,
entryPoint,
shaderModel,
flag,
0,
pBlob.GetAddress(),
pErrorBlob.GetAddress());
if (FAILED(hr))
{
if (pErrorBlob.GetPtr() != nullptr)
{ ELOGA("Error : D3DCompileFromFile() Failed. msg = %s", pErrorBlob->GetBufferPointer()); }
ELOGA("Error : D3DCompileFromFile() errcode = 0x%x", hr);
Term();
return false;
}
return Init(
pDevice,
reinterpret_cast<uint8_t*>(pBlob->GetBufferPointer()),
pBlob->GetBufferSize());
}
//-----------------------------------------------------------------------------
// 終了処理を行います.
//-----------------------------------------------------------------------------
void ComputeShader::Term()
{
m_CS.Reset();
m_Reflection.Reset();
m_ThreadX = m_ThreadY = m_ThreadZ = 0;
}
//-----------------------------------------------------------------------------
// シェーダを設定します.
//-----------------------------------------------------------------------------
void ComputeShader::Bind(ID3D11DeviceContext* pContext)
{
pContext->CSSetShader(m_CS.GetPtr(), nullptr, 0);
}
//-----------------------------------------------------------------------------
// シェーダの設定を解除します.
//-----------------------------------------------------------------------------
void ComputeShader::UnBind(ID3D11DeviceContext* pContext)
{
pContext->CSSetShader(nullptr, nullptr, 0);
}
//-----------------------------------------------------------------------------
// ディスパッチします.
//-----------------------------------------------------------------------------
void ComputeShader::Dispatch(ID3D11DeviceContext* pContext)
{
pContext->Dispatch(m_ThreadX, m_ThreadY, m_ThreadZ);
}
//-----------------------------------------------------------------------------
// シェーダリフレクションを取得します.
//-----------------------------------------------------------------------------
ID3D11ShaderReflection* ComputeShader::GetReflection() const
{
return m_Reflection.GetPtr();
}
} // namespace asdx
| 30.712097
| 102
| 0.401675
|
ProjectAsura
|
43369c1a9cdd4d4bdffa3902ad50618e8a5962ee
| 1,182
|
cpp
|
C++
|
cmps109/asg4/debug.cpp
|
isaiah-solo/ucsc-classes
|
a3e834ee26822827f7ea4977707ecf7e42e1b0c9
|
[
"MIT"
] | 1
|
2018-05-11T19:14:47.000Z
|
2018-05-11T19:14:47.000Z
|
cmps109/asg4/debug.cpp
|
isaiah-solo/ucsc-classes
|
a3e834ee26822827f7ea4977707ecf7e42e1b0c9
|
[
"MIT"
] | null | null | null |
cmps109/asg4/debug.cpp
|
isaiah-solo/ucsc-classes
|
a3e834ee26822827f7ea4977707ecf7e42e1b0c9
|
[
"MIT"
] | 3
|
2019-04-19T03:38:47.000Z
|
2019-06-02T20:59:21.000Z
|
// $Id: debug.cpp,v 1.2 2014-05-08 18:07:04-07 - - $
#include <cassert>
#include <climits>
#include <iostream>
#include <vector>
using namespace std;
#include "debug.h"
#include "util.h"
vector<bool> debugflags::flags (UCHAR_MAX + 1, false);
void debugflags::setflags (const string& initflags) {
for (const char flag: initflags) {
if (flag == '@') flags.assign (flags.size(), true);
else flags[flag] = true;
}
// Note that DEBUGF can trace setflags.
if (getflag ('x')) {
string flag_chars;
for (size_t index = 0; index < flags.size(); ++index) {
if (getflag (index)) flag_chars += (char) index;
}
}
}
//
// getflag -
// Check to see if a certain flag is on.
//
bool debugflags::getflag (char flag) {
// WARNING: Don't TRACE this function or the stack will blow up.
unsigned uflag = (unsigned char) flag;
assert (uflag < flags.size());
return flags[uflag];
}
void debugflags::where (char flag, const char* file, int line,
const char* func) {
cout << sys_info::execname() << ": DEBUG(" << flag << ") "
<< file << "[" << line << "] " << func << "()" << endl;
}
| 25.695652
| 67
| 0.580372
|
isaiah-solo
|
4337b08acc7c11d11f0080fecfdd8a9033effeee
| 50,009
|
cxx
|
C++
|
src/decomposition/path/path.cxx
|
huttered40/critter
|
50609be057ff62b8f9f8018355736749bc83cfc9
|
[
"BSD-2-Clause"
] | 1
|
2021-09-12T01:44:43.000Z
|
2021-09-12T01:44:43.000Z
|
src/decomposition/path/path.cxx
|
huttered40/critter
|
50609be057ff62b8f9f8018355736749bc83cfc9
|
[
"BSD-2-Clause"
] | 20
|
2020-02-29T03:12:33.000Z
|
2020-12-21T17:43:34.000Z
|
src/decomposition/path/path.cxx
|
huttered40/critter
|
50609be057ff62b8f9f8018355736749bc83cfc9
|
[
"BSD-2-Clause"
] | 1
|
2020-07-21T11:52:54.000Z
|
2020-07-21T11:52:54.000Z
|
#include "path.h"
#include "../container/symbol_tracker.h"
#include "../../discretization/util/util.h"
#include "../util/util.h"
#include "../../util/util.h"
namespace critter{
namespace internal{
namespace decomposition{
void path::exchange_communicators(MPI_Comm oldcomm, MPI_Comm newcomm){
// Accumulate the computation time between last communication routine
// as both execution-time and computation time into both
// the execution-time critical path data structures and the
// per-process data structures.
volatile auto curtime = MPI_Wtime();
auto save_comp_time = curtime - computation_timer;
if (mode==1){
cp_costs[num_cp_measures-1] += save_comp_time;
cp_costs[num_cp_measures-3] += save_comp_time;
vol_costs[num_vol_measures-1] += save_comp_time;
vol_costs[num_vol_measures-3] += save_comp_time;
if (path_decomposition == 1){
for (size_t i=0; i<path_count; i++){
cp_costs[cp_costs_size-path_count-1-i] += save_comp_time; }
}
if (path_decomposition == 2 && path_count>0 && symbol_stack.size()>0){
// Get the current symbol's execution-time since last
// communication routine or its inception.
// Accumulate as both execution-time and computation time
// into both the execution-time critical path data structures
// and the per-process data structures.
auto last_symbol_time = curtime - symbol_timers[symbol_stack.top()].start_timer.top();
for (auto i=0; i<path_count; i++){
for (auto j=0; j<path_measure_index.size(); j++){
if (path_measure_index[j] == path_measure_select.size()-1){
symbol_timers[symbol_stack.top()].cp_exclusive_measure[i][j] += last_symbol_time;
symbol_timers[symbol_stack.top()].cp_excl_measure[i][j] += last_symbol_time;
} else if (path_measure_index[j] == path_measure_select.size()-2){
symbol_timers[symbol_stack.top()].cp_exclusive_measure[i][j] += last_symbol_time;
symbol_timers[symbol_stack.top()].cp_excl_measure[i][j] += last_symbol_time;
}
}
}
symbol_timers[symbol_stack.top()].pp_exclusive_measure[num_decomp_pp_measures-1] += last_symbol_time;
symbol_timers[symbol_stack.top()].pp_exclusive_measure[num_decomp_pp_measures-2] += last_symbol_time;
symbol_timers[symbol_stack.top()].pp_excl_measure[num_decomp_pp_measures-1] += last_symbol_time;
symbol_timers[symbol_stack.top()].pp_excl_measure[num_decomp_pp_measures-2] += last_symbol_time;
}
}
if (mode==1){
computation_timer = MPI_Wtime();
if (path_decomposition == 2 && path_count>0 && symbol_stack.size()>0){
symbol_timers[symbol_stack.top()].start_timer.top() = computation_timer; }
}
}
bool path::initiate_comp(size_t id, volatile double curtime, float flop_count,
int param1, int param2, int param3, int param4, int param5){
// accumulate computation time
auto save_comp_time = curtime - computation_timer;
cp_costs[num_cp_measures-3] += save_comp_time;
cp_costs[num_cp_measures-1] += save_comp_time;
vol_costs[num_vol_measures-3] += save_comp_time;
vol_costs[num_vol_measures-1] += save_comp_time;
if (path_decomposition == 1){
for (size_t i=0; i<path_count; i++){
cp_costs[cp_costs_size-path_count-1-i] += save_comp_time; }
}
if (path_decomposition == 2 && path_count>0 && symbol_stack.size()>0){
// Get the current symbol's execution-time since last
// communication routine or its inception.
// Accumulate as both execution-time and computation time
// into both the execution-time critical path data structures
// and the per-process data structures.
auto last_symbol_time = curtime - symbol_timers[symbol_stack.top()].start_timer.top();
for (auto i=0; i<path_count; i++){
for (auto j=0; j<path_measure_index.size(); j++){
if (path_measure_index[j] == path_measure_select.size()-1){
symbol_timers[symbol_stack.top()].cp_exclusive_measure[i][j] += last_symbol_time;
symbol_timers[symbol_stack.top()].cp_excl_measure[i][j] += last_symbol_time;
} else if (path_measure_index[j] == path_measure_select.size()-2){
symbol_timers[symbol_stack.top()].cp_exclusive_measure[i][j] += last_symbol_time;
symbol_timers[symbol_stack.top()].cp_excl_measure[i][j] += last_symbol_time;
}
}
}
symbol_timers[symbol_stack.top()].pp_exclusive_measure[num_decomp_pp_measures-1] += last_symbol_time;
symbol_timers[symbol_stack.top()].pp_exclusive_measure[num_decomp_pp_measures-2] += last_symbol_time;
symbol_timers[symbol_stack.top()].pp_excl_measure[num_decomp_pp_measures-1] += last_symbol_time;
symbol_timers[symbol_stack.top()].pp_excl_measure[num_decomp_pp_measures-2] += last_symbol_time;
}
// start compunication timer for compunication routine
comp_start_time = MPI_Wtime();
return true;
}
void path::complete_comp(double errtime, size_t id, float flop_count,
int param1, int param2, int param3, int param4, int param5){
volatile auto comp_time = MPI_Wtime() - comp_start_time - errtime; // complete computation time
// Save kernel information
if (autotuning_debug == 1){
comp_kernel_key key(-1,id,flop_count,param1,param2,param3,param4,param5);
if (comp_kernel_info.find(key) == comp_kernel_info.end()){
comp_kernel_info[key] = std::make_pair(1,comp_time);
} else{
comp_kernel_info[key].first++;
comp_kernel_info[key].second += comp_time;
}
}
// Decompose measurements along multiple paths by symbol
if (path_decomposition == 2 && path_count>0 && symbol_stack.size()>0){
for (auto i=0; i<path_count; i++){
for (auto j=0; j<path_measure_index.size(); j++){
if (path_measure_index[j] == path_measure_select.size()-5){
symbol_timers[symbol_stack.top()].cp_exclusive_measure[i][j] += flop_count;
symbol_timers[symbol_stack.top()].cp_excl_measure[i][j] += flop_count;
} else if (path_measure_index[j] == path_measure_select.size()-2){
symbol_timers[symbol_stack.top()].cp_exclusive_measure[i][j] += comp_time;
symbol_timers[symbol_stack.top()].cp_excl_measure[i][j] += comp_time;
} else if (path_measure_index[j] == path_measure_select.size()-1){
symbol_timers[symbol_stack.top()].cp_exclusive_measure[i][j] += comp_time;
symbol_timers[symbol_stack.top()].cp_excl_measure[i][j] += comp_time;
}
}
}
symbol_timers[symbol_stack.top()].pp_exclusive_measure[num_decomp_pp_measures-5] += flop_count;
symbol_timers[symbol_stack.top()].pp_excl_measure[num_decomp_pp_measures-5] += flop_count;
symbol_timers[symbol_stack.top()].pp_exclusive_measure[num_decomp_pp_measures-2] += comp_time;
symbol_timers[symbol_stack.top()].pp_excl_measure[num_decomp_pp_measures-2] += comp_time;
symbol_timers[symbol_stack.top()].pp_exclusive_measure[num_decomp_pp_measures-1] += comp_time;
symbol_timers[symbol_stack.top()].pp_excl_measure[num_decomp_pp_measures-1] += comp_time;
}
cp_costs[num_cp_measures-6] += flop_count;
cp_costs[num_cp_measures-3] += comp_time;
cp_costs[num_cp_measures-2] += comp_time;
cp_costs[num_cp_measures-1] += comp_time;
if (path_decomposition == 1){
for (size_t i=0; i<path_count; i++){ cp_costs[cp_costs_size-1-i] += comp_time; }
for (size_t i=0; i<path_count; i++){ cp_costs[cp_costs_size-path_count-1-i] += comp_time; }
for (size_t i=0; i<path_count; i++){ cp_costs[cp_costs_size-3*path_count-1-i] += flop_count; }
}
vol_costs[num_vol_measures-7] += flop_count;
vol_costs[num_vol_measures-3] += comp_time;
vol_costs[num_vol_measures-2] += comp_time;
vol_costs[num_vol_measures-1] += comp_time;
computation_timer = MPI_Wtime();
if (path_decomposition == 2 && path_count>0 && symbol_stack.size()>0){
symbol_timers[symbol_stack.top()].start_timer.top() = computation_timer; }
}
static void update_cp_decomp1(float* in, float* inout, size_t len){
assert(len == cp_costs_size); // this assert prevents user from obtaining wrong output if MPI implementation cuts up the message.
if (path_count > 0){
// We do not track paths for synchronization time nor comp-kernel time, so check for those
for (int i=0; i<path_index.size(); i++){
// 0->0, 1->1, 2->2, 3->3, 4->5, 5->7
int j= path_index[i]<4 ? path_index[i] : path_index[i]+1; if (j==6) j++;
path_decisions[i] = inout[j] > in[j];
}
for (int i=0; i<num_cp_measures; i++){
inout[i] = std::max(inout[i],in[i]);
}
for (int i=num_cp_measures; i<cp_costs_size; i++){
int idx = (i-num_cp_measures)%path_count;
inout[i] = (path_decisions[idx] ? inout[i] : in[i]);
}
} else{
for (int i=0; i<num_cp_measures; i++){
inout[i] = std::max(inout[i],in[i]);
}
}
}
static void update_cp_decomp2(float* in, float* inout, size_t len){
assert(len == cp_costs_size); // this assert prevents user from obtaining wrong output if MPI implementation cuts up the message.
if (path_count > 0){
// We do not track paths for synchronization time nor comp-kernel time, so check for those
for (int i=0; i<path_index.size(); i++){
// 0->0, 1->1, 2->2, 3->3, 4->5, 5->7
int j= path_index[i]<4 ? path_index[i] : path_index[i]+1; if (j==6) j++;
assert(path_index[i] == 5);
path_decisions[i] = inout[j] > in[j];
}
for (int i=0; i<num_cp_measures; i++){
inout[i] = std::max(inout[i],in[i]);
}
size_t path_select_offset = 4*num_decomp_cp_measures+1;
for (int i=num_cp_measures; i<cp_costs_size; i++){
int idx = (i-num_cp_measures)%(path_count*path_select_offset);// restarts for each symbol
idx /= path_select_offset;
inout[i] = (path_decisions[idx] ? inout[i] : in[i]);
}
} else{
for (int i=0; i<num_cp_measures; i++){
inout[i] = std::max(inout[i],in[i]);
}
}
}
static void propagate_cp_decomp1_op(float* in, float* inout, int* len, MPI_Datatype* dtype){
update_cp_decomp1(in,inout,static_cast<size_t>(*len));
}
static void propagate_cp_decomp2_op(float* in, float* inout, int* len, MPI_Datatype* dtype){
update_cp_decomp2(in,inout,static_cast<size_t>(*len));
}
bool path::initiate_comm(blocking& tracker, volatile double curtime, int64_t nelem, MPI_Datatype t, MPI_Comm comm,
bool is_sender, int partner1, int user_tag1, int partner2, int user_tag2){
// Check for conflicting communication tag(s)
if (partner1 != -1) assert(!(user_tag1 >= internal_tag && user_tag1 <= internal_tag5));
if (partner2 != -1) assert(!(user_tag2 >= internal_tag && user_tag2 <= internal_tag5));
// Save and accumulate the computation time between last communication routine as both execution-time and computation time
// into both the execution-time critical path data structures and the per-process data structures.
tracker.comp_time = curtime - computation_timer;
int rank; MPI_Comm_rank(comm, &rank);
MPI_Buffer_attach(&eager_pad[0],eager_pad.size());
// Save caller communication attributes into reference object for use in corresponding static method 'complete'
int word_size,np; MPI_Type_size(t, &word_size);
int64_t nbytes = word_size * nelem;
MPI_Comm_size(comm, &np);
tracker.nbytes = nbytes;
tracker.comm = comm;
tracker.comm_size = np;
tracker.is_sender = is_sender;
tracker.partner1 = partner1;
tracker.partner2 = partner2 != -1 ? partner2 : partner1;// Useful in propagation
tracker.synch_time = 0.;// might get updated below
tracker.barrier_time = 0.;// might get updated below
if (partner1 == MPI_ANY_SOURCE){// only possible for 'MPI_Recv'
MPI_Status st;
PMPI_Probe(partner1,user_tag1,comm,&st);
save_wildcard_id = st.MPI_SOURCE;
tracker.partner1 = save_wildcard_id;
} else if (partner2 == MPI_ANY_SOURCE){// only possible for 'MPI_Sendrecv' / 'MPI_Sendrecv_replace'
assert((tracker.tag == 13) || (tracker.tag == 14));
MPI_Status st;
PMPI_Probe(partner2,user_tag2,comm,&st);
save_wildcard_id = st.MPI_SOURCE;
tracker.partner2 = save_wildcard_id;
}
volatile auto init_time = MPI_Wtime();
if (tracker.partner1 == -1){
PMPI_Barrier(tracker.comm);
tracker.barrier_time = MPI_Wtime() - init_time;
}
else {
MPI_Request barrier_reqs[3]; int barrier_count=0;
char sbuf='H'; char rbuf='H';
if ((is_sender) && (rank != tracker.partner1)){
PMPI_Bsend(&sbuf, 1, MPI_CHAR, tracker.partner1, internal_tag3, tracker.comm);
}
if ((!is_sender) && (rank != tracker.partner1)){
PMPI_Irecv(&rbuf, 1, MPI_CHAR, tracker.partner1, internal_tag3, tracker.comm, &barrier_reqs[barrier_count]); barrier_count++;
}
if ((partner2 != -1) && (rank != partner2)){
PMPI_Irecv(&rbuf, 1, MPI_CHAR, tracker.partner2, internal_tag3, tracker.comm, &barrier_reqs[barrier_count]); barrier_count++;
}
PMPI_Waitall(barrier_count,&barrier_reqs[0],MPI_STATUSES_IGNORE);
if (barrier_count>0) tracker.barrier_time = MPI_Wtime() - init_time;
}
cp_costs[num_cp_measures-3] += tracker.comp_time;
cp_costs[num_cp_measures-1] += tracker.comp_time;
vol_costs[num_vol_measures-3] += tracker.comp_time;
vol_costs[num_vol_measures-1] += tracker.comp_time;
if (path_decomposition == 1){
for (size_t i=0; i<path_count; i++){
cp_costs[cp_costs_size-1-i-path_count] += tracker.comp_time;
cp_costs[cp_costs_size-1-i-2*path_count] += tracker.barrier_time;
}
}
if (path_decomposition == 2 && path_count>0 && symbol_stack.size()>0){
auto last_symbol_time = curtime - symbol_timers[symbol_stack.top()].start_timer.top();
for (auto i=0; i<path_count; i++){
for (auto j=0; j<path_measure_index.size(); j++){
if (path_measure_index[j] == path_measure_select.size()-1){
symbol_timers[symbol_stack.top()].cp_exclusive_measure[i][j] += last_symbol_time;
symbol_timers[symbol_stack.top()].cp_excl_measure[i][j] += last_symbol_time;
} else if (path_measure_index[j] == path_measure_select.size()-2){
symbol_timers[symbol_stack.top()].cp_exclusive_measure[i][j] += last_symbol_time;
symbol_timers[symbol_stack.top()].cp_excl_measure[i][j] += last_symbol_time;
}
}
}
symbol_timers[symbol_stack.top()].pp_exclusive_measure[num_decomp_pp_measures-1] += last_symbol_time;
symbol_timers[symbol_stack.top()].pp_exclusive_measure[num_decomp_pp_measures-2] += last_symbol_time;
symbol_timers[symbol_stack.top()].pp_excl_measure[num_decomp_pp_measures-1] += last_symbol_time;
symbol_timers[symbol_stack.top()].pp_excl_measure[num_decomp_pp_measures-2] += last_symbol_time;
}
if (track_synchronization && tracker.partner1==-1){
// Use the user communication routine to measre synchronization time.
// Note the following consequences of using a tiny 1-byte message (note that 0-byte is trivially handled by most MPI implementations) on measuring synchronization time:
// 1) The collective communication algorithm is likely different for small messages than large messages.
// 2) The eager sending protocol will be utilized, which would incur a potentially significant difference in synchronization time than if rendezvous protocol was invoked.
// Special arrays for use in the collective -v routines as well as Reduce_scatter.
std::vector<int> counts(np,1); std::vector<int> disp(np,0);
if (tracker.tag>=9 && tracker.tag<=12) for (int i=1; i<np; i++) disp[i]=disp[i-1]+1;
// start synchronization timer for communication routine
tracker.start_time = MPI_Wtime();
switch (tracker.tag){
case 0:
PMPI_Barrier(tracker.comm);
break;
case 1:
PMPI_Bcast(&synch_pad_send[0], 1, MPI_CHAR, 0, tracker.comm);// arbitrary root 0
break;
case 2:
PMPI_Reduce(&synch_pad_send[0], &synch_pad_recv[0], 1, MPI_CHAR, MPI_MAX, 0, tracker.comm);// arbitrary root 0
break;
case 3:
PMPI_Allreduce(MPI_IN_PLACE, &synch_pad_send[0], 1, MPI_CHAR, MPI_MAX, tracker.comm);
break;
case 4:
PMPI_Gather(&synch_pad_send[0], 1, MPI_CHAR, &synch_pad_recv[0], 1, MPI_CHAR, 0, tracker.comm);// arbitrary root 0
break;
case 5:
PMPI_Allgather(&synch_pad_send[0], 1, MPI_CHAR, &synch_pad_recv[0], 1, MPI_CHAR, tracker.comm);
break;
case 6:
PMPI_Scatter(&synch_pad_send[0], 1, MPI_CHAR, &synch_pad_recv[0], 1, MPI_CHAR, 0, tracker.comm);// arbitrary root 0
break;
case 7:
PMPI_Reduce_scatter(&synch_pad_send[0], &synch_pad_recv[0], &counts[0], MPI_CHAR, MPI_MAX, tracker.comm);
break;
case 8:
PMPI_Alltoall(&synch_pad_send[0], 1, MPI_CHAR, &synch_pad_recv[0], 1, MPI_CHAR, tracker.comm);
break;
case 9:
PMPI_Gatherv(&synch_pad_send[0], 1, MPI_CHAR, &synch_pad_recv[0], &counts[0], &disp[0], MPI_CHAR, 0, tracker.comm);// arbitrary root 0
break;
case 10:
PMPI_Allgatherv(&synch_pad_send[0], 1, MPI_CHAR, &synch_pad_recv[0], &counts[0], &disp[0], MPI_CHAR, tracker.comm);
break;
case 11:
PMPI_Scatterv(&synch_pad_send[0], &counts[0], &disp[0], MPI_CHAR, &synch_pad_recv[0], 1, MPI_CHAR, 0, tracker.comm);// arbitrary root 0
break;
case 12:
PMPI_Alltoallv(&synch_pad_send[0], &counts[0], &disp[0], MPI_CHAR, &synch_pad_recv[0], &counts[0], &disp[0], MPI_CHAR, tracker.comm);
break;
}
tracker.synch_time = MPI_Wtime()-tracker.start_time;
}
void* temp_buf; int temp_size;
MPI_Buffer_detach(&temp_buf,&temp_size);
// start communication timer for communication routine
tracker.start_time = MPI_Wtime();
return true;
}
void path::complete_comm(blocking& tracker){
volatile auto comm_time = MPI_Wtime() - tracker.start_time; // complete communication time
int rank; MPI_Comm_rank(tracker.comm, &rank);
MPI_Buffer_attach(&eager_pad[0],eager_pad.size());
// Save kernel information
if (autotuning_debug == 1){
assert(comm_channel_map.find(tracker.comm) != comm_channel_map.end());
int comm_sizes[2]={0,0}; int comm_strides[2]={0,0};
for (auto i=0; i<comm_channel_map[tracker.comm]->id.size(); i++){
comm_sizes[i]=comm_channel_map[tracker.comm]->id[i].first;
comm_strides[i]=comm_channel_map[tracker.comm]->id[i].second;
}
comm_kernel_key key(rank,-1,tracker.tag,comm_sizes,comm_strides,tracker.nbytes,tracker.partner1);
if (comm_kernel_info.find(key) == comm_kernel_info.end()){
comm_kernel_info[key] = std::make_pair(1,comm_time);
} else{
comm_kernel_info[key].first++;
comm_kernel_info[key].second += comm_time;
}
}
std::pair<float,float> cost = cost_model == 0 ?
tracker.cost_func_bsp(tracker.nbytes, tracker.comm_size)
: tracker.cost_func_alphabeta(tracker.nbytes, tracker.comm_size);
// Decompose measurements along multiple paths by MPI routine.
*tracker.my_synch_time += tracker.synch_time;
*tracker.my_comm_time += comm_time;
*tracker.my_msg_count += cost.first;
*tracker.my_wrd_count += cost.second;
for (size_t i=0; i<path_count; i++){
*(tracker.cp_synch_time+i) += tracker.synch_time;
*(tracker.cp_comm_time+i) += comm_time;
*(tracker.cp_msg_count+i) += cost.first;
*(tracker.cp_wrd_count+i) += cost.second;
}
// Decompose measurements along multiple paths by symbol
if (path_decomposition == 2 && path_count>0 && symbol_stack.size()>0){
for (auto i=0; i<path_count; i++){
// update all communication-related measures for the top symbol in stack
for (auto j=0; j<path_measure_index.size(); j++){
if (path_measure_index[j] == 0){
symbol_timers[symbol_stack.top()].cp_exclusive_measure[i][j] += cost.second;
symbol_timers[symbol_stack.top()].cp_excl_measure[i][j] += cost.second;
} else if (path_measure_index[j] == 1){
symbol_timers[symbol_stack.top()].cp_exclusive_measure[i][j] += cost.second;
symbol_timers[symbol_stack.top()].cp_excl_measure[i][j] += cost.second;
} else if (path_measure_index[j] == path_measure_select.size()-4){
symbol_timers[symbol_stack.top()].cp_exclusive_measure[i][j] += comm_time;
symbol_timers[symbol_stack.top()].cp_excl_measure[i][j] += comm_time;
} else if (path_measure_index[j] == path_measure_select.size()-3){
symbol_timers[symbol_stack.top()].cp_exclusive_measure[i][j] += tracker.synch_time;
symbol_timers[symbol_stack.top()].cp_excl_measure[i][j] += tracker.synch_time;
} else if (path_measure_index[j] == path_measure_select.size()-1){
symbol_timers[symbol_stack.top()].cp_exclusive_measure[i][j] += comm_time;
symbol_timers[symbol_stack.top()].cp_excl_measure[i][j] += comm_time;
}
}
}
symbol_timers[symbol_stack.top()].pp_exclusive_measure[0] += cost.second;
symbol_timers[symbol_stack.top()].pp_excl_measure[0] += cost.second;
symbol_timers[symbol_stack.top()].pp_exclusive_measure[1] += cost.first;
symbol_timers[symbol_stack.top()].pp_excl_measure[1] += cost.first;
symbol_timers[symbol_stack.top()].pp_exclusive_measure[num_decomp_pp_measures-4] += comm_time;
symbol_timers[symbol_stack.top()].pp_excl_measure[num_decomp_pp_measures-4] += comm_time;
symbol_timers[symbol_stack.top()].pp_exclusive_measure[num_decomp_pp_measures-3] += tracker.synch_time;
symbol_timers[symbol_stack.top()].pp_excl_measure[num_decomp_pp_measures-3] += tracker.synch_time;
symbol_timers[symbol_stack.top()].pp_exclusive_measure[num_decomp_pp_measures-1] += comm_time;
symbol_timers[symbol_stack.top()].pp_excl_measure[num_decomp_pp_measures-1] += comm_time;
if (include_barrier_time){
symbol_timers[symbol_stack.top()].pp_exclusive_measure[num_decomp_pp_measures-1] += tracker.barrier_time;
symbol_timers[symbol_stack.top()].pp_excl_measure[num_decomp_pp_measures-1] += tracker.barrier_time;
}
}
// Update measurements that define the critical path for each metric.
cp_costs[num_cp_measures-8] += cost.second;
cp_costs[num_cp_measures-7] += cost.first;
cp_costs[num_cp_measures-5] += comm_time;
cp_costs[num_cp_measures-4] += tracker.synch_time;
cp_costs[num_cp_measures-1] += comm_time;
vol_costs[num_vol_measures-9] += cost.second;
vol_costs[num_vol_measures-8] += cost.first;
vol_costs[num_vol_measures-6] += tracker.barrier_time;// Note this will be a bit high, as it includes time for last process to enter
vol_costs[num_vol_measures-5] += comm_time;
vol_costs[num_vol_measures-4] += tracker.synch_time;
vol_costs[num_vol_measures-1] += comm_time;
if (include_barrier_time){
vol_costs[num_vol_measures-1] += tracker.barrier_time;
}
// Note that this block of code below is left in solely for blocking communication to avoid over-counting the idle time
// If per-process execution-time gets larger than execution-time along the execution-time critical path,
// subtract out the difference from idle time.
auto path_diff = vol_costs[num_vol_measures-1]-cp_costs[num_cp_measures-1];
if (include_barrier_time==0) path_diff += vol_costs[num_vol_measures-6];
vol_costs[num_vol_measures-6] -= std::max((float)0.,path_diff);
if (path_decomposition == 2 && path_count>0 && symbol_stack.size()>0){
// Special handling of excessively large idle time caused by suspected tool interference
// Specifically, this interference is caused by not subtracting out the barrier time of the last process to enter the barrier (which ideally is 0).
if (include_barrier_time){
symbol_timers[symbol_stack.top()].pp_exclusive_measure[num_decomp_pp_measures-1] -= std::max((float)0.,path_diff);
symbol_timers[symbol_stack.top()].pp_excl_measure[num_decomp_pp_measures-1] -= std::max((float)0.,path_diff);
symbol_timers[symbol_stack.top()].pp_exclusive_measure[num_decomp_pp_measures-6] -= std::max((float)0.,path_diff);
symbol_timers[symbol_stack.top()].pp_excl_measure[num_decomp_pp_measures-6] -= std::max((float)0.,path_diff);
}
}
// Due to granularity of timing, if a per-process measure ever gets more expensive than a critical path measure, we set the per-process measure to the cp measure
for (int i=1; i<=5; i++){
vol_costs[num_vol_measures-i] = std::min(vol_costs[num_vol_measures-i],cp_costs[num_cp_measures-i]);
}
propagate(tracker);
void* temp_buf; int temp_size;
MPI_Buffer_detach(&temp_buf,&temp_size);
// Prepare to leave interception and re-enter user code by restarting computation timers.
bsp_counter++;
computation_timer = MPI_Wtime();
if (path_decomposition == 2 && path_count>0 && symbol_stack.size()>0){
symbol_timers[symbol_stack.top()].start_timer.top() = computation_timer; }
}
// Called by both nonblocking p2p and nonblocking collectives
bool path::initiate_comm(nonblocking& tracker, volatile double curtime, int64_t nelem, MPI_Datatype t, MPI_Comm comm, bool is_sender, int partner, int user_tag){
// Check for conflicting communication tag(s)
if (partner != -1) assert(!(user_tag >= internal_tag && user_tag <= internal_tag5));
tracker.comp_time = curtime - computation_timer;
cp_costs[num_cp_measures-3] += tracker.comp_time;
cp_costs[num_cp_measures-1] += tracker.comp_time;
vol_costs[num_vol_measures-3] += tracker.comp_time;
vol_costs[num_vol_measures-1] += tracker.comp_time;
if (path_decomposition == 1){
for (size_t i=0; i<path_count; i++){
cp_costs[cp_costs_size-1-i-path_count] += tracker.comp_time;
}
}
if (path_decomposition == 2 && path_count>0 && symbol_stack.size()>0){
auto last_symbol_time = curtime - symbol_timers[symbol_stack.top()].start_timer.top();
for (auto i=0; i<path_count; i++){
for (auto j=0; j<path_measure_index.size(); j++){
if (path_measure_index[j] == path_measure_select.size()-1){
symbol_timers[symbol_stack.top()].cp_exclusive_measure[i][j] += last_symbol_time;
symbol_timers[symbol_stack.top()].cp_excl_measure[i][j] += last_symbol_time;
} else if (path_measure_index[j] == path_measure_select.size()-2){
symbol_timers[symbol_stack.top()].cp_exclusive_measure[i][j] += last_symbol_time;
symbol_timers[symbol_stack.top()].cp_excl_measure[i][j] += last_symbol_time;
}
}
}
symbol_timers[symbol_stack.top()].pp_exclusive_measure[num_decomp_pp_measures-1] += last_symbol_time;
symbol_timers[symbol_stack.top()].pp_exclusive_measure[num_decomp_pp_measures-2] += last_symbol_time;
symbol_timers[symbol_stack.top()].pp_excl_measure[num_decomp_pp_measures-1] += last_symbol_time;
symbol_timers[symbol_stack.top()].pp_excl_measure[num_decomp_pp_measures-2] += last_symbol_time;
}
// Note: routine below will be called immediately afterward.
return true;
}
// Called by both nonblocking p2p and nonblocking collectives
void path::initiate_comm(nonblocking& tracker, volatile double itime, int64_t nelem,
MPI_Datatype t, MPI_Comm comm, MPI_Request* request, bool is_sender, int partner, int user_tag){
// Check for conflicting communication tag(s)
if (partner != -1) assert(!(user_tag >= internal_tag && user_tag <= internal_tag5));
// Deal with computational cost at the beginning, but don't synchronize to find computation-critical path-path yet or that will screw up calculation of overlap!
tracker.comp_time = itime;
cp_costs[num_cp_measures-3] += tracker.comp_time;
cp_costs[num_cp_measures-1] += tracker.comp_time;
vol_costs[num_vol_measures-3] += tracker.comp_time;
vol_costs[num_vol_measures-1] += tracker.comp_time;
if (path_decomposition == 1){
for (size_t i=0; i<path_count; i++){
cp_costs[cp_costs_size-1-i-path_count] += tracker.comp_time;
}
}
if (path_decomposition == 2 && path_count>0 && symbol_stack.size()>0){
auto last_symbol_time = itime;
for (auto i=0; i<path_count; i++){
for (auto j=0; j<path_measure_index.size(); j++){
if (path_measure_index[j] == path_measure_select.size()-1){
symbol_timers[symbol_stack.top()].cp_exclusive_measure[i][j] += last_symbol_time;
symbol_timers[symbol_stack.top()].cp_excl_measure[i][j] += last_symbol_time;
} else if (path_measure_index[j] == path_measure_select.size()-2){
symbol_timers[symbol_stack.top()].cp_exclusive_measure[i][j] += last_symbol_time;
symbol_timers[symbol_stack.top()].cp_excl_measure[i][j] += last_symbol_time;
}
}
}
symbol_timers[symbol_stack.top()].pp_exclusive_measure[num_decomp_pp_measures-1] += last_symbol_time;
symbol_timers[symbol_stack.top()].pp_exclusive_measure[num_decomp_pp_measures-2] += last_symbol_time;
symbol_timers[symbol_stack.top()].pp_excl_measure[num_decomp_pp_measures-1] += last_symbol_time;
symbol_timers[symbol_stack.top()].pp_excl_measure[num_decomp_pp_measures-2] += last_symbol_time;
}
int rank; MPI_Comm_rank(comm,&rank);
int el_size,p;
MPI_Type_size(t, &el_size);
int64_t nbytes = el_size * nelem;
MPI_Comm_size(comm, &p);
MPI_Buffer_attach(&eager_pad[0],eager_pad.size());
MPI_Request barrier_req = MPI_REQUEST_NULL;// Only necessary for nonblocking receives
// Issue the barrier call, regardless of msg size
// Note that this is only necessary due to blocking+nonblocking p2p communication
// Therefore, nonblocking collectives need not participate in the barrier call
if (partner!=-1){// Branch protects against nonblocking collectives
if (is_sender && rank != partner){
PMPI_Bsend(&barrier_pad_send, 1, MPI_CHAR, partner, internal_tag3, comm);
}
else if (!is_sender && rank != partner){
PMPI_Irecv(&barrier_pad_recv, 1, MPI_CHAR, partner, internal_tag3, comm, &barrier_req);
}
}
tracker.comm = comm;
tracker.is_sender = is_sender;
tracker.partner1 = partner;
tracker.partner2 = -1;
tracker.comm_size = p;
tracker.nbytes = nbytes;
MPI_Request prop_req = MPI_REQUEST_NULL;
float* path_data = nullptr;
propagate(tracker,path_data,&prop_req);
nonblocking_info msg_info(path_data,barrier_req,prop_req,is_sender,partner,comm,(float)nbytes,(float)p,&tracker);
nonblocking_internal_info[*request] = msg_info;
void* temp_buf; int temp_size;
MPI_Buffer_detach(&temp_buf,&temp_size);
computation_timer = MPI_Wtime();
if (path_decomposition == 2 && path_count>0 && symbol_stack.size()>0){
symbol_timers[symbol_stack.top()].start_timer.top() = computation_timer; }
}
void path::complete_comm(double comp_time){
cp_costs[num_cp_measures-3] += comp_time;
cp_costs[num_cp_measures-1] += comp_time;
if (path_decomposition == 1){
for (size_t i=0; i<path_count; i++){
cp_costs[cp_costs_size-1-i-path_count] += comp_time;
}
}
vol_costs[num_vol_measures-3] += comp_time;
vol_costs[num_vol_measures-1] += comp_time;
// Decompose measurements along multiple paths by symbol
if (path_decomposition == 2 && path_count>0 && symbol_stack.size()>0){
for (auto i=0; i<path_count; i++){
for (auto j=0; j<path_measure_index.size(); j++){
if (path_measure_index[j] == path_measure_select.size()-2){
symbol_timers[symbol_stack.top()].cp_exclusive_measure[i][j] += comp_time;
symbol_timers[symbol_stack.top()].cp_excl_measure[i][j] += comp_time;
} else if (path_measure_index[j] == path_measure_select.size()-1){
symbol_timers[symbol_stack.top()].cp_exclusive_measure[i][j] += comp_time;
symbol_timers[symbol_stack.top()].cp_excl_measure[i][j] += comp_time;
}
}
}
symbol_timers[symbol_stack.top()].pp_exclusive_measure[num_decomp_pp_measures-2] += comp_time;
symbol_timers[symbol_stack.top()].pp_exclusive_measure[num_decomp_pp_measures-1] += comp_time;
symbol_timers[symbol_stack.top()].pp_excl_measure[num_decomp_pp_measures-2] += comp_time;
symbol_timers[symbol_stack.top()].pp_excl_measure[num_decomp_pp_measures-1] += comp_time;
}
}
void path::complete_comm(nonblocking& tracker, MPI_Request* request, double comp_time, double comm_time){
auto info_it = nonblocking_internal_info.find(*request);
assert(info_it != nonblocking_internal_info.end());
tracker.is_sender = info_it->second.is_sender;
tracker.comm = info_it->second.comm;
tracker.partner1 = info_it->second.partner;
tracker.partner2 = -1;
tracker.nbytes = info_it->second.nbytes;
tracker.comm_size = info_it->second.comm_size;
tracker.synch_time=0;
int rank; MPI_Comm_rank(tracker.comm, &rank);
if (autotuning_debug == 1){
assert(comm_channel_map.find(tracker.comm) != comm_channel_map.end());
int comm_sizes[2]={0,0}; int comm_strides[2]={0,0};
for (auto i=0; i<comm_channel_map[tracker.comm]->id.size(); i++){
comm_sizes[i]=comm_channel_map[tracker.comm]->id[i].first;
comm_strides[i]=comm_channel_map[tracker.comm]->id[i].second;
}
comm_kernel_key key(rank,-1,tracker.tag,comm_sizes,comm_strides,tracker.nbytes,tracker.partner1);
if (comm_kernel_info.find(key) == comm_kernel_info.end()){
comm_kernel_info[key] = std::make_pair(1,comm_time);
} else{
comm_kernel_info[key].first++;
comm_kernel_info[key].second += comm_time;
}
}
std::pair<float,float> cost = cost_model == 0 ?
tracker.cost_func_bsp(tracker.nbytes, tracker.comm_size)
: tracker.cost_func_alphabeta(tracker.nbytes, tracker.comm_size);
if (!is_first_request && cost_model==0) cost.first = 0;
// Update measurements that define the critical path for each metric.
cp_costs[0] += cost.second;
cp_costs[1] += cost.first;
cp_costs[num_cp_measures-5] += comm_time;
cp_costs[num_cp_measures-4] += 0.;
cp_costs[num_cp_measures-3] += comp_time;
cp_costs[num_cp_measures-1] += comp_time+comm_time;
if (path_decomposition == 1){
for (size_t i=0; i<path_count; i++){
cp_costs[cp_costs_size-1-i-path_count] += comp_time;
}
}
vol_costs[0] += cost.second;
vol_costs[1] += cost.first;
vol_costs[num_vol_measures-5] += comm_time;
vol_costs[num_vol_measures-3] += comp_time;
vol_costs[num_vol_measures-1] += comp_time+comm_time;
// Due to granularity of timing, if a per-process measure ever gets more expensive than a critical path measure, we set the per-process measure to the cp measure
for (int i=1; i<=5; i++){
vol_costs[num_vol_measures-i] = std::min(vol_costs[num_vol_measures-i],cp_costs[num_cp_measures-i]);
}
// Decompose measurements along multiple paths by MPI routine.
// Accumuate MPI routine-local measurements. The "my_..." members will never modify the accumulations, while the "cp_..." will first accumulate before path propagation.
*tracker.my_synch_time += 0;
*tracker.my_comm_time += comm_time;
*tracker.my_msg_count += cost.first;
*tracker.my_wrd_count += cost.second;
for (size_t i=0; i<path_count; i++){
*(tracker.cp_synch_time+i) += tracker.synch_time;
*(tracker.cp_comm_time+i) += comm_time;
*(tracker.cp_msg_count+i) += cost.first;
*(tracker.cp_wrd_count+i) += cost.second;
}
// Decompose measurements along multiple paths by symbol
if (path_decomposition == 2 && path_count>0 && symbol_stack.size()>0){
for (auto i=0; i<path_count; i++){
for (auto j=0; j<path_measure_index.size(); j++){
if (path_measure_index[j] == 0){
symbol_timers[symbol_stack.top()].cp_exclusive_measure[i][j] += cost.second;
symbol_timers[symbol_stack.top()].cp_excl_measure[i][j] += cost.second;
} else if (path_measure_index[j] == 1){
symbol_timers[symbol_stack.top()].cp_exclusive_measure[i][j] += cost.first;
symbol_timers[symbol_stack.top()].cp_excl_measure[i][j] += cost.first;
} else if (path_measure_index[j] == path_measure_select.size()-4){
symbol_timers[symbol_stack.top()].cp_exclusive_measure[i][j] += comm_time;
symbol_timers[symbol_stack.top()].cp_excl_measure[i][j] += comm_time;
} else if (path_measure_index[j] == path_measure_select.size()-2){
symbol_timers[symbol_stack.top()].cp_exclusive_measure[i][j] += comp_time;
symbol_timers[symbol_stack.top()].cp_excl_measure[i][j] += comp_time;
} else if (path_measure_index[j] == path_measure_select.size()-1){
symbol_timers[symbol_stack.top()].cp_exclusive_measure[i][j] += (comp_time+comm_time);
symbol_timers[symbol_stack.top()].cp_excl_measure[i][j] += (comp_time+comm_time);
}
}
}
symbol_timers[symbol_stack.top()].pp_exclusive_measure[0] += cost.second;
symbol_timers[symbol_stack.top()].pp_exclusive_measure[1] += cost.first;
symbol_timers[symbol_stack.top()].pp_excl_measure[0] += cost.second;
symbol_timers[symbol_stack.top()].pp_excl_measure[1] += cost.first;
symbol_timers[symbol_stack.top()].pp_exclusive_measure[num_decomp_pp_measures-4] += comm_time;
symbol_timers[symbol_stack.top()].pp_exclusive_measure[num_decomp_pp_measures-2] += comp_time;
symbol_timers[symbol_stack.top()].pp_exclusive_measure[num_decomp_pp_measures-1] += (comp_time+comm_time);
symbol_timers[symbol_stack.top()].pp_excl_measure[num_decomp_pp_measures-4] += comm_time;
symbol_timers[symbol_stack.top()].pp_excl_measure[num_decomp_pp_measures-2] += comp_time;
symbol_timers[symbol_stack.top()].pp_excl_measure[num_decomp_pp_measures-1] += (comp_time+comm_time);
}
nonblocking_internal_info.erase(*request);
}
int path::complete_comm(double curtime, MPI_Request* request, MPI_Status* status, int is_test, int* flag){
auto comp_time = curtime - computation_timer;
int ret = MPI_SUCCESS;
auto info_it = nonblocking_internal_info.find(*request);
assert(info_it != nonblocking_internal_info.end());
MPI_Request save_request = info_it->first;
volatile auto last_start_time = MPI_Wtime();
if (is_test == 0) ret = PMPI_Wait(request, status);
else{
ret = PMPI_Test(request,flag,status);
if (*flag == 0){
auto save_comm_time = MPI_Wtime() - last_start_time;
complete_comm(save_comm_time+comp_time);
computation_timer = MPI_Wtime();
if (path_decomposition == 2 && path_count>0 && symbol_stack.size()>0){
symbol_timers[symbol_stack.top()].start_timer.top() = computation_timer; }
return ret;
}
}
auto save_comm_time = MPI_Wtime() - last_start_time;
int rank; MPI_Comm_rank(info_it->second.track->comm,&rank);
if (rank != info_it->second.partner){
// If receiver or collective, complete the barrier and the path data propagation
if (!info_it->second.is_sender || info_it->second.partner==-1){
assert(info_it->second.path_data != nullptr);
MPI_Request req_array[] = {info_it->second.barrier_req, info_it->second.prop_req};
PMPI_Waitall(2, &req_array[0], MPI_STATUSES_IGNORE);
if (path_decomposition <= 1) update_cp_decomp1(info_it->second.path_data,&cp_costs[0],cp_costs_size);
else if (path_decomposition == 2) update_cp_decomp2(info_it->second.path_data,&cp_costs[0],cp_costs_size);
if (info_it->second.path_data != nullptr) free(info_it->second.path_data);
if (info_it->second.partner == MPI_ANY_SOURCE) { info_it->second.track->partner1 = status->MPI_SOURCE; }
}
}
complete_comm(*info_it->second.track, &save_request, comp_time, save_comm_time);
computation_timer = MPI_Wtime();
if (path_decomposition == 2 && path_count>0 && symbol_stack.size()>0){
symbol_timers[symbol_stack.top()].start_timer.top() = computation_timer; }
return ret;
}
int path::complete_comm(double curtime, int count, MPI_Request array_of_requests[], int* indx, MPI_Status* status, int is_test, int* flag){
auto comp_time = curtime - computation_timer;
int ret = MPI_SUCCESS;
// We must save the requests before the completition of a request by the MPI implementation
// because its tag is set to MPI_REQUEST_NULL and lost forever
std::vector<MPI_Request> pt(count); for (int i=0;i<count;i++){pt[i]=(array_of_requests)[i];}
volatile auto last_start_time = MPI_Wtime();
if (is_test == 0) ret = PMPI_Waitany(count,array_of_requests,indx,status);
else{
ret = PMPI_Testany(count,array_of_requests,indx,flag,status);
if (*flag == 0){
auto save_comm_time = MPI_Wtime() - last_start_time;
complete_comm(save_comm_time+comp_time);
computation_timer = MPI_Wtime();
if (path_decomposition == 2 && path_count>0 && symbol_stack.size()>0){
symbol_timers[symbol_stack.top()].start_timer.top() = computation_timer; }
return ret;
}
}
auto waitany_comm_time = MPI_Wtime() - last_start_time;
MPI_Request request = pt[*indx];
auto info_it = nonblocking_internal_info.find(request);
assert(info_it != nonblocking_internal_info.end());
int rank; MPI_Comm_rank(info_it->second.track->comm,&rank);
if (rank != info_it->second.partner){
// If receiver, complete the barrier and the path data propagation
if (!info_it->second.is_sender || info_it->second.partner==-1){
assert(info_it->second.path_data != nullptr);
MPI_Request req_array[] = {info_it->second.barrier_req, info_it->second.prop_req};
PMPI_Waitall(2, &req_array[0], MPI_STATUSES_IGNORE);
if (path_decomposition <= 1) update_cp_decomp1(info_it->second.path_data,&cp_costs[0],cp_costs_size);
else if (path_decomposition == 2) update_cp_decomp2(info_it->second.path_data,&cp_costs[0],cp_costs_size);
if (info_it->second.path_data != nullptr) free(info_it->second.path_data);
if (info_it->second.partner == MPI_ANY_SOURCE) { info_it->second.track->partner1 = status->MPI_SOURCE; }
}
}
complete_comm(*info_it->second.track, &request, comp_time, waitany_comm_time);
computation_timer = MPI_Wtime();
if (path_decomposition == 2 && path_count>0 && symbol_stack.size()>0){
symbol_timers[symbol_stack.top()].start_timer.top() = computation_timer; }
return ret;
}
int path::complete_comm(double curtime, int incount, MPI_Request array_of_requests[], int* outcount, int array_of_indices[],
MPI_Status array_of_statuses[], int is_test){
auto waitsome_comp_time = curtime - computation_timer;
int ret = MPI_SUCCESS;
is_first_request=true;
// We must save the requests before the completition of a request by the MPI implementation
// because its tag is set to MPI_REQUEST_NULL and lost forever
std::vector<MPI_Request> pt(incount); for (int i=0;i<incount;i++){pt[i]=(array_of_requests)[i];}
volatile auto last_start_time = MPI_Wtime();
if (is_test == 0) ret = PMPI_Waitsome(incount,array_of_requests,outcount,array_of_indices,array_of_statuses);
else{
ret = PMPI_Testsome(incount,array_of_requests,outcount,array_of_indices,array_of_statuses);
if (*outcount == 0){
auto save_comm_time = MPI_Wtime() - last_start_time;
complete_comm(save_comm_time+waitsome_comp_time);
computation_timer = MPI_Wtime();
if (path_decomposition == 2 && path_count>0 && symbol_stack.size()>0){
symbol_timers[symbol_stack.top()].start_timer.top() = computation_timer; }
return ret;
}
}
auto waitsome_comm_time = MPI_Wtime() - last_start_time;
for (int i=0; i<*outcount; i++){
MPI_Request request = pt[(array_of_indices)[i]];
auto info_it = nonblocking_internal_info.find(request);
assert(info_it != nonblocking_internal_info.end());
int rank; MPI_Comm_rank(info_it->second.track->comm,&rank);
if (rank != info_it->second.partner){
// If receiver, complete the barrier and the path data propagation
if (!info_it->second.is_sender || info_it->second.partner==-1){
assert(info_it->second.path_data != nullptr);
MPI_Request req_array[] = {info_it->second.barrier_req, info_it->second.prop_req};
PMPI_Waitall(2, &req_array[0], MPI_STATUSES_IGNORE);
if (path_decomposition <= 1) update_cp_decomp1(info_it->second.path_data,&cp_costs[0],cp_costs_size);
else if (path_decomposition == 2) update_cp_decomp2(info_it->second.path_data,&cp_costs[0],cp_costs_size);
if (info_it->second.path_data != nullptr) free(info_it->second.path_data);
if (info_it->second.partner == MPI_ANY_SOURCE) { info_it->second.track->partner1 = (array_of_statuses)[i].MPI_SOURCE; }
}
}
complete_comm(*info_it->second.track, &request, waitsome_comp_time, waitsome_comm_time);
waitsome_comp_time=0; waitsome_comm_time=0; is_first_request=false;
}
computation_timer = MPI_Wtime();
if (path_decomposition == 2 && path_count>0 && symbol_stack.size()>0){
symbol_timers[symbol_stack.top()].start_timer.top() = computation_timer; }
return ret;
}
int path::complete_comm(double curtime, int count, MPI_Request array_of_requests[], MPI_Status array_of_statuses[], int is_test, int* flag){
auto waitall_comp_time = curtime - computation_timer;
int ret = MPI_SUCCESS;
is_first_request=true;
// We must save the requests before the completition of a request by the MPI implementation
// because its tag is set to MPI_REQUEST_NULL and lost forever
std::vector<MPI_Request> pt(count); for (int i=0;i<count;i++){pt[i]=(array_of_requests)[i];}
volatile auto last_start_time = MPI_Wtime();
if (is_test == 0) ret = PMPI_Waitall(count,array_of_requests,array_of_statuses);
else{
ret = PMPI_Testall(count,array_of_requests,flag,array_of_statuses);
if (*flag == 0){
auto save_comm_time = MPI_Wtime() - last_start_time;
complete_comm(save_comm_time+waitall_comp_time);
computation_timer = MPI_Wtime();
if (path_decomposition == 2 && path_count>0 && symbol_stack.size()>0){
symbol_timers[symbol_stack.top()].start_timer.top() = computation_timer; }
return ret;
}
}
auto waitall_comm_time = MPI_Wtime() - last_start_time;
for (int i=0; i<count; i++){
MPI_Request request = pt[i];
auto info_it = nonblocking_internal_info.find(request);
assert(info_it != nonblocking_internal_info.end());
int rank; MPI_Comm_rank(info_it->second.track->comm,&rank);
if (rank != info_it->second.partner){
// If receiver, complete the barrier and the path data propagation
if (!info_it->second.is_sender || info_it->second.partner==-1){
assert(info_it->second.path_data != nullptr);
MPI_Request req_array[] = {info_it->second.barrier_req, info_it->second.prop_req};
PMPI_Waitall(2, &req_array[0], MPI_STATUSES_IGNORE);
if (path_decomposition <= 1) update_cp_decomp1(info_it->second.path_data,&cp_costs[0],cp_costs_size);
else if (path_decomposition == 2) update_cp_decomp2(info_it->second.path_data,&cp_costs[0],cp_costs_size);
if (info_it->second.path_data != nullptr) free(info_it->second.path_data);
if (info_it->second.partner == MPI_ANY_SOURCE) { info_it->second.track->partner1 = (array_of_statuses)[i].MPI_SOURCE; }
}
}
complete_comm(*info_it->second.track, &request, waitall_comp_time, waitall_comm_time);
// Although we have to exchange the path data for each request, we do not want to float-count the computation time nor the communicaion time
waitall_comp_time=0; waitall_comm_time=0; is_first_request=false;
}
computation_timer = MPI_Wtime();
if (path_decomposition == 2 && path_count>0 && symbol_stack.size()>0){
symbol_timers[symbol_stack.top()].start_timer.top() = computation_timer; }
return ret;
}
void path::propagate(blocking& tracker){
int rank; MPI_Comm_rank(tracker.comm,&rank);
if ((rank == tracker.partner1) && (rank == tracker.partner2)) { return; }
// Exchange the tracked routine critical path data
if (tracker.partner1 == -1){
MPI_Op op;
if (path_decomposition <= 1) MPI_Op_create((MPI_User_function*) propagate_cp_decomp1_op,0,&op);
else if (path_decomposition == 2) MPI_Op_create((MPI_User_function*) propagate_cp_decomp2_op,0,&op);
PMPI_Allreduce(MPI_IN_PLACE, &cp_costs[0], cp_costs.size(), MPI_FLOAT, op, tracker.comm);
MPI_Op_free(&op);
} else{
if (tracker.is_sender){
PMPI_Bsend(&cp_costs[0], cp_costs.size(), MPI_FLOAT, tracker.partner1, internal_tag2, tracker.comm);
} else{
PMPI_Recv(&cp_costs_foreign[0], cp_costs.size(), MPI_FLOAT, tracker.partner1, internal_tag2, tracker.comm, MPI_STATUS_IGNORE);
if (path_decomposition <= 1) update_cp_decomp1(&cp_costs_foreign[0],&cp_costs[0],cp_costs_size);
else if (path_decomposition == 2) update_cp_decomp2(&cp_costs_foreign[0],&cp_costs[0],cp_costs_size);
}
if (tracker.partner2 != tracker.partner1){
PMPI_Recv(&cp_costs_foreign[0], cp_costs.size(), MPI_FLOAT, tracker.partner2, internal_tag2, tracker.comm, MPI_STATUS_IGNORE);
if (path_decomposition <= 1) update_cp_decomp1(&cp_costs_foreign[0],&cp_costs[0],cp_costs_size);
else if (path_decomposition == 2) update_cp_decomp2(&cp_costs_foreign[0],&cp_costs[0],cp_costs_size);
}
}
}
void path::propagate(nonblocking& tracker, float*& path_data, MPI_Request* prop_req){
int rank; MPI_Comm_rank(tracker.comm,&rank);
if (rank == tracker.partner1) { return; }
// Exchange the tracked routine critical path data
if (tracker.partner1 == -1){
MPI_Op op;
if (path_decomposition <= 1) MPI_Op_create((MPI_User_function*) propagate_cp_decomp1_op,0,&op);
else if (path_decomposition == 2) MPI_Op_create((MPI_User_function*) propagate_cp_decomp2_op,0,&op);
path_data = (float*)malloc(cp_costs.size()*sizeof(float));
std::memcpy(path_data, &cp_costs[0], cp_costs.size()*sizeof(float));
PMPI_Iallreduce(MPI_IN_PLACE,path_data,cp_costs.size(),MPI_FLOAT,op,tracker.comm,prop_req);
//MPI_Op_free(&op);
}
else{
if (tracker.is_sender){
PMPI_Bsend(&cp_costs[0], cp_costs.size(), MPI_FLOAT, tracker.partner1, internal_tag2, tracker.comm);
}
else{
path_data = (float*)malloc(cp_costs.size()*sizeof(float));
PMPI_Irecv(path_data, cp_costs.size(), MPI_FLOAT, tracker.partner1, internal_tag2, tracker.comm, prop_req);
}
}
}
}
}
}
| 51.55567
| 175
| 0.707793
|
huttered40
|
4337c0bd814d439575b21c2b54f38d573e1d0714
| 4,649
|
cpp
|
C++
|
Source/Gui/OptionBox.cpp
|
alvinahmadov/Dixter
|
6f98f1e84192e1e43eee409bdee6b3dac75d6443
|
[
"MIT"
] | 4
|
2018-12-06T01:20:50.000Z
|
2019-08-04T10:19:23.000Z
|
Source/Gui/OptionBox.cpp
|
alvinahmadov/Dixter
|
6f98f1e84192e1e43eee409bdee6b3dac75d6443
|
[
"MIT"
] | null | null | null |
Source/Gui/OptionBox.cpp
|
alvinahmadov/Dixter
|
6f98f1e84192e1e43eee409bdee6b3dac75d6443
|
[
"MIT"
] | null | null | null |
/**
* Copyright (C) 2015-2019
* Author Alvin Ahmadov <alvin.dev.ahmadov@gmail.com>
*
* This file is part of Dixter Project
* License-Identifier: MIT License
* See README.md for more information.
*/
#include <QDebug>
#include "Utilities.hpp"
#include "Configuration.hpp"
#include "Constants.hpp"
#include "Gui/OptionBox.hpp"
namespace AlgoUtils = Dixter::Utilities::Algorithms;
using std::vector;
namespace Dixter
{
namespace Gui
{
void arrayStringToVector(const QStringList& src, vector<QString>& dest)
{
AlgoUtils::foreachCompound(src, dest, [](const QString& srcValue, QString& destValue)
{
destValue = srcValue;
});
}
void vectorToArrayString(const vector<QString>& src, QStringList& dest)
{
Utilities::Algorithms::foreachCompound(src, dest, [ ](const QString& srcValue, QString& destValue)
{
destValue = srcValue;
});
}
QStringList vectorToArrayString(const vector<QString>& src)
{
QStringList __ret {};
Utilities::Algorithms::foreachCompound(src, __ret, [ ](const QString& srcValue, QString& destValue)
{
destValue = srcValue;
});
return __ret;
}
Int32 compare(const QVariant& v1, const QVariant& v2)
{
return v1.toString().compare(v2.toString());
}
TOptionBox::TOptionBox(QWidget* parent,
const QString& placeholder,
const QSize& size, bool sort)
: QComboBox(parent),
m_isPlaceholderSet(),
m_sort(sort),
m_placeHolder(placeholder)
{
setPlaceholder(placeholder);
if (size.height() > 0 and size.width() > 0)
setMinimumSize(size);
init();
connectEvents();
}
TOptionBox::TOptionBox(const QString& placeholder,
const QSize& size, bool sort)
: TOptionBox(nullptr, placeholder, size, sort)
{ }
inline void TOptionBox::setPlaceholder(const QString& placeholder)
{
if (not placeholder.isEmpty())
{
m_placeHolder = placeholder;
m_isPlaceholderSet = true;
if (count() > 0)
{
int srchNum { };
srchNum = findText(m_placeHolder);
if (srchNum != -1)
{
setCurrentIndex(srchNum);
} else
{
insertItem(0, m_placeHolder);
}
} else
{
addItem(m_placeHolder);
}
setCurrentText(m_placeHolder);
}
}
void TOptionBox::resetPlaceholder()
{
if (m_isPlaceholderSet)
{
auto idx = findText(m_placeHolder);
if (idx > -1)
removeItem(idx);
m_isPlaceholderSet = false;
}
}
void TOptionBox::setValues(vector<TUString>& options, bool sort)
{
Q_UNUSED(sort)
if (options.size() > 0)
{
for (const auto& option : options)
{
auto __option = option.asCustom();
addItem(__option);
}
}
}
void TOptionBox::setValues(const QStringList& options)
{
if (options.size() > 0)
{
for (const auto& option : options)
{
addItem(option);
}
}
}
void TOptionBox::swapCurrent(TOptionBox* src)
{
if(isPlaceholderSet() or src->isPlaceholderSet())
return;
auto __srcCount = src->getItemCount();
auto __currentIndex = currentIndex();
if (__srcCount > 0)
{
setCurrentIndex(src->currentIndex());
src->setCurrentIndex(__currentIndex);
}
}
void TOptionBox::sort(bool ascending)
{
//TODO(Alvin): Reimplement
(void)ascending;
// auto __currentValues = currentData();
// clear();
// if (ascending)
// {
// std::sort(__currentValues.begin(), __currentValues.end(), std::greater<QString>());
// } else
// {
// std::sort(__currentValues.begin(), __currentValues.end(), std::less<QString>());
// }
//
// setValues(__currentValues);
}
Int32 TOptionBox::getItemCount() const
{
return (isPlaceholderSet() ? count() - 1 : count());
}
Int32 TOptionBox::getPosition(const QString& value)
{
Int32 __pos { -1 };
__pos = findText(value);
return __pos;
}
bool TOptionBox::isPlaceholderSet() const
{
return m_isPlaceholderSet;
}
void TOptionBox::onChanged(int)
{
resetPlaceholder();
}
void TOptionBox::init()
{
auto __confMan = getIniManager({ g_guiConfigPath});
auto __bgColour = __confMan->accessor()->getValue(NodeKey::kWinBgColourNode).asCustom();
auto __fontName = __confMan->accessor()->getValue(NodeKey::kWinFontNameNode).asCustom();
int __fontSize = __confMan->accessor()->getValue(NodeKey::kWinFontSizeNode);
__bgColour.prepend('#');
setPalette(QPalette(__bgColour));
setFont(QFont(__fontName, __fontSize));
}
void TOptionBox::connectEvents()
{
connect(this, SIGNAL(activated(int)), SLOT(onChanged(int)));
}
}
}
| 22.244019
| 102
| 0.640783
|
alvinahmadov
|
4338947a412da18f04207d6cd91e24b985b681b3
| 914
|
cpp
|
C++
|
RayTracing/Grid/UI/Float3Slider.cpp
|
DarriusWrightGD/realtimeraytracing
|
1b1117858dcd8880ed88b59ce0388cfb39fc1d96
|
[
"MIT"
] | 1
|
2020-03-27T18:59:57.000Z
|
2020-03-27T18:59:57.000Z
|
RayTracing/Grid/UI/Float3Slider.cpp
|
DarriusWrightGD/RealtimeRaytracing
|
1b1117858dcd8880ed88b59ce0388cfb39fc1d96
|
[
"MIT"
] | null | null | null |
RayTracing/Grid/UI/Float3Slider.cpp
|
DarriusWrightGD/RealtimeRaytracing
|
1b1117858dcd8880ed88b59ce0388cfb39fc1d96
|
[
"MIT"
] | null | null | null |
#include "Float3Slider.h"
Float3Slider::Float3Slider(char * name, glm::vec3 min, glm::vec3 max, float * value , glm::vec3 gran) :
min(min), max(max), value(value), gran(gran)
{
sliderLayout = new QHBoxLayout();
vectorLabel = new QLabel(name);
sliderVector[0] = new FloatSlider("X", min[0],max[0],&value[0], gran[0]);
sliderVector[1] = new FloatSlider("Y", min[1],max[1],&value[1], gran[1]);
sliderVector[2] = new FloatSlider("Z", min[2],max[2],&value[2], gran[2]);
sliderLayout->addWidget(vectorLabel);
sliderLayout->addWidget(sliderVector[0]);
sliderLayout->addWidget(sliderVector[1]);
sliderLayout->addWidget(sliderVector[2]);
sliderLayout->setContentsMargins(0,0,0,0);
sliderLayout->setSpacing(0);
sliderLayout->setMargin(0);
setLayout(sliderLayout);
}
Float3Slider::~Float3Slider(void)
{
}
void Float3Slider::update()
{
for (int i = 0; i < 3; i++)
{
sliderVector[i]->update();
}
}
| 23.435897
| 103
| 0.68709
|
DarriusWrightGD
|
433ae75e9d736f625f831a1620e6e38bc019bf04
| 557
|
cpp
|
C++
|
apps/src/libvideostitch-gui/videostitcher/globalcontroller.cpp
|
tlalexander/stitchEm
|
cdff821ad2c500703e6cb237ec61139fce7bf11c
|
[
"MIT"
] | 182
|
2019-04-19T12:38:30.000Z
|
2022-03-20T16:48:20.000Z
|
apps/src/libvideostitch-gui/videostitcher/globalcontroller.cpp
|
tlalexander/stitchEm
|
cdff821ad2c500703e6cb237ec61139fce7bf11c
|
[
"MIT"
] | 107
|
2019-04-23T10:49:35.000Z
|
2022-03-02T18:12:28.000Z
|
apps/src/libvideostitch-gui/videostitcher/globalcontroller.cpp
|
tlalexander/stitchEm
|
cdff821ad2c500703e6cb237ec61139fce7bf11c
|
[
"MIT"
] | 59
|
2019-06-04T11:27:25.000Z
|
2022-03-17T23:49:49.000Z
|
// Copyright (c) 2012-2017 VideoStitch SAS
// Copyright (c) 2018 stitchEm
#include "globalcontroller.hpp"
GlobalController::GlobalController() : impl(nullptr) {}
GlobalController::~GlobalController() {
Q_ASSERT(impl);
delete impl;
}
StitcherController* GlobalController::getController() const {
Q_ASSERT(impl);
return impl->getController();
}
void GlobalController::createController(int device) {
Q_ASSERT(impl);
impl->createController(device);
}
void GlobalController::deleteController() {
Q_ASSERT(impl);
impl->deleteController();
}
| 20.62963
| 61
| 0.745063
|
tlalexander
|
433cf735c1a16d5d0c1fbc2d7508beafac849f4c
| 750
|
cpp
|
C++
|
cpp/minsk/source/analysis/text/span.cpp
|
Phytolizer/Minsk
|
5fb59f0d5d8cf1f0046471b91e2f5d0c41fc874c
|
[
"MIT"
] | null | null | null |
cpp/minsk/source/analysis/text/span.cpp
|
Phytolizer/Minsk
|
5fb59f0d5d8cf1f0046471b91e2f5d0c41fc874c
|
[
"MIT"
] | 1
|
2022-03-23T03:34:48.000Z
|
2022-03-24T06:47:30.000Z
|
cpp/minsk/source/analysis/text/span.cpp
|
Phytolizer/Minsk
|
5fb59f0d5d8cf1f0046471b91e2f5d0c41fc874c
|
[
"MIT"
] | null | null | null |
#include "minsk/analysis/text/span.hpp"
minsk::analysis::text::text_span::text_span(int start, int length)
: m_start(start), m_length(length) {}
minsk::analysis::text::text_span
minsk::analysis::text::text_span::from_bounds(int start, int end) {
return text_span{start, end - start};
}
int minsk::analysis::text::text_span::start() const { return m_start; }
int minsk::analysis::text::text_span::length() const { return m_length; }
int minsk::analysis::text::text_span::end() const { return m_start + m_length; }
std::ostream &minsk::analysis::text::operator<<(
std::ostream &os, const minsk::analysis::text::text_span &span) {
return os << "text_span{start: " << span.start()
<< ", length: " << span.length() << "}";
}
| 34.090909
| 80
| 0.676
|
Phytolizer
|
433d042ebbf37ddf2d23e09e8c5cf0931dedd2cb
| 5,567
|
cpp
|
C++
|
iotbx/pdb/hierarchy_atoms_bpl.cpp
|
rimmartin/cctbx_project
|
644090f9432d9afc22cfb542fc3ab78ca8e15e5d
|
[
"BSD-3-Clause-LBNL"
] | 155
|
2016-11-23T12:52:16.000Z
|
2022-03-31T15:35:44.000Z
|
iotbx/pdb/hierarchy_atoms_bpl.cpp
|
rimmartin/cctbx_project
|
644090f9432d9afc22cfb542fc3ab78ca8e15e5d
|
[
"BSD-3-Clause-LBNL"
] | 590
|
2016-12-10T11:31:18.000Z
|
2022-03-30T23:10:09.000Z
|
iotbx/pdb/hierarchy_atoms_bpl.cpp
|
rimmartin/cctbx_project
|
644090f9432d9afc22cfb542fc3ab78ca8e15e5d
|
[
"BSD-3-Clause-LBNL"
] | 115
|
2016-11-15T08:17:28.000Z
|
2022-02-09T15:30:14.000Z
|
#include <cctbx/boost_python/flex_fwd.h>
#include <cctbx/xray/scatterer.h>
#include <cctbx/adptbx.h>
#include <cctbx/uctbx.h>
#include <boost/python/class.hpp>
#include <boost/python/dict.hpp>
#include <boost/python/str.hpp>
#include <boost/python/args.hpp>
#include <boost/python/return_arg.hpp>
#include <scitbx/array_family/boost_python/shared_wrapper.h>
#include <scitbx/array_family/boost_python/selections_wrapper.h>
#include <iotbx/pdb/hierarchy_atoms.h>
#include <boost/format.hpp>
namespace iotbx { namespace pdb { namespace hierarchy { namespace atoms {
namespace {
boost::python::dict
build_dict(
af::const_ref<atom> const& atoms,
bool strip_names,
bool upper_names,
bool convert_stars_to_primes,
bool throw_runtime_error_if_duplicate_keys)
{
namespace bp = boost::python;
bp::dict result;
bp::object none;
for(unsigned i=0;i<atoms.size();i++) {
str4 name = atoms[i].data->name;
if (strip_names) name = name.strip();
if (upper_names) name.upper_in_place();
if (convert_stars_to_primes) name.replace_in_place('*', '\'');
bp::str key = name.elems;
bp::object prev_atom = result.get(key);
if (prev_atom.ptr() == none.ptr()) {
result[key] = atoms[i];
}
else if (throw_runtime_error_if_duplicate_keys) {
throw std::runtime_error((boost::format(
"Duplicate keys in build_dict("
"strip_names=%s, upper_names=%s, convert_stars_to_primes=%s):\n"
" %s\n"
" %s")
% (strip_names ? "true" : "false")
% (upper_names ? "true" : "false")
% (convert_stars_to_primes ? "true" : "false")
% bp::extract<atom const&>(prev_atom)().id_str()
% atoms[i].id_str()).str());
}
}
return result;
}
void
set_adps_from_scatterers(
af::const_ref<atom> const& atoms,
af::const_ref<cctbx::xray::scatterer<> > const& scatterers,
cctbx::uctbx::unit_cell const& unit_cell)
{
namespace adptbx = cctbx::adptbx;
for (unsigned i = 0; i < atoms.size(); i++) {
if (scatterers[i].flags.use_u_iso()) {
atoms[i].data->b = adptbx::u_as_b(scatterers[i].u_iso);
atoms[i].uij_erase();
} else if (scatterers[i].flags.use_u_aniso()) {
atoms[i].data->uij = adptbx::u_star_as_u_cart(unit_cell,
scatterers[i].u_star);
atoms[i].data->b = adptbx::u_as_b(adptbx::u_cart_as_u_iso(
atoms[i].data->uij));
}
}
}
} // namespace <anonymous>
void
bpl_wrap()
{
using namespace boost::python;
class_<atom_tmp_sentinel,
std::auto_ptr<atom_tmp_sentinel>,
boost::noncopyable>("atom_data_tmp_sentinel", no_init);
typedef scitbx::af::boost_python::shared_wrapper<atom> wat;
class_<wat::w_t> wa = wat::wrap("af_shared_atom");
scitbx::af::boost_python::select_wrappers<
atom, af::shared<atom> >::wrap(wa);
typedef scitbx::af::boost_python::shared_wrapper<atom_with_labels> wawl_t;
class_<wawl_t::w_t> wawl = wawl_t::wrap("af_shared_atom_with_labels");
scitbx::af::boost_python::select_wrappers<
atom_with_labels, af::shared<atom_with_labels> >::wrap(wawl);
wa.def("extract_serial", extract_serial)
.def("extract_name", extract_name)
.def("extract_segid", extract_segid)
.def("extract_xyz", extract_xyz)
.def("extract_sigxyz", extract_sigxyz)
.def("extract_occ", extract_occ)
.def("extract_sigocc", extract_sigocc)
.def("extract_b", extract_b)
.def("extract_sigb", extract_sigb)
.def("extract_uij", extract_uij)
#ifdef IOTBX_PDB_ENABLE_ATOM_DATA_SIGUIJ
.def("extract_siguij", extract_siguij)
#endif
.def("extract_fp", extract_fp)
.def("extract_fdp", extract_fdp)
.def("extract_hetero", extract_hetero)
.def("extract_element", extract_element, (arg("strip")=false))
.def("extract_i_seq", extract_i_seq)
.def("extract_tmp_as_size_t", extract_tmp_as_size_t)
.def("set_xyz", set_xyz, (arg("new_xyz")), return_self<>())
.def("set_sigxyz", set_sigxyz, (arg("new_sigxyz")), return_self<>())
.def("set_occ", set_occ, (arg("new_occ")), return_self<>())
.def("set_sigocc", set_sigocc, (arg("new_sigocc")), return_self<>())
.def("set_b", set_b, (arg("new_b")), return_self<>())
.def("set_sigb", set_sigb, (arg("new_sigb")), return_self<>())
.def("set_uij", set_uij, (arg("new_uij")), return_self<>())
#ifdef IOTBX_PDB_ENABLE_ATOM_DATA_SIGUIJ
.def("set_siguij", set_siguij, (arg("new_siguij")), return_self<>())
#endif
.def("set_fp", set_fp, (arg("new_fp")), return_self<>())
.def("set_fdp", set_fdp, (arg("new_fdp")), return_self<>())
.def("reset_serial", reset_serial, (arg("first_value")=1))
.def("set_chemical_element_simple_if_necessary",
set_chemical_element_simple_if_necessary, (
arg("tidy_existing")=true))
.def("reset_i_seq", reset_i_seq)
.def("reset_tmp", reset_tmp, (
arg("first_value")=0,
arg("increment")=1))
.def("reset_tmp_for_occupancy_groups_simple",
reset_tmp_for_occupancy_groups_simple)
.def("build_dict", build_dict, (
arg("strip_names")=false,
arg("upper_names")=false,
arg("convert_stars_to_primes")=false,
arg("throw_runtime_error_if_duplicate_keys")=true))
.def("set_adps_from_scatterers", set_adps_from_scatterers, (
arg("scatterers"),
arg("unit_cell")));
;
}
}}}} // namespace iotbx::pdb::hierarchy::atoms
| 37.870748
| 78
| 0.645949
|
rimmartin
|
433d04b598e823da49c5fb6e196785cd3745b131
| 3,505
|
hpp
|
C++
|
src/xalanc/PlatformSupport/Writer.hpp
|
ulisesten/xalanc
|
a722de08e61ce66965c4a828242f7d1250950621
|
[
"Apache-2.0"
] | 24
|
2015-07-29T22:49:17.000Z
|
2022-03-25T10:14:17.000Z
|
src/xalanc/PlatformSupport/Writer.hpp
|
ulisesten/xalanc
|
a722de08e61ce66965c4a828242f7d1250950621
|
[
"Apache-2.0"
] | 14
|
2019-05-10T16:25:50.000Z
|
2021-11-24T18:04:47.000Z
|
src/xalanc/PlatformSupport/Writer.hpp
|
ulisesten/xalanc
|
a722de08e61ce66965c4a828242f7d1250950621
|
[
"Apache-2.0"
] | 28
|
2015-04-20T15:50:51.000Z
|
2022-01-26T14:56:55.000Z
|
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined(WRITER_HEADER_GUARD_1357924680)
#define WRITER_HEADER_GUARD_1357924680
// Base include file. Must be first.
#include <xalanc/PlatformSupport/PlatformSupportDefinitions.hpp>
#include <cstddef>
#include <xalanc/XalanDOM/XalanDOMString.hpp>
namespace XALAN_CPP_NAMESPACE {
class XalanOutputStream;
class XALAN_PLATFORMSUPPORT_EXPORT Writer
{
public:
Writer();
virtual
~Writer();
/**
* Close the stream
*/
virtual void
close() = 0;
/**
* Flush the stream
*/
virtual void
flush() = 0;
/**
* Get the stream associated with the writer...
*/
virtual XalanOutputStream*
getStream();
/**
* Get the stream associated with the writer...
*/
virtual const XalanOutputStream*
getStream() const;
// Output functions
static const size_t npos;
/**
* Writes a string
*
* @param s string to write
* @param theOffset starting offset in string to begin writing, default 0
* @param theLength number of characters to write. If the length is npos, then the array is assumed to be null-terminated.
*/
virtual void
write(
const char* s,
size_t theOffset = 0,
size_t theLength = npos) = 0;
/**
* Writes a string
*
* @param s string to write
* @param theOffset starting offset in string to begin writing, default 0
* @param theLength number of characters to write. If the length is XalanDOMString::npos, then the array is assumed to be null-terminated.
*/
virtual void
write(
const XalanDOMChar* s,
XalanDOMString::size_type theOffset = 0,
XalanDOMString::size_type theLength = XalanDOMString::npos) = 0;
/**
* Writes a character
*
* @param c character to write
*/
virtual void
write(XalanDOMChar c) = 0;
/**
* Writes a string
*
* @param s string to write
* @param theOffset starting offset in string to begin writing, default 0
* @param theLength number of characters to write. If the length is XalanDOMString::npos, then the entire string is printed.
*/
virtual void
write(
const XalanDOMString& s,
XalanDOMString::size_type theOffset = 0,
XalanDOMString::size_type theLength = XalanDOMString::npos) = 0;
private:
// Not implemented
Writer(const Writer&);
Writer&
operator=(const Writer&);
bool
operator==(const Writer&);
};
}
#endif // WRITER_HEADER_GUARD_1357924680
| 23.682432
| 144
| 0.637946
|
ulisesten
|
433d1527559c11feb2d9e258eecd883f91e66a7b
| 2,174
|
hh
|
C++
|
src/rng/LC_Subrandom_Generator.hh
|
rspavel/Draco
|
b279b1afbfbb39f2d521579697172394c5efd81d
|
[
"BSD-3-Clause-Open-MPI"
] | null | null | null |
src/rng/LC_Subrandom_Generator.hh
|
rspavel/Draco
|
b279b1afbfbb39f2d521579697172394c5efd81d
|
[
"BSD-3-Clause-Open-MPI"
] | null | null | null |
src/rng/LC_Subrandom_Generator.hh
|
rspavel/Draco
|
b279b1afbfbb39f2d521579697172394c5efd81d
|
[
"BSD-3-Clause-Open-MPI"
] | null | null | null |
//----------------------------------*-C++-*----------------------------------//
/*!
* \file rng/LC_Subrandom_Generator.hh
* \author Kent Budge
* \brief Definition of class LC_Subrandom_Generator
* \note Copyright (C) 2016-2019 Triad National Security, LLC.
* All rights reserved. */
//---------------------------------------------------------------------------//
#ifndef rng_LC_Subrandom_Generator_hh
#define rng_LC_Subrandom_Generator_hh
#include "Subrandom_Generator.hh"
#include "gsl/gsl_rng.h"
namespace rtt_rng {
//===========================================================================//
/*!
* \class LC_Subrandom_Generator
* \brief Generator for a sequence of subrandom (pseudorandom) vectors.
*
* This is an implementation of the old, hoary linear congruential
* generator. The name is somewhat of a misnomer since this is a true
* pseudorandom generator (is that an oxymoron?) rather than a subrandom
* generator. In other words, the approximation to an integral computed using
* this sequence as quadrature points converges smoothly, but only as
* 1/sqrt(N) rather than 1/N.
*/
//===========================================================================//
class LC_Subrandom_Generator : public Subrandom_Generator {
public:
// NESTED CLASSES AND TYPEDEFS
// CREATORS
//! Normal constructor.
explicit LC_Subrandom_Generator(unsigned const count = 1);
~LC_Subrandom_Generator();
// MANIPULATORS
//! Advance sequence.
void shift_vector();
//! Get the next element in the current vector.
double shift();
// ACCESSORS
bool check_class_invariants() const;
private:
// NESTED CLASSES AND TYPEDEFS
// IMPLEMENTATION
//! not implemented
LC_Subrandom_Generator(LC_Subrandom_Generator const &);
// not implemented
LC_Subrandom_Generator &operator=(LC_Subrandom_Generator const &);
// DATA
gsl_rng *generator_;
};
} // end namespace rtt_rng
#endif // rng_LC_Subrandom_Generator_hh
//---------------------------------------------------------------------------//
// end of rng/LC_Subrandom_Generator.hh
//---------------------------------------------------------------------------//
| 28.233766
| 79
| 0.579577
|
rspavel
|
433e267645d7db0ec43692267f8e771a01a48d07
| 511
|
hpp
|
C++
|
plugins/libpng/include/sge/libpng/error_context_ref.hpp
|
cpreh/spacegameengine
|
313a1c34160b42a5135f8223ffaa3a31bc075a01
|
[
"BSL-1.0"
] | 2
|
2016-01-27T13:18:14.000Z
|
2018-05-11T01:11:32.000Z
|
plugins/libpng/include/sge/libpng/error_context_ref.hpp
|
cpreh/spacegameengine
|
313a1c34160b42a5135f8223ffaa3a31bc075a01
|
[
"BSL-1.0"
] | null | null | null |
plugins/libpng/include/sge/libpng/error_context_ref.hpp
|
cpreh/spacegameengine
|
313a1c34160b42a5135f8223ffaa3a31bc075a01
|
[
"BSL-1.0"
] | 3
|
2018-05-11T01:11:34.000Z
|
2021-04-24T19:47:45.000Z
|
// Copyright Carl Philipp Reh 2006 - 2019.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef SGE_LIBPNG_ERROR_CONTEXT_REF_HPP_INCLUDED
#define SGE_LIBPNG_ERROR_CONTEXT_REF_HPP_INCLUDED
#include <sge/libpng/error_context_fwd.hpp>
#include <fcppt/reference_impl.hpp>
namespace sge::libpng
{
using error_context_ref = fcppt::reference<sge::libpng::error_context>;
}
#endif
| 25.55
| 71
| 0.761252
|
cpreh
|
433f775a1a2d66621435d3f82f7810ba28529c92
| 581
|
cpp
|
C++
|
272 TEX Quotes.cpp
|
zihadboss/UVA-Solutions
|
020fdcb09da79dc0a0411b04026ce3617c09cd27
|
[
"Apache-2.0"
] | 86
|
2016-01-20T11:36:50.000Z
|
2022-03-06T19:43:14.000Z
|
272 TEX Quotes.cpp
|
Mehedishihab/UVA-Solutions
|
474fe3d9d9ba574b97fd40ca5abb22ada95654a1
|
[
"Apache-2.0"
] | null | null | null |
272 TEX Quotes.cpp
|
Mehedishihab/UVA-Solutions
|
474fe3d9d9ba574b97fd40ca5abb22ada95654a1
|
[
"Apache-2.0"
] | 113
|
2015-12-04T06:40:57.000Z
|
2022-02-11T02:14:28.000Z
|
#include <iostream>
#include <string>
using namespace std;
int main()
{
string temp;
bool isFirst(true);
while (getline(cin, temp))
{
for (string::iterator iter = temp.begin(); iter != temp.end(); ++iter)
{
if (*iter == '"')
{
if (isFirst)
cout << "``";
else
cout << "''";
isFirst = !isFirst;
}
else
cout << *iter;
}
cout << '\n';
}
}
| 18.15625
| 78
| 0.342513
|
zihadboss
|
434088dc41dd9cf7b51e868677a756cd0fce5f2d
| 1,186
|
cpp
|
C++
|
Game_Engine/GameOver.cpp
|
IndiaWomble/Game-Engine
|
8b2a47db6e976d272e62c6f9f4f2bc8d6b07b957
|
[
"Apache-2.0"
] | null | null | null |
Game_Engine/GameOver.cpp
|
IndiaWomble/Game-Engine
|
8b2a47db6e976d272e62c6f9f4f2bc8d6b07b957
|
[
"Apache-2.0"
] | null | null | null |
Game_Engine/GameOver.cpp
|
IndiaWomble/Game-Engine
|
8b2a47db6e976d272e62c6f9f4f2bc8d6b07b957
|
[
"Apache-2.0"
] | null | null | null |
//Game Over State source file
#include "GameOver.h"
//Instantiating static variable gameOverID
const std::string GameOverState::gameOverID = "GAMEOVER";
//GameOver State constructor
GameOverState::GameOverState(std::vector<GameObject*> parameter, void (*callbackFunction)())
{
for (int i = 0; i < parameter.size(); i++)
gameObjects.push_back(parameter[i]);
callback = callbackFunction;
sleepTime = 0.0f;
}
//Return state ID
std::string GameOverState::GetStateID() const
{
return gameOverID;
}
//Update function of GameOver State
void GameOverState::Update(float dtAsSeconds)
{
//Find a way to change state to play state and revert back all the updates to the initial values
/*sleepTime += dtAsSeconds;
if (sleepTime > 2)
callback();*/
}
//Render function of GameOver State
void GameOverState::Render(RenderWindow* window)
{
gameObjects[1]->DrawStill(window);
}
//First function to be called when we enter GameOver State
bool GameOverState::OnEnter()
{
return true;
}
//Last function to be called when we exit GameOver State
bool GameOverState::OnExit()
{
for (int i = 0; i < gameObjects.size(); i++)
gameObjects[i]->Clean();
gameObjects.clear();
return true;
}
| 23.254902
| 97
| 0.735245
|
IndiaWomble
|
43416145b8f4cbbf25133e338b72525b6d825609
| 4,188
|
cpp
|
C++
|
src/ledger/FeeFrame.cpp
|
RomanTkachenkoDistr/SwarmCore
|
db0544758e7bb3c879778cfdd6946b9a72ba23ab
|
[
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSL-1.0",
"BSD-3-Clause"
] | null | null | null |
src/ledger/FeeFrame.cpp
|
RomanTkachenkoDistr/SwarmCore
|
db0544758e7bb3c879778cfdd6946b9a72ba23ab
|
[
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSL-1.0",
"BSD-3-Clause"
] | null | null | null |
src/ledger/FeeFrame.cpp
|
RomanTkachenkoDistr/SwarmCore
|
db0544758e7bb3c879778cfdd6946b9a72ba23ab
|
[
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSL-1.0",
"BSD-3-Clause"
] | null | null | null |
#include "ledger/FeeFrame.h"
#include "database/Database.h"
#include "crypto/SecretKey.h"
#include "crypto/SHA.h"
#include "LedgerDelta.h"
#include "util/types.h"
using namespace std;
using namespace soci;
namespace stellar
{
FeeFrame::FeeFrame() : EntryFrame(LedgerEntryType::FEE), mFee(mEntry.data.feeState())
{
}
FeeFrame::FeeFrame(LedgerEntry const& from)
: EntryFrame(from), mFee(mEntry.data.feeState())
{
}
FeeFrame::FeeFrame(FeeFrame const& from) : FeeFrame(from.mEntry)
{
}
FeeFrame& FeeFrame::operator=(FeeFrame const& other)
{
if (&other != this)
{
mFee = other.mFee;
mKey = other.mKey;
mKeyCalculated = other.mKeyCalculated;
}
return *this;
}
FeeFrame::pointer FeeFrame::create(FeeType feeType, int64_t fixedFee,
int64_t percentFee, AssetCode asset, AccountID* accountID,
AccountType* accountType, int64_t subtype, int64_t lowerBound, int64_t upperBound)
{
LedgerEntry le;
le.data.type(LedgerEntryType::FEE);
FeeEntry& entry = le.data.feeState();
entry.fixedFee = fixedFee;
entry.percentFee = percentFee;
entry.feeType = feeType;
entry.asset = asset;
entry.subtype = subtype;
if (accountID)
entry.accountID.activate() = *accountID;
if (accountType)
entry.accountType.activate() = *accountType;
entry.lowerBound = lowerBound;
entry.upperBound = upperBound;
entry.hash = calcHash(feeType, asset, accountID, accountType, subtype);
return std::make_shared<FeeFrame>(le);
}
bool FeeFrame::isInRange(int64_t a, int64_t b, int64_t point)
{
return a <= point && point <= b;
}
int64_t FeeFrame::calculatePercentFee(int64_t amount, bool roundUp)
{
if (mFee.percentFee == 0)
return 0;
auto rounding = roundUp ? ROUND_UP : ROUND_DOWN;
return bigDivide(amount, mFee.percentFee, 100 * ONE, rounding);
}
bool FeeFrame::calculatePercentFee(const uint64_t amount, uint64_t& result,
const Rounding rounding) const
{
result = 0;
if (mFee.percentFee == 0)
{
return true;
}
return bigDivide(result, amount, mFee.percentFee, 100 * ONE, rounding);
}
int64_t FeeFrame::calculatePercentFeeForPeriod(int64_t amount, int64_t periodPassed, int64_t basePeriod)
{
if (mFee.percentFee == 0
|| periodPassed == 0
|| basePeriod == 0
|| amount == 0)
{
return 0;
}
int64_t percentFeeForFullPeriod = calculatePercentFee(amount);
return bigDivide(percentFeeForFullPeriod, periodPassed, basePeriod, ROUND_UP);
}
bool
FeeFrame::isValid(FeeEntry const& oe)
{
auto res = oe.fixedFee >= 0
&& oe.percentFee >= 0
&& oe.percentFee <= 100 * ONE
&& isFeeTypeValid(oe.feeType)
&& oe.lowerBound <= oe.upperBound;
return res;
}
Hash
FeeFrame::calcHash(FeeType feeType, AssetCode asset, AccountID* accountID, AccountType* accountType, int64_t subtype)
{
std::string data = "";
char buff[100];
snprintf(buff, sizeof(buff), "type:%i", feeType);
std::string buffAsStdStr = buff;
data += buffAsStdStr;
std::string rawAsset = asset;
snprintf(buff, sizeof(buff), "asset:%s", rawAsset.c_str());
buffAsStdStr = buff;
data += buffAsStdStr;
snprintf(buff, sizeof(buff), "subtype:%s", std::to_string(subtype).c_str());
buffAsStdStr = buff;
data += buffAsStdStr;
if (accountID) {
std::string actIDStrKey = PubKeyUtils::toStrKey(*accountID);
snprintf(buff, sizeof(buff), "accountID:%s", actIDStrKey.c_str());
buffAsStdStr = buff;
data += buffAsStdStr;
}
if (accountType) {
snprintf(buff, sizeof(buff), "accountType:%i", *accountType);
buffAsStdStr = buff;
data += buffAsStdStr;
}
return Hash(sha256(data));
}
bool
FeeFrame::isValid() const
{
return isValid(mFee);
}
}
| 27.019355
| 121
| 0.608644
|
RomanTkachenkoDistr
|
43424a0765c0632fbd13fd85bbdd39f388d36333
| 4,979
|
cc
|
C++
|
enumerative-search/utils.cc
|
HiroakiMikami/DeepCoder-Utils
|
c433d76371cf3f3a62b7b2dbaec9e8121d394a08
|
[
"MIT"
] | 26
|
2019-05-23T20:12:03.000Z
|
2022-03-25T06:52:14.000Z
|
enumerative-search/utils.cc
|
HiroakiMikami/DeepCoder-Utils
|
c433d76371cf3f3a62b7b2dbaec9e8121d394a08
|
[
"MIT"
] | 1
|
2019-08-16T13:05:36.000Z
|
2019-08-16T13:05:36.000Z
|
enumerative-search/utils.cc
|
HiroakiMikami/DeepCoder-Utils
|
c433d76371cf3f3a62b7b2dbaec9e8121d394a08
|
[
"MIT"
] | 8
|
2019-05-10T10:58:19.000Z
|
2020-12-12T17:29:01.000Z
|
#include "utils.h"
#include <stdio.h>
#include <stdarg.h>
#include <string>
#include <math.h>
#include <iostream>
string StringPrintf(const char *format, ...) {
va_list arg;
char buffer[512]; // TODO(medium): Should check for overflow
va_start(arg, format);
vsprintf(buffer, format, arg);
va_end (arg);
return string(buffer);
}
double Sigmoid(double z) {
return 1 / (1 + exp(-z));
}
double Square(double z) {
return z*z;
}
float Sigmoidfb(float z) {
return 1 / (1 + exp(-z));
}
double LogSum(double log_a, double log_b) {
if (log_a < -10000000) return log_b;
if (log_b < -10000000) return log_a;
if (log_a < log_b) {
return log_a + log(exp(log_a - log_b));
} else {
return log_b + log(exp(log_b - log_a));
}
}
double StringDistance(string s1, string s2) {
double costs[s1.length()][s2.length()];
costs[0][0] = BIG_DOUBLE;
for (uint i = 0; i < s1.length(); i++) {
for (uint j = 0; j < s2.length(); j++) {
// Cost of coming from each of the directions wrt current cell
// (up & left, up, left, up & up & left & left)
double ul, u, l, uull;
ul = u = l = uull = BIG_DOUBLE;
// Single character operations
if (i > 0 && j > 0) {
ul = costs[i-1][j-1] + MatchCost(s1[i], s2[j]);
}
if (i > 0) {
u = costs[i-1][j] + DeletionCost(s1[i]);
}
if (j > 0) {
l = costs[i][j-1] + InsertionCost(s2[j]);
}
// Multiple (2) character operations
if (i > 1 && j > 1) {
uull = costs[i-2][j-2] + SwapCost(s1[i-1], s1[i], s2[j-1], s2[j]);
}
double best_cost = min(ul,min(u, min(l, uull)));
if (best_cost == BIG_DOUBLE) best_cost = 0;
costs[i][j] = best_cost;
if (i == 0 && j == 0) {
costs[i][j] = MatchCost(s1[0], s2[0]);
}
}
}
bool print_matrix = false;
if (print_matrix) {
cout << " ";
for (uint j = 0; j < s2.length(); j++) {
cout << s2[j] << " ";
}
cout << endl;
for (uint i = 0; i < s1.length(); i++) {
cout << s1[i] << " ";
for (uint j = 0; j < s2.length(); j++) {
cout << costs[i][j] << " ";
}
cout << endl;
}
}
return costs[s1.length()-1][s2.length()-1];
}
double MatchCost(char a, char b) {
return (a == b) ? 0 : 1.2;
}
double InsertionCost(char a) {
a = 1;
return 1.2;
}
double DeletionCost(char a) {
a = 1;
return 1.1;
}
// cost of matching [a1 a2] to [b1 b2]
double SwapCost(char a1, char a2, char b1, char b2) {
return 1;
return (a1 == b2 && a2 == b1) ? 1 : MatchCost(a1, b1) + MatchCost(a2, b2);
}
bool PairCompareFirst(pair<double, int> a, pair<double, int> b) {
return (a.first > b.first);
}
// My implementation of Matlab's fullfile() function.
// Concatenate two strings holding parts of a path, making sure that the pathseparator (/)
// does not get repeated or missed.
// TODO: Extend to variable inputs
string fullfile2(string path, string file)
{
// check if file is empty
int len = path.length();
if (len == 0)
path += '/';
// check for file-separator at end of path. If not present, add.
if ( !(path.at(len-1) == '/') && !(path.at(len-1) == '\\') )
path = path + "/" + file;
else
path += file;
len = path.length();
// if ( !(path.at(len-1) == '/') && !(path.at(len-1) == '\\') )
// path += "/";
return path;
}
// Class to hold cute matlab-style tic-toc functions to time things
void MyTimer::tic()
{
clk_start = clock();
//tm_start = time(NULL);
gettimeofday(&tm_start,NULL);
}
double MyTimer::toc(bool print, double* pclk_diff, double *ptm_diff)
{
// CPU time
clk_diff = (double) (clock() - clk_start);
//printf("%lf %d\n", clk_diff, CLOCKS_PER_SEC);
clk_diff /= CLOCKS_PER_SEC;
//printf("%lf %d\n", clk_diff, CLOCKS_PER_SEC);
// Real time
timeval tm_end;
gettimeofday(&tm_end,NULL);
tm_diff = (double)(tm_end.tv_sec - tm_start.tv_sec)
+ (double)(tm_end.tv_usec - tm_start.tv_usec)/1000000;
if (print)
printf("Time Elapsed: %lf (CPU), %lf (Real) secs\n",clk_diff,tm_diff);
if (pclk_diff)
*pclk_diff = clk_diff;
if (ptm_diff)
*ptm_diff = tm_diff;
if (clk_diff > 0) {
//printf("Returning clk_diff");
return clk_diff;
}
else {
//printf("Returning tm_diff");
return tm_diff;
}
}
// Split a path into dirname and basename
void splitpath(string path, string& dirname, string& basename)
{
size_t pos = path.find_last_of("/\\");
EXPECT_NEQ(pos, string::npos, "Basename empty");
dirname = path.substr(0,pos);
basename = path.substr(pos+1);
}
// Split a filename into name and extension
void splitfname(string fname, string& fname_noext, string& ext)
{
size_t pos = fname.find_last_of(".");
EXPECT_NEQ(pos, string::npos, "No Extention Found");
fname_noext = fname.substr(0,pos);
ext = fname.substr(pos);
}
| 23.822967
| 91
| 0.565776
|
HiroakiMikami
|
4344759dacfa6557e99d15c35d3f20bf63617418
| 445,525
|
cpp
|
C++
|
src/mame/drivers/nmk16.cpp
|
Robbbert/messui
|
49b756e2140d8831bc81335298ee8c5471045e79
|
[
"BSD-3-Clause"
] | 26
|
2015-03-31T06:25:51.000Z
|
2021-12-14T09:29:04.000Z
|
src/mame/drivers/nmk16.cpp
|
Robbbert/messui
|
49b756e2140d8831bc81335298ee8c5471045e79
|
[
"BSD-3-Clause"
] | null | null | null |
src/mame/drivers/nmk16.cpp
|
Robbbert/messui
|
49b756e2140d8831bc81335298ee8c5471045e79
|
[
"BSD-3-Clause"
] | 10
|
2015-03-27T05:45:51.000Z
|
2022-02-04T06:57:36.000Z
|
// license:BSD-3-Clause
// copyright-holders:Mirko Buffoni,Nicola Salmoria,Bryan McPhail,David Haywood,R. Belmont,Alex Marshall,Angelo Salese,Luca Elia
// thanks-to:Richard Bush
/********************************************************************
Task Force Harrier 1989 UPL 68000 Z80 YM2203 2xOKIM6295
Many Block 1991 Bee-Oh 68000 Z80 YM2203 2xOKIM6295
Mustang 1990 UPL 68000 NMK004 YM2203 2xOKIM6295
Bio-ship Paladin 1990 UPL 68000 NMK004 YM2203 2xOKIM6295
Vandyke 1990 UPL 68000 NMK004 YM2203 2xOKIM6295
Black Heart 1991 UPL 68000 NMK004 YM2203 2xOKIM6295
Acrobat Mission 1991 UPL 68000 NMK004 YM2203 2xOKIM6295
Strahl 1992 UPL 68000 NMK004 YM2203 2xOKIM6295
Thunder Dragon 1991 NMK/Tecmo 68000 NMK004 YM2203 2xOKIM6295
Hacha Mecha Fighter proto 1991 NMK 68000 NMK004 YM2203 2xOKIM6295
Hacha Mecha Fighter 1991 NMK 68000 NMK004 YM2203 2xOKIM6295
Macross 1992 Banpresto 68000 NMK004 YM2203 2xOKIM6295
GunNail 1993 NMK/Tecmo 68000 NMK004 YM2203 2xOKIM6295
Macross II 1993 Banpresto 68000 Z80 YM2203 2xOKIM6295
Thunder Dragon 2 1993 NMK 68000 Z80 YM2203 2xOKIM6295
Arcadia / Rapid Hero 1994 NMK 68000 tmp90c841 YM2203 2xOKIM6295
S.S. Mission 1992 Comad 68000 Z80 OKIM6295 (hack of Thunder Dragon)
Air Attack 1996 Comad 68000 Z80 OKIM6295 (hack of Thunder Dragon)
Mustang (bootleg) 68000 Z80 YM3812 OKIM6295
Thunder Dragon (bootleg) 68000 Z80 YM3812 OKIM6295
Thunder Dragon 3 (bootleg) 1996 Conny 68000 Z80 (Unknown, Single OKIM6295 identified)
Saboten Bombers 1992 NMK/Tecmo 68000 2xOKIM6295
Bombjack Twin 1993 NMK 68000 2xOKIM6295
Nouryoku Koujou Iinkai 1995 Tecmo 68000 2xOKIM6295
driver by Mirko Buffoni, Richard Bush, Nicola Salmoria, Bryan McPhail,
David Haywood, R. Belmont, Alex Marshal and Luca Elia.
Afega based their hardware on the NMK hardware, not surprising considering Twin
Action is simply a hack of USSAF Mustang.
The NMK004 CPU is a Toshiba TMP90C840 with internal ROM.
The dumped internal ROM has a date string of 900315 in ROM and a version number of V-00
The later games (from GunNail onwards) have a higher resolution (384x224 instead
of 256x224) but the hardware is pretty much the same. It's obvious that the higher
res is an afterthought, because the tilemap layout is weird (the left 8 screen
columns have to be taken from the rightmost 8 columns of the tilemap), and the
games rely on mirror addresses to access the tilemap sequentially.
TODO:
- tharrier performs a handshake operation which is the same as that used by the
other games to initialize the NMK004 at boot, however it doesn't have an NMK004
(it uses a Z80 based sound system and also predates the NMK004)
maybe it has a pre-NMK004 chip using the same communication protocol but used
for protection instead.
- tharrier: Current emulation is stuck when try to access test mode.
- Protection is patched in several games.
- Hacha Mecha Fighter: mcu simulation is wrong/incorrect (see notes).
- In Bioship, there's an occasional flicker of one of the sprites composing big
ships. Increasing CPU speed from 12 to 16 MHz improved it, but it's still not
100% fixed. (the CPU speed has been verified to be 10Mhz??)
- (PCB owners): Measure pixel clock / vblank duration for all of these games.
- for the Afega games (Guardian Storm especially) the lives display has bad colours,
it doesn't matter if this is drawn with the TX layer (some sets) or the sprites (others)
so it's probably something else funky with the memory access.
- Thunder Dragon 3 (bootleg of Thunder Dragon 2) :
Sound System isn't hooked up correctly for this set.
- Verify sprite limits for games when resolution is 384x224
NOT BUGS:
- Black Heart: test mode text are buggy
- Hacha Mecha Fighter: (BTANB) the bomb graphics are pretty weird when the game
is in japanese mode, but it's like this on the original game.
- Vandyke: Many enemies make very strange sounds because they seem to have no
rate limit for making their sound effect. This is normal, it's like this on all
PCB recordings.
- Sprite number is limited related to screen size and each sprite size.
reference : http://upl-gravedigger.boo.jp/pcb_info/pcb_manual_7.jpg
----
tharrier test mode:
1) Press player 2 buttons 1+2 during reset. "Are you ready?" will appear
2) Press player 1 buttons in this sequence:
2,1,2,2,1,1,↓,↓
Note: this doesn't currently work, the message never appears (most likely an error in the protection simulation).
tdragon and hachamf test mode:
1) Press player 2 buttons 1+2 during reset. "Ready?" will appear
2) Press player 1 button 2 14 (!) times
mustang and blkheart test mode:
1) Press player 2 buttons 1+2 during reset. "Ready?" will appear
2) Press player 1 button 1 14 (!) times
Note: blkheart has a buggy service mode, apparently they shifted the ASCII gfx bank at $3xx but
forgot to update the routines so it treats the VRAM as if ASCII bank is at $0xx (cfr. the move.w imm,Ax).
gunnail test mode:
1) Press player 2 buttons 1+2 during reset. "Ready?" will appear
2) Press player 2 button 1 3 times
bjtwin test mode:
1) Press player 2 buttons 1+2 during reset. "Ready?" will appear
2) Press player 1 buttons in this sequence:
2,2,2, 1,1,1, 2,2,2, 1,1,1
The release date of this program will appear.
Note: Some code has to be patched out for this to work (cfr. init_bjtwin fn).
The program remaps button 2 and 3 to button 1, so you can't enter the above sequence.
---
'gunnailp' observed differences (from notes by trap15)
- Different introduction scene
- Many unique enemy types that ended up unused
- Tweaked enemy attack patterns
- Tweaked boss behavior and attack patterns
- Dramatically different stages (and only 7 of them):
- Stage 1: Became Stage 5, very different layouts
- Stage 2: Became Stage 7, with mostly slight enemy layout changes
- Stage 3: Became Stage 6, almost the same as final
- Stage 4: Stayed as Stage 4, with very minor enemy layout changes
- Stage 5: Entirely unique stage, majorly reworked to become final Stage 2
- Stage 6: Became Stage 3, many enemy layout changes
- Stage 7: Entirely unique stage, majorly reworked to become final Stage 1
- No ending, instead loops forever
- Loop has extremely fast bullets
- The difficulty seems the same on all loops
- Player's blue shot has a wider maximum and minimum spread
- Player's main shot hitbox is symmetrical and wider than final
- When the hitbox was shrunk for the final, it was only shrunk in one direction, making it extended to the right
---
Questions / Notes
'manybloc' :
- There are writes to 0x080010.w and 0x080012.w (MCU ?) in code between
0x005000 to 0x005690, but I see no call to "main" routine at 0x005504 !
- There are writes to 0x08001c.w and 0x08001e.w but I can't tell what
the effect is ! Could it be related to sound and/or interrupts ?
- In the "test mode", press BOTH player 1 buttons to exit
- When help is available, press BUTTON2 twice within the timer to "solve"
---
Sound notes for games with a Z80:
mustangb, strahljb and tdragonb use the Seibu Raiden sound hardware and a modified
Z80 program (but the music is intact and recognizable). See audio/seibu.cpp
for more info on this.
---
Afega Games
95 Twin Action this is a hack of Mustang with new graphics
97 Red Hawk
98 Sen Jin - Guardian Storm
98 Stagger I Japanese release of Red Hawk
98 Bubble 2000 By Tuning, but it seems to be the same HW
/ Hot Bubble
00 Spectrum 2000 By YomaTech -- NOTE sprite bugs happen on real hw!!
01 Fire Hawk By ESD with different sound hardware: 2 M6295,
this doesn't have the glitches present in spec2k
Afega stands for "Art-Fiction Electronic Game"
Reference of music tempo:
stagger1 - https://www.youtube.com/watch?v=xWszb2fP07M
********************************************************************/
#include "emu.h"
#include "includes/nmk16.h"
#include "audio/seibu.h"
#include "cpu/m68000/m68000.h"
#include "cpu/pic16c5x/pic16c5x.h"
#include "cpu/tlcs90/tlcs90.h"
#include "cpu/z80/z80.h"
#include "machine/nmk004.h"
#include "machine/nmk112.h"
#include "sound/okim6295.h"
#include "sound/ymopm.h"
#include "sound/ymopn.h"
#include "sound/ymopl.h"
#include "screen.h"
#include "speaker.h"
void nmk16_state::nmk004_x0016_w(u16 data)
{
// this is part of a watchdog scheme
// generating an NMI on the NMK004 keeps a timer alive
// if that timer expires the NMK004 resets the system
m_nmk004->nmi_w(BIT(data, 0) ? ASSERT_LINE : CLEAR_LINE);
}
void nmk16_state::nmk004_bioship_x0016_w(u16 data)
{
// ugly, ugly logic invert hack, but otherwise bioship doesn't hit the NMI enough to keep the game alive!
m_nmk004->nmi_w(BIT(data, 0) ? CLEAR_LINE : ASSERT_LINE);
}
/**********************************************************
Protection: Memory Scrambling
Several NMK and Afega games (notably the ones running at
the lower resolution) require strange handling of work
RAM when performing 8-bit writes. This handling breaks
some of the later games if used, but is essential for
Mustang, Black Heart, Task Force Harrier, and the Afega
shooters to work correctly without ROM patches. Tests
on the board would help verify this as correct.
I'm not sure if this is actually protection, or just
poor board design.
**********************************************************/
void nmk16_state::mainram_strange_w(offs_t offset, u16 data/*, u16 mem_mask*/)
{
#if 0
if (!ACCESSING_BITS_8_15)
{
m_mainram[offset] = (data & 0x00ff) | ((data & 0x00ff)<<8);
}
else if (!ACCESSING_BITS_0_7)
{
m_mainram[offset] = (data & 0xff00) | ((data & 0xff00) >> 8);
}
else
{
m_mainram[offset] = data;
}
#endif
// as of SVN 30715 the 68k core replicates the above behavior, providing mirrored bits in 'data' regardless of the value of 'mem_mask'
m_mainram[offset] = data;
}
// tdragon2, raphero has address-swapped mainram handler
u16 nmk16_state::mainram_swapped_r(offs_t offset)
{
return m_mainram[bitswap<16>(offset, 15, 14, 13, 12, 11, 7, 9, 8, 10, 6, 5, 4, 3, 2, 1, 0)];
}
void nmk16_state::mainram_swapped_w(offs_t offset, u16 data, u16 mem_mask)
{
COMBINE_DATA(&m_mainram[bitswap<16>(offset, 15, 14, 13, 12, 11, 7, 9, 8, 10, 6, 5, 4, 3, 2, 1, 0)]);
}
void nmk16_state::ssmissin_soundbank_w(u8 data)
{
m_okibank[0]->set_entry(data & 0x3);
}
void nmk16_state::tharrier_mcu_control_w(u16 data)
{
// logerror("%04x: mcu_control_w %02x\n",m_maincpu->pc(),data);
}
u16 nmk16_state::tharrier_mcu_r(offs_t offset, u16 mem_mask)
{
/* The MCU is mapped as the top byte for byte accesses only,
all word accesses are to the input port */
if (ACCESSING_BITS_8_15 && !ACCESSING_BITS_0_7)
{
static const u8 to_main[] =
{
0x82,0xc7,0x00,0x2c,0x6c,0x00,0x9f,0xc7,0x00,0x29,0x69,0x00,0x8b,0xc7,0x00
};
int res;
if (m_maincpu->pc()==0x8aa) res = (m_mainram[0x9064/2])|0x20; // Task Force Harrier
else if (m_maincpu->pc()==0x8ce) res = (m_mainram[0x9064/2])|0x60; // Task Force Harrier
else
{
res = to_main[m_prot_count++];
if (m_prot_count == sizeof(to_main))
m_prot_count = 0;
}
return res << 8;
}
else
{
// the above statement appears to be incorrect, it should also read DSW1 from here, almost certainly
// through the MCU. The weird 0x080202 address where we read IN2 is also probably just a mirror of 0x080002 (here)
return ~m_in_io[1]->read();
}
}
void nmk16_state::macross2_sound_reset_w(u16 data)
{
/* PCB behaviour verified by Corrado Tomaselli at MAME Italia Forum:
every time music changes Z80 is reset */
m_audiocpu->set_input_line(INPUT_LINE_RESET, data ? CLEAR_LINE : ASSERT_LINE);
}
void nmk16_state::macross2_sound_bank_w(u8 data)
{
m_audiobank->set_entry(data & 0x07);
}
template<unsigned Chip>
void nmk16_state::tharrier_oki_bankswitch_w(u8 data)
{
data &= 3;
if (data != 3)
m_okibank[Chip]->set_entry(data);
}
/***************************************************************************
VRAM handlers
***************************************************************************/
template<unsigned Layer>
void nmk16_state::bgvideoram_w(offs_t offset, u16 data, u16 mem_mask)
{
COMBINE_DATA(&m_bgvideoram[Layer][offset]);
if ((offset >> 13) == m_tilerambank)
m_bg_tilemap[Layer]->mark_tile_dirty(offset & 0x1fff);
}
void nmk16_state::txvideoram_w(offs_t offset, u16 data, u16 mem_mask)
{
COMBINE_DATA(&m_txvideoram[offset]);
m_tx_tilemap->mark_tile_dirty(offset);
}
template<unsigned Layer>
void nmk16_state::scroll_w(offs_t offset, u8 data)
{
m_scroll[Layer][offset] = data;
if (offset & 2)
{
m_bg_tilemap[Layer]->set_scrolly(0,((m_scroll[Layer][2] << 8) | m_scroll[Layer][3]));
}
else
{
if ((m_bgvideoram[Layer].bytes() > 0x4000) && (offset == 0))
{
int newbank = (m_scroll[Layer][0] >> 4) & ((m_bgvideoram[Layer].bytes() >> 14) - 1);
if (m_tilerambank != newbank)
{
m_tilerambank = newbank;
if (m_bg_tilemap[Layer])
m_bg_tilemap[Layer]->mark_all_dirty();
}
}
m_bg_tilemap[Layer]->set_scrollx(0,(m_scroll[Layer][0] << 8) | m_scroll[Layer][1]);
}
}
/***************************************************************************/
void nmk16_state::vandyke_map(address_map &map)
{
map(0x000000, 0x03ffff).rom();
map(0x080000, 0x080001).portr("IN0");
map(0x080002, 0x080003).portr("IN1");
map(0x080008, 0x080009).portr("DSW1");
map(0x08000a, 0x08000b).portr("DSW2");
map(0x08000f, 0x08000f).r(m_nmk004, FUNC(nmk004_device::read));
map(0x080016, 0x080017).w(FUNC(nmk16_state::nmk004_x0016_w));
map(0x080019, 0x080019).w(FUNC(nmk16_state::tilebank_w));
map(0x08001f, 0x08001f).w(m_nmk004, FUNC(nmk004_device::write));
map(0x088000, 0x0887ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0x08c000, 0x08c007).w(FUNC(nmk16_state::vandyke_scroll_w));
map(0x090000, 0x093fff).ram().w(FUNC(nmk16_state::bgvideoram_w<0>)).share("bgvideoram0");
map(0x094000, 0x097fff).ram(); // what is this?
map(0x09d000, 0x09d7ff).ram().w(FUNC(nmk16_state::txvideoram_w)).share("txvideoram");
map(0x0f0000, 0x0fffff).ram().share("mainram");
}
void nmk16_state::vandykeb_map(address_map &map)
{
map(0x000000, 0x03ffff).rom();
map(0x080000, 0x080001).portr("IN0");
map(0x080002, 0x080003).portr("IN1");
map(0x080008, 0x080009).portr("DSW1");
map(0x08000a, 0x08000b).portr("DSW2");
// map(0x08000f, 0x08000f).r(m_nmk004, FUNC(nmk004_device::read));
map(0x080010, 0x08001d).w(FUNC(nmk16_state::vandykeb_scroll_w)); // 10, 12, 1a, 1c
map(0x080016, 0x080017).nopw(); // IRQ enable?
map(0x080019, 0x080019).w(FUNC(nmk16_state::tilebank_w));
// map(0x08001f, 0x08001f).w(m_nmk004, FUNC(nmk004_device::write));
map(0x088000, 0x0887ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0x08c000, 0x08c007).nopw(); // just in case...
map(0x090000, 0x093fff).ram().w(FUNC(nmk16_state::bgvideoram_w<0>)).share("bgvideoram0");
map(0x094000, 0x097fff).ram(); // what is this?
map(0x09d000, 0x09d7ff).ram().w(FUNC(nmk16_state::txvideoram_w)).share("txvideoram");
map(0x0f0000, 0x0fffff).ram().share("mainram");
}
void nmk16_state::manybloc_map(address_map &map)
{
map(0x000000, 0x03ffff).rom();
map(0x080000, 0x080001).portr("IN0");
map(0x080002, 0x080003).portr("IN1");
map(0x080004, 0x080005).portr("DSW1");
map(0x080010, 0x080011).nopw(); // See notes at the top of the driver
map(0x080012, 0x080013).nopw(); // See notes at the top of the driver
map(0x080015, 0x080015).w(FUNC(nmk16_state::flipscreen_w));
map(0x08001c, 0x08001d).nopw(); // See notes at the top of the driver
map(0x08001f, 0x08001f).r("soundlatch2", FUNC(generic_latch_8_device::read)).w(m_soundlatch, FUNC(generic_latch_8_device::write)).umask16(0x00ff);
map(0x088000, 0x0883ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0x090000, 0x093fff).ram().w(FUNC(nmk16_state::bgvideoram_w<0>)).share("bgvideoram0");
map(0x09c000, 0x09cfff).ram().w(FUNC(nmk16_state::manybloc_scroll_w)).share("scrollram");
map(0x09d000, 0x09d7ff).ram().w(FUNC(nmk16_state::txvideoram_w)).share("txvideoram");
map(0x0f0000, 0x0fffff).ram().share("mainram");
}
void nmk16_tomagic_state::tomagic_map(address_map &map)
{
map(0x000000, 0x07ffff).rom().region("maincpu", 0);
map(0x080000, 0x080001).portr("IN0");
map(0x080002, 0x080003).portr("IN1");
map(0x080008, 0x080009).portr("DSW1");
map(0x08000a, 0x08000b).portr("DSW2");
map(0x080014, 0x080015).w(FUNC(nmk16_tomagic_state::flipscreen_w));
map(0x080018, 0x080019).w(FUNC(nmk16_tomagic_state::tilebank_w));
map(0x08001f, 0x08001f).w(m_soundlatch, FUNC(generic_latch_8_device::write));
map(0x088000, 0x0887ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0x08c000, 0x08c1ff).writeonly().share("scrollram");
map(0x08c200, 0x08c3ff).writeonly().share("scrollramy");
map(0x090000, 0x093fff).ram().w(FUNC(nmk16_tomagic_state::bgvideoram_w<0>)).share("bgvideoram0");
map(0x094001, 0x094001).w(m_oki[0], FUNC(okim6295_device::write));
map(0x094003, 0x094003).r(m_oki[0], FUNC(okim6295_device::read));
map(0x09c000, 0x09cfff).mirror(0x001000).ram().w(FUNC(nmk16_tomagic_state::txvideoram_w)).share("txvideoram");
map(0x0f0000, 0x0fffff).ram().share("mainram");
}
void nmk16_tomagic_state::tomagic_sound_map(address_map &map)
{
map(0x0000, 0x7fff).rom().region("audiocpu", 0);
map(0x8000, 0xbfff).bankr("audiobank");
map(0xc000, 0xdfff).ram();
}
void nmk16_tomagic_state::tomagic_sound_io_map(address_map &map)
{
map.global_mask(0xff);
map(0x00, 0x00).w(FUNC(nmk16_tomagic_state::macross2_sound_bank_w));
map(0x02, 0x03).rw("ymsnd", FUNC(ym3812_device::read), FUNC(ym3812_device::write));
map(0x06, 0x06).r(m_soundlatch, FUNC(generic_latch_8_device::read));
}
void nmk16_state::tharrier_map(address_map &map)
{
map(0x000000, 0x03ffff).rom();
map(0x080000, 0x080001).portr("IN0");
map(0x080002, 0x080003).r(FUNC(nmk16_state::tharrier_mcu_r)); // .portr("IN1");
map(0x080004, 0x080005).portr("DSW1");
map(0x08000f, 0x08000f).r("soundlatch2", FUNC(generic_latch_8_device::read)); // from Z80
map(0x080010, 0x080011).w(FUNC(nmk16_state::tharrier_mcu_control_w));
map(0x080012, 0x080013).nopw();
// map(0x080015, 0x080015).w(FUNC(nmk16_state::flipscreen_w));
// map(0x080019, 0x080019).w(FUNC(nmk16_state::tilebank_w));
map(0x08001f, 0x08001f).w(m_soundlatch, FUNC(generic_latch_8_device::write));
map(0x080202, 0x080203).portr("IN2");
map(0x088000, 0x0883ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
// map(0x08c000, 0x08c007).w(FUNC(nmk16_state::scroll_w<0>)).umask16(0x00ff);
map(0x090000, 0x093fff).ram().w(FUNC(nmk16_state::bgvideoram_w<0>)).share("bgvideoram0");
map(0x09c000, 0x09c7ff).ram(); // Unused txvideoram area?
map(0x09d000, 0x09d7ff).ram().w(FUNC(nmk16_state::txvideoram_w)).share("txvideoram");
map(0x0f0000, 0x0fffff).ram().w(FUNC(nmk16_state::mainram_strange_w)).share("mainram");
}
void nmk16_state::tharrier_sound_map(address_map &map)
{
map(0x0000, 0xbfff).rom();
map(0xc000, 0xc7ff).ram();
map(0xf000, 0xf000).r(m_soundlatch, FUNC(generic_latch_8_device::read)).w("soundlatch2", FUNC(generic_latch_8_device::write));
map(0xf400, 0xf400).rw(m_oki[0], FUNC(okim6295_device::read), FUNC(okim6295_device::write));
map(0xf500, 0xf500).rw(m_oki[1], FUNC(okim6295_device::read), FUNC(okim6295_device::write));
map(0xf600, 0xf600).w(FUNC(nmk16_state::tharrier_oki_bankswitch_w<0>));
map(0xf700, 0xf700).w(FUNC(nmk16_state::tharrier_oki_bankswitch_w<1>));
}
void nmk16_state::tharrier_sound_io_map(address_map &map)
{
map.global_mask(0xff);
map(0x00, 0x01).rw("ymsnd", FUNC(ym2203_device::read), FUNC(ym2203_device::write));
}
//Read input port 1 030c8/ BAD
//3478 GOOD
void nmk16_state::mustang_map(address_map &map)
{
map(0x000000, 0x03ffff).rom();
map(0x080000, 0x080001).portr("IN0");
map(0x080002, 0x080003).portr("IN1");
map(0x080004, 0x080005).portr("DSW1");
map(0x08000f, 0x08000f).r(m_nmk004, FUNC(nmk004_device::read));
map(0x08000e, 0x08000f).nopw();
map(0x080015, 0x080015).w(FUNC(nmk16_state::flipscreen_w));
map(0x080016, 0x080017).w(FUNC(nmk16_state::nmk004_x0016_w)); // frame number?
map(0x08001f, 0x08001f).w(m_nmk004, FUNC(nmk004_device::write));
map(0x088000, 0x0887ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0x08c000, 0x08c001).w(FUNC(nmk16_state::mustang_scroll_w));
map(0x08c002, 0x08c087).nopw(); // ??
map(0x090000, 0x093fff).ram().w(FUNC(nmk16_state::bgvideoram_w<0>)).share("bgvideoram0");
map(0x09c000, 0x09c7ff).ram().w(FUNC(nmk16_state::txvideoram_w)).share("txvideoram");
map(0x0f0000, 0x0fffff).ram().w(FUNC(nmk16_state::mainram_strange_w)).share("mainram");
}
void nmk16_state::mustangb_map(address_map &map)
{
map(0x000000, 0x03ffff).rom();
map(0x080000, 0x080001).portr("IN0");
map(0x080002, 0x080003).portr("IN1");
map(0x080004, 0x080005).portr("DSW1");
map(0x08000e, 0x08000f).noprw();
map(0x080015, 0x080015).w(FUNC(nmk16_state::flipscreen_w));
map(0x080016, 0x080017).nopw(); // frame number?
map(0x08001e, 0x08001f).w("seibu_sound", FUNC(seibu_sound_device::main_mustb_w));
map(0x088000, 0x0887ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0x08c000, 0x08c001).w(FUNC(nmk16_state::mustang_scroll_w));
map(0x08c002, 0x08c087).nopw(); // ??
map(0x090000, 0x093fff).ram().w(FUNC(nmk16_state::bgvideoram_w<0>)).share("bgvideoram0");
map(0x09c000, 0x09c7ff).ram().w(FUNC(nmk16_state::txvideoram_w)).share("txvideoram");
map(0x0f0000, 0x0fffff).ram().w(FUNC(nmk16_state::mainram_strange_w)).share("mainram");
}
void nmk16_state::mustangb3_map(address_map &map)
{
map(0x000000, 0x03ffff).rom();
map(0x080000, 0x080001).portr("IN0");
map(0x080002, 0x080003).portr("IN1");
map(0x080004, 0x080005).portr("DSW1");
map(0x080006, 0x080007).lr16(NAME([this]() { if (m_maincpu->pc() == 0x416) return 0x9000; if (m_maincpu->pc() == 0x64e) return 0x548d; return 0x0000; })); // TODO: gross hack. Protection? Or probably something more obvious
map(0x08000f, 0x08000f).r("soundlatch2", FUNC(generic_latch_8_device::read));
map(0x08000e, 0x08000f).nopw();
map(0x080015, 0x080015).w(FUNC(nmk16_state::flipscreen_w));
map(0x080016, 0x080017).noprw();
map(0x08001f, 0x08001f).w(m_soundlatch, FUNC(generic_latch_8_device::write));
map(0x088000, 0x0887ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0x08c000, 0x08c001).w(FUNC(nmk16_state::mustang_scroll_w));
map(0x08c002, 0x08c087).nopw();
map(0x090000, 0x093fff).ram().w(FUNC(nmk16_state::bgvideoram_w<0>)).share("bgvideoram0");
map(0x09c000, 0x09c7ff).ram().w(FUNC(nmk16_state::txvideoram_w)).share("txvideoram");
map(0x0f0000, 0x0fffff).ram().w(FUNC(nmk16_state::mainram_strange_w)).share("mainram");
}
void nmk16_state::twinactn_map(address_map &map)
{
map(0x000000, 0x03ffff).rom();
map(0x080000, 0x080001).portr("IN0");
map(0x080002, 0x080003).portr("IN1");
map(0x080004, 0x080005).portr("DSW1");
map(0x08000e, 0x08000f).noprw();
map(0x080015, 0x080015).w(FUNC(nmk16_state::flipscreen_w));
map(0x080016, 0x080017).nopw(); // frame number?
map(0x08001f, 0x08001f).w(m_soundlatch, FUNC(generic_latch_8_device::write));
map(0x088000, 0x0887ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0x08c000, 0x08c001).w(FUNC(nmk16_state::mustang_scroll_w));
map(0x08c002, 0x08c087).nopw(); // ??
map(0x090000, 0x093fff).ram().w(FUNC(nmk16_state::bgvideoram_w<0>)).share("bgvideoram0");
map(0x09c000, 0x09c7ff).ram().w(FUNC(nmk16_state::txvideoram_w)).share("txvideoram");
map(0x0f0000, 0x0fffff).ram().w(FUNC(nmk16_state::mainram_strange_w)).share("mainram");
}
void nmk16_state::acrobatm_map(address_map &map)
{
map(0x00000, 0x3ffff).rom();
map(0x80000, 0x8ffff).ram().share("mainram");
map(0xc0000, 0xc0001).portr("IN0");
map(0xc0002, 0xc0003).portr("IN1");
map(0xc0008, 0xc0009).portr("DSW1");
map(0xc000a, 0xc000b).portr("DSW2");
map(0xc000f, 0xc000f).r(m_nmk004, FUNC(nmk004_device::read));
map(0xc0015, 0xc0015).w(FUNC(nmk16_state::flipscreen_w));
map(0xc0016, 0xc0017).w(FUNC(nmk16_state::nmk004_x0016_w));
map(0xc0019, 0xc0019).w(FUNC(nmk16_state::tilebank_w));
map(0xc001f, 0xc001f).w(m_nmk004, FUNC(nmk004_device::write));
map(0xc4000, 0xc45ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0xc8000, 0xc8007).ram().w(FUNC(nmk16_state::scroll_w<0>)).umask16(0x00ff);
map(0xcc000, 0xcffff).ram().w(FUNC(nmk16_state::bgvideoram_w<0>)).share("bgvideoram0");
map(0xd4000, 0xd47ff).ram().w(FUNC(nmk16_state::txvideoram_w)).share("txvideoram");
}
void nmk16_state::bioship_map(address_map &map)
{
map(0x000000, 0x03ffff).rom();
map(0x080000, 0x080001).portr("IN0");
map(0x080002, 0x080003).portr("IN1");
map(0x080008, 0x080009).portr("DSW1");
map(0x08000a, 0x08000b).portr("DSW2");
map(0x08000f, 0x08000f).r(m_nmk004, FUNC(nmk004_device::read));
// map(0xc0015, 0xc0015).w(FUNC(nmk16_state::flipscreen_w));
map(0x080016, 0x080017).w(FUNC(nmk16_state::nmk004_bioship_x0016_w));
map(0x08001f, 0x08001f).w(m_nmk004, FUNC(nmk004_device::write));
map(0x084001, 0x084001).w(FUNC(nmk16_state::bioship_bank_w));
map(0x088000, 0x0887ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0x08c000, 0x08c007).ram().w(FUNC(nmk16_state::scroll_w<1>)).umask16(0xff00);
map(0x08c010, 0x08c017).ram().w(FUNC(nmk16_state::scroll_w<0>)).umask16(0xff00);
map(0x090000, 0x093fff).ram().w(FUNC(nmk16_state::bgvideoram_w<1>)).share("bgvideoram1");
map(0x09c000, 0x09c7ff).ram().w(FUNC(nmk16_state::txvideoram_w)).share("txvideoram");
map(0x0f0000, 0x0fffff).ram().share("mainram");
}
/******************************************************************************************
Thunder Dragon & Hacha Mecha Fighter shares some ram with the MCU,the job of the latter
is to provide some jsr vectors used by the game for gameplay calculations.Also it has
the job to give the vectors of where the inputs are to be read & to calculate the coin
settings,the latter is in a TIMER_DEVICE_CALLBACK to avoid sync problems.
To make a long story short,this MCU is an alternative version of the same protection
used by the MJ-8956 games (there are even the same kind of error codes!(i.e the number
printed on the up-left corner of the screen).
******************************************************************************************/
#define PROT_JSR(_offs_,_protvalue_,_pc_) \
if (m_mainram[(_offs_)/2] == _protvalue_) \
{ \
m_mainram[(_offs_)/2] = 0xffff; /*(MCU job done)*/ \
m_mainram[(_offs_+2-0x10)/2] = 0x4ef9;/*JMP*/\
m_mainram[(_offs_+4-0x10)/2] = 0x0000;/*HI-DWORD*/\
m_mainram[(_offs_+6-0x10)/2] = _pc_; /*LO-DWORD*/\
}
#define PROT_INPUT(_offs_,_protvalue_,_protinput_,_input_) \
if (m_mainram[_offs_] == _protvalue_) \
{ \
m_mainram[_protinput_] = ((_input_ & 0xffff0000) >> 16);\
m_mainram[_protinput_+1] = (_input_ & 0x0000ffff);\
}
//td - hmf
//008D9E - 00796e
/*
(Old notes, for reference)
007B9E: bra 7b9c
007BA0: move.w #$10, $f907a.l
007BA8: bsr 8106
007BAC: bsr dfc4
007BB0: bsr c44e
007BB4: bcs 7cfa
007BB8: bsr d9c6
007BBC: bsr 9400
007BC0: bsr 7a54
007BC4: bsr da06
007BC8: cmpi.w #$3, $f907a.l
007BD0: bcc 7be2
007BD2: move.w #$a, $f530e.l
007BDA: move.w #$a, $f670e.l
007BE2: bsr 81aa
007BE6: bsr 8994
007BEA: bsr 8c36
007BEE: bsr 8d0c
007BF2: bsr 870a
007BF6: bsr 9d66
007BFA: bsr b3f2
007BFE: bsr b59e
007C02: bsr 9ac2
007C06: bsr c366
thunder dragon algorithm (level 1):
90 - spriteram update
a0 - tilemap update
b0 - player inputs
c0 - controls sprite animation
d0 - player shoots
e0 - controls power-ups
f0 - player bombs
00 - controls player shoots
10 - ?
20 - level logic
30 - enemy appearence
40 - enemy energy
50 - enemy energy 2
60 - enemy shoots
hacha mecha fighter algorithm (level 1):
90 - spriteram update (d9c6)
a0 - tilemap update (d1f8?)
b0 - player inputs (da06)
c0 - controls sprite animation (81aa)
d0 - player shoots (8994)
e0 - controls power-ups & options (8d0c)
f0 - player bombs (8c36)
00 - controls player shoots (870a)
10 - ?
20 - level logic (9642)
30 - enemy appearence (9d66)
40 - enemy energy (b3f2)
50 - enemy energy 2 (b59e)
60 - enemy shoots (9ac2)
70 - ?
80 - <unused>
*/
void nmk16_state::hachamf_mainram_w(offs_t offset, u16 data, u16 mem_mask)
{
COMBINE_DATA(&m_mainram[offset]);
#define DUMMYA 0x7b9c
// 7960
switch (offset)
{
case 0xe058/2: PROT_INPUT(0xe058/2,0xc71f,0xe000/2,0x00080000); break;
case 0xe182/2: PROT_INPUT(0xe182/2,0x865d,0xe004/2,0x00080002); break;
case 0xe51e/2: PROT_INPUT(0xe51e/2,0x0f82,0xe008/2,0x00080008); break;
case 0xe6b4/2: PROT_INPUT(0xe6b4/2,0x79be,0xe00c/2,0x0008000a); break;
case 0xe10e/2: PROT_JSR(0xe10e,0x8007,0x870a);//870a not 9d66
PROT_JSR(0xe10e,0x8000,0xd9c6); break;
case 0xe11e/2: PROT_JSR(0xe11e,0x8038,DUMMYA);//972a - (unused)
PROT_JSR(0xe11e,0x8031,0x7a54); break;
case 0xe12e/2: PROT_JSR(0xe12e,0x8019,0x9642);//OK-9642
PROT_JSR(0xe12e,0x8022,0xda06); break;
case 0xe13e/2: PROT_JSR(0xe13e,0x802a,0x9d66);//9d66 not 9400 - OK
PROT_JSR(0xe13e,0x8013,0x81aa); break;
case 0xe14e/2: PROT_JSR(0xe14e,0x800b,0xb3f2);//b3f2 - OK
PROT_JSR(0xe14e,0x8004,0x8994); break;
case 0xe15e/2: PROT_JSR(0xe15e,0x803c,0xb59e);//b59e - OK
PROT_JSR(0xe15e,0x8035,0x8c36); break;
case 0xe16e/2: PROT_JSR(0xe16e,0x801d,0x9ac2);//9ac2 - OK
PROT_JSR(0xe16e,0x8026,0x8d0c); break;
case 0xe17e/2: PROT_JSR(0xe17e,0x802e,0xc366);//c366 - OK
PROT_JSR(0xe17e,0x8017,0x870a); break;
case 0xe18e/2: PROT_JSR(0xe18e,0x8004,DUMMYA); //unused
PROT_JSR(0xe18e,0x8008,DUMMYA); break; //unused
case 0xe19e/2: PROT_JSR(0xe19e,0x8030,0xd9c6);//OK-d9c6
PROT_JSR(0xe19e,0x8039,0x9642); break;
case 0xe1ae/2: PROT_JSR(0xe1ae,0x8011,0x7a54);//d1f8 not c67e
PROT_JSR(0xe1ae,0x802a,0x9d66); break;
case 0xe1be/2: PROT_JSR(0xe1be,0x8022,0xda06);//da06
PROT_JSR(0xe1be,0x801b,0xb3f2); break;
case 0xe1ce/2: PROT_JSR(0xe1ce,0x8003,0x81aa);//81aa
PROT_JSR(0xe1ce,0x800c,0xb59e); break;
case 0xe1de/2: PROT_JSR(0xe1de,0x8034,0x8994);//8994 - OK
PROT_JSR(0xe1de,0x803d,0x9ac2); break;
case 0xe1ee/2: PROT_JSR(0xe1ee,0x8015,0x8c36);//8d0c not 82f6
PROT_JSR(0xe1ee,0x802e,0xc366); break;
case 0xe1fe/2: PROT_JSR(0xe1fe,0x8026,0x8d0c);//8c36
PROT_JSR(0xe1fe,0x8016,DUMMYA); break; //unused
case 0xef00/2:
if (m_mainram[0xef00/2] == 0x60fe)
{
m_mainram[0xef00/2] = 0x0000; //this is the coin counter
m_mainram[0xef02/2] = 0x0000;
m_mainram[0xef04/2] = 0x4ef9;
m_mainram[0xef06/2] = 0x0000;
m_mainram[0xef08/2] = 0x7dc2;
}
break;
}
#undef DUMMYA
}
void nmk16_state::hachamf_map(address_map &map)
{
map(0x000000, 0x03ffff).rom();
// I/O Region
map(0x080000, 0x080001).portr("IN0");
map(0x080002, 0x080003).portr("IN1");
map(0x080008, 0x080009).portr("DSW1");
map(0x08000a, 0x08000b).portr("DSW2");
map(0x08000f, 0x08000f).r(m_nmk004, FUNC(nmk004_device::read));
map(0x080015, 0x080015).w(FUNC(nmk16_state::flipscreen_w));
map(0x080016, 0x080017).w(FUNC(nmk16_state::nmk004_x0016_w));
map(0x080019, 0x080019).w(FUNC(nmk16_state::tilebank_w));
map(0x08001f, 0x08001f).w(m_nmk004, FUNC(nmk004_device::write));
// Video Region
map(0x088000, 0x0887ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0x08c000, 0x08c007).w(FUNC(nmk16_state::scroll_w<0>)).umask16(0x00ff);
map(0x090000, 0x093fff).ram().w(FUNC(nmk16_state::bgvideoram_w<0>)).share("bgvideoram0");
map(0x09c000, 0x09c7ff).ram().w(FUNC(nmk16_state::txvideoram_w)).share("txvideoram");
// Main RAM, inc sprites, shared with MCU
map(0x0f0000, 0x0fffff).ram().share("mainram"); // ram is shared with MCU
}
void nmk16_state::tdragon_mainram_w(offs_t offset, u16 data, u16 mem_mask)
{
COMBINE_DATA(&m_mainram[offset]);
switch (offset)
{
case 0xe066/2: PROT_INPUT(0xe066/2,0xe23e,0xe000/2,0x000c0000); break;
case 0xe144/2: PROT_INPUT(0xe144/2,0xf54d,0xe004/2,0x000c0002); break;
case 0xe60e/2: PROT_INPUT(0xe60e/2,0x067c,0xe008/2,0x000c0008); break;
case 0xe714/2: PROT_INPUT(0xe714/2,0x198b,0xe00c/2,0x000c000a); break;
case 0xe70e/2: PROT_JSR(0xe70e,0x8007,0x9e22);
PROT_JSR(0xe70e,0x8000,0xd518); break;
case 0xe71e/2: PROT_JSR(0xe71e,0x8038,0xaa0a);
PROT_JSR(0xe71e,0x8031,0x8e7c); break;
case 0xe72e/2: PROT_JSR(0xe72e,0x8019,0xac48);
PROT_JSR(0xe72e,0x8022,0xd558); break;
case 0xe73e/2: PROT_JSR(0xe73e,0x802a,0xb110);
PROT_JSR(0xe73e,0x8013,0x96da); break;
case 0xe74e/2: PROT_JSR(0xe74e,0x800b,0xb9b2);
PROT_JSR(0xe74e,0x8004,0xa062); break;
case 0xe75e/2: PROT_JSR(0xe75e,0x803c,0xbb4c);
PROT_JSR(0xe75e,0x8035,0xa154); break;
case 0xe76e/2: PROT_JSR(0xe76e,0x801d,0xafa6);
PROT_JSR(0xe76e,0x8026,0xa57a); break;
case 0xe77e/2: PROT_JSR(0xe77e,0x802e,0xc6a4);
PROT_JSR(0xe77e,0x8017,0x9e22); break;
case 0xe78e/2: PROT_JSR(0xe78e,0x8004,0xaa0a);
PROT_JSR(0xe78e,0x8008,0xaa0a); break;
case 0xe79e/2: PROT_JSR(0xe79e,0x8030,0xd518);
PROT_JSR(0xe79e,0x8039,0xac48); break;
case 0xe7ae/2: PROT_JSR(0xe7ae,0x8011,0x8e7c);
PROT_JSR(0xe7ae,0x802a,0xb110); break;
case 0xe7be/2: PROT_JSR(0xe7be,0x8022,0xd558);
PROT_JSR(0xe7be,0x801b,0xb9b2); break;
case 0xe7ce/2: PROT_JSR(0xe7ce,0x8003,0x96da);
PROT_JSR(0xe7ce,0x800c,0xbb4c); break;
case 0xe7de/2: PROT_JSR(0xe7de,0x8034,0xa062);
PROT_JSR(0xe7de,0x803d,0xafa6); break;
case 0xe7ee/2: PROT_JSR(0xe7ee,0x8015,0xa154);
PROT_JSR(0xe7ee,0x802e,0xc6a4); break;
case 0xe7fe/2: PROT_JSR(0xe7fe,0x8026,0xa57a);
PROT_JSR(0xe7fe,0x8016,0xa57a); break;
case 0xef00/2:
if (m_mainram[0xef00/2] == 0x60fe)
{
m_mainram[0xef00/2] = 0x0000; //this is the coin counter
m_mainram[0xef02/2] = 0x0000;
m_mainram[0xef04/2] = 0x4ef9;
m_mainram[0xef06/2] = 0x0000;
m_mainram[0xef08/2] = 0x92f4;
}
break;
}
}
// coin setting MCU simulation
void nmk16_state::mcu_run(u8 dsw_setting)
{
u16 coin_input;
u8 dsw[2];
u8 i;
// Accept the start button but needs some m68k processing first,otherwise you can't start a play with 1 credit inserted
if (m_start_helper & 1 && m_mainram[0x9000/2] & 0x0200) // start 1
{
m_mainram[0xef00/2]--;
m_start_helper = m_start_helper & 2;
}
if (m_start_helper & 2 && m_mainram[0x9000/2] & 0x0100) // start 2
{
m_mainram[0xef00/2]--;
m_start_helper = m_start_helper & 1;
}
// needed because of the uncompatibility of the dsw settings.
if (dsw_setting) // Thunder Dragon
{
dsw[0] = (m_dsw_io[1]->read() & 0x7);
dsw[1] = (m_dsw_io[1]->read() & 0x38) >> 3;
for (i = 0; i < 2; i++)
{
switch (dsw[i] & 7)
{
case 0: m_mainram[0x9000/2] |= 0x4000; break; //free play
case 1: m_coin_count_frac[i] = 1; m_coin_count[i] = 4; break;
case 2: m_coin_count_frac[i] = 1; m_coin_count[i] = 3; break;
case 3: m_coin_count_frac[i] = 1; m_coin_count[i] = 2; break;
case 4: m_coin_count_frac[i] = 4; m_coin_count[i] = 1; break;
case 5: m_coin_count_frac[i] = 3; m_coin_count[i] = 1; break;
case 6: m_coin_count_frac[i] = 2; m_coin_count[i] = 1; break;
case 7: m_coin_count_frac[i] = 1; m_coin_count[i] = 1; break;
}
}
}
else // Hacha Mecha Fighter
{
dsw[0] = (m_dsw_io[0]->read() & 0x0700) >> 8;
dsw[1] = (m_dsw_io[0]->read() & 0x3800) >> 11;
for (i = 0; i < 2; i++)
{
switch (dsw[i] & 7)
{
case 0: m_mainram[0x9000/2] |= 0x4000; break; //free play
case 1: m_coin_count_frac[i] = 4; m_coin_count[i] = 1; break;
case 2: m_coin_count_frac[i] = 3; m_coin_count[i] = 1; break;
case 3: m_coin_count_frac[i] = 2; m_coin_count[i] = 1; break;
case 4: m_coin_count_frac[i] = 1; m_coin_count[i] = 4; break;
case 5: m_coin_count_frac[i] = 1; m_coin_count[i] = 3; break;
case 6: m_coin_count_frac[i] = 1; m_coin_count[i] = 2; break;
case 7: m_coin_count_frac[i] = 1; m_coin_count[i] = 1; break;
}
}
}
// read the coin port
coin_input = (~(m_in_io[0]->read()));
if (coin_input & 0x01)//coin 1
{
if ((m_input_pressed & 0x01) == 0)
{
if (m_coin_count_frac[0] != 1)
{
m_mainram[0xef02/2] += m_coin_count[0];
if (m_coin_count_frac[0] == m_mainram[0xef02/2])
{
m_mainram[0xef00/2] += m_coin_count[0];
m_mainram[0xef02/2] = 0;
}
}
else
m_mainram[0xef00/2] += m_coin_count[0];
}
m_input_pressed = (m_input_pressed & 0xfe) | 1;
}
else
m_input_pressed = (m_input_pressed & 0xfe);
if (coin_input & 0x02)//coin 2
{
if ((m_input_pressed & 0x02) == 0)
{
if (m_coin_count_frac[1] != 1)
{
m_mainram[0xef02/2] += m_coin_count[1];
if (m_coin_count_frac[1] == m_mainram[0xef02/2])
{
m_mainram[0xef00/2] += m_coin_count[1];
m_mainram[0xef02/2] = 0;
}
}
else
m_mainram[0xef00/2] += m_coin_count[1];
}
m_input_pressed = (m_input_pressed & 0xfd) | 2;
}
else
m_input_pressed = (m_input_pressed & 0xfd);
if (coin_input & 0x04)//service 1
{
if ((m_input_pressed & 0x04) == 0)
m_mainram[0xef00/2]++;
m_input_pressed = (m_input_pressed & 0xfb) | 4;
}
else
m_input_pressed = (m_input_pressed & 0xfb);
// The 0x9000 ram address is the status
if (m_mainram[0xef00/2] > 0 && m_mainram[0x9000/2] & 0x8000) // enable start button
{
if (coin_input & 0x08)//start 1
{
if ((m_input_pressed & 0x08) == 0 && (!(m_mainram[0x9000/2] & 0x0200))) //start 1
m_start_helper = 1;
m_input_pressed = (m_input_pressed & 0xf7) | 8;
}
else
m_input_pressed = (m_input_pressed & 0xf7);
if (coin_input & 0x10)//start 2
{
// Decrease two coins to let two players play with one start 2 button and two credits inserted at the insert coin screen.
if ((m_input_pressed & 0x10) == 0 && (!(m_mainram[0x9000/2] & 0x0100))) // start 2
m_start_helper = (m_mainram[0x9000/2] == 0x8000) ? (3) : (2);
m_input_pressed = (m_input_pressed & 0xef) | 0x10;
}
else
m_input_pressed = (m_input_pressed & 0xef);
}
}
TIMER_DEVICE_CALLBACK_MEMBER(nmk16_state::tdragon_mcu_sim)
{
mcu_run(1);
}
TIMER_DEVICE_CALLBACK_MEMBER(nmk16_state::hachamf_mcu_sim)
{
mcu_run(0);
}
void nmk16_state::tdragon_map(address_map &map)
{
map(0x000000, 0x03ffff).rom();
map(0x044022, 0x044023).nopr(); // No Idea
// map(0x0b0000, 0x0b7fff).ram(); // Work RAM
// map(0x0b8000, 0x0b8fff).ram().share("spriteram"); // Sprite RAM
// map(0x0b9000, 0x0bdfff).ram().share("mcu_work_ram"); // Work RAM
// map(0x0be000, 0x0befff).lr(NAME([this] (offs_t offset) { return nmk16_mcu_shared_ram[offset]; })).w(FUNC(nmk16_state::tdragon_mcu_shared_w)).share("mcu_shared_ram"); // Work RAM
// map(0x0bf000, 0x0bffff).ram(); // Work RAM
map(0x0b0000, 0x0bffff).ram().share("mainram");
map(0x0c0000, 0x0c0001).portr("IN0");
map(0x0c0002, 0x0c0003).portr("IN1");
map(0x0c0008, 0x0c0009).portr("DSW1");
map(0x0c000a, 0x0c000b).portr("DSW2");
map(0x0c000f, 0x0c000f).r(m_nmk004, FUNC(nmk004_device::read));
map(0x0c0015, 0x0c0015).w(FUNC(nmk16_state::flipscreen_w)); // Maybe
map(0x0c0016, 0x0c0017).w(FUNC(nmk16_state::nmk004_x0016_w));
map(0x0c0019, 0x0c0019).w(FUNC(nmk16_state::tilebank_w)); // Tile Bank?
map(0x0c001f, 0x0c001f).w(m_nmk004, FUNC(nmk004_device::write));
map(0x0c4000, 0x0c4007).ram().w(FUNC(nmk16_state::scroll_w<0>)).umask16(0x00ff);
map(0x0c8000, 0x0c87ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0x0cc000, 0x0cffff).ram().w(FUNC(nmk16_state::bgvideoram_w<0>)).share("bgvideoram0");
map(0x0d0000, 0x0d07ff).ram().w(FUNC(nmk16_state::txvideoram_w)).share("txvideoram");
}
// No sprites without this. Is it actually protection?
u16 nmk16_state::tdragonb_prot_r()
{
return 0x0003;
}
void nmk16_state::tdragonb_map(address_map &map)
{
map(0x000000, 0x03ffff).rom();
map(0x044022, 0x044023).r(FUNC(nmk16_state::tdragonb_prot_r));
map(0x0b0000, 0x0bffff).ram().share("mainram");
map(0x0c0000, 0x0c0001).portr("IN0");
map(0x0c0002, 0x0c0003).portr("IN1");
map(0x0c0008, 0x0c0009).portr("DSW1");
map(0x0c000a, 0x0c000b).portr("DSW2");
map(0x0c0015, 0x0c0015).w(FUNC(nmk16_state::flipscreen_w)); // Maybe
map(0x0c0019, 0x0c0019).w(FUNC(nmk16_state::tilebank_w)); // Tile Bank?
map(0x0c001e, 0x0c001f).w("seibu_sound", FUNC(seibu_sound_device::main_mustb_w));
map(0x0c4000, 0x0c4007).ram().w(FUNC(nmk16_state::scroll_w<0>)).umask16(0x00ff);
map(0x0c8000, 0x0c87ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0x0cc000, 0x0cffff).ram().w(FUNC(nmk16_state::bgvideoram_w<0>)).share("bgvideoram0");
map(0x0d0000, 0x0d07ff).ram().w(FUNC(nmk16_state::txvideoram_w)).share("txvideoram");
}
void nmk16_state::tdragonb2_map(address_map &map)
{
map(0x000000, 0x03ffff).rom();
map(0x0b0000, 0x0bffff).ram().share("mainram");
map(0x0c0000, 0x0c0001).portr("IN0");
map(0x0c0002, 0x0c0003).portr("IN1");
map(0x0c0008, 0x0c0009).portr("DSW1"); // .w TODO oki banking?
map(0x0c000a, 0x0c000b).portr("DSW2");
//map(0x0c000e, 0x0c000f).r; TODO: what's this?
map(0x0c0015, 0x0c0015).w(FUNC(nmk16_state::flipscreen_w)); // Maybe
map(0x0c0019, 0x0c0019).w(FUNC(nmk16_state::tilebank_w)); // Tile Bank
map(0x0c001f, 0x0c001f).w("oki", FUNC(okim6295_device::write));
map(0x0c4000, 0x0c4007).ram().w(FUNC(nmk16_state::scroll_w<0>)).umask16(0x00ff);
map(0x0c8000, 0x0c87ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0x0cc000, 0x0cffff).ram().w(FUNC(nmk16_state::bgvideoram_w<0>)).share("bgvideoram0");
map(0x0d0000, 0x0d07ff).ram().w(FUNC(nmk16_state::txvideoram_w)).share("txvideoram");
}
void nmk16_state::ssmissin_map(address_map &map)
{
map(0x000000, 0x03ffff).rom();
map(0x0b0000, 0x0bffff).ram().share("mainram");
map(0x0c0000, 0x0c0001).portr("IN0");
map(0x0c0004, 0x0c0005).portr("IN1");
map(0x0c0006, 0x0c0007).portr("DSW1");
// map(0x0c000e, 0x0c000f).r(FUNC(nmk16_state::??));
map(0x0c0015, 0x0c0015).w(FUNC(nmk16_state::flipscreen_w)); // Maybe
map(0x0c0019, 0x0c0019).w(FUNC(nmk16_state::tilebank_w)); // Tile Bank?
map(0x0c001f, 0x0c001f).w(m_soundlatch, FUNC(generic_latch_8_device::write));
map(0x0c4000, 0x0c4007).ram().w(FUNC(nmk16_state::scroll_w<0>)).umask16(0x00ff);
map(0x0c8000, 0x0c87ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0x0cc000, 0x0cffff).ram().w(FUNC(nmk16_state::bgvideoram_w<0>)).share("bgvideoram0");
map(0x0d0000, 0x0d07ff).mirror(0x1800).ram().w(FUNC(nmk16_state::txvideoram_w)).share("txvideoram"); //mirror for airattck
}
void nmk16_state::ssmissin_sound_map(address_map &map)
{
map(0x0000, 0x7fff).rom();
map(0x8000, 0x87ff).ram();
map(0x9000, 0x9000).w(FUNC(nmk16_state::ssmissin_soundbank_w));
map(0x9800, 0x9800).rw(m_oki[0], FUNC(okim6295_device::read), FUNC(okim6295_device::write));
map(0xa000, 0xa000).r(m_soundlatch, FUNC(generic_latch_8_device::read));
}
void nmk16_state::oki1_map(address_map &map)
{
map(0x00000, 0x1ffff).rom().region("oki1", 0);
map(0x20000, 0x3ffff).bankr("okibank1");
}
void nmk16_state::oki2_map(address_map &map)
{
map(0x00000, 0x1ffff).rom().region("oki2", 0);
map(0x20000, 0x3ffff).bankr("okibank2");
}
void nmk16_state::strahl_map(address_map &map)
{
map(0x00000, 0x3ffff).rom();
map(0x80000, 0x80001).portr("IN0");
map(0x80002, 0x80003).portr("IN1");
map(0x80008, 0x80009).portr("DSW1");
map(0x8000a, 0x8000b).portr("DSW2");
map(0x8000f, 0x8000f).r(m_nmk004, FUNC(nmk004_device::read));
map(0x80015, 0x80015).w(FUNC(nmk16_state::flipscreen_w));
map(0x80016, 0x80017).w(FUNC(nmk16_state::nmk004_x0016_w));
map(0x8001f, 0x8001f).w(m_nmk004, FUNC(nmk004_device::write));
map(0x84000, 0x84007).ram().w(FUNC(nmk16_state::scroll_w<0>)).umask16(0x00ff);
map(0x88000, 0x88007).ram().w(FUNC(nmk16_state::scroll_w<1>)).umask16(0x00ff);
map(0x8c000, 0x8c7ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0x90000, 0x93fff).ram().w(FUNC(nmk16_state::bgvideoram_w<0>)).share("bgvideoram0");
map(0x94000, 0x97fff).ram().w(FUNC(nmk16_state::bgvideoram_w<1>)).share("bgvideoram1");
map(0x9c000, 0x9c7ff).ram().w(FUNC(nmk16_state::txvideoram_w)).share("txvideoram");
map(0xf0000, 0xfffff).ram().share("mainram");
}
void nmk16_state::strahljbl_map(address_map &map)
{
map(0x00000, 0x3ffff).rom();
map(0x80000, 0x80001).portr("IN0");
map(0x80002, 0x80003).portr("IN1");
map(0x80008, 0x80009).portr("DSW1");
map(0x8000a, 0x8000b).portr("DSW2");
map(0x80015, 0x80015).w(FUNC(nmk16_state::flipscreen_w));
map(0x8001e, 0x8001f).w("seibu_sound", FUNC(seibu_sound_device::main_mustb_w));
map(0x84000, 0x84007).ram().w(FUNC(nmk16_state::scroll_w<0>)).umask16(0x00ff);
map(0x88000, 0x88007).ram().w(FUNC(nmk16_state::scroll_w<1>)).umask16(0x00ff);
map(0x8c000, 0x8c7ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0x90000, 0x93fff).ram().w(FUNC(nmk16_state::bgvideoram_w<0>)).share("bgvideoram0");
map(0x94000, 0x97fff).ram().w(FUNC(nmk16_state::bgvideoram_w<1>)).share("bgvideoram1");
map(0x9c000, 0x9c7ff).ram().w(FUNC(nmk16_state::txvideoram_w)).share("txvideoram");
map(0xf0000, 0xfffff).ram().share("mainram");
}
void nmk16_state::macross_map(address_map &map)
{
map(0x000000, 0x07ffff).rom();
map(0x080000, 0x080001).portr("IN0");
map(0x080002, 0x080003).portr("IN1");
map(0x080008, 0x080009).portr("DSW1");
map(0x08000a, 0x08000b).portr("DSW2");
map(0x08000f, 0x08000f).r(m_nmk004, FUNC(nmk004_device::read));
map(0x080015, 0x080015).w(FUNC(nmk16_state::flipscreen_w));
map(0x080016, 0x080017).w(FUNC(nmk16_state::nmk004_x0016_w));
map(0x080019, 0x080019).w(FUNC(nmk16_state::tilebank_w));
map(0x08001f, 0x08001f).w(m_nmk004, FUNC(nmk004_device::write));
map(0x088000, 0x0887ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0x08c000, 0x08c007).ram().w(FUNC(nmk16_state::scroll_w<0>)).umask16(0x00ff);
map(0x090000, 0x093fff).ram().w(FUNC(nmk16_state::bgvideoram_w<0>)).share("bgvideoram0");
map(0x09c000, 0x09c7ff).ram().w(FUNC(nmk16_state::txvideoram_w)).share("txvideoram");
map(0x0f0000, 0x0fffff).ram().w(FUNC(nmk16_state::mainram_strange_w)).share("mainram");
}
void nmk16_state::gunnail_map(address_map &map)
{
map(0x000000, 0x07ffff).rom();
map(0x080000, 0x080001).portr("IN0");
map(0x080002, 0x080003).portr("IN1");
map(0x080008, 0x080009).portr("DSW1");
map(0x08000a, 0x08000b).portr("DSW2");
map(0x08000f, 0x08000f).r(m_nmk004, FUNC(nmk004_device::read));
map(0x080015, 0x080015).w(FUNC(nmk16_state::flipscreen_w));
map(0x080016, 0x080017).w(FUNC(nmk16_state::nmk004_x0016_w));
map(0x080019, 0x080019).w(FUNC(nmk16_state::tilebank_w));
map(0x08001f, 0x08001f).w(m_nmk004, FUNC(nmk004_device::write));
map(0x088000, 0x0887ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0x08c000, 0x08c1ff).writeonly().share("scrollram");
map(0x08c200, 0x08c3ff).writeonly().share("scrollramy");
map(0x08c400, 0x08c7ff).nopw(); // unknown
map(0x090000, 0x093fff).ram().w(FUNC(nmk16_state::bgvideoram_w<0>)).share("bgvideoram0");
map(0x09c000, 0x09cfff).mirror(0x001000).ram().w(FUNC(nmk16_state::txvideoram_w)).share("txvideoram");
map(0x0f0000, 0x0fffff).ram().share("mainram");
}
void nmk16_state::gunnailb_map(address_map &map)
{
map(0x000000, 0x07ffff).rom();
map(0x080000, 0x080001).portr("IN0");
map(0x080002, 0x080003).portr("IN1");
map(0x080008, 0x080009).portr("DSW1");
map(0x08000a, 0x08000b).portr("DSW2");
map(0x08000f, 0x08000f).r("soundlatch2", FUNC(generic_latch_8_device::read));
map(0x080015, 0x080015).w(FUNC(nmk16_state::flipscreen_w));
//map(0x080016, 0x080017).noprw();
map(0x080019, 0x080019).w(FUNC(nmk16_state::tilebank_w));
map(0x08001f, 0x08001f).w(m_soundlatch, FUNC(generic_latch_8_device::write));
map(0x088000, 0x0887ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0x08c000, 0x08c1ff).writeonly().share("scrollram");
map(0x08c200, 0x08c3ff).writeonly().share("scrollramy");
map(0x08c400, 0x08c7ff).nopw(); // unknown
map(0x090000, 0x093fff).ram().w(FUNC(nmk16_state::bgvideoram_w<0>)).share("bgvideoram0");
map(0x09c000, 0x09cfff).mirror(0x001000).ram().w(FUNC(nmk16_state::txvideoram_w)).share("txvideoram");
map(0x0f0000, 0x0fffff).ram().share("mainram");
map(0x194001, 0x194001).w(m_oki[0], FUNC(okim6295_device::write));
}
void nmk16_state::gunnailb_sound_map(address_map &map)
{
map(0x0000, 0x7fff).rom();
map(0x8000, 0xbfff).bankr("audiobank");
map(0xc000, 0xdfff).ram();
}
void nmk16_state::gunnailb_sound_io_map(address_map &map)
{
map.global_mask(0xff);
map(0x00, 0x00).w(FUNC(nmk16_state::macross2_sound_bank_w));
map(0x02, 0x03).rw("ymsnd", FUNC(ym2203_device::read), FUNC(ym2203_device::write));
map(0x04, 0x04).noprw(); // since the bootleggers used the same audio CPU ROM as airbustr but a different Oki ROM, they connected the Oki to the main CPU
map(0x06, 0x06).r(m_soundlatch, FUNC(generic_latch_8_device::read)).w("soundlatch2", FUNC(generic_latch_8_device::write));
}
void nmk16_state::macross2_map(address_map &map)
{
map(0x000000, 0x07ffff).rom();
map(0x100000, 0x100001).portr("IN0");
map(0x100002, 0x100003).portr("IN1");
map(0x100008, 0x100009).portr("DSW1");
map(0x10000a, 0x10000b).portr("DSW2");
map(0x10000f, 0x10000f).r("soundlatch2", FUNC(generic_latch_8_device::read)); // from Z80
map(0x100015, 0x100015).w(FUNC(nmk16_state::flipscreen_w));
map(0x100016, 0x100017).w(FUNC(nmk16_state::macross2_sound_reset_w)); // Z80 reset
map(0x100019, 0x100019).w(FUNC(nmk16_state::tilebank_w));
map(0x10001f, 0x10001f).w(m_soundlatch, FUNC(generic_latch_8_device::write)); // to Z80
map(0x120000, 0x1207ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0x130000, 0x130007).ram().w(FUNC(nmk16_state::scroll_w<0>)).umask16(0x00ff);
map(0x140000, 0x14ffff).ram().w(FUNC(nmk16_state::bgvideoram_w<0>)).share("bgvideoram0");
map(0x170000, 0x170fff).mirror(0x1000).ram().w(FUNC(nmk16_state::txvideoram_w)).share("txvideoram");
map(0x1f0000, 0x1fffff).ram().share("mainram");
}
void nmk16_state::tdragon2_map(address_map &map)
{ // mainram address scrambled
macross2_map(map);
map(0x1f0000, 0x1fffff).rw(FUNC(nmk16_state::mainram_swapped_r), FUNC(nmk16_state::mainram_swapped_w)).share("mainram");
}
void nmk16_state::tdragon3h_map(address_map &map)
{ // bootleg has these 2 swapped
tdragon2_map(map);
map(0x10000e, 0x10000f).portr("DSW2");
map(0x10000b, 0x10000b).r("soundlatch2", FUNC(generic_latch_8_device::read)); // from Z80
}
void nmk16_state::raphero_map(address_map &map)
{
map(0x000000, 0x07ffff).rom();
map(0x100000, 0x100001).portr("IN0");
map(0x100002, 0x100003).portr("IN1");
map(0x100008, 0x100009).portr("DSW1");
map(0x10000a, 0x10000b).portr("DSW2");
map(0x10000f, 0x10000f).r("soundlatch2", FUNC(generic_latch_8_device::read)); // from Z80
map(0x100015, 0x100015).w(FUNC(nmk16_state::flipscreen_w));
map(0x100016, 0x100017).nopw(); // IRQ enable or z80 sound reset like in Macross 2?
map(0x100019, 0x100019).w(FUNC(nmk16_state::tilebank_w));
map(0x10001f, 0x10001f).w(m_soundlatch, FUNC(generic_latch_8_device::write)); // to Z80
map(0x120000, 0x1207ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0x130000, 0x1301ff).ram().w(FUNC(nmk16_state::raphero_scroll_w)).share("scrollram");
map(0x130200, 0x1303ff).ram().share("scrollramy");
map(0x130400, 0x1307ff).ram();
map(0x140000, 0x14ffff).ram().w(FUNC(nmk16_state::bgvideoram_w<0>)).share("bgvideoram0");
map(0x170000, 0x170fff).mirror(0x1000).ram().w(FUNC(nmk16_state::txvideoram_w)).share("txvideoram");
map(0x1f0000, 0x1fffff).rw(FUNC(nmk16_state::mainram_swapped_r), FUNC(nmk16_state::mainram_swapped_w)).share("mainram");
}
void nmk16_state::raphero_sound_mem_map(address_map &map)
{
map(0x0000, 0x7fff).rom();
map(0x8000, 0xbfff).bankr("audiobank");
map(0xc000, 0xc001).rw("ymsnd", FUNC(ym2203_device::read), FUNC(ym2203_device::write));
map(0xc800, 0xc800).rw(m_oki[0], FUNC(okim6295_device::read), FUNC(okim6295_device::write));
map(0xc808, 0xc808).rw(m_oki[1], FUNC(okim6295_device::read), FUNC(okim6295_device::write));
map(0xc810, 0xc817).w("nmk112", FUNC(nmk112_device::okibank_w));
map(0xd000, 0xd000).w(FUNC(nmk16_state::macross2_sound_bank_w));
map(0xd800, 0xd800).r(m_soundlatch, FUNC(generic_latch_8_device::read)).w("soundlatch2", FUNC(generic_latch_8_device::write)); // main cpu
map(0xe000, 0xffff).ram();
}
void nmk16_state::macross2_sound_map(address_map &map)
{
map(0x0000, 0x7fff).rom();
map(0x8000, 0xbfff).bankr("audiobank"); // banked ROM
map(0xa000, 0xa000).nopr(); // IRQ ack? watchdog?
map(0xc000, 0xdfff).ram();
map(0xe001, 0xe001).w(FUNC(nmk16_state::macross2_sound_bank_w));
map(0xf000, 0xf000).r(m_soundlatch, FUNC(generic_latch_8_device::read)).w("soundlatch2", FUNC(generic_latch_8_device::write)); // from 68000
}
void nmk16_state::macross2_sound_io_map(address_map &map)
{
map.global_mask(0xff);
map(0x00, 0x01).rw("ymsnd", FUNC(ym2203_device::read), FUNC(ym2203_device::write));
map(0x80, 0x80).rw(m_oki[0], FUNC(okim6295_device::read), FUNC(okim6295_device::write));
map(0x88, 0x88).rw(m_oki[1], FUNC(okim6295_device::read), FUNC(okim6295_device::write));
map(0x90, 0x97).w("nmk112", FUNC(nmk112_device::okibank_w));
}
void nmk16_state::tdragon3h_sound_io_map(address_map &map)
{
map.global_mask(0xff);
//map(0x00, 0x01).rw("ymsnd", FUNC(ym2203_device::read), FUNC(ym2203_device::write)); // writes here since ROM is the same as the original, but no chip on PCB
//map(0x80, 0x80).rw(m_oki[0], FUNC(okim6295_device::read), FUNC(okim6295_device::write)); // same as above
map(0x88, 0x88).rw(m_oki[1], FUNC(okim6295_device::read), FUNC(okim6295_device::write));
map(0x90, 0x97).w("nmk112", FUNC(nmk112_device::okibank_w));
}
void nmk16_state::bjtwin_map(address_map &map)
{
map(0x000000, 0x07ffff).rom();
map(0x080000, 0x080001).portr("IN0");
map(0x080002, 0x080003).portr("IN1");
map(0x080008, 0x080009).portr("DSW1");
map(0x08000a, 0x08000b).portr("DSW2");
map(0x080015, 0x080015).w(FUNC(nmk16_state::flipscreen_w));
map(0x084001, 0x084001).rw(m_oki[0], FUNC(okim6295_device::read), FUNC(okim6295_device::write));
map(0x084011, 0x084011).rw(m_oki[1], FUNC(okim6295_device::read), FUNC(okim6295_device::write));
map(0x084020, 0x08402f).w("nmk112", FUNC(nmk112_device::okibank_w)).umask16(0x00ff);
map(0x088000, 0x0887ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette");
map(0x094001, 0x094001).w(FUNC(nmk16_state::tilebank_w));
map(0x094003, 0x094003).w(FUNC(nmk16_state::bjtwin_scroll_w)); // sabotenb specific?
map(0x09c000, 0x09cfff).mirror(0x1000).ram().w(FUNC(nmk16_state::bgvideoram_w<0>)).share("bgvideoram0");
map(0x0f0000, 0x0fffff).ram().share("mainram");
}
static INPUT_PORTS_START( vandyke )
PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Maybe unused
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Maybe unused
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Maybe unused
PORT_START("IN1")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("DSW1")
PORT_DIPNAME( 0x01, 0x01, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:8") // The manual states this dip is "Unused"
PORT_DIPSETTING( 0x00, "2" )
PORT_DIPSETTING( 0x01, "3" )
PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:7") // The manual states this dip is "Unused"
PORT_DIPSETTING( 0x02, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:6") // The manual states this dip is "Unused"
PORT_DIPSETTING( 0x04, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_SERVICE_DIPLOC( 0x08, IP_ACTIVE_LOW, "SW1:5" ) // The manual states this dip is "Unused"
PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:4") // The manual states this dip is "Unused"
PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x20, 0x20, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:3")
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
PORT_DIPSETTING( 0x20, DEF_STR( On ) )
PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:2,1")
PORT_DIPSETTING( 0x00, DEF_STR( Easy ) )
PORT_DIPSETTING( 0xc0, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x40, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x80, DEF_STR( Hardest ) )
PORT_START("DSW2")
PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:8")
PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:7")
PORT_DIPSETTING( 0x02, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x1c, 0x1c, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW2:6,5,4")
PORT_DIPSETTING( 0x00, DEF_STR( 5C_1C ) )
PORT_DIPSETTING( 0x10, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x08, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x18, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x1c, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0c, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x14, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x04, DEF_STR( 1C_4C ) )
PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:3,2,1")
PORT_DIPSETTING( 0x00, DEF_STR( 5C_1C ) )
PORT_DIPSETTING( 0x80, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x40, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0xc0, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0xe0, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x60, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0xa0, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x20, DEF_STR( 1C_4C ) )
INPUT_PORTS_END
static INPUT_PORTS_START( vandykeb )
PORT_INCLUDE( vandyke )
PORT_MODIFY("IN0")
PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN ) // Tested on boot
INPUT_PORTS_END
static INPUT_PORTS_START( blkheart )
PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Maybe unused
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Maybe unused
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Maybe unused
PORT_START("IN1")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("DSW1")
PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:8")
PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_SERVICE_DIPLOC( 0x02, IP_ACTIVE_LOW, "SW1:7" )
PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:6,5")
PORT_DIPSETTING( 0x0c, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x08, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x04, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) )
PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:4")
PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:3")
PORT_DIPSETTING( 0x20, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:2,1")
PORT_DIPSETTING( 0x40, "2" )
PORT_DIPSETTING( 0xc0, "3" )
PORT_DIPSETTING( 0x80, "4" )
PORT_DIPSETTING( 0x00, "5" )
PORT_START("DSW2")
PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:8")
PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7")
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
PORT_DIPSETTING( 0x02, DEF_STR( On ) )
PORT_DIPNAME( 0x1c, 0x1c, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW2:6,5,4")
PORT_DIPSETTING( 0x10, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x08, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x18, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x1c, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0c, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x14, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x04, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) )
PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:3,2,1")
PORT_DIPSETTING( 0x80, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x40, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0xc0, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0xe0, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x60, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0xa0, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x20, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) )
INPUT_PORTS_END
static INPUT_PORTS_START( manybloc )
PORT_START("IN0") // 0x080000
PORT_BIT( 0x7fff, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN ) // VBLANK ? Check code at 0x005640
PORT_START("IN1") // 0x080002
PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_START1 )
PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1) // select fruits
PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) // help
PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY
PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY
PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY
PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY
PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_COIN1 )
PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_START2 )
PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2) // select fruits
PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) // help
PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_COCKTAIL
PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_COIN2 )
PORT_START("DSW1") // 0x080004 -> 0x0f0036
PORT_DIPNAME( 0x0001, 0x0000, "Slot System" ) PORT_DIPLOCATION("SW1:1")
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0001, DEF_STR( On ) )
PORT_DIPNAME( 0x0002, 0x0000, "Explanation" ) PORT_DIPLOCATION("SW1:2")
PORT_DIPSETTING( 0x0000, DEF_STR( English ) )
PORT_DIPSETTING( 0x0002, DEF_STR( Japanese ) )
PORT_DIPNAME( 0x0004, 0x0000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:3")
PORT_DIPSETTING( 0x0004, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW1:4") // "Play Type"
PORT_DIPSETTING( 0x0008, DEF_STR( Upright ) ) // "Uplight" !
PORT_DIPSETTING( 0x0000, DEF_STR( Cocktail ) ) // "Table"
PORT_SERVICE_DIPLOC( 0x10, IP_ACTIVE_HIGH, "SW1:5" ) // "Test Mode"
PORT_DIPNAME( 0x0060, 0x0000, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:6,7")
PORT_DIPSETTING( 0x0060, DEF_STR( Easy ) ) // "Level 1
PORT_DIPSETTING( 0x0000, DEF_STR( Normal ) ) // "Level 2
PORT_DIPSETTING( 0x0020, DEF_STR( Hard ) ) // "Level 3
PORT_DIPSETTING( 0x0040, DEF_STR( Hardest ) ) // "Level 4
PORT_DIPNAME( 0x0080, 0x0000, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:8") // "Display"
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) ) // "Normal"
PORT_DIPSETTING( 0x0080, DEF_STR( On ) ) // "Inverse"
PORT_DIPNAME( 0x0700, 0x0000, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:1,2,3")
PORT_DIPSETTING( 0x0700, DEF_STR( 5C_1C ) )
PORT_DIPSETTING( 0x0600, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x0500, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x0400, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x0000, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0100, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x0200, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x0300, DEF_STR( 1C_4C ) )
PORT_DIPNAME( 0x3800, 0x0000, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW2:4,5,6")
PORT_DIPSETTING( 0x3800, DEF_STR( 5C_1C ) )
PORT_DIPSETTING( 0x3000, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x2800, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x2000, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x0000, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0800, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x1000, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x1800, DEF_STR( 1C_4C ) )
PORT_DIPNAME( 0xc000, 0x0000, "Plate Probability" ) PORT_DIPLOCATION("SW2:7,8")
PORT_DIPSETTING( 0xc000, "Bad" )
PORT_DIPSETTING( 0x0000, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x4000, "Better" )
PORT_DIPSETTING( 0x8000, "Best" )
INPUT_PORTS_END
static INPUT_PORTS_START( tomagic )
PORT_START("IN0") // $080000.w
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("IN1") // $080002.w
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("DSW1")
PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x0001, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x0002, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x0004, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x0008, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Demo_Sounds ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0010, DEF_STR( On ) )
PORT_DIPNAME( 0x00e0, 0x00e0, DEF_STR( Coin_A ) )
PORT_DIPSETTING( 0x0080, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x0040, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x00c0, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x00e0, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0060, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x00a0, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x0020, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) )
PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("DSW2") // somewhere in here is likely Difficulty & Bonus
PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x0001, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x0002, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x0004, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x0008, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x0010, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x0020, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x00c0, 0x00c0, "Balls" )
PORT_DIPSETTING( 0x0040, "2" )
PORT_DIPSETTING( 0x00c0, "3" )
PORT_DIPSETTING( 0x0080, "4" )
PORT_DIPSETTING( 0x0000, "5" )
PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
INPUT_PORTS_END
/**********************************************************
Input Ports: Task Force Harrier
this is a little strange compared to the other games, the
protection might be more involved here than it first
appears, however, this works.
**********************************************************/
static INPUT_PORTS_START( tharrier )
PORT_START("IN0")
PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_COIN1 )
PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_COIN2 )
PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_SERVICE1 )
PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_START1 )
PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_START2 )
PORT_BIT( 0x7fe0, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_CUSTOM ) // MCU status?
PORT_START("IN1")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_START1)
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_START2) //title
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNKNOWN)
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_START2 ) //in game
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("DSW1")
PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:8")
PORT_DIPSETTING( 0x0001, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7")
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0002, DEF_STR( On ) )
PORT_DIPNAME( 0x001c, 0x001c, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW2:6,5,4")
PORT_DIPSETTING( 0x0010, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x0008, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x0018, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x001c, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x000c, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x0014, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x0004, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) )
PORT_DIPNAME( 0x00e0, 0x00e0, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:3,2,1")
PORT_DIPSETTING( 0x0080, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x0040, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x00c0, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x00e0, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0060, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x00a0, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x0020, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) )
PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW1:8")
PORT_DIPSETTING( 0x0100, DEF_STR( Upright ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Cocktail ) )
PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:7")
PORT_DIPSETTING( 0x0200, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0c00, 0x0c00, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:6,5")
PORT_DIPSETTING( 0x0400, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x0c00, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x0800, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) )
PORT_DIPNAME( 0x3000, 0x3000, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW1:4,3")
PORT_DIPSETTING( 0x3000, "200k" )
PORT_DIPSETTING( 0x2000, "200k and 1 Mil" )
PORT_DIPSETTING( 0x0000, "200k, 500k & 1,2,3,5 Mil" )
PORT_DIPSETTING( 0x1000, DEF_STR( None ) )
PORT_DIPNAME( 0xc000, 0xc000, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:2,1")
PORT_DIPSETTING( 0x4000, "2" )
PORT_DIPSETTING( 0xc000, "3" )
PORT_DIPSETTING( 0x8000, "4" )
PORT_DIPSETTING( 0x0000, "5" )
PORT_START("IN2")
PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(1)
PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_PLAYER(1)
PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_BUTTON3 )PORT_PLAYER(1)
PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_UNKNOWN )//coin ?
PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_PLAYER(2)
PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_PLAYER(2)
PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_UNKNOWN ) //coin ?
INPUT_PORTS_END
static INPUT_PORTS_START( mustang )
PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // TEST in service mode
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("IN1")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("DSW1")
PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:8")
PORT_DIPSETTING( 0x0001, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7")
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0002, DEF_STR( On ) )
PORT_DIPNAME( 0x001c, 0x001c, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW2:6,5,4")
PORT_DIPSETTING( 0x0010, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x0008, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x0018, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x001c, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x000c, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x0014, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x0004, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) )
PORT_DIPNAME( 0x00e0, 0x00e0, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:3,2,1")
PORT_DIPSETTING( 0x0080, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x0040, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x00c0, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x00e0, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0060, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x00a0, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x0020, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) )
PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:8")
PORT_DIPSETTING( 0x0100, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:7")
PORT_DIPSETTING( 0x0200, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0c00, 0x0c00, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:6,5")
PORT_DIPSETTING( 0x0400, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x0c00, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x0800, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) )
PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:4")
PORT_DIPSETTING( 0x1000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:3")
PORT_DIPSETTING( 0x2000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0xc000, 0xc000, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:2,1")
PORT_DIPSETTING( 0x4000, "2" )
PORT_DIPSETTING( 0xc000, "3" )
PORT_DIPSETTING( 0x8000, "4" )
PORT_DIPSETTING( 0x0000, "5" )
PORT_START("COIN") // referenced by Seibu sound board
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
INPUT_PORTS_END
static INPUT_PORTS_START( hachamf_prot )
PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) //bryan: test mode in some games?
PORT_START("IN1")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("DSW1")
PORT_DIPNAME( 0x0700, 0x0700, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:8,7,6")
PORT_DIPSETTING( 0x0100, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x0200, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x0300, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x0700, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0600, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x0500, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x0400, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) )
PORT_DIPNAME( 0x3800, 0x3800, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW2:5,4,3")
PORT_DIPSETTING( 0x0800, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x1000, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x1800, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x3800, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x3000, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x2800, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x2000, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) )
PORT_DIPNAME( 0x4000, 0x4000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:2")
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x4000, DEF_STR( On ) )
PORT_DIPNAME( 0x8000, 0x8000, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:1")
PORT_DIPSETTING( 0x8000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:8")
PORT_DIPSETTING( 0x0001, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0002, 0x0000, DEF_STR( Language ) ) PORT_DIPLOCATION("SW1:7")
PORT_DIPSETTING( 0x0000, DEF_STR( English ) )
PORT_DIPSETTING( 0x0002, DEF_STR( Japanese ) )
PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:6,5")
PORT_DIPSETTING( 0x0004, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x000c, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x0008, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) )
PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:4")
PORT_DIPSETTING( 0x0010, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:3")
PORT_DIPSETTING( 0x0020, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x00c0, 0x00c0, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:2,1")
PORT_DIPSETTING( 0x0000, "1" )
PORT_DIPSETTING( 0x0040, "2" )
PORT_DIPSETTING( 0x00c0, "3" )
PORT_DIPSETTING( 0x0080, "4" )
PORT_START("DSW2")
INPUT_PORTS_END
static INPUT_PORTS_START( hachamfb )
PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) //bryan: test mode in some games?
PORT_START("IN1")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("DSW1")
PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:8")
PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x02, 0x00, DEF_STR( Language ) ) PORT_DIPLOCATION("SW1:7")
PORT_DIPSETTING( 0x00, DEF_STR( English ) )
PORT_DIPSETTING( 0x02, DEF_STR( Japanese ) )
PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:6,5")
PORT_DIPSETTING( 0x04, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x0c, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x08, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) )
PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:4")
PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:3")
PORT_DIPSETTING( 0x20, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:2,1")
PORT_DIPSETTING( 0x00, "1" )
PORT_DIPSETTING( 0x40, "2" )
PORT_DIPSETTING( 0xc0, "3" )
PORT_DIPSETTING( 0x80, "4" )
PORT_START("DSW2")
PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:8")
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
PORT_DIPSETTING( 0x01, DEF_STR( On ) )
PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7")
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
PORT_DIPSETTING( 0x02, DEF_STR( On ) )
PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:6") // turning these 3 off results in a broken freeplay mode, probably a leftover from the bootleg not simulating coinage settings
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
PORT_DIPSETTING( 0x04, DEF_STR( On ) )
PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:5") // ^
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
PORT_DIPSETTING( 0x08, DEF_STR( On ) )
PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:4") // ^
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
PORT_DIPSETTING( 0x10, DEF_STR( On ) )
PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:3") // likewise turning these 3 off
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
PORT_DIPSETTING( 0x20, DEF_STR( On ) )
PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:2") // ^
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
PORT_DIPSETTING( 0x40, DEF_STR( On ) )
PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:1") // ^
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
PORT_DIPSETTING( 0x80, DEF_STR( On ) )
INPUT_PORTS_END
static INPUT_PORTS_START( hachamfp )
PORT_INCLUDE(hachamfb)
PORT_MODIFY("DSW1")
PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:8")
PORT_DIPSETTING( 0x0001, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:7")
PORT_DIPSETTING( 0x0002, DEF_STR( Japanese ) )
PORT_DIPSETTING( 0x0000, DEF_STR( English ) )
PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:6,5")
PORT_DIPSETTING( 0x0004, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x000c, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x0008, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) )
PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:4")
PORT_DIPSETTING( 0x0010, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:3")
PORT_DIPSETTING( 0x0020, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x00c0, 0x00c0, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:2,1")
PORT_DIPSETTING( 0x0000, "1" )
PORT_DIPSETTING( 0x0040, "2" )
PORT_DIPSETTING( 0x00c0, "3" )
PORT_DIPSETTING( 0x0080, "4" )
PORT_MODIFY("DSW2")
PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:8")
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0001, DEF_STR( On ) )
PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7")
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0002, DEF_STR( On ) )
PORT_DIPNAME( 0x001c, 0x001c, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW2:4,5,6")
PORT_DIPSETTING( 0x0010, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x0008, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x0018, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x001c, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x000c, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x0014, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x0004, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) )
PORT_DIPNAME( 0x00e0, 0x00e0, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:1,2,3")
PORT_DIPSETTING( 0x0080, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x0040, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x00c0, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x00e0, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0060, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x00a0, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x0020, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) )
INPUT_PORTS_END
static INPUT_PORTS_START( strahl )
PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) //bryan: test mode in some games?
PORT_START("IN1")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("DSW1")
PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2,3")
PORT_DIPSETTING( 0x00, DEF_STR( 5C_1C ) )
PORT_DIPSETTING( 0x01, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x02, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x03, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x07, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x06, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x05, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x04, DEF_STR( 1C_4C ) )
PORT_DIPNAME( 0x38, 0x38, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:4,5,6")
PORT_DIPSETTING( 0x00, DEF_STR( 5C_1C ) )
PORT_DIPSETTING( 0x08, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x10, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x18, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x38, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x30, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x28, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x20, DEF_STR( 1C_4C ) )
PORT_DIPNAME( 0x40, 0x40, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:7")
PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x80, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:8")
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_START("DSW2")
PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:1,2")
PORT_DIPSETTING( 0x02, "2" )
PORT_DIPSETTING( 0x03, "3" )
PORT_DIPSETTING( 0x01, "4" )
PORT_DIPSETTING( 0x00, "5" )
PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:3,4")
PORT_DIPSETTING( 0x08, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x0c, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x04, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) )
PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:5")
PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x60, 0x60, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW2:6,7")
PORT_DIPSETTING( 0x40, "100k and every 200k" )
PORT_DIPSETTING( 0x60, "200k and every 200k" )
PORT_DIPSETTING( 0x20, "300k and every 300k" )
PORT_DIPSETTING( 0x00, DEF_STR( None ) )
PORT_SERVICE_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW2:8" )
INPUT_PORTS_END
static INPUT_PORTS_START( strahljbl )
PORT_INCLUDE(strahl)
PORT_START("COIN") // referenced by Seibu sound board
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
INPUT_PORTS_END
static INPUT_PORTS_START( acrobatm )
PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("IN1")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) // used by secret code
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("DSW1")
PORT_DIPNAME( 0x0001, 0x0000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:8")
PORT_DIPSETTING( 0x0001, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:7")
PORT_DIPSETTING( 0x0002, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x001C, 0x001C, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:6,5,4")
PORT_DIPSETTING( 0x0000, DEF_STR( 5C_1C ) )
PORT_DIPSETTING( 0x0010, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x0008, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x0018, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x001C, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x000C, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x0014, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x0004, DEF_STR( 1C_4C ) )
PORT_DIPNAME( 0x00E0, 0x00E0, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:3,2,1")
PORT_DIPSETTING( 0x0000, DEF_STR( 5C_1C ) )
PORT_DIPSETTING( 0x0080, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x0040, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x00C0, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x00E0, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0060, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x00A0, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x0020, DEF_STR( 1C_4C ) )
PORT_START("DSW2")
PORT_SERVICE_DIPLOC( 0x01, IP_ACTIVE_LOW, "SW2:8" )
PORT_DIPNAME( 0x06, 0x06, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW2:7,6")
PORT_DIPSETTING( 0x02, "50k and 100k" )
PORT_DIPSETTING( 0x06, "100k and 100k" )
PORT_DIPSETTING( 0x04, "100k and 200k" )
PORT_DIPSETTING( 0x00, DEF_STR( None ) )
PORT_DIPNAME( 0x08, 0x00, DEF_STR( Language ) ) PORT_DIPLOCATION("SW2:5")
PORT_DIPSETTING( 0x00, DEF_STR( English ) )
PORT_DIPSETTING( 0x08, DEF_STR( Japanese ) )
PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:4,3")
PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) )
PORT_DIPSETTING( 0x10, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x20, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x30, DEF_STR( Normal ) )
PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:2,1")
PORT_DIPSETTING( 0x40, "2" )
PORT_DIPSETTING( 0xc0, "3" )
PORT_DIPSETTING( 0x80, "4" )
PORT_DIPSETTING( 0x00, "5" )
INPUT_PORTS_END
static INPUT_PORTS_START( bioship )
PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) //bryan: test mode in some games?
PORT_START("IN1")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("DSW1")
PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:8")
PORT_DIPSETTING( 0x0001, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0006, 0x0006, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:7,6")
PORT_DIPSETTING( 0x0000, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x0006, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x0002, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x0004, DEF_STR( Hardest ) )
PORT_SERVICE_DIPLOC( 0x0008, IP_ACTIVE_LOW, "SW1:5" )
PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:4")
PORT_DIPSETTING( 0x0010, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:3")
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0020, DEF_STR( On ) )
PORT_DIPNAME( 0x00C0, 0x00C0, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:2,1")
PORT_DIPSETTING( 0x0000, "2" )
PORT_DIPSETTING( 0x00C0, "3" )
PORT_DIPSETTING( 0x0080, "4" )
PORT_DIPSETTING( 0x0040, "5" )
PORT_START("DSW2")
PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:8")
PORT_DIPSETTING( 0x0001, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:7")
PORT_DIPSETTING( 0x0002, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x001C, 0x001C, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW2:6,5,4")
PORT_DIPSETTING( 0x0000, DEF_STR( 5C_1C ) )
PORT_DIPSETTING( 0x0010, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x0008, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x0018, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x001C, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x000C, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x0014, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x0004, DEF_STR( 1C_4C ) )
PORT_DIPNAME( 0x00E0, 0x00E0, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:3,2,1")
PORT_DIPSETTING( 0x0000, DEF_STR( 5C_1C ) )
PORT_DIPSETTING( 0x0080, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x0040, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x00C0, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x00E0, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0060, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x00A0, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x0020, DEF_STR( 1C_4C ) )
INPUT_PORTS_END
static INPUT_PORTS_START( tdragon_prot )
PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // TEST in service mode
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("IN1")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("DSW1")
PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:8")
PORT_DIPSETTING( 0x0001, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:7") // The manual states this dip is "Unused"
PORT_DIPSETTING( 0x0002, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:6,5")
PORT_DIPSETTING( 0x0004, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x000c, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x0008, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) )
PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:4") // The manual states this dip is "Unused"
PORT_DIPSETTING( 0x0010, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:3") // The manual states this dip is "Unused"
PORT_DIPSETTING( 0x0020, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x00c0, 0x00c0, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:2,1")
PORT_DIPSETTING( 0x0000, "1" )
PORT_DIPSETTING( 0x0040, "2" )
PORT_DIPSETTING( 0x00c0, "3" )
PORT_DIPSETTING( 0x0080, "4" )
PORT_START("DSW2")
PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:1,2,3")
PORT_DIPSETTING( 0x0004, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x0005, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x0006, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x0007, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0003, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x0002, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x0001, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) )
PORT_DIPNAME( 0x0038, 0x0038, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW2:4,5,6")
PORT_DIPSETTING( 0x0020, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x0028, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x0030, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x0038, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0018, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x0010, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x0008, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) )
PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7") // The MCU (undumped/unemulated) takes care of this
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0040, DEF_STR( On ) )
PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:8") // The manual states this dip is "Unused"
PORT_DIPSETTING( 0x0080, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
INPUT_PORTS_END
static INPUT_PORTS_START( tdragon )
PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // TEST in service mode
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("IN1")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("DSW1")
PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:8")
PORT_DIPSETTING( 0x0001, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:7") // The manual states this dip is "Unused"
PORT_DIPSETTING( 0x0002, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:6,5")
PORT_DIPSETTING( 0x0004, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x000c, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x0008, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) )
PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:4") // The manual states this dip is "Unused"
PORT_DIPSETTING( 0x0010, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:3") // The manual states this dip is "Unused"
PORT_DIPSETTING( 0x0020, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x00c0, 0x00c0, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:2,1")
PORT_DIPSETTING( 0x0000, "1" )
PORT_DIPSETTING( 0x0040, "2" )
PORT_DIPSETTING( 0x00c0, "3" )
PORT_DIPSETTING( 0x0080, "4" )
PORT_START("DSW2") // reverse bit order compared to tdragon_prot?
PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:8")
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0001, DEF_STR( On ) )
PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7")
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0002, DEF_STR( On ) )
PORT_DIPNAME( 0x001c, 0x001c, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW2:4,5,6")
PORT_DIPSETTING( 0x0010, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x0008, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x0018, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x001c, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x000c, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x0014, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x0004, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) )
PORT_DIPNAME( 0x00e0, 0x00e0, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:1,2,3")
PORT_DIPSETTING( 0x0080, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x0040, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x00c0, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x00e0, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0060, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x00a0, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x0020, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) )
INPUT_PORTS_END
static INPUT_PORTS_START( tdragonb )
PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // TEST in service mode
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("IN1")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("DSW1")
PORT_DIPNAME( 0x0003, 0x0003, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:1,2")
PORT_DIPSETTING( 0x0000, "1" )
PORT_DIPSETTING( 0x0002, "2" )
PORT_DIPSETTING( 0x0003, "3" )
PORT_DIPSETTING( 0x0001, "4" )
PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:3") // The manual states this dip is "Unused"
PORT_DIPSETTING( 0x0004, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:4") // The manual states this dip is "Unused"
PORT_DIPSETTING( 0x0008, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0030, 0x0030, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:5,6")
PORT_DIPSETTING( 0x0020, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x0030, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x0010, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) )
PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:7") // The manual states this dip is "Unused"
PORT_DIPSETTING( 0x0040, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:8")
PORT_DIPSETTING( 0x0080, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_START("DSW2")
PORT_DIPNAME( 0x0007, 0x0007, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:1,2,3")
PORT_DIPSETTING( 0x0004, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x0005, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x0006, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x0007, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0003, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x0002, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x0001, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) )
PORT_DIPNAME( 0x0038, 0x0038, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW2:4,5,6")
PORT_DIPSETTING( 0x0020, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x0028, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x0030, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x0038, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0018, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x0010, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x0008, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) )
PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7")
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0040, DEF_STR( On ) )
PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:8") // The manual states this dip is "Unused"
PORT_DIPSETTING( 0x0080, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_START("COIN") // referenced by Seibu sound board
PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN )
INPUT_PORTS_END
static INPUT_PORTS_START( ssmissin )
PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) // "Servise" in "test mode"
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("IN1")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) // "Fire"
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) // "Bomb"
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) // "Fire"
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) // "Bomb"
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("DSW1")
PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:8")
PORT_DIPSETTING( 0x0001, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:7")
PORT_DIPSETTING( 0x0002, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:6,5")
PORT_DIPSETTING( 0x0004, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x000c, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x0008, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) )
PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:4")
PORT_DIPSETTING( 0x0010, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:3")
PORT_DIPSETTING( 0x0020, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x00c0, 0x00c0, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:2,1")
PORT_DIPSETTING( 0x0000, "1" )
PORT_DIPSETTING( 0x0040, "2" )
PORT_DIPSETTING( 0x00c0, "3" )
PORT_DIPSETTING( 0x0080, "4" )
PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:8")
PORT_DIPSETTING( 0x0100, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7")
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0200, DEF_STR( On ) )
#if 0
PORT_DIPNAME( 0x1c00, 0x1c00, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW2:6,5,4") // initialised but not read back
PORT_DIPSETTING( 0x0400, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x1400, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x0c00, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x1c00, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x1800, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x0800, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x1000, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) )
#else
PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:6")
PORT_DIPSETTING( 0x0400, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:5")
PORT_DIPSETTING( 0x0800, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:4")
PORT_DIPSETTING( 0x1000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
#endif
PORT_DIPNAME( 0xe000, 0xe000, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW2:3,2,1")
PORT_DIPSETTING( 0x2000, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0xa000, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x6000, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0xe000, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0xc000, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x4000, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x8000, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) )
INPUT_PORTS_END
static INPUT_PORTS_START( airattck )
PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) // "Servise" in "test mode"
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("IN1")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) // "Fire"
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) // "Bomb"
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) // "Fire"
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) // "Bomb"
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("DSW1")
PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:8")
PORT_DIPSETTING( 0x0001, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:7")
PORT_DIPSETTING( 0x0002, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:6,5")
PORT_DIPSETTING( 0x0004, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x000c, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x0008, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) )
PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:4")
PORT_DIPSETTING( 0x0010, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:3")
PORT_DIPSETTING( 0x0020, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x00c0, 0x00c0, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:2,1")
PORT_DIPSETTING( 0x0000, "1" )
PORT_DIPSETTING( 0x0040, "2" )
PORT_DIPSETTING( 0x00c0, "3" )
PORT_DIPSETTING( 0x0080, "4" )
PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:8")
PORT_DIPSETTING( 0x0100, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7")
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0200, DEF_STR( On ) )
PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:6")
PORT_DIPSETTING( 0x0400, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0800, 0x0800, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:5")
PORT_DIPSETTING( 0x0800, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:4")
PORT_DIPSETTING( 0x1000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0xe000, 0xe000, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW2:3,2,1")
PORT_DIPSETTING( 0x2000, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0xa000, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x6000, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0xe000, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0xc000, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x4000, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x8000, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) )
INPUT_PORTS_END
static INPUT_PORTS_START( macross )
PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Maybe unused
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Maybe unused
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Maybe unused
PORT_START("IN1")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("DSW1")
PORT_SERVICE_DIPLOC( 0x01, IP_ACTIVE_LOW, "SW1:8" )
PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:7")
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
PORT_DIPSETTING( 0x02, DEF_STR( On ) )
PORT_DIPNAME( 0x04, 0x04, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:6")
PORT_DIPSETTING( 0x04, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x08, 0x00, DEF_STR( Language ) ) PORT_DIPLOCATION("SW1:5")
PORT_DIPSETTING( 0x00, DEF_STR( English ) )
PORT_DIPSETTING( 0x08, DEF_STR( Japanese ) )
PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:4,3")
PORT_DIPSETTING( 0x10, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x30, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x20, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) )
PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:2,1")
PORT_DIPSETTING( 0x00, "1" )
PORT_DIPSETTING( 0x40, "2" )
PORT_DIPSETTING( 0xc0, "3" )
PORT_DIPSETTING( 0x80, "4" )
PORT_START("DSW2")
PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW2:8,7,6,5")
PORT_DIPSETTING( 0x04, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x0a, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x01, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x00, DEF_STR( 5C_3C ) )
PORT_DIPSETTING( 0x02, DEF_STR( 3C_2C ) )
PORT_DIPSETTING( 0x08, DEF_STR( 4C_3C ) )
PORT_DIPSETTING( 0x0f, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0c, DEF_STR( 3C_4C ) )
PORT_DIPSETTING( 0x0e, DEF_STR( 2C_3C ) )
PORT_DIPSETTING( 0x07, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x06, DEF_STR( 2C_5C ) )
PORT_DIPSETTING( 0x0b, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x03, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x0d, DEF_STR( 1C_5C ) )
PORT_DIPSETTING( 0x05, DEF_STR( 1C_6C ) )
PORT_DIPSETTING( 0x09, DEF_STR( 1C_7C ) )
PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:4,3,2,1")
PORT_DIPSETTING( 0x40, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0xa0, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x10, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x20, DEF_STR( 3C_2C ) )
PORT_DIPSETTING( 0x80, DEF_STR( 4C_3C ) )
PORT_DIPSETTING( 0xf0, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0xc0, DEF_STR( 3C_4C ) )
PORT_DIPSETTING( 0xe0, DEF_STR( 2C_3C ) )
PORT_DIPSETTING( 0x70, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x60, DEF_STR( 2C_5C ) )
PORT_DIPSETTING( 0xb0, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x30, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0xd0, DEF_STR( 1C_5C ) )
PORT_DIPSETTING( 0x50, DEF_STR( 1C_6C ) )
PORT_DIPSETTING( 0x90, DEF_STR( 1C_7C ) )
PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) )
INPUT_PORTS_END
static INPUT_PORTS_START( macross2 )
PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Maybe unused
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Maybe unused
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Maybe unused
PORT_START("IN1")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("DSW1")
PORT_SERVICE_DIPLOC( 0x01, IP_ACTIVE_LOW, "SW1:8" )
PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:7")
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
PORT_DIPSETTING( 0x02, DEF_STR( On ) )
PORT_DIPNAME( 0x04, 0x04, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:6")
PORT_DIPSETTING( 0x04, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x08, 0x00, DEF_STR( Language ) ) PORT_DIPLOCATION("SW1:5")
PORT_DIPSETTING( 0x00, DEF_STR( English ) )
PORT_DIPSETTING( 0x08, DEF_STR( Japanese ) )
PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:4,3") // Initial points needed for 1st Stage Clear
PORT_DIPSETTING( 0x10, DEF_STR( Easy ) ) // 100,000
PORT_DIPSETTING( 0x30, DEF_STR( Normal ) ) // 150,000
PORT_DIPSETTING( 0x20, DEF_STR( Hard ) ) // 200,000
PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) // 250,000
PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:2")
PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:1")
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_START("DSW2")
PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW2:8,7,6,5")
PORT_DIPSETTING( 0x04, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x0a, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x01, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x00, DEF_STR( 5C_3C ) )
PORT_DIPSETTING( 0x02, DEF_STR( 3C_2C ) )
PORT_DIPSETTING( 0x08, DEF_STR( 4C_3C ) )
PORT_DIPSETTING( 0x0f, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0c, DEF_STR( 3C_4C ) )
PORT_DIPSETTING( 0x0e, DEF_STR( 2C_3C ) )
PORT_DIPSETTING( 0x07, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x06, DEF_STR( 2C_5C ) )
PORT_DIPSETTING( 0x0b, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x03, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x0d, DEF_STR( 1C_5C ) )
PORT_DIPSETTING( 0x05, DEF_STR( 1C_6C ) )
PORT_DIPSETTING( 0x09, DEF_STR( 1C_7C ) )
PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:4,3,2,1")
PORT_DIPSETTING( 0x40, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0xa0, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x10, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x20, DEF_STR( 3C_2C ) )
PORT_DIPSETTING( 0x80, DEF_STR( 4C_3C ) )
PORT_DIPSETTING( 0xf0, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0xc0, DEF_STR( 3C_4C ) )
PORT_DIPSETTING( 0xe0, DEF_STR( 2C_3C ) )
PORT_DIPSETTING( 0x70, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x60, DEF_STR( 2C_5C ) )
PORT_DIPSETTING( 0xb0, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x30, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0xd0, DEF_STR( 1C_5C ) )
PORT_DIPSETTING( 0x50, DEF_STR( 1C_6C ) )
PORT_DIPSETTING( 0x90, DEF_STR( 1C_7C ) )
PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) )
INPUT_PORTS_END
static INPUT_PORTS_START( tdragon2 )
PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Maybe unused
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Maybe unused
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Maybe unused
PORT_START("IN1")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("DSW1")
PORT_SERVICE_DIPLOC( 0x01, IP_ACTIVE_LOW, "SW1:8" )
PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:7")
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
PORT_DIPSETTING( 0x02, DEF_STR( On ) )
PORT_DIPNAME( 0x04, 0x04, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:6")
PORT_DIPSETTING( 0x04, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:5") // The manual states this dip is "Unused"
PORT_DIPSETTING( 0x00, DEF_STR( Off) )
PORT_DIPSETTING( 0x08, DEF_STR( On ) )
PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:3,4")
PORT_DIPSETTING( 0x10, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x30, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x20, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) )
PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:1,2")
PORT_DIPSETTING( 0x00, "1" )
PORT_DIPSETTING( 0x40, "2" )
PORT_DIPSETTING( 0xc0, "3" )
PORT_DIPSETTING( 0x80, "4" )
PORT_START("DSW2")
PORT_DIPNAME( 0x0f, 0x0f, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW2:8,7,6,5")
PORT_DIPSETTING( 0x04, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x0a, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x01, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x00, DEF_STR( 5C_3C ) )
PORT_DIPSETTING( 0x02, DEF_STR( 3C_2C ) )
PORT_DIPSETTING( 0x08, DEF_STR( 4C_3C ) )
PORT_DIPSETTING( 0x0f, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0c, DEF_STR( 3C_4C ) )
PORT_DIPSETTING( 0x0e, DEF_STR( 2C_3C ) )
PORT_DIPSETTING( 0x07, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x06, DEF_STR( 2C_5C ) )
PORT_DIPSETTING( 0x0b, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x03, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x0d, DEF_STR( 1C_5C ) )
PORT_DIPSETTING( 0x05, DEF_STR( 1C_6C ) )
PORT_DIPSETTING( 0x09, DEF_STR( 1C_7C ) )
PORT_DIPNAME( 0xf0, 0xf0, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:4,3,2,1")
PORT_DIPSETTING( 0x40, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0xa0, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x10, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x20, DEF_STR( 3C_2C ) )
PORT_DIPSETTING( 0x80, DEF_STR( 4C_3C ) )
PORT_DIPSETTING( 0xf0, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0xc0, DEF_STR( 3C_4C ) )
PORT_DIPSETTING( 0xe0, DEF_STR( 2C_3C ) )
PORT_DIPSETTING( 0x70, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x60, DEF_STR( 2C_5C ) )
PORT_DIPSETTING( 0xb0, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x30, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0xd0, DEF_STR( 1C_5C ) )
PORT_DIPSETTING( 0x50, DEF_STR( 1C_6C ) )
PORT_DIPSETTING( 0x90, DEF_STR( 1C_7C ) )
PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) )
INPUT_PORTS_END
static INPUT_PORTS_START( gunnail )
PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Maybe unused
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Maybe unused
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Maybe unused
PORT_START("IN1")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("DSW1")
PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:8")
PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x02, 0x00, DEF_STR( Language ) ) PORT_DIPLOCATION("SW1:7") // The manual states this dip is "Unused"
PORT_DIPSETTING( 0x02, DEF_STR( Japanese ) ) // Will add "Distributed by TECMO" to the title screen
PORT_DIPSETTING( 0x00, DEF_STR( English ) )
PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:6,5")
PORT_DIPSETTING( 0x08, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x0c, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x04, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) )
PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:4") // The manual states dips 1-4 are "Unused"
PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:3")
PORT_DIPSETTING( 0x20, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x40, 0x40, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:2")
PORT_DIPSETTING( 0x40, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:1")
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_START("DSW2")
PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:8") // The manual states this dip is "Unused"
PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7")
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
PORT_DIPSETTING( 0x02, DEF_STR( On ) )
PORT_DIPNAME( 0x1c, 0x1c, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW2:6,5,4")
PORT_DIPSETTING( 0x10, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x08, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x18, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x1c, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0c, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x14, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x04, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) )
PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:3,2,1")
PORT_DIPSETTING( 0x80, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x40, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0xc0, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0xe0, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x60, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0xa0, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x20, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) )
INPUT_PORTS_END
static INPUT_PORTS_START( raphero )
PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Maybe unused
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Maybe unused
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Maybe unused
PORT_START("IN1")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1)
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2)
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("DSW1")
PORT_SERVICE_DIPLOC( 0x01, IP_ACTIVE_LOW, "SW1:8" )
PORT_DIPNAME( 0x02, 0x00, DEF_STR( Language ) ) PORT_DIPLOCATION("SW1:7") // Main characters text "talk" at Stage Clear screen, but only when set to Japanese
PORT_DIPSETTING( 0x02, DEF_STR( Japanese ) )
PORT_DIPSETTING( 0x00, DEF_STR( English ) )
PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:6") // The manual states this dip is "Unused"
PORT_DIPSETTING( 0x04, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:5") // The manual states this dip is "Unused"
PORT_DIPSETTING( 0x00, DEF_STR( Off) )
PORT_DIPSETTING( 0x08, DEF_STR( On ) )
PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:4,3")
PORT_DIPSETTING( 0x10, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x30, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x20, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) )
PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:2,1")
PORT_DIPSETTING( 0x00, "1" )
PORT_DIPSETTING( 0x40, "2" )
PORT_DIPSETTING( 0xc0, "3" )
PORT_DIPSETTING( 0x80, "4" )
PORT_START("DSW2")
PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:8")
PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7")
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
PORT_DIPSETTING( 0x02, DEF_STR( On ) )
PORT_DIPNAME( 0x1c, 0x1c, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW2:6,5,4")
PORT_DIPSETTING( 0x10, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x08, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x18, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x1c, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0c, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x14, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x04, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) )
PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:3,2,1")
PORT_DIPSETTING( 0x80, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x40, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0xc0, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0xe0, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x60, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0xa0, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x20, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) )
INPUT_PORTS_END
static INPUT_PORTS_START( sabotenb )
PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // shown in service mode, but no effect
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Maybe unused
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Maybe unused
PORT_START("IN1")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("DSW1")
PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:8")
PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x02, 0x02, DEF_STR( Language ) ) PORT_DIPLOCATION("SW1:7")
PORT_DIPSETTING( 0x02, DEF_STR( Japanese ) )
PORT_DIPSETTING( 0x00, DEF_STR( English ) )
PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:6,5")
PORT_DIPSETTING( 0x08, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x0c, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x04, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) )
PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:4") // The manual states this dip is "Unused"
PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x20, 0x20, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:3") // The manual states this dip is "Unused"
PORT_DIPSETTING( 0x20, DEF_STR( Off) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:2,1")
PORT_DIPSETTING( 0x00, "1" )
PORT_DIPSETTING( 0x40, "2" )
PORT_DIPSETTING( 0xc0, "3" )
PORT_DIPSETTING( 0x80, "4" )
PORT_START("DSW2")
PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:8") // The manual states this dip is "Unused"
PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7")
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
PORT_DIPSETTING( 0x02, DEF_STR( On ) )
PORT_DIPNAME( 0x1c, 0x1c, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW2:6,5,4")
PORT_DIPSETTING( 0x10, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x08, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x18, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x1c, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0c, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x14, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x04, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) )
PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:3,2,1")
PORT_DIPSETTING( 0x80, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x40, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0xc0, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0xe0, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x60, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0xa0, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x20, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) )
INPUT_PORTS_END
static INPUT_PORTS_START( bjtwin )
PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // shown in service mode, but no effect
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Maybe unused
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) // Maybe unused
PORT_START("IN1")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("DSW1")
PORT_DIPNAME( 0x01, 0x01, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:8")
PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x0e, 0x0e, "Starting level" ) PORT_DIPLOCATION("SW1:7,6,5")
PORT_DIPSETTING( 0x08, "Germany" )
PORT_DIPSETTING( 0x04, "Thailand" )
PORT_DIPSETTING( 0x0c, "Nevada" )
PORT_DIPSETTING( 0x0e, DEF_STR( Japan ) )
PORT_DIPSETTING( 0x06, DEF_STR( Korea ) )
PORT_DIPSETTING( 0x0a, "England" )
PORT_DIPSETTING( 0x02, DEF_STR( Hong_Kong ) )
PORT_DIPSETTING( 0x00, DEF_STR( China ) )
PORT_DIPNAME( 0x30, 0x30, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:4,3")
PORT_DIPSETTING( 0x20, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x30, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x10, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) )
PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:2,1")
PORT_DIPSETTING( 0x00, "1" )
PORT_DIPSETTING( 0x40, "2" )
PORT_DIPSETTING( 0xc0, "3" )
PORT_DIPSETTING( 0x80, "4" )
PORT_START("DSW2")
PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:8")
PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x02, 0x02, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7")
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
PORT_DIPSETTING( 0x02, DEF_STR( On ) )
PORT_DIPNAME( 0x1c, 0x1c, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW2:6,5,4")
PORT_DIPSETTING( 0x10, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x08, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x18, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x1c, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0c, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x14, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x04, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) )
PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:3,2,1")
PORT_DIPSETTING( 0x80, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x40, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0xc0, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0xe0, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x60, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0xa0, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x20, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x00, DEF_STR( Free_Play ) )
INPUT_PORTS_END
static INPUT_PORTS_START( nouryoku )
PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("IN1")
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("DSW1")
PORT_DIPNAME( 0x03, 0x03, "Life Decrease Speed" ) PORT_DIPLOCATION("SW1:8,7")
PORT_DIPSETTING( 0x02, "Slow" )
PORT_DIPSETTING( 0x03, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x01, "Fast" )
PORT_DIPSETTING( 0x00, "Very Fast" )
PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:6,5")
PORT_DIPSETTING( 0x08, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x0c, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x04, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) )
PORT_DIPNAME( 0x10, 0x10, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW1:4")
PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0xe0, 0xe0, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:3,2,1")
PORT_DIPSETTING( 0x20, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0xa0, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x60, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0xe0, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x00, DEF_STR( 2C_3C ) )
PORT_DIPSETTING( 0xc0, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x40, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x80, DEF_STR( 1C_4C ) )
PORT_START("DSW2")
PORT_DIPNAME( 0x01, 0x01, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:8") // The manual states this dip is "Unused"
PORT_DIPSETTING( 0x01, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x02, 0x02, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:7") // The manual states this dip is "Unused"
PORT_DIPSETTING( 0x02, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x04, 0x04, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:6") // The manual states this dip is "Unused"
PORT_DIPSETTING( 0x04, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x08, 0x08, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:5") // The manual states this dip is "Unused"
PORT_DIPSETTING( 0x08, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x10, 0x10, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:4") // The manual states this dip is "Unused"
PORT_DIPSETTING( 0x10, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x20, 0x20, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:3")
PORT_DIPSETTING( 0x20, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_DIPNAME( 0x40, 0x40, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:2")
PORT_DIPSETTING( 0x00, DEF_STR( Off ) )
PORT_DIPSETTING( 0x40, DEF_STR( On ) )
PORT_SERVICE_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW2:1" )
INPUT_PORTS_END
/***************************************************************************
Input Ports
***************************************************************************/
/***************************************************************************
Stagger I
***************************************************************************/
static INPUT_PORTS_START( afega_common )
PORT_START("IN0") // $080000.w
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_SERVICE1 )
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("IN1") // $080002.w
PORT_BIT( 0x0001, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
PORT_BIT( 0x0002, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
PORT_BIT( 0x0020, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
PORT_BIT( 0x0040, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
INPUT_PORTS_END
static INPUT_PORTS_START( stagger1 )
PORT_INCLUDE( afega_common )
PORT_START("DSW1") // $080004.w
PORT_SERVICE_DIPLOC( 0x0001, IP_ACTIVE_LOW, "SW2:8" )
PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7")
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0002, DEF_STR( On ) )
PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:6")
PORT_DIPSETTING( 0x0004, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:5")
PORT_DIPSETTING( 0x0008, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:4")
PORT_DIPSETTING( 0x0010, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:3")
PORT_DIPSETTING( 0x0020, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x00c0, 0x00c0, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:2,1")
PORT_DIPSETTING( 0x0000, "1" )
PORT_DIPSETTING( 0x0080, "2" )
PORT_DIPSETTING( 0x00c0, "3" )
PORT_DIPSETTING( 0x0040, "5" )
PORT_DIPNAME( 0x0300, 0x0300, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:8,7")
PORT_DIPSETTING( 0x0300, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPSETTING( 0x0200, "Horizontally" )
PORT_DIPSETTING( 0x0100, "Vertically" )
PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:6")
PORT_DIPSETTING( 0x0400, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x1800, 0x1800, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:5,4")
PORT_DIPSETTING( 0x0800, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x1800, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x1000, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) )
PORT_DIPNAME( 0xe000, 0xe000, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:3,2,1")
PORT_DIPSETTING( 0x0000, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x8000, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x4000, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0xc000, DEF_STR( 3C_2C ) )
PORT_DIPSETTING( 0xe000, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x2000, DEF_STR( 2C_3C ) )
PORT_DIPSETTING( 0x6000, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0xa000, DEF_STR( 1C_3C ) )
INPUT_PORTS_END
// everything seems active high, not low
static INPUT_PORTS_START( redhawkb )
PORT_START("IN0") // $080000.w
PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_COIN1 )
PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_COIN2 )
PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_SERVICE1 )
PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_START1 )
PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_START2 )
PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_BIT( 0xff00, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_START("IN1") // $080002.w
PORT_BIT( 0x0001, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1)
PORT_BIT( 0x0002, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(1)
PORT_BIT( 0x0004, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(1)
PORT_BIT( 0x0008, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(1)
PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)
PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1)
PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_BIT( 0x0080, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_BIT( 0x0100, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
PORT_BIT( 0x0200, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
PORT_BIT( 0x0400, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
PORT_BIT( 0x0800, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
PORT_BIT( 0x1000, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x2000, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2)
PORT_BIT( 0x4000, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_BIT( 0x8000, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_START("DSW1") // $080004.w -- probably just redhawk but inverted
PORT_DIPNAME( 0x0001, 0x0000, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:8") // Other sets, this is TEST MODE, but here it doesn't work
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0001, DEF_STR( On ) )
PORT_DIPNAME( 0x0002, 0x0000, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7")
PORT_DIPSETTING( 0x0002, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0004, 0x0000, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:6")
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0004, DEF_STR( On ) )
PORT_DIPNAME( 0x0008, 0x0000, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:5")
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0008, DEF_STR( On ) )
PORT_DIPNAME( 0x0010, 0x0000, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:4")
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0010, DEF_STR( On ) )
PORT_DIPNAME( 0x0020, 0x0000, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:3")
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0020, DEF_STR( On ) )
PORT_DIPNAME( 0x00c0, 0x0000, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:2,1")
PORT_DIPSETTING( 0x00c0, "1" )
PORT_DIPSETTING( 0x0040, "2" )
PORT_DIPSETTING( 0x0000, "3" )
PORT_DIPSETTING( 0x0080, "5" )
PORT_DIPNAME( 0x0300, 0x0000, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:8,7") // not supported
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0300, DEF_STR( On ) )
PORT_DIPSETTING( 0x0100, "Horizontally" )
PORT_DIPSETTING( 0x0200, "Vertically" )
PORT_DIPNAME( 0x0400, 0x0000, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:6")
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0400, DEF_STR( On ) )
PORT_DIPNAME( 0x1800, 0x0000, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:5,4")
PORT_DIPSETTING( 0x1000, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x0800, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x1800, DEF_STR( Hardest ) )
PORT_DIPNAME( 0xe000, 0x0000, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW1:3,2,1")
PORT_DIPSETTING( 0xe000, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x6000, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0xa000, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x2000, DEF_STR( 3C_2C ) )
PORT_DIPSETTING( 0x0000, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0xc000, DEF_STR( 2C_3C ) )
PORT_DIPSETTING( 0x8000, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x4000, DEF_STR( 1C_3C ) )
INPUT_PORTS_END
/***************************************************************************
Sen Jin - Guardian Storm
***************************************************************************/
static INPUT_PORTS_START( grdnstrm )
PORT_INCLUDE( afega_common )
PORT_START("DSW1") // $080004.w
PORT_SERVICE_DIPLOC( 0x01, IP_ACTIVE_LOW, "SW1:8" )
PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:7")
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0002, DEF_STR( On ) )
PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW1:6")
PORT_DIPSETTING( 0x0004, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0008, 0x0008, "Bombs" ) PORT_DIPLOCATION("SW1:5")
PORT_DIPSETTING( 0x0008, "2" )
PORT_DIPSETTING( 0x0000, "3" )
PORT_DIPUNUSED_DIPLOC( 0x10, 0x10, "SW1:4" ) // Listed as "Unused" & doesn't show in test mode
PORT_DIPUNUSED_DIPLOC( 0x20, 0x20, "SW1:3" ) // Listed as "Unused" & doesn't show in test mode
PORT_DIPNAME( 0x00c0, 0x00c0, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:2,1")
PORT_DIPSETTING( 0x0000, "1" )
PORT_DIPSETTING( 0x0080, "2" )
PORT_DIPSETTING( 0x00c0, "3" )
PORT_DIPSETTING( 0x0040, "5" )
PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:8")
PORT_DIPSETTING( 0x0200, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0100, 0x0100, "Mirror Screen" ) PORT_DIPLOCATION("SW2:7")
PORT_DIPSETTING( 0x0100, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:6")
PORT_DIPSETTING( 0x0400, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x1800, 0x1800, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:5,4")
PORT_DIPSETTING( 0x0800, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x1800, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x1000, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) )
PORT_DIPNAME( 0xe000, 0xe000, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW2:3,2,1")
PORT_DIPSETTING( 0x0000, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x8000, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x4000, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0xc000, DEF_STR( 3C_2C ) )
PORT_DIPSETTING( 0xe000, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x2000, DEF_STR( 2C_3C ) )
PORT_DIPSETTING( 0x6000, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0xa000, DEF_STR( 1C_3C ) )
INPUT_PORTS_END
static INPUT_PORTS_START( grdnstrk )
PORT_INCLUDE( grdnstrm )
PORT_MODIFY("DSW1") // $080004.w
PORT_DIPNAME( 0x0200, 0x0200, "Mirror Screen" ) PORT_DIPLOCATION("SW2:8")
PORT_DIPSETTING( 0x0200, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW2:7")
PORT_DIPSETTING( 0x0100, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
INPUT_PORTS_END
/***************************************************************************
Pop's Pop's
***************************************************************************/
static INPUT_PORTS_START( popspops )
PORT_INCLUDE( afega_common )
// the dips on this are a mess... service mode doesn't seem to be 100% trustable
PORT_START("DSW1") // $080004.w
PORT_SERVICE( 0x0001, IP_ACTIVE_LOW )
PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Demo_Sounds ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0002, DEF_STR( On ) )
PORT_DIPNAME( 0x0004, 0x0000, DEF_STR( Unknown ) ) // if ON it tells you the answers?!
PORT_DIPSETTING( 0x0004, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0008, 0x0008, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x0008, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x0010, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x0020, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Free_Play ) )
PORT_DIPSETTING( 0x0040, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x0080, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x0100, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x0200, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x0400, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x1800, 0x1800, DEF_STR( Difficulty ) )
PORT_DIPSETTING( 0x1000, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x1800, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x0800, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) )
PORT_DIPNAME( 0xe000, 0xe000, DEF_STR( Coinage ) )
PORT_DIPSETTING( 0x0000, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x2000, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x4000, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x6000, DEF_STR( 3C_2C ) )
PORT_DIPSETTING( 0xe000, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x8000, DEF_STR( 2C_3C ) )
PORT_DIPSETTING( 0xc000, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0xa000, DEF_STR( 1C_3C ) )
INPUT_PORTS_END
/***************************************************************************
Bubble 2000
***************************************************************************/
static INPUT_PORTS_START( bubl2000 )
PORT_INCLUDE( afega_common )
PORT_START("DSW1") // $080004.w
PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:8") // Manual lists as "Screen Flip Horizontal" Doesn't work???
PORT_DIPSETTING( 0x0001, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:7") // Manual lists as "Screen Flip Vertical" Doesn't work???
PORT_DIPSETTING( 0x0002, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:6,5")
PORT_DIPSETTING( 0x0008, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x000c, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x0004, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) )
PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:4") // Manual lists as "Unused"
PORT_DIPSETTING( 0x0010, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:3") // Manual lists as "Unused"
PORT_DIPSETTING( 0x0020, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x00c0, 0x00c0, "Free Credit" ) PORT_DIPLOCATION("SW2:2,1")
PORT_DIPSETTING( 0x0080, "500k" )
PORT_DIPSETTING( 0x00c0, "800k" )
PORT_DIPSETTING( 0x0040, "1000k" )
PORT_DIPSETTING( 0x0000, "1500k" )
PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:8") // Manual lists as "Unused"
PORT_DIPSETTING( 0x0100, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:7") // Manual lists as "Unused"
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0200, DEF_STR( On ) )
PORT_DIPNAME( 0x1c00, 0x1c00, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:6,5,4")
PORT_DIPSETTING( 0x1000, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x0800, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x1800, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x1c00, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0c00, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x1400, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x0400, DEF_STR( 1C_4C ) )
// PORT_DIPSETTING( 0x0000, "Disabled" )
PORT_DIPNAME( 0xe000, 0xe000, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:3,2,1")
PORT_DIPSETTING( 0x8000, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x4000, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0xc000, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0xe000, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x6000, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0xa000, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x2000, DEF_STR( 1C_4C ) )
// PORT_DIPSETTING( 0x0000, "Disabled" )
INPUT_PORTS_END
static INPUT_PORTS_START( bubl2000a )
PORT_INCLUDE( afega_common )
PORT_START("DSW1") // $080004.w
PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:8") // Manual lists as "Unused"
PORT_DIPSETTING( 0x0001, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW1:7") // Manual lists as "Unused" - N0 Demo Sounds
PORT_DIPSETTING( 0x0002, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x001c, 0x001c, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:6,5,4")
PORT_DIPSETTING( 0x0010, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x0008, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x0018, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x001c, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x000c, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x0014, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x0004, DEF_STR( 1C_4C ) )
// PORT_DIPSETTING( 0x0000, "Disabled" )
PORT_DIPNAME( 0x00e0, 0x00e0, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:3,2,1")
PORT_DIPSETTING( 0x0080, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x0040, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x00c0, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x00e0, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0060, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x00a0, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x0020, DEF_STR( 1C_4C ) )
// PORT_DIPSETTING( 0x0000, "Disabled" )
PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:8") // Manual lists as "Screen Flip Horizontal" Doesn't work???
PORT_DIPSETTING( 0x0100, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:7") // Manual lists as "Screen Flip Vertical" Doesn't work???
PORT_DIPSETTING( 0x0200, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0c00, 0x0c00, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:6,5")
PORT_DIPSETTING( 0x0800, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x0c00, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x0400, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) )
PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:4") // Manual lists as "Unused"
PORT_DIPSETTING( 0x1000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unused ) ) PORT_DIPLOCATION("SW2:3") // Manual lists as "Unused"
PORT_DIPSETTING( 0x2000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0xc000, 0xc000, "Free Credit" ) PORT_DIPLOCATION("SW2:2,1")
PORT_DIPSETTING( 0x8000, "500k" )
PORT_DIPSETTING( 0xc000, "800k" )
PORT_DIPSETTING( 0x4000, "1000k" )
PORT_DIPSETTING( 0x0000, "1500k" )
INPUT_PORTS_END
/***************************************************************************
Mang Chi
***************************************************************************/
static INPUT_PORTS_START( mangchi )
PORT_INCLUDE( afega_common )
PORT_START("DSW1") // $080004.w
PORT_DIPNAME( 0x0001, 0x0001, "DSWS" ) // Setting to on cuases screen issues, Flip Screen? or unfinished test mode?
PORT_DIPSETTING( 0x0001, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Demo_Sounds ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0002, DEF_STR( On ) )
PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x0004, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0018, 0x0018, "Vs Rounds" )
PORT_DIPSETTING( 0x0018, "2" )
PORT_DIPSETTING( 0x0010, "3" )
PORT_DIPSETTING( 0x0008, "4" )
PORT_DIPSETTING( 0x0000, "5" )
PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x0020, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0040, 0x0040, DEF_STR( Free_Play ) )
PORT_DIPSETTING( 0x0040, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0080, 0x0080, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x0080, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x0100, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x0200, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x0400, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x1800, 0x1800, DEF_STR( Difficulty ) ) // Hard to tell levels of difficulty by play :-(
PORT_DIPSETTING( 0x0800, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x1800, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x1000, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) )
PORT_DIPNAME( 0xe000, 0xe000, DEF_STR( Coinage ) )
PORT_DIPSETTING( 0x0000, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x2000, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x4000, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x6000, DEF_STR( 3C_2C ) )
PORT_DIPSETTING( 0xe000, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x8000, DEF_STR( 2C_3C ) )
PORT_DIPSETTING( 0xc000, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0xa000, DEF_STR( 1C_3C ) )
INPUT_PORTS_END
/***************************************************************************
Fire Hawk
***************************************************************************/
static INPUT_PORTS_START( firehawk )
PORT_INCLUDE( afega_common )
PORT_START("DSW1") // $080004.w
PORT_SERVICE_DIPLOC( 0x01, IP_ACTIVE_LOW, "SW1:8" )
PORT_DIPNAME( 0x000e, 0x000e, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:7,6,5")
PORT_DIPSETTING( 0x0006, DEF_STR( Very_Easy) )
PORT_DIPSETTING( 0x0008, DEF_STR( Easy ) )
// PORT_DIPSETTING( 0x000a, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x000e, DEF_STR( Normal ) )
// PORT_DIPSETTING( 0x0000, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x0002, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x0004, DEF_STR( Hardest ) )
PORT_DIPSETTING( 0x000c, DEF_STR( Very_Hard ) )
PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:4")
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0010, DEF_STR( On ) )
PORT_DIPNAME( 0x0020, 0x0020, "Number of Bombs" ) PORT_DIPLOCATION("SW1:3")
PORT_DIPSETTING( 0x0020, "2" )
PORT_DIPSETTING( 0x0000, "3" )
PORT_DIPNAME( 0x00c0, 0x00c0, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:2,1")
PORT_DIPSETTING( 0x0000, "1" )
PORT_DIPSETTING( 0x0080, "2" )
PORT_DIPSETTING( 0x00c0, "3" )
PORT_DIPSETTING( 0x0040, "4" )
PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:8")
PORT_DIPSETTING( 0x0100, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Region ) ) PORT_DIPLOCATION("SW2:7")
PORT_DIPSETTING( 0x0200, DEF_STR( World ) ) // Fire Hawk
PORT_DIPSETTING( 0x0000, DEF_STR( China ) ) // 火狐傳說/Huǒhú chuánshuō
PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW2:6")
PORT_DIPSETTING( 0x0400, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x1800, 0x1800, "Continue Coins" ) PORT_DIPLOCATION("SW2:5,4")
PORT_DIPSETTING( 0x1800, "1 Coin" )
PORT_DIPSETTING( 0x0800, "2 Coins" )
PORT_DIPSETTING( 0x1000, "3 Coins" )
PORT_DIPSETTING( 0x0000, "4 Coins" )
PORT_DIPNAME( 0xe000, 0xe000, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW2:3,2,1")
PORT_DIPSETTING( 0x0000, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x8000, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x4000, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0xc000, DEF_STR( 3C_2C ) )
PORT_DIPSETTING( 0xe000, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x2000, DEF_STR( 2C_3C ) )
PORT_DIPSETTING( 0x6000, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0xa000, DEF_STR( 1C_3C ) )
INPUT_PORTS_END
static INPUT_PORTS_START( firehawkv )
PORT_INCLUDE( firehawk )
PORT_MODIFY("DSW1")
PORT_DIPNAME( 0x0100, 0x0000, "Orientation" ) PORT_DIPLOCATION("SW2:8")
PORT_DIPSETTING( 0x0100, "Vertical" )
PORT_DIPSETTING( 0x0000, "Horizontal" )
INPUT_PORTS_END
/***************************************************************************
Spectrum 2000
***************************************************************************/
static INPUT_PORTS_START( spec2k )
PORT_INCLUDE( afega_common )
PORT_START("DSW1") // $080004.w
PORT_SERVICE_DIPLOC( 0x01, IP_ACTIVE_LOW, "SW1:8" )
PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW1:7")
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0002, DEF_STR( On ) )
PORT_DIPNAME( 0x0004, 0x0004, DEF_STR( Free_Play ) ) PORT_DIPLOCATION("SW1:6")
PORT_DIPSETTING( 0x0004, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0008, 0x0008, "Number of Bombs" ) PORT_DIPLOCATION("SW1:5")
PORT_DIPSETTING( 0x0008, "2" )
PORT_DIPSETTING( 0x0000, "3" )
PORT_DIPNAME( 0x0010, 0x0010, "Copyright Notice" ) PORT_DIPLOCATION("SW1:4")
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0010, DEF_STR( On ) )
PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:3")
PORT_DIPSETTING( 0x0020, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x00c0, 0x00c0, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:2,1")
PORT_DIPSETTING( 0x0000, "1" )
PORT_DIPSETTING( 0x0080, "2" )
PORT_DIPSETTING( 0x00c0, "3" )
PORT_DIPSETTING( 0x0040, "5" )
PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:8")
PORT_DIPSETTING( 0x0100, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:7")
PORT_DIPSETTING( 0x0200, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0400, 0x0400, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:6")
PORT_DIPSETTING( 0x0400, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x1800, 0x1800, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:5,4")
PORT_DIPSETTING( 0x0800, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x1800, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x1000, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) )
PORT_DIPNAME( 0xe000, 0xe000, DEF_STR( Coinage ) ) PORT_DIPLOCATION("SW2:3,2,1")
PORT_DIPSETTING( 0x0000, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x8000, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x4000, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0xc000, DEF_STR( 3C_2C ) )
PORT_DIPSETTING( 0xe000, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x2000, DEF_STR( 2C_3C ) )
PORT_DIPSETTING( 0x6000, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0xa000, DEF_STR( 1C_3C ) )
INPUT_PORTS_END
/***************************************************************************
Twin Action
***************************************************************************/
static INPUT_PORTS_START( twinactn )
PORT_INCLUDE( afega_common )
PORT_MODIFY("IN0") // $080000.w
PORT_SERVICE_NO_TOGGLE(0x0020, IP_ACTIVE_LOW ) // Test in service mode
PORT_MODIFY("IN1") // $080002.w
PORT_BIT( 0x0080, IP_ACTIVE_HIGH,IPT_UNKNOWN ) // Tested at boot
PORT_BIT( 0x8000, IP_ACTIVE_HIGH,IPT_UNKNOWN ) // Tested at boot
PORT_START("DSW1") // $080004.w
PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:8")
PORT_DIPSETTING( 0x0001, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7")
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0002, DEF_STR( On ) )
PORT_DIPNAME( 0x001c, 0x001c, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW2:6,5,4")
PORT_DIPSETTING( 0x0010, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x0008, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x0018, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x001c, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x000c, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x0014, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x0004, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) )
PORT_DIPNAME( 0x00e0, 0x00e0, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:3,2,1")
PORT_DIPSETTING( 0x0080, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x0040, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x00c0, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x00e0, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0060, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x00a0, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x0020, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Free_Play ) )
PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Flip_Screen ) ) PORT_DIPLOCATION("SW1:8")
PORT_DIPSETTING( 0x0100, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:7")
PORT_DIPSETTING( 0x0200, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0c00, 0x0c00, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:6,5")
PORT_DIPSETTING( 0x0c00, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x0400, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x0800, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) )
PORT_DIPNAME( 0x1000, 0x1000, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:4")
PORT_DIPSETTING( 0x1000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x2000, 0x2000, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:3")
PORT_DIPSETTING( 0x2000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0xc000, 0xc000, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW1:2,1")
PORT_DIPSETTING( 0x4000, "2" )
PORT_DIPSETTING( 0xc000, "3" )
PORT_DIPSETTING( 0x8000, "4" )
PORT_DIPSETTING( 0x0000, "5" )
INPUT_PORTS_END
static INPUT_PORTS_START( dolmen )
PORT_INCLUDE( afega_common )
PORT_MODIFY("IN0") // $080000.w
PORT_SERVICE_NO_TOGGLE(0x0020, IP_ACTIVE_LOW ) // Test in service mode
PORT_MODIFY("IN1") // $080002.w
PORT_BIT( 0x0080, IP_ACTIVE_LOW,IPT_UNKNOWN ) // Tested at boot
PORT_BIT( 0x8000, IP_ACTIVE_LOW,IPT_UNKNOWN ) // Tested at boot
PORT_START("DSW1") // $080004.w
PORT_DIPNAME( 0x0001, 0x0001, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:8")
PORT_DIPSETTING( 0x0001, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0002, 0x0002, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:7")
PORT_DIPSETTING( 0x0002, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x000c, 0x000c, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW1:6,5")
PORT_DIPSETTING( 0x0008, DEF_STR( Easy ) )
PORT_DIPSETTING( 0x000c, DEF_STR( Normal ) )
PORT_DIPSETTING( 0x0004, DEF_STR( Hard ) )
PORT_DIPSETTING( 0x0000, DEF_STR( Hardest ) )
PORT_DIPNAME( 0x0010, 0x0010, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:4")
PORT_DIPSETTING( 0x0010, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0020, 0x0020, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:3")
PORT_DIPSETTING( 0x0020, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x00c0, 0x00c0, "Free Credit" ) PORT_DIPLOCATION("SW1:2,1") // Not verified - From Bubble 2000
PORT_DIPSETTING( 0x0080, "500k" )
PORT_DIPSETTING( 0x00c0, "800k" )
PORT_DIPSETTING( 0x0040, "1000k" )
PORT_DIPSETTING( 0x0000, "1500k" )
PORT_DIPNAME( 0x0100, 0x0100, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW2:8")
PORT_DIPSETTING( 0x0100, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0000, DEF_STR( On ) )
PORT_DIPNAME( 0x0200, 0x0200, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:7")
PORT_DIPSETTING( 0x0000, DEF_STR( Off ) )
PORT_DIPSETTING( 0x0200, DEF_STR( On ) )
PORT_DIPNAME( 0x1c00, 0x1c00, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW2:6,5,4")
PORT_DIPSETTING( 0x1000, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x0800, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0x1800, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0x1c00, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x0c00, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0x1400, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x0400, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x0000, "Credits Don't Register" )
PORT_DIPNAME( 0xe000, 0xe000, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW2:3,2,1")
PORT_DIPSETTING( 0x8000, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x4000, DEF_STR( 3C_1C ) )
PORT_DIPSETTING( 0xc000, DEF_STR( 2C_1C ) )
PORT_DIPSETTING( 0xe000, DEF_STR( 1C_1C ) )
PORT_DIPSETTING( 0x6000, DEF_STR( 1C_2C ) )
PORT_DIPSETTING( 0xa000, DEF_STR( 1C_3C ) )
PORT_DIPSETTING( 0x2000, DEF_STR( 1C_4C ) )
PORT_DIPSETTING( 0x0000, "Credits Don't Register" )
INPUT_PORTS_END
static GFXDECODE_START( gfx_tharrier )
GFXDECODE_ENTRY( "fgtile", 0, gfx_8x8x4_packed_msb, 0x000, 16 ) // color 0x000-0x0ff
GFXDECODE_ENTRY( "bgtile", 0, gfx_8x8x4_col_2x2_group_packed_msb, 0x000, 16 ) // color 0x000-0x0ff
GFXDECODE_ENTRY( "sprites", 0, gfx_8x8x4_col_2x2_group_packed_msb, 0x100, 16 ) // color 0x100-0x1ff
GFXDECODE_END
static GFXDECODE_START( gfx_macross )
GFXDECODE_ENTRY( "fgtile", 0, gfx_8x8x4_packed_msb, 0x200, 16 ) // color 0x200-0x2ff
GFXDECODE_ENTRY( "bgtile", 0, gfx_8x8x4_col_2x2_group_packed_msb, 0x000, 16 ) // color 0x000-0x0ff
GFXDECODE_ENTRY( "sprites", 0, gfx_8x8x4_col_2x2_group_packed_msb, 0x100, 16 ) // color 0x100-0x1ff
GFXDECODE_END
static GFXDECODE_START( gfx_macross2 )
GFXDECODE_ENTRY( "fgtile", 0, gfx_8x8x4_packed_msb, 0x300, 16 ) // color 0x300-0x3ff
GFXDECODE_ENTRY( "bgtile", 0, gfx_8x8x4_col_2x2_group_packed_msb, 0x000, 16 ) // color 0x000-0x0ff
GFXDECODE_ENTRY( "sprites", 0, gfx_8x8x4_col_2x2_group_packed_msb, 0x100, 32 ) // color 0x100-0x2ff
GFXDECODE_END
static GFXDECODE_START( gfx_bjtwin )
GFXDECODE_ENTRY( "fgtile", 0, gfx_8x8x4_packed_msb, 0x000, 16 ) // color 0x000-0x0ff
GFXDECODE_ENTRY( "bgtile", 0, gfx_8x8x4_packed_msb, 0x000, 16 ) // color 0x000-0x0ff
GFXDECODE_ENTRY( "sprites", 0, gfx_8x8x4_col_2x2_group_packed_msb, 0x100, 16 ) // color 0x100-0x1ff
GFXDECODE_END
static GFXDECODE_START( gfx_bioship )
GFXDECODE_ENTRY( "fgtile", 0, gfx_8x8x4_packed_msb, 0x300, 16 ) // color 0x300-0x3ff
GFXDECODE_ENTRY( "bgtile", 0, gfx_8x8x4_col_2x2_group_packed_msb, 0x100, 16 ) // color 0x100-0x1ff
GFXDECODE_ENTRY( "sprites", 0, gfx_8x8x4_col_2x2_group_packed_msb, 0x200, 16 ) // color 0x200-0x2ff
GFXDECODE_ENTRY( "gfx4", 0, gfx_8x8x4_col_2x2_group_packed_msb, 0x000, 16 ) // color 0x000-0x0ff
GFXDECODE_END
static GFXDECODE_START( gfx_strahl )
GFXDECODE_ENTRY( "fgtile", 0, gfx_8x8x4_packed_msb, 0x000, 16 ) // color 0x000-0x0ff
GFXDECODE_ENTRY( "bgtile", 0, gfx_8x8x4_col_2x2_group_packed_msb, 0x300, 16 ) // color 0x300-0x3ff
GFXDECODE_ENTRY( "sprites", 0, gfx_8x8x4_col_2x2_group_packed_msb, 0x100, 16 ) // color 0x100-0x1ff
GFXDECODE_ENTRY( "gfx4", 0, gfx_8x8x4_col_2x2_group_packed_msb, 0x200, 16 ) // color 0x200-0x2ff
GFXDECODE_END
/*
----
IRQ1 - Half-blanking interrupt
IRQ2 - Display interrupt
IRQ4 - V-blanking interrupt
Timing:
17.8 msec
|<---------------------------->|
| 3.45 msec | 14.35 msec |
|<--------->|<---------------->|
| | | 8.9 msec | |
| | |<-------->| |
LV4 LV2 LV1 LV1
| DISPLAY
|<->|<--->| |
|256| 694 | |
| us| usec| |
| | DMA | |
CPU is stopped during DMA
*/
// todo:total scanlines is 263, adjust according to that!
// todo: replace with raw screen timings
TIMER_DEVICE_CALLBACK_MEMBER(nmk16_state::nmk16_scanline)
{
const int NUM_SCANLINES = 256;
const int IRQ1_SCANLINE = 25; // guess
const int VBIN_SCANLINE = 0;
const int VBOUT_SCANLINE = 240;
const int SPRDMA_SCANLINE = 241; // 256 USEC after VBOUT
int scanline = param;
if (scanline == VBOUT_SCANLINE) // vblank-out irq
{
m_maincpu->set_input_line(4, HOLD_LINE);
m_dma_timer->adjust(m_screen->time_until_pos(SPRDMA_SCANLINE)/*attotime::from_usec(256)*/);
}
/* Vblank-in irq, Vandyke definitely relies that irq fires at scanline ~0 instead of 112 (as per previous
cpu_getiloops function implementation), mostly noticeable with sword collisions and related attract mode behaviour. */
if (scanline == VBIN_SCANLINE)
m_maincpu->set_input_line(2, HOLD_LINE);
// time from IRQ2 to first IRQ1 fire. is not stated, 25 is a guess
if (scanline == IRQ1_SCANLINE)
m_maincpu->set_input_line(1, HOLD_LINE);
// 8.9ms from first IRQ1 to second IRQ1 fire. approx 128 lines (half frame time)
if (scanline == IRQ1_SCANLINE+(NUM_SCANLINES/2)) // if this happens too late bioship sprites will glitch on the left edge
m_maincpu->set_input_line(1, HOLD_LINE);
}
TIMER_CALLBACK_MEMBER(nmk16_state::dma_callback)
{
// 2 buffers confirmed on PCB, 1 on sabotenb
memcpy(m_spriteram_old2.get(),m_spriteram_old.get(), 0x1000);
memcpy(m_spriteram_old.get(), m_mainram + m_sprdma_base / 2, 0x1000);
//m_maincpu->spin_until_time(attotime::from_usec(694)); // stop cpu during DMA?
}
void nmk16_state::set_hacky_interrupt_timing(machine_config &config)
{
TIMER(config, "scantimer").configure_scanline(FUNC(nmk16_state::nmk16_scanline), "screen", 0, 1);
}
void nmk16_state::set_hacky_screen_lowres(machine_config &config)
{
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
//m_screen->set_raw(XTAL(12'000'000)/2, 384, 0, 256, 278, 16, 240); // confirmed
m_screen->set_refresh_hz(56.18);
m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(3450));
m_screen->set_size(256, 256);
m_screen->set_visarea(0*8, 32*8-1, 2*8, 30*8-1);
m_screen->set_palette(m_palette);
NMK_16BIT_SPRITE(config, m_spritegen, XTAL(12'000'000)/2);
m_spritegen->set_screen_size(384, 256);
m_spritegen->set_max_sprite_clock(384 * 263); // from hardware manual
}
void nmk16_state::set_hacky_screen_hires(machine_config &config)
{
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
//m_screen->set_raw(XTAL(16'000'000)/2, 512, 0, 384, 278, 16, 240); // confirmed
m_screen->set_refresh_hz(56.18);
m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(3450));
m_screen->set_size(512, 256);
m_screen->set_visarea(0*8, 48*8-1, 2*8, 30*8-1);
m_screen->set_palette(m_palette);
NMK_16BIT_SPRITE(config, m_spritegen, XTAL(16'000'000)/2);
m_spritegen->set_screen_size(384, 256);
m_spritegen->set_max_sprite_clock(512 * 263); // not verified?
m_spritegen->set_videoshift(64);
}
// OSC : 10MHz, 12MHz, 4MHz, 4.9152MHz
void nmk16_state::tharrier(machine_config &config)
{
// basic machine hardware
M68000(config, m_maincpu, XTAL(10'000'000)); // TMP68000P-12, 10 MHz
m_maincpu->set_addrmap(AS_PROGRAM, &nmk16_state::tharrier_map);
set_hacky_interrupt_timing(config);
Z80(config, m_audiocpu, XTAL(4'915'200)); // Z0840006PSC, 4.9152 MHz
m_audiocpu->set_addrmap(AS_PROGRAM, &nmk16_state::tharrier_sound_map);
m_audiocpu->set_addrmap(AS_IO, &nmk16_state::tharrier_sound_io_map);
// video hardware
set_hacky_screen_lowres(config);
m_spritegen->set_colpri_callback(FUNC(nmk16_state::get_colour_4bit));
m_spritegen->set_ext_callback(FUNC(nmk16_state::get_sprite_flip));
m_screen->set_screen_update(FUNC(nmk16_state::screen_update_tharrier));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_tharrier);
PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 512);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,macross)
// sound hardware
SPEAKER(config, "mono").front_center();
GENERIC_LATCH_8(config, m_soundlatch);
GENERIC_LATCH_8(config, "soundlatch2");
ym2203_device &ymsnd(YM2203(config, "ymsnd", XTAL(12'000'000) / 8));
ymsnd.irq_handler().set_inputline("audiocpu", 0);
ymsnd.add_route(0, "mono", 0.50);
ymsnd.add_route(1, "mono", 0.50);
ymsnd.add_route(2, "mono", 0.50);
ymsnd.add_route(3, "mono", 1.20);
OKIM6295(config, m_oki[0], XTAL(4'000'000), okim6295_device::PIN7_LOW);
m_oki[0]->set_addrmap(0, &nmk16_state::oki1_map);
m_oki[0]->add_route(ALL_OUTPUTS, "mono", 0.10);
OKIM6295(config, m_oki[1], XTAL(4'000'000), okim6295_device::PIN7_LOW);
m_oki[1]->set_addrmap(0, &nmk16_state::oki2_map);
m_oki[1]->add_route(ALL_OUTPUTS, "mono", 0.10);
}
void nmk16_state::mustang(machine_config &config)
{
// basic machine hardware
M68000(config, m_maincpu, 10000000); // 10 MHz ?
m_maincpu->set_addrmap(AS_PROGRAM, &nmk16_state::mustang_map);
set_hacky_interrupt_timing(config);
// video hardware
set_hacky_screen_lowres(config);
m_spritegen->set_colpri_callback(FUNC(nmk16_state::get_colour_4bit));
m_screen->set_screen_update(FUNC(nmk16_state::screen_update_macross));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_macross);
PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,macross)
// sound hardware
SPEAKER(config, "mono").front_center();
NMK004(config, m_nmk004, 8000000);
m_nmk004->reset_cb().set_inputline(m_maincpu, INPUT_LINE_RESET);
ym2203_device &ymsnd(YM2203(config, "ymsnd", 1500000));
ymsnd.irq_handler().set("nmk004", FUNC(nmk004_device::ym2203_irq_handler));
ymsnd.add_route(0, "mono", 0.50);
ymsnd.add_route(1, "mono", 0.50);
ymsnd.add_route(2, "mono", 0.50);
ymsnd.add_route(3, "mono", 1.20);
OKIM6295(config, m_oki[0], 16000000/4, okim6295_device::PIN7_LOW);
m_oki[0]->set_addrmap(0, &nmk16_state::oki1_map);
m_oki[0]->add_route(ALL_OUTPUTS, "mono", 0.10);
OKIM6295(config, m_oki[1], 16000000/4, okim6295_device::PIN7_LOW);
m_oki[1]->set_addrmap(0, &nmk16_state::oki2_map);
m_oki[1]->add_route(ALL_OUTPUTS, "mono", 0.10);
}
void nmk16_state::mustangb(machine_config &config)
{
// basic machine hardware
M68000(config, m_maincpu, 10000000); // 10 MHz ?
m_maincpu->set_addrmap(AS_PROGRAM, &nmk16_state::mustangb_map);
set_hacky_interrupt_timing(config);
Z80(config, m_audiocpu, 14318180/4);
m_audiocpu->set_addrmap(AS_PROGRAM, &nmk16_state::seibu_sound_map);
m_audiocpu->set_irq_acknowledge_callback("seibu_sound", FUNC(seibu_sound_device::im0_vector_cb));
// video hardware
set_hacky_screen_lowres(config);
m_spritegen->set_colpri_callback(FUNC(nmk16_state::get_colour_4bit));
m_screen->set_screen_update(FUNC(nmk16_state::screen_update_macross));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_macross);
PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,macross)
// sound hardware
SPEAKER(config, "mono").front_center();
ym3812_device &ymsnd(YM3812(config, "ymsnd", 14318180/4));
ymsnd.irq_handler().set("seibu_sound", FUNC(seibu_sound_device::fm_irqhandler));
ymsnd.add_route(ALL_OUTPUTS, "mono", 1.0);
OKIM6295(config, "oki", 1320000, okim6295_device::PIN7_LOW).add_route(ALL_OUTPUTS, "mono", 0.40);
seibu_sound_device &seibu_sound(SEIBU_SOUND(config, "seibu_sound", 0));
seibu_sound.int_callback().set_inputline(m_audiocpu, 0);
seibu_sound.set_rom_tag("audiocpu");
seibu_sound.set_rombank_tag("seibu_bank1");
seibu_sound.ym_read_callback().set("ymsnd", FUNC(ym3812_device::read));
seibu_sound.ym_write_callback().set("ymsnd", FUNC(ym3812_device::write));
}
void nmk16_state::mustangb3(machine_config &config)
{
// basic machine hardware
M68000(config, m_maincpu, 10000000); // 10 MHz ?
m_maincpu->set_addrmap(AS_PROGRAM, &nmk16_state::mustangb3_map);
set_hacky_interrupt_timing(config);
Z80(config, m_audiocpu, 14318180/4);
m_audiocpu->set_addrmap(AS_PROGRAM, &nmk16_state::tharrier_sound_map);
m_audiocpu->set_addrmap(AS_IO, &nmk16_state::tharrier_sound_io_map);
// video hardware
set_hacky_screen_lowres(config);
m_spritegen->set_colpri_callback(FUNC(nmk16_state::get_colour_4bit));
m_screen->set_screen_update(FUNC(nmk16_state::screen_update_macross));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_macross);
PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,macross)
GENERIC_LATCH_8(config, m_soundlatch);
GENERIC_LATCH_8(config, "soundlatch2");
// sound hardware
SPEAKER(config, "mono").front_center();
ym2203_device &ymsnd(YM2203(config, "ymsnd", 1500000));
ymsnd.irq_handler().set_inputline("audiocpu", 0);
ymsnd.add_route(0, "mono", 0.50);
ymsnd.add_route(1, "mono", 0.50);
ymsnd.add_route(2, "mono", 0.50);
ymsnd.add_route(3, "mono", 1.20);
OKIM6295(config, m_oki[0], 16000000/4, okim6295_device::PIN7_LOW);
m_oki[0]->add_route(ALL_OUTPUTS, "mono", 0.10);
OKIM6295(config, m_oki[1], 16000000/4, okim6295_device::PIN7_LOW);
m_oki[1]->add_route(ALL_OUTPUTS, "mono", 0.10);
}
void nmk16_state::bioship(machine_config &config)
{
// basic machine hardware
M68000(config, m_maincpu, XTAL(10'000'000)); // 10.0 MHz (verified)
m_maincpu->set_addrmap(AS_PROGRAM, &nmk16_state::bioship_map);
set_hacky_interrupt_timing(config);
// video hardware
set_hacky_screen_lowres(config);
m_spritegen->set_colpri_callback(FUNC(nmk16_state::get_colour_4bit));
m_screen->set_screen_update(FUNC(nmk16_state::screen_update_strahl));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_bioship);
PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,bioship)
// sound hardware
SPEAKER(config, "mono").front_center();
NMK004(config, m_nmk004, XTAL(8'000'000));
m_nmk004->reset_cb().set_inputline(m_maincpu, INPUT_LINE_RESET);
ym2203_device &ymsnd(YM2203(config, "ymsnd", XTAL(12'000'000) / 8)); // 1.5 Mhz (verified)
ymsnd.irq_handler().set("nmk004", FUNC(nmk004_device::ym2203_irq_handler));
ymsnd.add_route(0, "mono", 0.50);
ymsnd.add_route(1, "mono", 0.50);
ymsnd.add_route(2, "mono", 0.50);
ymsnd.add_route(3, "mono", 1.20);
OKIM6295(config, m_oki[0], XTAL(8'000'000) / 2, okim6295_device::PIN7_LOW); // 4.0 Mhz, Pin 7 High (verified)
m_oki[0]->set_addrmap(0, &nmk16_state::oki1_map);
m_oki[0]->add_route(ALL_OUTPUTS, "mono", 0.10);
OKIM6295(config, m_oki[1], XTAL(8'000'000) / 2, okim6295_device::PIN7_LOW); // 4.0 Mhz, Pin 7 High (verified)
m_oki[1]->set_addrmap(0, &nmk16_state::oki2_map);
m_oki[1]->add_route(ALL_OUTPUTS, "mono", 0.10);
}
void nmk16_state::vandyke(machine_config &config)
{
// basic machine hardware
M68000(config, m_maincpu, XTAL(10'000'000)); // 68000p12 running at 10Mhz, verified on PCB
m_maincpu->set_addrmap(AS_PROGRAM, &nmk16_state::vandyke_map);
set_hacky_interrupt_timing(config);
// video hardware
set_hacky_screen_lowres(config);
m_spritegen->set_colpri_callback(FUNC(nmk16_state::get_colour_4bit));
m_screen->set_screen_update(FUNC(nmk16_state::screen_update_macross));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_macross);
PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,macross)
// sound hardware
SPEAKER(config, "mono").front_center();
NMK004(config, m_nmk004, 8000000);
m_nmk004->reset_cb().set_inputline(m_maincpu, INPUT_LINE_RESET);
ym2203_device &ymsnd(YM2203(config, "ymsnd", XTAL(12'000'000)/8)); // verified on PCB
ymsnd.irq_handler().set("nmk004", FUNC(nmk004_device::ym2203_irq_handler));
ymsnd.add_route(0, "mono", 0.50);
ymsnd.add_route(1, "mono", 0.50);
ymsnd.add_route(2, "mono", 0.50);
ymsnd.add_route(3, "mono", 1.20);
OKIM6295(config, m_oki[0], XTAL(12'000'000)/3, okim6295_device::PIN7_LOW); // verified on PCB
m_oki[0]->set_addrmap(0, &nmk16_state::oki1_map);
m_oki[0]->add_route(ALL_OUTPUTS, "mono", 0.10);
OKIM6295(config, m_oki[1], XTAL(12'000'000)/3, okim6295_device::PIN7_LOW); // verified on PCB
m_oki[1]->set_addrmap(0, &nmk16_state::oki2_map);
m_oki[1]->add_route(ALL_OUTPUTS, "mono", 0.10);
}
void nmk16_state::vandykeb(machine_config &config)
{
// basic machine hardware
M68000(config, m_maincpu, 10000000); // 10 MHz ?
m_maincpu->set_addrmap(AS_PROGRAM, &nmk16_state::vandykeb_map);
set_hacky_interrupt_timing(config);
PIC16C57(config, "mcu", 12000000).set_disable(); // 3MHz
// video hardware
set_hacky_screen_lowres(config);
m_spritegen->set_colpri_callback(FUNC(nmk16_state::get_colour_4bit));
m_screen->set_screen_update(FUNC(nmk16_state::screen_update_macross));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_macross);
PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,macross)
// sound hardware
SPEAKER(config, "mono").front_center();
OKIM6295(config, m_oki[0], 16000000/16, okim6295_device::PIN7_LOW);
m_oki[0]->set_addrmap(0, &nmk16_state::oki1_map);
m_oki[0]->add_route(ALL_OUTPUTS, "mono", 0.20);
}
void nmk16_state::acrobatm(machine_config &config)
{
// basic machine hardware
M68000(config, m_maincpu, XTAL(10'000'000)); // 10 MHz (verified on PCB)
m_maincpu->set_addrmap(AS_PROGRAM, &nmk16_state::acrobatm_map);
set_hacky_interrupt_timing(config);
// video hardware
set_hacky_screen_lowres(config);
m_spritegen->set_colpri_callback(FUNC(nmk16_state::get_colour_4bit));
m_screen->set_screen_update(FUNC(nmk16_state::screen_update_macross));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_macross);
PALETTE(config, m_palette).set_format(palette_device::RGBx_444, 768);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,macross)
// sound hardware
SPEAKER(config, "mono").front_center();
NMK004(config, m_nmk004, XTAL(16'000'000)/2);
m_nmk004->reset_cb().set_inputline(m_maincpu, INPUT_LINE_RESET);
ym2203_device &ymsnd(YM2203(config, "ymsnd", XTAL(12'000'000)/8)); // verified on PCB
ymsnd.irq_handler().set("nmk004", FUNC(nmk004_device::ym2203_irq_handler));
ymsnd.add_route(0, "mono", 0.50);
ymsnd.add_route(1, "mono", 0.50);
ymsnd.add_route(2, "mono", 0.50);
ymsnd.add_route(3, "mono", 1.20);
OKIM6295(config, m_oki[0], XTAL(16'000'000)/4, okim6295_device::PIN7_LOW); // (verified on PCB) on the PCB pin7 is not connected to gnd or +5v!
m_oki[0]->set_addrmap(0, &nmk16_state::oki1_map);
m_oki[0]->add_route(ALL_OUTPUTS, "mono", 0.10);
OKIM6295(config, m_oki[1], XTAL(16'000'000)/4, okim6295_device::PIN7_LOW); // (verified on PCB) on the PCB pin7 is not connected to gnd or +5v!
m_oki[1]->set_addrmap(0, &nmk16_state::oki2_map);
m_oki[1]->add_route(ALL_OUTPUTS, "mono", 0.10);
}
void nmk16_state::tdragonb(machine_config &config) // bootleg using Raiden sound hardware
{
// basic machine hardware
M68000(config, m_maincpu, 10000000);
m_maincpu->set_addrmap(AS_PROGRAM, &nmk16_state::tdragonb_map);
set_hacky_interrupt_timing(config);
Z80(config, m_audiocpu, 14318180/4);
m_audiocpu->set_addrmap(AS_PROGRAM, &nmk16_state::seibu_sound_map);
m_audiocpu->set_irq_acknowledge_callback("seibu_sound", FUNC(seibu_sound_device::im0_vector_cb));
// video hardware
set_hacky_screen_lowres(config);
m_spritegen->set_colpri_callback(FUNC(nmk16_state::get_colour_4bit));
m_screen->set_screen_update(FUNC(nmk16_state::screen_update_macross));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_macross);
PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,macross)
// sound hardware
SPEAKER(config, "mono").front_center();
ym3812_device &ymsnd(YM3812(config, "ymsnd", 14318180/4));
ymsnd.irq_handler().set("seibu_sound", FUNC(seibu_sound_device::fm_irqhandler));
ymsnd.add_route(ALL_OUTPUTS, "mono", 1.0);
OKIM6295(config, "oki", 1320000, okim6295_device::PIN7_LOW).add_route(ALL_OUTPUTS, "mono", 0.40);
seibu_sound_device &seibu_sound(SEIBU_SOUND(config, "seibu_sound", 0));
seibu_sound.int_callback().set_inputline(m_audiocpu, 0);
seibu_sound.set_rom_tag("audiocpu");
seibu_sound.set_rombank_tag("seibu_bank1");
seibu_sound.ym_read_callback().set("ymsnd", FUNC(ym3812_device::read));
seibu_sound.ym_write_callback().set("ymsnd", FUNC(ym3812_device::write));
}
void nmk16_state::tdragonb2(machine_config &config)
{
// basic machine hardware
M68000(config, m_maincpu, 10000000);
m_maincpu->set_addrmap(AS_PROGRAM, &nmk16_state::tdragonb2_map);
set_hacky_interrupt_timing(config);
// video hardware
set_hacky_screen_lowres(config);
m_spritegen->set_colpri_callback(FUNC(nmk16_state::get_colour_4bit));
m_screen->set_screen_update(FUNC(nmk16_state::screen_update_macross));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_macross);
PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,macross)
// sound hardware
SPEAKER(config, "mono").front_center();
OKIM6295(config, "oki", 1320000, okim6295_device::PIN7_LOW).add_route(ALL_OUTPUTS, "mono", 0.40);
}
void nmk16_state::tdragon(machine_config &config)
{
// basic machine hardware
M68000(config, m_maincpu, XTAL(8'000'000)); // verified on PCB
m_maincpu->set_addrmap(AS_PROGRAM, &nmk16_state::tdragon_map);
set_hacky_interrupt_timing(config);
// video hardware
set_hacky_screen_lowres(config);
m_spritegen->set_colpri_callback(FUNC(nmk16_state::get_colour_4bit));
m_screen->set_screen_update(FUNC(nmk16_state::screen_update_macross));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_macross);
PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,macross)
// sound hardware
SPEAKER(config, "mono").front_center();
NMK004(config, m_nmk004, 8000000);
m_nmk004->reset_cb().set_inputline(m_maincpu, INPUT_LINE_RESET);
ym2203_device &ymsnd(YM2203(config, "ymsnd", XTAL(12'000'000)/8)); // verified on PCB
ymsnd.irq_handler().set("nmk004", FUNC(nmk004_device::ym2203_irq_handler));
ymsnd.add_route(0, "mono", 0.50);
ymsnd.add_route(1, "mono", 0.50);
ymsnd.add_route(2, "mono", 0.50);
ymsnd.add_route(3, "mono", 1.20);
OKIM6295(config, m_oki[0], XTAL(8'000'000)/2, okim6295_device::PIN7_LOW); // verified on PCB
m_oki[0]->set_addrmap(0, &nmk16_state::oki1_map);
m_oki[0]->add_route(ALL_OUTPUTS, "mono", 0.10);
OKIM6295(config, m_oki[1], XTAL(8'000'000)/2, okim6295_device::PIN7_LOW); // verified on PCB
m_oki[1]->set_addrmap(0, &nmk16_state::oki2_map);
m_oki[1]->add_route(ALL_OUTPUTS, "mono", 0.10);
}
void nmk16_state::tdragon_prot(machine_config &config)
{
tdragon(config);
TIMER(config, "coinsim").configure_periodic(FUNC(nmk16_state::tdragon_mcu_sim), attotime::from_hz(10000));
}
void nmk16_state::ssmissin(machine_config &config)
{
// basic machine hardware
M68000(config, m_maincpu, 8000000); // 8 Mhz
m_maincpu->set_addrmap(AS_PROGRAM, &nmk16_state::ssmissin_map);
set_hacky_interrupt_timing(config);
Z80(config, m_audiocpu, 8000000/2); // 4 Mhz
m_audiocpu->set_addrmap(AS_PROGRAM, &nmk16_state::ssmissin_sound_map);
// video hardware
set_hacky_screen_lowres(config);
m_spritegen->set_colpri_callback(FUNC(nmk16_state::get_colour_4bit));
m_screen->set_screen_update(FUNC(nmk16_state::screen_update_macross));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_macross);
PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,macross)
// sound hardware
SPEAKER(config, "mono").front_center();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, 0);
OKIM6295(config, m_oki[0], 8000000/8, okim6295_device::PIN7_HIGH); // 1 Mhz, pin 7 high
m_oki[0]->set_addrmap(0, &nmk16_state::oki1_map);
m_oki[0]->add_route(ALL_OUTPUTS, "mono", 1.0);
}
void nmk16_state::strahl(machine_config &config)
{
// basic machine hardware
M68000(config, m_maincpu, 12000000); // 12 MHz ?
m_maincpu->set_addrmap(AS_PROGRAM, &nmk16_state::strahl_map);
set_hacky_interrupt_timing(config);
// video hardware
set_hacky_screen_lowres(config);
m_spritegen->set_colpri_callback(FUNC(nmk16_state::get_colour_4bit));
m_screen->set_screen_update(FUNC(nmk16_state::screen_update_strahl));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_strahl);
PALETTE(config, m_palette).set_format(palette_device::RGBx_444, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,strahl)
// sound hardware
SPEAKER(config, "mono").front_center();
NMK004(config, m_nmk004, 8000000);
m_nmk004->reset_cb().set_inputline(m_maincpu, INPUT_LINE_RESET);
ym2203_device &ymsnd(YM2203(config, "ymsnd", 1500000));
ymsnd.irq_handler().set("nmk004", FUNC(nmk004_device::ym2203_irq_handler));
ymsnd.add_route(0, "mono", 0.50);
ymsnd.add_route(1, "mono", 0.50);
ymsnd.add_route(2, "mono", 0.50);
ymsnd.add_route(3, "mono", 1.20);
OKIM6295(config, m_oki[0], 16000000/4, okim6295_device::PIN7_LOW);
m_oki[0]->set_addrmap(0, &nmk16_state::oki1_map);
m_oki[0]->add_route(ALL_OUTPUTS, "mono", 0.10);
OKIM6295(config, m_oki[1], 16000000/4, okim6295_device::PIN7_LOW);
m_oki[1]->set_addrmap(0, &nmk16_state::oki2_map);
m_oki[1]->add_route(ALL_OUTPUTS, "mono", 0.10);
}
void nmk16_state::strahljbl(machine_config &config)
{
M68000(config, m_maincpu, 12_MHz_XTAL);
m_maincpu->set_addrmap(AS_PROGRAM, &nmk16_state::strahljbl_map);
set_hacky_interrupt_timing(config);
Z80(config, m_audiocpu, 12_MHz_XTAL / 4); // XTAL confirmed, divisor not
m_audiocpu->set_addrmap(AS_PROGRAM, &nmk16_state::seibu_sound_map);
m_audiocpu->set_irq_acknowledge_callback("seibu_sound", FUNC(seibu_sound_device::im0_vector_cb));
set_hacky_screen_lowres(config);
m_spritegen->set_colpri_callback(FUNC(nmk16_state::get_colour_4bit));
m_screen->set_screen_update(FUNC(nmk16_state::screen_update_strahl));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_strahl);
PALETTE(config, m_palette).set_format(palette_device::RGBx_444, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,strahl)
SPEAKER(config, "mono").front_center();
ym3812_device &ymsnd(YM3812(config, "ymsnd", 12_MHz_XTAL / 4)); // XTAL confirmed, divisor not
ymsnd.irq_handler().set("seibu_sound", FUNC(seibu_sound_device::fm_irqhandler));
ymsnd.add_route(ALL_OUTPUTS, "mono", 1.0);
OKIM6295(config, "oki", 12_MHz_XTAL / 12, okim6295_device::PIN7_LOW).add_route(ALL_OUTPUTS, "mono", 0.40); // XTAL confirmed, divisor not
seibu_sound_device &seibu_sound(SEIBU_SOUND(config, "seibu_sound", 0));
seibu_sound.int_callback().set_inputline(m_audiocpu, 0);
seibu_sound.set_rom_tag("audiocpu");
seibu_sound.set_rombank_tag("seibu_bank1");
seibu_sound.ym_read_callback().set("ymsnd", FUNC(ym3812_device::read));
seibu_sound.ym_write_callback().set("ymsnd", FUNC(ym3812_device::write));
}
void nmk16_state::hachamf(machine_config &config)
{
// basic machine hardware
M68000(config, m_maincpu, 10000000); // 10 MHz ?
m_maincpu->set_addrmap(AS_PROGRAM, &nmk16_state::hachamf_map);
set_hacky_interrupt_timing(config);
// video hardware
set_hacky_screen_lowres(config);
m_spritegen->set_colpri_callback(FUNC(nmk16_state::get_colour_4bit));
m_screen->set_screen_update(FUNC(nmk16_state::screen_update_macross));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_macross);
PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,macross)
// sound hardware
SPEAKER(config, "mono").front_center();
NMK004(config, m_nmk004, 8000000);
m_nmk004->reset_cb().set_inputline(m_maincpu, INPUT_LINE_RESET);
ym2203_device &ymsnd(YM2203(config, "ymsnd", 1500000));
ymsnd.irq_handler().set("nmk004", FUNC(nmk004_device::ym2203_irq_handler));
ymsnd.add_route(0, "mono", 0.50);
ymsnd.add_route(1, "mono", 0.50);
ymsnd.add_route(2, "mono", 0.50);
ymsnd.add_route(3, "mono", 1.20);
OKIM6295(config, m_oki[0], 16000000/4, okim6295_device::PIN7_LOW);
m_oki[0]->set_addrmap(0, &nmk16_state::oki1_map);
m_oki[0]->add_route(ALL_OUTPUTS, "mono", 0.10);
OKIM6295(config, m_oki[1], 16000000/4, okim6295_device::PIN7_LOW);
m_oki[1]->set_addrmap(0, &nmk16_state::oki2_map);
m_oki[1]->add_route(ALL_OUTPUTS, "mono", 0.10);
}
void nmk16_state::hachamf_prot(machine_config &config)
{
hachamf(config);
TIMER(config, "coinsim").configure_periodic(FUNC(nmk16_state::hachamf_mcu_sim), attotime::from_hz(10000));
}
void nmk16_state::macross(machine_config &config)
{
// basic machine hardware
M68000(config, m_maincpu, 10000000); // 10 MHz ?
m_maincpu->set_addrmap(AS_PROGRAM, &nmk16_state::macross_map);
set_hacky_interrupt_timing(config);
// video hardware
set_hacky_screen_lowres(config);
m_spritegen->set_colpri_callback(FUNC(nmk16_state::get_colour_4bit));
m_screen->set_screen_update(FUNC(nmk16_state::screen_update_macross));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_macross);
PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,macross)
// sound hardware
SPEAKER(config, "mono").front_center();
NMK004(config, m_nmk004, 8000000);
m_nmk004->reset_cb().set_inputline(m_maincpu, INPUT_LINE_RESET);
ym2203_device &ymsnd(YM2203(config, "ymsnd", 1500000));
ymsnd.irq_handler().set("nmk004", FUNC(nmk004_device::ym2203_irq_handler));
ymsnd.add_route(0, "mono", 0.50);
ymsnd.add_route(1, "mono", 0.50);
ymsnd.add_route(2, "mono", 0.50);
ymsnd.add_route(3, "mono", 1.20);
OKIM6295(config, m_oki[0], 16000000/4, okim6295_device::PIN7_LOW);
m_oki[0]->set_addrmap(0, &nmk16_state::oki1_map);
m_oki[0]->add_route(ALL_OUTPUTS, "mono", 0.10);
OKIM6295(config, m_oki[1], 16000000/4, okim6295_device::PIN7_LOW);
m_oki[1]->set_addrmap(0, &nmk16_state::oki2_map);
m_oki[1]->add_route(ALL_OUTPUTS, "mono", 0.10);
}
void nmk16_state::blkheart(machine_config &config)
{
// basic machine hardware
M68000(config, m_maincpu, XTAL(8'000'000)); // verified on PCB
m_maincpu->set_addrmap(AS_PROGRAM, &nmk16_state::macross_map);
set_hacky_interrupt_timing(config);
// video hardware
set_hacky_screen_lowres(config);
m_spritegen->set_colpri_callback(FUNC(nmk16_state::get_colour_4bit));
m_screen->set_screen_update(FUNC(nmk16_state::screen_update_macross));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_macross);
PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,macross)
// sound hardware
SPEAKER(config, "mono").front_center();
NMK004(config, m_nmk004, 8000000);
m_nmk004->reset_cb().set_inputline(m_maincpu, INPUT_LINE_RESET);
ym2203_device &ymsnd(YM2203(config, "ymsnd", XTAL(12'000'000)/8)); // verified on PCB
ymsnd.irq_handler().set("nmk004", FUNC(nmk004_device::ym2203_irq_handler));
ymsnd.add_route(0, "mono", 0.50);
ymsnd.add_route(1, "mono", 0.50);
ymsnd.add_route(2, "mono", 0.50);
ymsnd.add_route(3, "mono", 1.20);
OKIM6295(config, m_oki[0], XTAL(8'000'000)/2, okim6295_device::PIN7_LOW); // verified on PCB
m_oki[0]->set_addrmap(0, &nmk16_state::oki1_map);
m_oki[0]->add_route(ALL_OUTPUTS, "mono", 0.10);
OKIM6295(config, m_oki[1], XTAL(8'000'000)/2, okim6295_device::PIN7_LOW); // verified on PCB
m_oki[1]->set_addrmap(0, &nmk16_state::oki2_map);
m_oki[1]->add_route(ALL_OUTPUTS, "mono", 0.10);
}
void nmk16_state::gunnail(machine_config &config)
{
// basic machine hardware
M68000(config, m_maincpu, XTAL(10'000'000)); // verified on PCB
m_maincpu->set_addrmap(AS_PROGRAM, &nmk16_state::gunnail_map);
set_hacky_interrupt_timing(config);
// video hardware
set_hacky_screen_hires(config);
m_spritegen->set_colpri_callback(FUNC(nmk16_state::get_colour_4bit));
m_screen->set_screen_update(FUNC(nmk16_state::screen_update_macross));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_macross);
PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,gunnail)
// sound hardware
SPEAKER(config, "mono").front_center();
NMK004(config, m_nmk004, XTAL(16'000'000)/2); // verified on PCB
m_nmk004->reset_cb().set_inputline(m_maincpu, INPUT_LINE_RESET);
ym2203_device &ymsnd(YM2203(config, "ymsnd", XTAL(12'000'000)/8)); // verified on PCB
ymsnd.irq_handler().set("nmk004", FUNC(nmk004_device::ym2203_irq_handler));
ymsnd.add_route(0, "mono", 0.50);
ymsnd.add_route(1, "mono", 0.50);
ymsnd.add_route(2, "mono", 0.50);
ymsnd.add_route(3, "mono", 1.20);
OKIM6295(config, m_oki[0], XTAL(16'000'000)/4, okim6295_device::PIN7_LOW); // verified on PCB
m_oki[0]->set_addrmap(0, &nmk16_state::oki1_map);
m_oki[0]->add_route(ALL_OUTPUTS, "mono", 0.10);
OKIM6295(config, m_oki[1], XTAL(16'000'000)/4, okim6295_device::PIN7_LOW); // verified on PCB
m_oki[1]->set_addrmap(0, &nmk16_state::oki2_map);
m_oki[1]->add_route(ALL_OUTPUTS, "mono", 0.10);
}
void nmk16_state::gunnailb(machine_config &config)
{
gunnail(config);
m_maincpu->set_addrmap(AS_PROGRAM, &nmk16_state::gunnailb_map);
Z80(config, m_audiocpu, 6000000); // 6 MHz ?
m_audiocpu->set_addrmap(AS_PROGRAM, &nmk16_state::gunnailb_sound_map);
m_audiocpu->set_addrmap(AS_IO, &nmk16_state::gunnailb_sound_io_map);
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
GENERIC_LATCH_8(config, "soundlatch2");
subdevice<ym2203_device>("ymsnd")->irq_handler().set_inputline(m_audiocpu, INPUT_LINE_IRQ0);
OKIM6295(config.replace(), m_oki[0], 12000000 / 4, okim6295_device::PIN7_LOW); // no OKI banking
m_oki[0]->add_route(ALL_OUTPUTS, "mono", 0.80);
config.device_remove("nmk004");
config.device_remove("oki2");
}
void nmk16_state::macross2(machine_config &config)
{
// basic machine hardware
M68000(config, m_maincpu, XTAL(10'000'000)); // MC68000P12 10 MHz
m_maincpu->set_addrmap(AS_PROGRAM, &nmk16_state::macross2_map);
set_hacky_interrupt_timing(config);
Z80(config, m_audiocpu, 4000000); // Z8400B PS 4 MHz ?
m_audiocpu->set_addrmap(AS_PROGRAM, &nmk16_state::macross2_sound_map);
m_audiocpu->set_addrmap(AS_IO, &nmk16_state::macross2_sound_io_map);
// video hardware
set_hacky_screen_hires(config);
m_spritegen->set_colpri_callback(FUNC(nmk16_state::get_colour_5bit));
m_screen->set_screen_update(FUNC(nmk16_state::screen_update_macross));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_macross2);
PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,macross2)
// sound hardware
SPEAKER(config, "mono").front_center();
GENERIC_LATCH_8(config, m_soundlatch);
GENERIC_LATCH_8(config, "soundlatch2");
ym2203_device &ymsnd(YM2203(config, "ymsnd", XTAL(12'000'000) / 8));
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
ymsnd.add_route(0, "mono", 0.50);
ymsnd.add_route(1, "mono", 0.50);
ymsnd.add_route(2, "mono", 0.50);
ymsnd.add_route(3, "mono", 1.20);
OKIM6295(config, m_oki[0], XTAL(16'000'000) / 4, okim6295_device::PIN7_LOW);
m_oki[0]->add_route(ALL_OUTPUTS, "mono", 0.10);
OKIM6295(config, m_oki[1], XTAL(16'000'000) / 4, okim6295_device::PIN7_LOW);
m_oki[1]->add_route(ALL_OUTPUTS, "mono", 0.10);
nmk112_device &nmk112(NMK112(config, "nmk112", 0));
nmk112.set_rom0_tag("oki1");
nmk112.set_rom1_tag("oki2");
}
void nmk16_state::tdragon2(machine_config &config)
{
// basic machine hardware
M68000(config, m_maincpu, XTAL(10'000'000)); // TMP68000P-12 10 MHz
m_maincpu->set_addrmap(AS_PROGRAM, &nmk16_state::tdragon2_map);
set_hacky_interrupt_timing(config);
Z80(config, m_audiocpu, 4000000); // Z0840006PSC 4? MHz
m_audiocpu->set_addrmap(AS_PROGRAM, &nmk16_state::macross2_sound_map);
m_audiocpu->set_addrmap(AS_IO, &nmk16_state::macross2_sound_io_map);
// video hardware
set_hacky_screen_hires(config);
m_spritegen->set_colpri_callback(FUNC(nmk16_state::get_colour_5bit));
m_screen->set_screen_update(FUNC(nmk16_state::screen_update_macross));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_macross2);
PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,macross2)
// sound hardware
SPEAKER(config, "mono").front_center();
GENERIC_LATCH_8(config, m_soundlatch);
GENERIC_LATCH_8(config, "soundlatch2");
ym2203_device &ymsnd(YM2203(config, "ymsnd", XTAL(12'000'000) / 8));
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
ymsnd.add_route(0, "mono", 0.50);
ymsnd.add_route(1, "mono", 0.50);
ymsnd.add_route(2, "mono", 0.50);
ymsnd.add_route(3, "mono", 1.20);
OKIM6295(config, m_oki[0], XTAL(16'000'000) / 4, okim6295_device::PIN7_LOW);
m_oki[0]->add_route(ALL_OUTPUTS, "mono", 0.10);
OKIM6295(config, m_oki[1], XTAL(16'000'000) / 4, okim6295_device::PIN7_LOW);
m_oki[1]->add_route(ALL_OUTPUTS, "mono", 0.10);
nmk112_device &nmk112(NMK112(config, "nmk112", 0));
nmk112.set_rom0_tag("oki1");
nmk112.set_rom1_tag("oki2");
}
void nmk16_state::tdragon3h(machine_config &config)
{
tdragon2(config);
m_maincpu->set_addrmap(AS_PROGRAM, &nmk16_state::tdragon3h_map);
// No YM2203 and only one OKI, the PCB has a space for the YM2203, populated by a 7474 and a 74367.
// It's been verified that by removing them and putting the YM2203 in its place, the game can make use of it.
m_audiocpu->set_addrmap(AS_IO, &nmk16_state::tdragon3h_sound_io_map);
config.device_remove("ymsnd");
config.device_remove("oki1");
}
void nmk16_state::raphero(machine_config &config)
{
// basic machine hardware
M68000(config, m_maincpu, XTAL(14'000'000)); // MC68HC000P12 or MC68000P12F or TMP68HC000P-16 14 MHz
m_maincpu->set_addrmap(AS_PROGRAM, &nmk16_state::raphero_map);
set_hacky_interrupt_timing(config);
TMP90841(config, m_audiocpu, XTAL(16'000'000) / 2); // TMP90C841AN 8 MHz
m_audiocpu->set_addrmap(AS_PROGRAM, &nmk16_state::raphero_sound_mem_map);
// video hardware
set_hacky_screen_hires(config);
m_spritegen->set_colpri_callback(FUNC(nmk16_state::get_colour_5bit));
m_screen->set_screen_update(FUNC(nmk16_state::screen_update_macross));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_macross2);
PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,gunnail)
// sound hardware
SPEAKER(config, "mono").front_center();
GENERIC_LATCH_8(config, m_soundlatch);
GENERIC_LATCH_8(config, "soundlatch2");
ym2203_device &ymsnd(YM2203(config, "ymsnd", XTAL(12'000'000) / 8));
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
ymsnd.add_route(0, "mono", 0.50);
ymsnd.add_route(1, "mono", 0.50);
ymsnd.add_route(2, "mono", 0.50);
ymsnd.add_route(3, "mono", 1.20);
OKIM6295(config, m_oki[0], XTAL(16'000'000) / 4, okim6295_device::PIN7_LOW);
m_oki[0]->add_route(ALL_OUTPUTS, "mono", 0.10);
OKIM6295(config, m_oki[1], XTAL(16'000'000) / 4, okim6295_device::PIN7_LOW);
m_oki[1]->add_route(ALL_OUTPUTS, "mono", 0.10);
nmk112_device &nmk112(NMK112(config, "nmk112", 0));
nmk112.set_rom0_tag("oki1");
nmk112.set_rom1_tag("oki2");
}
void nmk16_state::bjtwin(machine_config &config)
{
// basic machine hardware
M68000(config, m_maincpu, XTAL(10'000'000)); // verified on PCB
m_maincpu->set_addrmap(AS_PROGRAM, &nmk16_state::bjtwin_map);
set_hacky_interrupt_timing(config);
// video hardware
set_hacky_screen_hires(config);
m_spritegen->set_colpri_callback(FUNC(nmk16_state::get_colour_4bit));
m_screen->set_screen_update(FUNC(nmk16_state::screen_update_bjtwin));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_bjtwin);
PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,bjtwin)
// sound hardware
SPEAKER(config, "mono").front_center();
OKIM6295(config, m_oki[0], XTAL(16'000'000)/4, okim6295_device::PIN7_LOW); // verified on PCB
m_oki[0]->add_route(ALL_OUTPUTS, "mono", 0.20);
OKIM6295(config, m_oki[1], XTAL(16'000'000)/4, okim6295_device::PIN7_LOW); // verified on PCB
m_oki[1]->add_route(ALL_OUTPUTS, "mono", 0.20);
nmk112_device &nmk112(NMK112(config, "nmk112", 0));
nmk112.set_rom0_tag("oki1");
nmk112.set_rom1_tag("oki2");
}
TIMER_DEVICE_CALLBACK_MEMBER(nmk16_state::manybloc_scanline)
{
int scanline = param;
if (scanline == 248) // vblank-out irq
{
// only a single buffer
memcpy(m_spriteram_old2.get(), m_mainram + m_sprdma_base / 2, 0x1000);
m_maincpu->set_input_line(4, HOLD_LINE);
}
// This is either vblank-in or sprite DMA IRQ complete
if (scanline == 0)
m_maincpu->set_input_line(2, HOLD_LINE);
}
// non-nmk board, different to the others, very timing sensitive
void nmk16_state::manybloc(machine_config &config)
{
// basic machine hardware
M68000(config, m_maincpu, 10000000); // 10? MHz - check
m_maincpu->set_addrmap(AS_PROGRAM, &nmk16_state::manybloc_map);
m_maincpu->set_periodic_int(FUNC(nmk16_state::irq1_line_hold), attotime::from_hz(56)); // this needs to equal the framerate on this, rather than being double it...
TIMER(config, "scantimer").configure_scanline(FUNC(nmk16_state::manybloc_scanline), "screen", 0, 1);
Z80(config, m_audiocpu, 3000000);
m_audiocpu->set_addrmap(AS_PROGRAM, &nmk16_state::tharrier_sound_map);
m_audiocpu->set_addrmap(AS_IO, &nmk16_state::tharrier_sound_io_map);
// video hardware
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_refresh_hz(56);
m_screen->set_vblank_time(ATTOSECONDS_IN_USEC(2500)); // not accurate
m_screen->set_size(256, 256);
m_screen->set_visarea(0*8, 32*8-1, 1*8, 31*8-1);
m_screen->set_screen_update(FUNC(nmk16_state::screen_update_macross));
m_screen->set_palette(m_palette);
NMK_16BIT_SPRITE(config, m_spritegen, XTAL(12'000'000)/2);
m_spritegen->set_colpri_callback(FUNC(nmk16_state::get_colour_4bit));
m_spritegen->set_ext_callback(FUNC(nmk16_state::get_sprite_flip));
m_spritegen->set_screen_size(256, 256);
m_spritegen->set_max_sprite_clock(384 * 263); // from hardware manual
GFXDECODE(config, m_gfxdecode, m_palette, gfx_tharrier);
PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 512);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,macross)
// sound hardware
SPEAKER(config, "mono").front_center();
GENERIC_LATCH_8(config, m_soundlatch);
GENERIC_LATCH_8(config, "soundlatch2");
ym2203_device &ymsnd(YM2203(config, "ymsnd", 1500000));
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
ymsnd.add_route(0, "mono", 0.50);
ymsnd.add_route(1, "mono", 0.50);
ymsnd.add_route(2, "mono", 0.50);
ymsnd.add_route(3, "mono", 1.20);
OKIM6295(config, m_oki[0], 16000000/4, okim6295_device::PIN7_LOW);
m_oki[0]->set_addrmap(0, &nmk16_state::oki1_map);
m_oki[0]->add_route(ALL_OUTPUTS, "mono", 0.10);
OKIM6295(config, m_oki[1], 16000000/4, okim6295_device::PIN7_LOW);
m_oki[1]->set_addrmap(0, &nmk16_state::oki2_map);
m_oki[1]->add_route(ALL_OUTPUTS, "mono", 0.10);
}
// non-nmk board, clearly cloned hw tho, all clocks need checking.
void nmk16_tomagic_state::tomagic(machine_config &config)
{
// basic machine hardware
M68000(config, m_maincpu, 12000000); // 12? MHz
m_maincpu->set_addrmap(AS_PROGRAM, &nmk16_tomagic_state::tomagic_map);
set_hacky_interrupt_timing(config);
Z80(config, m_audiocpu, 12000000/4); // 3 Mhz?
m_audiocpu->set_addrmap(AS_PROGRAM, &nmk16_tomagic_state::tomagic_sound_map);
m_audiocpu->set_addrmap(AS_IO, &nmk16_tomagic_state::tomagic_sound_io_map);
// video hardware
set_hacky_screen_hires(config);
m_spritegen->set_colpri_callback(FUNC(nmk16_tomagic_state::get_colour_4bit));
m_screen->set_screen_update(FUNC(nmk16_tomagic_state::screen_update_macross));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_macross);
PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_tomagic_state,gunnail)
// sound hardware
SPEAKER(config, "mono").front_center();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, INPUT_LINE_NMI);
ym3812_device &ymsnd(YM3812(config, "ymsnd", 12000000/4)); // K-666 (YM3812) 3Mhz? */
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
ymsnd.add_route(ALL_OUTPUTS, "mono", 0.50);
OKIM6295(config, m_oki[0], 12000000/4, okim6295_device::PIN7_LOW);
m_oki[0]->add_route(ALL_OUTPUTS, "mono", 0.50);
}
u8 nmk16_state::decode_byte(u8 src, const u8 *bitp)
{
u8 ret = 0;
for (int i = 0; i < 8; i++)
ret |= (((src >> bitp[i]) & 1) << (7 - i));
return ret;
}
u32 nmk16_state::bjtwin_address_map_bg0(u32 addr)
{
return ((addr & 0x00004) >> 2) | ((addr & 0x00800) >> 10) | ((addr & 0x40000) >> 16);
}
u16 nmk16_state::decode_word(u16 src, const u8 *bitp)
{
u16 ret = 0;
for (int i = 0; i < 16; i++)
ret |= (((src >> bitp[i]) & 1) << (15 - i));
return ret;
}
u32 nmk16_state::bjtwin_address_map_sprites(u32 addr)
{
return ((addr & 0x00010) >> 4) | ((addr & 0x20000) >> 16) | ((addr & 0x100000) >> 18);
}
void nmk16_state::decode_gfx()
{
// GFX are scrambled. We decode them here. (BIG Thanks to Antiriad for descrambling info)
u8 *rom;
int len;
static const u8 decode_data_bg[8][8] =
{
{0x3,0x0,0x7,0x2,0x5,0x1,0x4,0x6},
{0x1,0x2,0x6,0x5,0x4,0x0,0x3,0x7},
{0x7,0x6,0x5,0x4,0x3,0x2,0x1,0x0},
{0x7,0x6,0x5,0x0,0x1,0x4,0x3,0x2},
{0x2,0x0,0x1,0x4,0x3,0x5,0x7,0x6},
{0x5,0x3,0x7,0x0,0x4,0x6,0x2,0x1},
{0x2,0x7,0x0,0x6,0x5,0x3,0x1,0x4},
{0x3,0x4,0x7,0x6,0x2,0x0,0x5,0x1},
};
static const u8 decode_data_sprite[8][16] =
{
{0x9,0x3,0x4,0x5,0x7,0x1,0xb,0x8,0x0,0xd,0x2,0xc,0xe,0x6,0xf,0xa},
{0x1,0x3,0xc,0x4,0x0,0xf,0xb,0xa,0x8,0x5,0xe,0x6,0xd,0x2,0x7,0x9},
{0xf,0xe,0xd,0xc,0xb,0xa,0x9,0x8,0x7,0x6,0x5,0x4,0x3,0x2,0x1,0x0},
{0xf,0xe,0xc,0x6,0xa,0xb,0x7,0x8,0x9,0x2,0x3,0x4,0x5,0xd,0x1,0x0},
{0x1,0x6,0x2,0x5,0xf,0x7,0xb,0x9,0xa,0x3,0xd,0xe,0xc,0x4,0x0,0x8}, // Haze 20/07/00
{0x7,0x5,0xd,0xe,0xb,0xa,0x0,0x1,0x9,0x6,0xc,0x2,0x3,0x4,0x8,0xf}, // Haze 20/07/00
{0x0,0x5,0x6,0x3,0x9,0xb,0xa,0x7,0x1,0xd,0x2,0xe,0x4,0xc,0x8,0xf}, // Antiriad, Corrected by Haze 20/07/00
{0x9,0xc,0x4,0x2,0xf,0x0,0xb,0x8,0xa,0xd,0x3,0x6,0x5,0xe,0x1,0x7}, // Antiriad, Corrected by Haze 20/07/00
};
// background
rom = memregion("bgtile")->base();
len = memregion("bgtile")->bytes();
for (int A = 0; A < len; A++)
{
rom[A] = decode_byte(rom[A], decode_data_bg[bjtwin_address_map_bg0(A)]);
}
// Sprites
rom = memregion("sprites")->base();
len = memregion("sprites")->bytes();
for (int A = 0; A < len; A += 2)
{
u16 tmp = decode_word(rom[A+1]*256 + rom[A], decode_data_sprite[bjtwin_address_map_sprites(A)]);
rom[A+1] = tmp >> 8;
rom[A] = tmp & 0xff;
}
}
void nmk16_state::decode_tdragonb()
{
/* Descrambling Info Again Taken from Raine, Huge Thanks to Antiriad and the Raine Team for
going Open Source, best of luck in future development. */
u8 *rom;
int len;
// The Main 68k Program of the Bootleg is Bitswapped
static const u8 decode_data_tdragonb[1][16] =
{
{0xe,0xc,0xa,0x8,0x7,0x5,0x3,0x1,0xf,0xd,0xb,0x9,0x6,0x4,0x2,0x0},
};
// Graphic Roms Could Also Do With Rearranging to make things simpler
static const u8 decode_data_tdragonbgfx[1][8] =
{
{0x7,0x6,0x5,0x3,0x4,0x2,0x1,0x0},
};
rom = memregion("maincpu")->base();
len = memregion("maincpu")->bytes();
for (int A = 0; A < len; A += 2)
{
int h = A + NATIVE_ENDIAN_VALUE_LE_BE(1,0), l = A + NATIVE_ENDIAN_VALUE_LE_BE(0,1);
u16 tmp = decode_word(rom[h]*256 + rom[l], decode_data_tdragonb[0]);
rom[h] = tmp >> 8;
rom[l] = tmp & 0xff;
}
rom = memregion("bgtile")->base();
len = memregion("bgtile")->bytes();
for (int A = 0; A < len; A++)
{
rom[A] = decode_byte(rom[A], decode_data_tdragonbgfx[0]);
}
rom = memregion("sprites")->base();
len = memregion("sprites")->bytes();
for (int A = 0; A < len; A++)
{
rom[A] = decode_byte(rom[A], decode_data_tdragonbgfx[0]);
}
}
void nmk16_state::decode_ssmissin()
{
// Like Thunder Dragon Bootleg without the Program Rom Swapping
u8 *rom;
int len;
// Graphic Roms Could Also Do With Rearranging to make things simpler
static const u8 decode_data_ssmissingfx[1][8] =
{
{0x7,0x6,0x5,0x3,0x4,0x2,0x1,0x0},
};
rom = memregion("bgtile")->base();
len = memregion("bgtile")->bytes();
for (int A = 0; A < len; A++)
{
rom[A] = decode_byte(rom[A], decode_data_ssmissingfx[0]);
}
rom = memregion("sprites")->base();
len = memregion("sprites")->bytes();
for (int A = 0; A < len; A++)
{
rom[A] = decode_byte(rom[A], decode_data_ssmissingfx[0]);
}
}
void nmk16_state::save_protregs()
{
save_item(NAME(m_input_pressed));
save_item(NAME(m_start_helper));
save_item(NAME(m_coin_count));
save_item(NAME(m_coin_count_frac));
}
void nmk16_state::init_nmk()
{
decode_gfx();
}
void nmk16_state::init_banked_audiocpu()
{
m_audiobank->configure_entries(0, 8, memregion("audiocpu")->base(), 0x4000);
}
void nmk16_state::init_tharrier()
{
m_okibank[0]->configure_entries(0, 4, memregion("oki1")->base() + 0x20000, 0x20000);
m_okibank[1]->configure_entries(0, 4, memregion("oki2")->base() + 0x20000, 0x20000);
save_item(NAME(m_prot_count));
m_prot_count = 0;
}
void nmk16_state::init_hachamf_prot()
{
u16 *rom = (u16 *)memregion("maincpu")->base();
//rom[0x0006/2] = 0x7dc2; // replace reset vector with the "real" one
// kludge the sound communication to let commands go through.
rom[0x048a/2] = 0x4e71;
rom[0x04aa/2] = 0x4e71;
m_maincpu->space(AS_PROGRAM).install_write_handler(0x0f0000, 0x0fffff, write16s_delegate(*this, FUNC(nmk16_state::hachamf_mainram_w)));
save_protregs();
}
void nmk16_state::init_tdragonb()
{
decode_tdragonb();
}
void nmk16_state::init_tdragon_prot()
{
u16 *rom = (u16 *)memregion("maincpu")->base();
//rom[0x94b0/2] = 0; // Patch out JMP to shared memory (protection)
//rom[0x94b2/2] = 0x92f4;
// kludge the sound communication to let commands go through.
rom[0x048a/2] = 0x4e71;
rom[0x04aa/2] = 0x4e71;
m_maincpu->space(AS_PROGRAM).install_write_handler(0x0b0000, 0x0bffff, write16s_delegate(*this, FUNC(nmk16_state::tdragon_mainram_w)));
save_protregs();
}
void nmk16_state::init_ssmissin()
{
decode_ssmissin();
m_okibank[0]->configure_entries(0, 4, memregion("oki1")->base() + 0x80000, 0x20000);
}
void nmk16_state::init_twinactn()
{
m_okibank[0]->configure_entries(0, 4, memregion("oki1")->base(), 0x20000);
}
void nmk16_state::init_bjtwin()
{
// Patch ROM to enable test mode
/* 008F54: 33F9 0008 0000 000F FFFC move.w $80000.l, $ffffc.l
* 008F5E: 3639 0008 0002 move.w $80002.l, D3
* 008F64: 3003 move.w D3, D0 \
* 008F66: 3203 move.w D3, D1 | This code remaps
* 008F68: 0041 BFBF ori.w #-$4041, D1 | buttons 2 and 3 to
* 008F6C: E441 asr.w #2, D1 | button 1, so
* 008F6E: 0040 DFDF ori.w #-$2021, D0 | you can't enter
* 008F72: E240 asr.w #1, D0 | service mode
* 008F74: C640 and.w D0, D3 |
* 008F76: C641 and.w D1, D3 /
* 008F78: 33C3 000F FFFE move.w D3, $ffffe.l
* 008F7E: 207C 000F 9000 movea.l #$f9000, A0
*/
#if 0
u16 *rom = (u16 *)memregion("maincpu")->base();
rom[0x09172/2] = 0x6006; // patch checksum error
rom[0x08f74/2] = 0x4e71;
#endif
init_nmk();
}
void nmk16_state::init_gunnailb()
{
decode_gfx();
init_banked_audiocpu();
}
// NO NMK004, it has a PIC instead
u16 nmk16_state::vandykeb_r(){ return 0x0000; }
void nmk16_state::init_vandykeb()
{
m_okibank[0]->configure_entries(0, 4, memregion("oki1")->base() + 0x20000, 0x20000);
m_maincpu->space(AS_PROGRAM).install_read_handler(0x08000e, 0x08000f, read16smo_delegate(*this, FUNC(nmk16_state::vandykeb_r)));
m_maincpu->space(AS_PROGRAM).nop_write(0x08001e, 0x08001f);
}
void nmk16_tomagic_state::init_tomagic()
{
// rearrange data so that we can use standard decode
u8 *rom = memregion("sprites")->base();
int size = memregion("sprites")->bytes();
for (int i = 0; i < size; i++)
rom[i] = bitswap<8>(rom[i], 0,1,2,3,4,5,6,7);
init_banked_audiocpu();
}
/***************************************************************************
Memory Maps - Main CPU
***************************************************************************/
u16 afega_state::afega_unknown_r()
{
// This fixes the text in Service Mode.
return 0x0100;
}
template<unsigned Scroll>
void afega_state::afega_scroll_w(offs_t offset, u16 data, u16 mem_mask)
{
COMBINE_DATA(&m_afega_scroll[Scroll][offset]);
}
void afega_state::afega_map(address_map &map)
{
map.global_mask(0xfffff);
map(0x000000, 0x07ffff).rom();
map(0x080000, 0x080001).portr("IN0"); // Buttons
map(0x080002, 0x080003).portr("IN1"); // P1 + P2
map(0x080004, 0x080005).portr("DSW1"); // 2 x DSW
map(0x080012, 0x080013).r(FUNC(afega_state::afega_unknown_r));
map(0x08001f, 0x08001f).w(m_soundlatch, FUNC(generic_latch_8_device::write)); // To Sound CPU
map(0x084000, 0x084003).ram().w(FUNC(afega_state::afega_scroll_w<0>)); // Scroll on redhawkb (mirror or changed?..)
map(0x084004, 0x084007).ram().w(FUNC(afega_state::afega_scroll_w<1>)); // Scroll on redhawkb (mirror or changed?..)
map(0x088000, 0x0885ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); // Palette
map(0x08c000, 0x08c003).ram().w(FUNC(afega_state::afega_scroll_w<0>)).share("afega_scroll_0"); // Scroll
map(0x08c004, 0x08c007).ram().w(FUNC(afega_state::afega_scroll_w<1>)).share("afega_scroll_1"); //
map(0x090000, 0x093fff).ram().w(FUNC(afega_state::bgvideoram_w<0>)).share("bgvideoram0"); // Layer 0 // ?
map(0x09c000, 0x09c7ff).ram().w(FUNC(afega_state::txvideoram_w)).share("txvideoram"); // Layer 1
map(0x0c0000, 0x0cffff).ram().w(FUNC(afega_state::mainram_strange_w)).share("mainram");
map(0x0f0000, 0x0fffff).ram().w(FUNC(afega_state::mainram_strange_w)).share("mainram");
}
// firehawk has 0x100000 bytes of program ROM (at least the switchable version) so the above can't work.
void afega_state::firehawk_map(address_map &map)
{
map.global_mask(0x3fffff);
map(0x000000, 0x0fffff).rom();
map(0x280000, 0x280001).portr("IN0"); // Buttons
map(0x280002, 0x280003).portr("IN1"); // P1 + P2
map(0x280004, 0x280005).portr("DSW1"); // 2 x DSW
map(0x280012, 0x280013).r(FUNC(afega_state::afega_unknown_r));
map(0x28001f, 0x28001f).w(m_soundlatch, FUNC(generic_latch_8_device::write)); // To Sound CPU
map(0x284000, 0x284003).ram().w(FUNC(afega_state::afega_scroll_w<0>)); // Scroll on redhawkb (mirror or changed?..)
map(0x284004, 0x284007).ram().w(FUNC(afega_state::afega_scroll_w<1>)); // Scroll on redhawkb (mirror or changed?..)
map(0x288000, 0x2885ff).ram().w(m_palette, FUNC(palette_device::write16)).share("palette"); // Palette
map(0x28c000, 0x28c003).ram().w(FUNC(afega_state::afega_scroll_w<0>)).share("afega_scroll_0"); // Scroll
map(0x28c004, 0x28c007).ram().w(FUNC(afega_state::afega_scroll_w<1>)).share("afega_scroll_1"); //
map(0x290000, 0x293fff).ram().w(FUNC(afega_state::bgvideoram_w<0>)).share("bgvideoram0"); // Layer 0 // ?
map(0x29c000, 0x29c7ff).ram().w(FUNC(afega_state::txvideoram_w)).share("txvideoram"); // Layer 1
map(0x3c0000, 0x3cffff).ram().w(FUNC(afega_state::mainram_strange_w)).share("mainram");
map(0x3f0000, 0x3fffff).ram().w(FUNC(afega_state::mainram_strange_w)).share("mainram");
}
/***************************************************************************
Memory Maps - Sound CPU
***************************************************************************/
void afega_state::spec2k_oki1_banking_w(u8 data)
{
if (data == 0xfe)
m_oki[1]->set_rom_bank(0);
else if (data == 0xff)
m_oki[1]->set_rom_bank(1);
}
void afega_state::afega_sound_cpu(address_map &map)
{
map(0x0003, 0x0003).nopw(); // bug in sound prg?
map(0x0004, 0x0004).nopw(); // bug in sound prg?
map(0x0000, 0xefff).rom();
map(0xf000, 0xf7ff).ram(); // RAM
map(0xf800, 0xf800).r(m_soundlatch, FUNC(generic_latch_8_device::read)); // From Main CPU
map(0xf808, 0xf809).rw("ymsnd", FUNC(ym2151_device::read), FUNC(ym2151_device::write)); // YM2151
map(0xf80a, 0xf80a).rw(m_oki[0], FUNC(okim6295_device::read), FUNC(okim6295_device::write)); // M6295
}
void afega_state::firehawk_sound_cpu(address_map &map)
{
map(0x0000, 0xefff).rom();
map(0xf000, 0xf7ff).ram();
map(0xf800, 0xffff).ram(); // not used, only tested
map(0xfff0, 0xfff0).r(m_soundlatch, FUNC(generic_latch_8_device::read));
map(0xfff2, 0xfff2).w(FUNC(afega_state::spec2k_oki1_banking_w));
map(0xfff8, 0xfff8).rw(m_oki[1], FUNC(okim6295_device::read), FUNC(okim6295_device::write));
map(0xfffa, 0xfffa).rw(m_oki[0], FUNC(okim6295_device::read), FUNC(okim6295_device::write));
}
/***************************************************************************
Graphics Layouts
***************************************************************************/
static const gfx_layout tilelayout_8bpp =
{
16,16,
RGN_FRAC(1,2),
8,
{ STEP4(RGN_FRAC(0,2),1), STEP4(RGN_FRAC(1,2),1) },
{ STEP8(0,4), STEP8(4*8*16,4) },
{ STEP16(0,4*8) },
16*16*4
};
static GFXDECODE_START( gfx_grdnstrm )
GFXDECODE_ENTRY( "fgtile", 0, gfx_8x8x4_packed_msb, 0x200, 16 ) // [2] Layer 1
GFXDECODE_ENTRY( "bgtile", 0, tilelayout_8bpp, 0x000, 1 ) // [1] Layer 0
GFXDECODE_ENTRY( "sprites", 0, gfx_8x8x4_col_2x2_group_packed_msb, 0x100, 16 ) // [0] Sprites
GFXDECODE_END
static GFXDECODE_START( gfx_redhawkb )
GFXDECODE_ENTRY( "fgtile", 0, gfx_8x8x4_packed_msb, 0x200, 16 ) // [2] Layer 1
GFXDECODE_ENTRY( "bgtile", 0, gfx_8x8x4_col_2x2_group_packed_lsb, 0x000, 16 ) // [1] Layer 0
GFXDECODE_ENTRY( "sprites", 0, gfx_8x8x4_col_2x2_group_packed_lsb, 0x100, 16 ) // [0] Sprites
GFXDECODE_END
/***************************************************************************
Machine Drivers
***************************************************************************/
void afega_state::stagger1(machine_config &config)
{
// basic machine hardware
M68000(config, m_maincpu, XTAL(12'000'000)); // 68000p10 running at 12mhz, verified on PCB
m_maincpu->set_addrmap(AS_PROGRAM, &afega_state::afega_map);
set_hacky_interrupt_timing(config);
Z80(config, m_audiocpu, XTAL(4'000'000)); // verified on PCB
m_audiocpu->set_addrmap(AS_PROGRAM, &afega_state::afega_sound_cpu);
// video hardware
set_hacky_screen_lowres(config);
m_spritegen->set_colpri_callback(FUNC(afega_state::get_colour_4bit));
m_spritegen->set_ext_callback(FUNC(afega_state::get_sprite_flip));
m_screen->set_screen_update(FUNC(afega_state::screen_update_afega));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_macross);
PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 768);
MCFG_VIDEO_START_OVERRIDE(afega_state,macross)
// sound hardware
SPEAKER(config, "mono").front_center();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, 0);
ym2151_device &ymsnd(YM2151(config, "ymsnd", XTAL(4'000'000))); // verified on PCB
ymsnd.irq_handler().set_inputline(m_audiocpu, 0);
ymsnd.add_route(ALL_OUTPUTS, "mono", 0.15);
OKIM6295(config, m_oki[0], XTAL(4'000'000)/4, okim6295_device::PIN7_HIGH); // verified on PCB
m_oki[0]->add_route(ALL_OUTPUTS, "mono", 0.70);
}
void afega_state::redhawki(machine_config &config)
{
stagger1(config);
// basic machine hardware
// video hardware
m_screen->set_screen_update(FUNC(afega_state::screen_update_redhawki));
}
void afega_state::redhawkb(machine_config &config)
{
stagger1(config);
// basic machine hardware
// video hardware
m_gfxdecode->set_info(gfx_redhawkb);
m_screen->set_screen_update(FUNC(afega_state::screen_update_redhawkb));
}
void afega_state::grdnstrm(machine_config &config)
{
stagger1(config);
// basic machine hardware
// video hardware
m_gfxdecode->set_info(gfx_grdnstrm);
MCFG_VIDEO_START_OVERRIDE(afega_state,grdnstrm)
m_screen->set_screen_update(FUNC(afega_state::screen_update_firehawk));
}
void afega_state::grdnstrmk(machine_config &config) // Side by side with PCB, the music seems too fast as well
{
stagger1(config);
// video hardware
m_screen->set_refresh_hz(57); // Side by side with PCB, MAME is too fast at 56
m_gfxdecode->set_info(gfx_grdnstrm);
MCFG_VIDEO_START_OVERRIDE(afega_state,grdnstrm)
}
void afega_state::popspops(machine_config &config)
{
grdnstrm(config);
// video hardware
m_screen->set_screen_update(FUNC(afega_state::screen_update_bubl2000));
}
void afega_state::firehawk(machine_config &config)
{
// basic machine hardware
M68000(config, m_maincpu, 12000000);
m_maincpu->set_addrmap(AS_PROGRAM, &afega_state::firehawk_map);
set_hacky_interrupt_timing(config);
Z80(config, m_audiocpu, 4000000);
m_audiocpu->set_addrmap(AS_PROGRAM, &afega_state::firehawk_sound_cpu);
// video hardware
set_hacky_screen_lowres(config);
m_spritegen->set_colpri_callback(FUNC(afega_state::get_colour_4bit));
m_spritegen->set_ext_callback(FUNC(afega_state::get_sprite_flip));
m_screen->set_screen_update(FUNC(afega_state::screen_update_firehawk));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_grdnstrm);
PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 768);
MCFG_VIDEO_START_OVERRIDE(afega_state,grdnstrm)
// sound hardware
SPEAKER(config, "mono").front_center();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, 0);
OKIM6295(config, m_oki[0], 1000000, okim6295_device::PIN7_HIGH);
m_oki[0]->add_route(ALL_OUTPUTS, "mono", 1.0);
OKIM6295(config, m_oki[1], 1000000, okim6295_device::PIN7_HIGH);
m_oki[1]->add_route(ALL_OUTPUTS, "mono", 1.0);
}
void afega_state::spec2k(machine_config &config)
{
firehawk(config);
m_maincpu->set_addrmap(AS_PROGRAM, &afega_state::afega_map);
}
void nmk16_state::twinactn(machine_config &config)
{
// basic machine hardware
M68000(config, m_maincpu, 12000000);
m_maincpu->set_addrmap(AS_PROGRAM, &nmk16_state::twinactn_map);
set_hacky_interrupt_timing(config);
Z80(config, m_audiocpu, 4000000);
m_audiocpu->set_addrmap(AS_PROGRAM, &nmk16_state::ssmissin_sound_map);
// video hardware
set_hacky_screen_lowres(config);
m_spritegen->set_colpri_callback(FUNC(nmk16_state::get_colour_4bit));
m_screen->set_screen_update(FUNC(nmk16_state::screen_update_macross));
GFXDECODE(config, m_gfxdecode, m_palette, gfx_macross);
PALETTE(config, m_palette).set_format(palette_device::RRRRGGGGBBBBRGBx, 1024);
MCFG_VIDEO_START_OVERRIDE(nmk16_state,macross)
// sound hardware
SPEAKER(config, "mono").front_center();
GENERIC_LATCH_8(config, m_soundlatch);
m_soundlatch->data_pending_callback().set_inputline(m_audiocpu, 0);
OKIM6295(config, m_oki[0], 1000000, okim6295_device::PIN7_HIGH);
m_oki[0]->set_addrmap(0, &nmk16_state::oki1_map);
m_oki[0]->add_route(ALL_OUTPUTS, "mono", 1.0);
}
/***************************************************************************
ROMs Loading
***************************************************************************/
// Address lines scrambling
static void decryptcode( running_machine &machine, int a23, int a22, int a21, int a20, int a19, int a18, int a17, int a16, int a15, int a14, int a13, int a12,
int a11, int a10, int a9, int a8, int a7, int a6, int a5, int a4, int a3, int a2, int a1, int a0 )
{
u8 *RAM = machine.root_device().memregion("maincpu")->base();
size_t size = machine.root_device().memregion("maincpu")->bytes();
std::vector<u8> buffer(size);
memcpy(&buffer[0], RAM, size);
for (int i = 0; i < size; i++)
{
RAM[i] = buffer[bitswap<24>(i, a23, a22, a21, a20, a19, a18, a17, a16, a15, a14, a13, a12,
a11, a10, a9, a8, a7, a6, a5, a4, a3, a2, a1, a0)];
}
}
ROM_START( vandyke )
ROM_REGION( 0x40000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "vdk-1.16", 0x00000, 0x20000, CRC(c1d01c59) SHA1(04a7fd31ca4d87d078070390660edf08bf1d96b5) )
ROM_LOAD16_BYTE( "vdk-2.15", 0x00001, 0x20000, CRC(9d741cc2) SHA1(2d101044fba5fc5b7d63869a0a053c42fdc2598b) )
ROM_REGION(0x10000, "audiocpu", 0 ) // 64k for sound CPU code
ROM_LOAD( "vdk-4.127", 0x00000, 0x10000, CRC(eba544f0) SHA1(36f6d048d15a392542a9220a244d8a7049aaff8b) )
ROM_REGION( 0x010000, "fgtile", 0 )
ROM_LOAD( "vdk-3.222", 0x000000, 0x010000, CRC(5a547c1b) SHA1(2d61f51ce2f91ebf0053ce3a00911d1bcbaba816) ) // 8x8 tiles
ROM_REGION( 0x080000, "bgtile", 0 )
ROM_LOAD( "vdk-01.13", 0x000000, 0x080000, CRC(195a24be) SHA1(3a20dd746a87efc5c1fdc5025b709efeff82e05e) ) // 16x16 tiles
ROM_REGION( 0x200000, "sprites", 0 )
ROM_LOAD16_BYTE( "vdk-07.202", 0x000000, 0x080000, CRC(42d41f06) SHA1(69fd1d38187b8081f65acea2424bc1a0d455d90c) ) // Sprites
ROM_LOAD16_BYTE( "vdk-06.203", 0x000001, 0x080000, CRC(d54722a8) SHA1(47f8e97b29ae0ff1a1d7d50734e4219a87a2ed57) ) // Sprites
ROM_LOAD16_BYTE( "vdk-04.2-1", 0x100000, 0x080000, CRC(0a730547) SHA1(afac0549eb86d1fab5ca8ae2a0dad14144f55c02) ) // Sprites
ROM_LOAD16_BYTE( "vdk-05.3-1", 0x100001, 0x080000, CRC(ba456d27) SHA1(5485a560ae2c2c8b6fdec314393c02a3de758ef3) ) // Sprites
ROM_REGION( 0x080000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD( "vdk-02.126", 0x000000, 0x080000, CRC(b2103274) SHA1(6bbdc912393607cd5306be946327c5ea0178c7a6) ) // 0x20000 - 0x80000 banked
ROM_REGION( 0x080000, "oki2", 0 ) // OKIM6295 samples
ROM_LOAD( "vdk-03.165", 0x000000, 0x080000, CRC(631776d3) SHA1(ffd76e5b03130252c55eaa6ae7edfee5632dae73) ) // 0x20000 - 0x80000 banked
ROM_REGION( 0x0200, "proms", 0 )
ROM_LOAD( "ic100.bpr", 0x0000, 0x0100, CRC(98ed1c97) SHA1(f125ad05c3cbd1b1ab356161f9b1d814781d4c3b) ) // V-sync hw (unused)
ROM_LOAD( "ic101.bpr", 0x0100, 0x0100, CRC(cfdbb86c) SHA1(588822f6308a860937349c9106c2b4b1a75823ec) ) // H-sync hw (unused)
ROM_END
ROM_START( vandykejal )
ROM_REGION( 0x40000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "vdk-1.16", 0x00000, 0x20000, CRC(c1d01c59) SHA1(04a7fd31ca4d87d078070390660edf08bf1d96b5) )
ROM_LOAD16_BYTE( "jaleco2.15", 0x00001, 0x20000, CRC(170e4d2e) SHA1(6009d19d30e345fea93e039d165061e2b20ff058) )
ROM_REGION(0x10000, "audiocpu", 0 ) // 64k for sound CPU code
ROM_LOAD( "vdk-4.127", 0x00000, 0x10000, CRC(eba544f0) SHA1(36f6d048d15a392542a9220a244d8a7049aaff8b) )
ROM_REGION( 0x010000, "fgtile", 0 )
ROM_LOAD( "vdk-3.222", 0x000000, 0x010000, CRC(5a547c1b) SHA1(2d61f51ce2f91ebf0053ce3a00911d1bcbaba816) ) // 8x8 tiles
ROM_REGION( 0x080000, "bgtile", 0 )
ROM_LOAD( "vdk-01.13", 0x000000, 0x080000, CRC(195a24be) SHA1(3a20dd746a87efc5c1fdc5025b709efeff82e05e) ) // 16x16 tiles
ROM_REGION( 0x200000, "sprites", 0 )
ROM_LOAD16_BYTE( "vdk-07.202", 0x000000, 0x080000, CRC(42d41f06) SHA1(69fd1d38187b8081f65acea2424bc1a0d455d90c) ) // Sprites
ROM_LOAD16_BYTE( "vdk-06.203", 0x000001, 0x080000, CRC(d54722a8) SHA1(47f8e97b29ae0ff1a1d7d50734e4219a87a2ed57) ) // Sprites
ROM_LOAD16_BYTE( "vdk-04.2-1", 0x100000, 0x080000, CRC(0a730547) SHA1(afac0549eb86d1fab5ca8ae2a0dad14144f55c02) ) // Sprites
ROM_LOAD16_BYTE( "vdk-05.3-1", 0x100001, 0x080000, CRC(ba456d27) SHA1(5485a560ae2c2c8b6fdec314393c02a3de758ef3) ) // Sprites
ROM_REGION( 0x080000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD( "vdk-02.126", 0x000000, 0x080000, CRC(b2103274) SHA1(6bbdc912393607cd5306be946327c5ea0178c7a6) ) // 0x20000 - 0x80000 banked
ROM_REGION( 0x080000, "oki2", 0 ) // OKIM6295 samples
ROM_LOAD( "vdk-03.165", 0x000000, 0x080000, CRC(631776d3) SHA1(ffd76e5b03130252c55eaa6ae7edfee5632dae73) ) // 0x20000 - 0x80000 banked
ROM_REGION( 0x0200, "proms", 0 )
ROM_LOAD( "ic100.bpr", 0x0000, 0x0100, CRC(98ed1c97) SHA1(f125ad05c3cbd1b1ab356161f9b1d814781d4c3b) ) // V-sync hw (unused)
ROM_LOAD( "ic101.bpr", 0x0100, 0x0100, CRC(cfdbb86c) SHA1(588822f6308a860937349c9106c2b4b1a75823ec) ) // H-sync hw (unused)
ROM_END
ROM_START( vandykejal2 )
ROM_REGION( 0x40000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "vdk-even.16", 0x00000, 0x20000, CRC(cde05a84) SHA1(dab5981d7dad9abe86cfe011da8ca0b11d484a3f) ) // Hand written labels, dated 2/12
ROM_LOAD16_BYTE( "vdk-odd.15", 0x00001, 0x20000, CRC(0f6fea40) SHA1(3acbe72c251d51b028d8c66274263a2b39b042ea) )
ROM_REGION(0x10000, "audiocpu", 0 ) // 64k for sound CPU code
ROM_LOAD( "vdk-4.127", 0x00000, 0x10000, CRC(eba544f0) SHA1(36f6d048d15a392542a9220a244d8a7049aaff8b) )
ROM_REGION( 0x010000, "fgtile", 0 )
ROM_LOAD( "vdk-3.222", 0x000000, 0x010000, CRC(5a547c1b) SHA1(2d61f51ce2f91ebf0053ce3a00911d1bcbaba816) ) // 8x8 tiles
ROM_REGION( 0x080000, "bgtile", 0 )
ROM_LOAD( "vdk-01.13", 0x000000, 0x080000, CRC(195a24be) SHA1(3a20dd746a87efc5c1fdc5025b709efeff82e05e) ) // 16x16 tiles
ROM_REGION( 0x200000, "sprites", 0 )
ROM_LOAD16_BYTE( "vdk-07.202", 0x000000, 0x080000, CRC(42d41f06) SHA1(69fd1d38187b8081f65acea2424bc1a0d455d90c) ) // Sprites
ROM_LOAD16_BYTE( "vdk-06.203", 0x000001, 0x080000, CRC(d54722a8) SHA1(47f8e97b29ae0ff1a1d7d50734e4219a87a2ed57) ) // Sprites
ROM_LOAD16_BYTE( "vdk-04.2-1", 0x100000, 0x080000, CRC(0a730547) SHA1(afac0549eb86d1fab5ca8ae2a0dad14144f55c02) ) // Sprites
ROM_LOAD16_BYTE( "vdk-05.3-1", 0x100001, 0x080000, CRC(ba456d27) SHA1(5485a560ae2c2c8b6fdec314393c02a3de758ef3) ) // Sprites
ROM_REGION( 0x080000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD( "vdk-02.126", 0x000000, 0x080000, CRC(b2103274) SHA1(6bbdc912393607cd5306be946327c5ea0178c7a6) ) // 0x20000 - 0x80000 banked
ROM_REGION( 0x080000, "oki2", 0 ) // OKIM6295 samples
ROM_LOAD( "vdk-03.165", 0x000000, 0x080000, CRC(631776d3) SHA1(ffd76e5b03130252c55eaa6ae7edfee5632dae73) ) // 0x20000 - 0x80000 banked
ROM_REGION( 0x0200, "proms", 0 )
ROM_LOAD( "ic100.bpr", 0x0000, 0x0100, CRC(98ed1c97) SHA1(f125ad05c3cbd1b1ab356161f9b1d814781d4c3b) ) // V-sync hw (unused)
ROM_LOAD( "ic101.bpr", 0x0100, 0x0100, CRC(cfdbb86c) SHA1(588822f6308a860937349c9106c2b4b1a75823ec) ) // H-sync hw (unused)
ROM_END
ROM_START( vandykeb )
ROM_REGION( 0x40000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "2.bin", 0x00000, 0x20000, CRC(9c269702) SHA1(831ff9d499aa94d85f62b8613477a95f00f62b34) )
ROM_LOAD16_BYTE( "1.bin", 0x00001, 0x20000, CRC(dd6303a1) SHA1(3c225ff1696adc1af05b1b36d8cf1f220181861c) )
ROM_REGION(0x10000, "mcu", 0 ) // PIC is read protected
ROM_LOAD( "pic16c57", 0x00000, 0x2d4c, BAD_DUMP CRC(bdb3920d) SHA1(2ef8d2aa3817cebea8e2443bc995cec3a3f88835) )
ROM_REGION( 0x010000, "fgtile", 0 )
ROM_LOAD( "3.bin", 0x000000, 0x010000, CRC(5a547c1b) SHA1(2d61f51ce2f91ebf0053ce3a00911d1bcbaba816) ) // 8x8 tiles
ROM_REGION( 0x080000, "bgtile", 0 )
ROM_LOAD( "4.bin", 0x000000, 0x040000, CRC(4ba4138d) SHA1(56f9c9422085eaf74ddec8977663a33c122b7e8b) ) // 16x16 tiles
ROM_LOAD( "5.bin", 0x040000, 0x040000, CRC(9a1ac697) SHA1(a8200b10606edf4578c7e2f53a0046bb1209a041) ) // 16x16 tiles
ROM_REGION( 0x200000, "sprites", 0 )
ROM_LOAD16_BYTE( "13.bin", 0x000000, 0x040000, CRC(bb561871) SHA1(33dcaf956112181eed531320d3ececb90b17a599) ) // Sprites
ROM_LOAD16_BYTE( "17.bin", 0x000001, 0x040000, CRC(346e3b66) SHA1(34df7167ed4048e1f236e7d8fa6dcdffb0965c71) ) // Sprites
ROM_LOAD16_BYTE( "12.bin", 0x080000, 0x040000, CRC(cdef9b17) SHA1(ec024a21685b87c82dc574cd050118d856a3cf57) ) // Sprites
ROM_LOAD16_BYTE( "16.bin", 0x080001, 0x040000, CRC(beda678c) SHA1(3dfb8763241a97b9d65113c6eb99b52ec5245cd6) ) // Sprites
ROM_LOAD16_BYTE( "11.bin", 0x100000, 0x020000, CRC(823185d9) SHA1(eaf0f3ab0921d894eb1d09d5b2e9d5b785928804) ) // Sprites
ROM_LOAD16_BYTE( "15.bin", 0x100001, 0x020000, CRC(149f3247) SHA1(5f515cb10468da048c89b543807280bd3e39e45a) ) // Sprites
ROM_LOAD16_BYTE( "10.bin", 0x140000, 0x020000, CRC(388b1abc) SHA1(9d1c43070130672a5e1a41807d796c944b0676ae) ) // Sprites
ROM_LOAD16_BYTE( "14.bin", 0x140001, 0x020000, CRC(32eeba37) SHA1(0d0218e864ed647bd33bbe379f0ef76ccefbd06c) ) // Sprites
ROM_REGION( 0x080000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD( "9.bin", 0x000000, 0x020000, CRC(56bf774f) SHA1(5ece618fff22483adb5dff062dd4ec212aab0f01) )
ROM_LOAD( "8.bin", 0x020000, 0x020000, CRC(89851fcf) SHA1(7b6284cb929059371dd2b5410cd18373834ba76b) )
ROM_LOAD( "7.bin", 0x040000, 0x020000, CRC(d7bf0f6a) SHA1(413713576692676a831949e0d4dc5574da338380) )
ROM_LOAD( "6.bin", 0x060000, 0x020000, CRC(a7fcf709) SHA1(dc6298b43a472e92e99b8286bd4d26f7e72fd278) )
ROM_END
ROM_START( tharrier )
ROM_REGION( 0x40000, "maincpu", 0 )
ROM_LOAD16_BYTE( "2.18b", 0x00000, 0x20000, CRC(f3887a44) SHA1(4e5b660d33ba1d1e00263030efa67e2db376a234) )
ROM_LOAD16_BYTE( "3.21b", 0x00001, 0x20000, CRC(65c247f6) SHA1(9f35f2b6f54814b4c4d23e2d78db8043e678fef2) )
ROM_REGION( 0x010000, "audiocpu", 0 )
ROM_LOAD( "12.4l", 0x00000, 0x10000, CRC(b959f837) SHA1(073b14935e7d5b0cad19a3471fd26e9e3a363827) )
ROM_REGION( 0x020000, "fgtile", 0 )
ROM_LOAD( "1.13b", 0x000000, 0x10000, CRC(005c26c3) SHA1(ee88d8f956b9b0a8ba5fb49c5c05f6ed6f01729c) )
ROM_REGION( 0x080000, "bgtile", 0 )
ROM_LOAD( "89050-4.16f", 0x000000, 0x80000, CRC(64d7d687) SHA1(dcfeac71fd577439e31cc1186b720388fbdc6ca0) )
ROM_REGION( 0x100000, "sprites", 0 ) // These two ROMs are located on the 89053-OBJ daughter-board
ROM_LOAD16_BYTE( "89050-13.16d", 0x000000, 0x80000, CRC(24db3fa4) SHA1(e0d76c479dfcacf03c04ec4760caecf3fd1e2ff7) ) // Sprites
ROM_LOAD16_BYTE( "89050-17.16e", 0x000001, 0x80000, CRC(7f715421) SHA1(bde5e0e1e22519e51ca0fd806909e90cc5b1c5b8) )
ROM_REGION(0x80000, "oki1", 0 ) // Oki sample data
ROM_LOAD( "89050-8.4j", 0x00000, 0x80000, CRC(11ee4c39) SHA1(163295c385cff963a5bf87dc3e7bef6019e10ba8) ) // 0x20000 - 0x80000 banked
ROM_REGION(0x80000, "oki2", 0 ) // Oki sample data
ROM_LOAD( "89050-10.14j", 0x00000, 0x80000, CRC(893552ab) SHA1(b0a34291f4e482858ed295203ae031b17c2dbabc) ) // 0x20000 - 0x80000 banked
ROM_REGION( 0x140, "proms", 0 )
ROM_LOAD( "21.bpr", 0x00000, 0x100, CRC(fcd5efea) SHA1(cbda6b14127dabd1788cc256743cf62efaa5e8c4) )
ROM_LOAD( "22.bpr", 0x00000, 0x100, CRC(cfdbb86c) SHA1(588822f6308a860937349c9106c2b4b1a75823ec) )
ROM_LOAD( "23.bpr", 0x00000, 0x020, CRC(fc3569f4) SHA1(e1c498085e4ae9d0a995c94530544b0a5b760fbf) )
ROM_LOAD( "24.bpr", 0x00000, 0x100, CRC(e0a009fe) SHA1(a66a27bb405d4ff8e4c0062273ee9b11e76ee520) )
ROM_LOAD( "25.bpr", 0x00000, 0x100, CRC(e0a009fe) SHA1(a66a27bb405d4ff8e4c0062273ee9b11e76ee520) ) // same as 24.bin
ROM_LOAD( "26.bpr", 0x00120, 0x020, CRC(0cbfb33e) SHA1(5dfee031a0a14bcd667fe2af2fa9cdfac3941d22) )
ROM_END
ROM_START( tharrieru )
ROM_REGION( 0x40000, "maincpu", 0 )
ROM_LOAD16_BYTE( "u_2.18b", 0x00000, 0x20000, CRC(78923aaa) SHA1(28338f49581180604403e1bd200f524fc4cb8b9f) ) // "U" stamped on label
ROM_LOAD16_BYTE( "u_3.21b", 0x00001, 0x20000, CRC(99cea259) SHA1(75abfb08b2358dd13809ade5a2dfffeb8b8df82c) ) // "U" stamped on label
ROM_REGION( 0x010000, "audiocpu", 0 )
ROM_LOAD( "12.4l", 0x00000, 0x10000, CRC(b959f837) SHA1(073b14935e7d5b0cad19a3471fd26e9e3a363827) )
ROM_REGION( 0x020000, "fgtile", 0 )
ROM_LOAD( "1.13b", 0x000000, 0x10000, CRC(c7402e4a) SHA1(25cade2f8d4784887f0f51beb48b1e6b695629c2) ) // sldh
ROM_REGION( 0x080000, "bgtile", 0 )
ROM_LOAD( "89050-4.16f", 0x000000, 0x80000, CRC(64d7d687) SHA1(dcfeac71fd577439e31cc1186b720388fbdc6ca0) )
ROM_REGION( 0x100000, "sprites", 0 ) // These two ROMs are located on the 89053-OBJ daughter-board
ROM_LOAD16_BYTE( "89050-13.16d", 0x000000, 0x80000, CRC(24db3fa4) SHA1(e0d76c479dfcacf03c04ec4760caecf3fd1e2ff7) ) // Sprites
ROM_LOAD16_BYTE( "89050-17.16e", 0x000001, 0x80000, CRC(7f715421) SHA1(bde5e0e1e22519e51ca0fd806909e90cc5b1c5b8) )
ROM_REGION(0x80000, "oki1", 0 ) // Oki sample data
ROM_LOAD( "89050-8.4j", 0x00000, 0x80000, CRC(11ee4c39) SHA1(163295c385cff963a5bf87dc3e7bef6019e10ba8) ) // 0x20000 - 0x80000 banked
ROM_REGION(0x80000, "oki2", 0 ) // Oki sample data
ROM_LOAD( "89050-10.14j", 0x00000, 0x80000, CRC(893552ab) SHA1(b0a34291f4e482858ed295203ae031b17c2dbabc) ) // 0x20000 - 0x80000 banked
ROM_REGION( 0x140, "proms", 0 )
ROM_LOAD( "21.bpr", 0x00000, 0x100, CRC(fcd5efea) SHA1(cbda6b14127dabd1788cc256743cf62efaa5e8c4) )
ROM_LOAD( "22.bpr", 0x00000, 0x100, CRC(cfdbb86c) SHA1(588822f6308a860937349c9106c2b4b1a75823ec) )
ROM_LOAD( "23.bpr", 0x00000, 0x020, CRC(fc3569f4) SHA1(e1c498085e4ae9d0a995c94530544b0a5b760fbf) )
ROM_LOAD( "24.bpr", 0x00000, 0x100, CRC(e0a009fe) SHA1(a66a27bb405d4ff8e4c0062273ee9b11e76ee520) )
ROM_LOAD( "25.bpr", 0x00000, 0x100, CRC(e0a009fe) SHA1(a66a27bb405d4ff8e4c0062273ee9b11e76ee520) ) // same as 24.bin
ROM_LOAD( "26.bpr", 0x00120, 0x020, CRC(0cbfb33e) SHA1(5dfee031a0a14bcd667fe2af2fa9cdfac3941d22) )
ROM_END
ROM_START( tharrierb )
ROM_REGION( 0x40000, "maincpu", 0 )
ROM_LOAD16_BYTE( "cpua", 0x00000, 0x20000, CRC(d55d21c7) SHA1(7c66283ca48453cc7eea257d70e5ce09217cfa1e) )
ROM_LOAD16_BYTE( "cpub", 0x00001, 0x20000, CRC(65c247f6) SHA1(9f35f2b6f54814b4c4d23e2d78db8043e678fef2) ) // just a BEQ at 0x6b6a changed to BRA and a BPL at 0x6ba0 changed to BRA
ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "s1.512", 0x00000, 0x10000, CRC(b959f837) SHA1(073b14935e7d5b0cad19a3471fd26e9e3a363827) )
ROM_REGION( 0x1000, "mcu", 0 )
ROM_LOAD( "mc68705r35", 0x0000, 0x1000, NO_DUMP ) // doesn't seem to be used by the game. Possibly empty or leftover from a conversion?
ROM_REGION( 0x8000, "fgtile", 0 )
ROM_LOAD( "t.256", 0x0000, 0x8000, CRC(4e9a7e0b) SHA1(ff143d1e01e865a62ecc695fe3359a2a0eacee05) ) // half size if compared to the original
ROM_REGION( 0x80000, "bgtile", 0 )
ROM_LOAD( "10h.512", 0x00000, 0x10000, CRC(9b97073c) SHA1(963d45bac06ae74872206442d7a7c1bfb142e951) )
ROM_LOAD( "21h.512", 0x10000, 0x10000, CRC(d5a90bd5) SHA1(b1bccc11aada4277482f3988f4f3ffa565f15f59) )
ROM_LOAD( "12h.512", 0x20000, 0x10000, CRC(3d4a03ac) SHA1(a2840d339249441e191bcee59c1330851b5b1992) )
ROM_LOAD( "24h.512", 0x30000, 0x10000, CRC(edecb4c8) SHA1(76190d35e188c5272aa2b0131f28e4edd812237b) )
ROM_LOAD( "11h.512", 0x40000, 0x10000, CRC(c20d20ed) SHA1(4d5492fcbff15c727c642a97bdc51bbf43623199) )
ROM_LOAD( "23h.512", 0x50000, 0x10000, CRC(c7949c45) SHA1(c0d2f58ec9e7e566980dcc8e93215aef735833d4) )
ROM_LOAD( "22h.512", 0x60000, 0x10000, CRC(7f38e700) SHA1(55e135f82154b1ad8210fab5b2aa72d38f4d2f32) ) // 1ST AND 2ND HALF IDENTICAL, original has 0x60000-0x67fff 0xff filled
ROM_LOAD( "9h.512", 0x70000, 0x10000, CRC(43499c11) SHA1(9215fa7a76be4e76bf5fdc55c93e635c9b113947) )
ROM_REGION( 0x100000, "sprites", 0 ) // identical to the original up t0 0xeffff, then this bootleg has more data?
ROM_LOAD16_BYTE( "l3.512", 0x00000, 0x10000, CRC(b1537a3b) SHA1(82eb2d5b99f3e42b570a46ad3e9861761522a406) )
ROM_LOAD16_BYTE( "l10.512", 0x00001, 0x10000, CRC(203b88f8) SHA1(58441f147719e349f3d7fbf4b21504e417c097f7) )
ROM_LOAD16_BYTE( "l1.512", 0x20000, 0x10000, CRC(060ed368) SHA1(bc9e742595f45e4726b449c808d89504e0663df5) )
ROM_LOAD16_BYTE( "l15.512", 0x20001, 0x10000, CRC(0c5cef0e) SHA1(6bee6956f52de436c2a06f5b5ff8d08f83a79a2d) )
ROM_LOAD16_BYTE( "l2.512", 0x40000, 0x10000, CRC(d62b4a9e) SHA1(b6db3fc00755a2d72effff96e721bfaef4216897) )
ROM_LOAD16_BYTE( "l16.512", 0x40001, 0x10000, CRC(6b637cda) SHA1(838b4ad3e3ebf29c6673bf559b9ad7f729ea148d) )
ROM_LOAD16_BYTE( "l6.512", 0x60000, 0x10000, CRC(5f249283) SHA1(7c25659a3d8f29ca0235b206fc03dfedf15a88fe) )
ROM_LOAD16_BYTE( "l14.512", 0x60001, 0x10000, CRC(dfabc192) SHA1(0d83cfbe308275e8b7e59522eaa49ff778e12713) )
ROM_LOAD16_BYTE( "l5.512", 0x80000, 0x10000, CRC(5e51cdfa) SHA1(d3d9d12c2caffabb670ef5d5909a474c52640443) )
ROM_LOAD16_BYTE( "l11.512", 0x80001, 0x10000, CRC(3ac04d8f) SHA1(e86f8cd21e70b8dd88fda4931db9b28803d6597f) )
ROM_LOAD16_BYTE( "l8.512", 0xa0000, 0x10000, CRC(0a8b8eca) SHA1(6be69a9d2fde671a735bce75fe28503c02062201) )
ROM_LOAD16_BYTE( "l12.512", 0xa0001, 0x10000, CRC(85445005) SHA1(ae880382591f707cf9d445fd11f2d182bfe44c79) )
ROM_LOAD16_BYTE( "l4.512", 0xc0000, 0x10000, CRC(19f82acd) SHA1(ff88e067b05c2de76f56e1a3ad423d8683b498c6) )
ROM_LOAD16_BYTE( "l13.512", 0xc0001, 0x10000, CRC(5cf2b63b) SHA1(2e4d093436a8ade97fe3f62a83d6211111900006) )
ROM_LOAD16_BYTE( "l7.512", 0xe0000, 0x10000, CRC(fc99519f) SHA1(35e86f3c86f978f75dcc37acce0b601cb1d65fdf) ) // 1ST AND 2ND HALF IDENTICAL, original has 0xf8000-0xfffff 0xff filled
ROM_LOAD16_BYTE( "l9.512", 0xe0001, 0x10000, CRC(4c5a8f33) SHA1(82540da291a1a78c91a47f05d9557c492315ddbc) ) // "
ROM_REGION(0x80000, "oki1", 0 ) // identical to the original, just smaller ROMs
ROM_LOAD( "8h.512", 0x00000, 0x10000, CRC(f509f5ca) SHA1(ebdf80efefa01f82d9b9773110326c17b536bfc9) )
ROM_LOAD( "7h.512", 0x10000, 0x10000, CRC(1a0ec174) SHA1(345f707d57311efbcc7a438eff76ae53a2055591) )
ROM_LOAD( "6h.512", 0x20000, 0x10000, CRC(55e704f7) SHA1(14142d25a5a3875046fc5284ff6d1fe8147045f0) )
ROM_LOAD( "5h.512", 0x30000, 0x10000, CRC(ad459ad3) SHA1(4ca8dcfca5bf5b1645d93b5cd18a645d76a9e2e8) )
ROM_LOAD( "4h.512", 0x40000, 0x10000, CRC(5ee53d1d) SHA1(1e7739ef7879f395f986ae04a3779536fee4d377) )
ROM_LOAD( "3h.512", 0x50000, 0x10000, CRC(91c27b64) SHA1(4e0e72bfac2eb97f19456a15f1dd14bb9c1f2e00) )
ROM_LOAD( "2h.512", 0x60000, 0x10000, CRC(8d11ce0d) SHA1(033ee8c8319a0e930ef10a2545d4d3844fee53ed) )
ROM_LOAD( "1h.512", 0x70000, 0x10000, CRC(b42203c4) SHA1(23e07e78d229096a837a496ee7e9826a414b9d6e) )
ROM_REGION(0x80000, "oki2", 0 ) // identical to the original, just smaller ROMs
ROM_LOAD( "13h.512", 0x00000, 0x10000, CRC(024878b1) SHA1(df6073ac12d09e7dede796d9bc4f4e2bd9720ff3) )
ROM_LOAD( "14h.512", 0x10000, 0x10000, CRC(3544758d) SHA1(df85c8df1ddaf4433bf33f4b82d9092261da25a3) )
ROM_LOAD( "15h.512", 0x20000, 0x10000, CRC(6929577a) SHA1(91c890e4e4aa39e219e8566b903cc1a5a38793d3) )
ROM_LOAD( "16h.512", 0x30000, 0x10000, CRC(c909d929) SHA1(45e8ac31a66af26044824159efee5fea87e0176d) )
ROM_LOAD( "17h.512", 0x40000, 0x10000, CRC(09e7635b) SHA1(64f8d5a7e5cec8abda4d8adcd595bfbb873d3adc) )
ROM_LOAD( "18h.512", 0x50000, 0x10000, CRC(370a2fbd) SHA1(9cdf8a6155a8afb4472f23df9d62f6a4e62fff30) )
ROM_LOAD( "19h.512", 0x60000, 0x10000, CRC(64e58cfe) SHA1(0310f5504513a8b0be20cfc337a038fcf7925131) )
ROM_LOAD( "20h.512", 0x70000, 0x10000, CRC(5ccd9205) SHA1(6e5443d6af5a896d6dd4b4e06d5c3151826bf8b5) )
ROM_END
ROM_START( mustang )
ROM_REGION( 0x40000, "maincpu", 0 )
ROM_LOAD16_BYTE( "2.bin", 0x00000, 0x20000, CRC(bd9f7c89) SHA1(a0af46a8ff82b90bece2515e1bd74e7a7ddf5379) )
ROM_LOAD16_BYTE( "3.bin", 0x00001, 0x20000, CRC(0eec36a5) SHA1(c549fbcd3e2741a6d0f2633ded6a85909d37f633) )
ROM_REGION(0x10000, "audiocpu", 0 ) // 64k for sound CPU code
ROM_LOAD( "90058-7", 0x00000, 0x10000, CRC(920a93c8) SHA1(7660ca419e2fd98848ae7f5994994eaed023151e) )
ROM_REGION( 0x020000, "fgtile", 0 )
ROM_LOAD( "90058-1", 0x00000, 0x20000, CRC(81ccfcad) SHA1(70a0f769c0d4588f6f17bd52cc86a745f30e9f00) )
ROM_REGION( 0x080000, "bgtile", 0 )
ROM_LOAD( "90058-4", 0x000000, 0x80000, CRC(a07a2002) SHA1(55720d84a251c33c52ae8c33aa41ff8ac9727941) )
ROM_REGION( 0x100000, "sprites", 0 )
ROM_LOAD16_BYTE( "90058-8", 0x00000, 0x80000, CRC(560bff04) SHA1(b005642adc81d878971ecbdead8ef5e604c90ae2) )
ROM_LOAD16_BYTE( "90058-9", 0x00001, 0x80000, CRC(b9d72a03) SHA1(43ee9def1b6c491c6832562d66c1af54d81d9b3c) )
ROM_REGION( 0x080000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD( "90058-5", 0x00000, 0x80000, CRC(c60c883e) SHA1(8a01950cad820b2e781ec81cd12737829edc4f19) ) // 0x20000 - 0x80000 banked
ROM_REGION( 0x080000, "oki2", 0 ) // OKIM6295 samples
ROM_LOAD( "90058-6", 0x00000, 0x80000, CRC(233c1776) SHA1(7010a2f914611698a65bf4f22bc1753a9ed26277) ) // 0x20000 - 0x80000 banked
ROM_REGION( 0x200, "proms", 0 )
ROM_LOAD( "10.bpr", 0x00000, 0x100, CRC(633ab1c9) SHA1(acd99fcca41eaab7948ca84988352f1d7d519c61) ) // unknown
ROM_LOAD( "90058-11", 0x00100, 0x100, CRC(cfdbb86c) SHA1(588822f6308a860937349c9106c2b4b1a75823ec) ) // unknown
ROM_END
ROM_START( mustangs )
ROM_REGION( 0x40000, "maincpu", 0 )
ROM_LOAD16_BYTE( "90058-2", 0x00000, 0x20000, CRC(833aa458) SHA1(a9924f7044397e3a36c674b064173ffae80a79ec) )
ROM_LOAD16_BYTE( "90058-3", 0x00001, 0x20000, CRC(e4b80f06) SHA1(ce589cebb5ea85c89eb44796b821a4bd0c44b9a8) )
ROM_REGION(0x10000, "audiocpu", 0 ) // 64k for sound CPU code
ROM_LOAD( "90058-7", 0x00000, 0x10000, CRC(920a93c8) SHA1(7660ca419e2fd98848ae7f5994994eaed023151e) )
ROM_REGION( 0x020000, "fgtile", 0 )
ROM_LOAD( "90058-1", 0x00000, 0x20000, CRC(81ccfcad) SHA1(70a0f769c0d4588f6f17bd52cc86a745f30e9f00) )
ROM_REGION( 0x080000, "bgtile", 0 )
ROM_LOAD( "90058-4", 0x000000, 0x80000, CRC(a07a2002) SHA1(55720d84a251c33c52ae8c33aa41ff8ac9727941) )
ROM_REGION( 0x100000, "sprites", 0 )
ROM_LOAD16_BYTE( "90058-8", 0x00000, 0x80000, CRC(560bff04) SHA1(b005642adc81d878971ecbdead8ef5e604c90ae2) )
ROM_LOAD16_BYTE( "90058-9", 0x00001, 0x80000, CRC(b9d72a03) SHA1(43ee9def1b6c491c6832562d66c1af54d81d9b3c) )
ROM_REGION( 0x080000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD( "90058-5", 0x00000, 0x80000, CRC(c60c883e) SHA1(8a01950cad820b2e781ec81cd12737829edc4f19) ) // 0x20000 - 0x80000 banked
ROM_REGION( 0x080000, "oki2", 0 ) // OKIM6295 samples
ROM_LOAD( "90058-6", 0x00000, 0x80000, CRC(233c1776) SHA1(7010a2f914611698a65bf4f22bc1753a9ed26277) ) // 0x20000 - 0x80000 banked
ROM_REGION( 0x200, "proms", 0 )
ROM_LOAD( "90058-10", 0x00000, 0x100, CRC(de156d99) SHA1(07b70deca74e23bab7c13e5e9aee32d0dbb06509) ) // unknown
ROM_LOAD( "90058-11", 0x00100, 0x100, CRC(cfdbb86c) SHA1(588822f6308a860937349c9106c2b4b1a75823ec) ) // unknown
ROM_END
ROM_START( mustangb )
ROM_REGION( 0x40000, "maincpu", 0 )
ROM_LOAD16_BYTE( "mustang.14", 0x00000, 0x20000, CRC(13c6363b) SHA1(e2c1985d1c8ec9751c47cd7e1b85e007f3aeb6fd) )
ROM_LOAD16_BYTE( "mustang.13", 0x00001, 0x20000, CRC(d8ccce31) SHA1(e8e3e34a480fcd298f11833c6c968c5df77c0e2a) )
ROM_REGION(0x20000, "audiocpu", 0 ) // 64k for sound CPU code
ROM_LOAD( "mustang.16", 0x00000, 0x8000, CRC(99ee7505) SHA1(b97c8ee5e26e8554b5de506fba3b32cc2fde53c9) )
ROM_CONTINUE( 0x010000, 0x08000 )
ROM_COPY( "audiocpu", 0x000000, 0x018000, 0x08000 )
ROM_REGION( 0x020000, "fgtile", 0 )
ROM_LOAD( "90058-1", 0x00000, 0x20000, CRC(81ccfcad) SHA1(70a0f769c0d4588f6f17bd52cc86a745f30e9f00) )
ROM_REGION( 0x080000, "bgtile", 0 )
ROM_LOAD( "90058-4", 0x000000, 0x80000, CRC(a07a2002) SHA1(55720d84a251c33c52ae8c33aa41ff8ac9727941) )
ROM_REGION( 0x100000, "sprites", 0 )
ROM_LOAD16_BYTE( "90058-8", 0x00000, 0x80000, CRC(560bff04) SHA1(b005642adc81d878971ecbdead8ef5e604c90ae2) )
ROM_LOAD16_BYTE( "90058-9", 0x00001, 0x80000, CRC(b9d72a03) SHA1(43ee9def1b6c491c6832562d66c1af54d81d9b3c) )
ROM_REGION( 0x040000, "oki", 0 ) // OKIM6295 samples
ROM_LOAD( "mustang.17", 0x00000, 0x10000, CRC(f6f6c4bf) SHA1(ea4cf74d968e254ae47c16c2f4c2f4bc1a528808) )
ROM_END
ROM_START( mustangb2 )
ROM_REGION( 0x40000, "maincpu", 0 )
ROM_LOAD16_BYTE( "05.bin", 0x00000, 0x20000, CRC(13c6363b) SHA1(e2c1985d1c8ec9751c47cd7e1b85e007f3aeb6fd) ) // bootleg manufacturered by TAB AUSTRIA
ROM_LOAD16_BYTE( "04.bin", 0x00001, 0x20000, CRC(0d06f723) SHA1(28d5899114746d186e1ddd207deb177b31ff614d) )
ROM_REGION(0x20000, "audiocpu", 0 ) // 64k for sound CPU code
ROM_LOAD( "01.bin", 0x00000, 0x8000, CRC(90820499) SHA1(ddd43373eb1891a05159085b52bf74760824e5aa) )
ROM_CONTINUE( 0x010000, 0x08000 )
ROM_COPY( "audiocpu", 0x000000, 0x018000, 0x08000 )
ROM_REGION( 0x020000, "fgtile", 0 )
ROM_LOAD( "06.bin", 0x00000, 0x20000, CRC(81ccfcad) SHA1(70a0f769c0d4588f6f17bd52cc86a745f30e9f00) )
ROM_REGION( 0x080000, "bgtile", 0 )
ROM_LOAD( "07.bin", 0x00000, 0x20000, CRC(5f8fdfb1) SHA1(529494a317409da978d44610682ef56ebc24e0af) )
ROM_LOAD( "10.bin", 0x20000, 0x20000, CRC(39757d6a) SHA1(71acf748c752df70f437b3ffa759d68d283c22cf) )
ROM_LOAD( "08.bin", 0x40000, 0x20000, CRC(b3dd5243) SHA1(38b71dad7d392319ecef690fb230fa9ca46c7d0a) )
ROM_LOAD( "09.bin", 0x60000, 0x20000, CRC(c6c9752f) SHA1(41a3581af7a10eab9eb15580760a99d27e67f085) )
ROM_REGION( 0x100000, "sprites", 0 )
ROM_LOAD16_BYTE( "18.bin", 0x00000, 0x20000, CRC(d13f0722) SHA1(3e9c0a3e124f8b2616bb4a39d2d3fb25623b8c85) )
ROM_LOAD16_BYTE( "13.bin", 0x00001, 0x20000, CRC(54773f95) SHA1(2c57f54efa069907dfb59f15fbc2c580180df3cc) )
ROM_LOAD16_BYTE( "17.bin", 0x40000, 0x20000, CRC(87c1fb43) SHA1(e874ab8aba448b002f64197dacb5d6c47fb83af2) )
ROM_LOAD16_BYTE( "14.bin", 0x40001, 0x20000, CRC(932d3e33) SHA1(a784f288fa99e605a0bf396bc7694319980d1cd1) )
ROM_LOAD16_BYTE( "16.bin", 0x80000, 0x20000, CRC(23d03ad5) SHA1(2cde1accd1d97ce9ea3d0ef24ae4d54e04b8f12f) )
ROM_LOAD16_BYTE( "15.bin", 0x80001, 0x20000, CRC(a62b2f87) SHA1(bcffc6d10bed84c509e5cb57125d08127ab2c89d) )
ROM_LOAD16_BYTE( "12.bin", 0xc0000, 0x20000, CRC(42a6cfc2) SHA1(46fc3b30a50efc94613e3b34aaf0543fa4cdc919) )
ROM_LOAD16_BYTE( "11.bin", 0xc0001, 0x20000, CRC(9d3bee66) SHA1(e8db57b9a5581d3d54e69bb7ba229a49a7cc224f) )
ROM_REGION( 0x040000, "oki", 0 ) // OKIM6295 samples
ROM_LOAD( "02.bin", 0x00000, 0x10000, CRC(f6f6c4bf) SHA1(ea4cf74d968e254ae47c16c2f4c2f4bc1a528808) )
ROM_END
// has tharrier derived sound
ROM_START( mustangb3 )
ROM_REGION( 0x40000, "maincpu", 0 )
ROM_LOAD16_BYTE( "u2.bin", 0x00000, 0x20000, CRC(1c6c0aaf) SHA1(4c411a814d5edf2ca6630332d3e90c43812e9b95) )
ROM_LOAD16_BYTE( "u1.bin", 0x00001, 0x20000, CRC(e954d6da) SHA1(eec51e651eddd6a4b74dc38fc1a17b31c3550379) )
ROM_REGION(0x10000, "audiocpu", 0 )
ROM_LOAD( "u14.bin", 0x00000, 0x10000, CRC(26041abd) SHA1(d7fb475bb44ea5d968e344a38dabb2eb21bb9e4c) )
ROM_REGION( 0x1000, "mcu", 0 )
ROM_LOAD( "mc68705r35", 0x0000, 0x1000, NO_DUMP ) // doesn't seem to be used by the game. Possibly empty or leftover from a conversion?
// GFX ROMs (3 to 11) aren't dumped yet, using the ones from the original for now
ROM_REGION( 0x20000, "fgtile", 0 )
ROM_LOAD( "90058-1", 0x00000, 0x20000, BAD_DUMP CRC(81ccfcad) SHA1(70a0f769c0d4588f6f17bd52cc86a745f30e9f00) )
ROM_REGION( 0x80000, "bgtile", 0 )
ROM_LOAD( "90058-4", 0x00000, 0x80000, BAD_DUMP CRC(a07a2002) SHA1(55720d84a251c33c52ae8c33aa41ff8ac9727941) )
ROM_REGION( 0x100000, "sprites", 0 )
ROM_LOAD16_BYTE( "90058-8", 0x00000, 0x80000, BAD_DUMP CRC(560bff04) SHA1(b005642adc81d878971ecbdead8ef5e604c90ae2) )
ROM_LOAD16_BYTE( "90058-9", 0x00001, 0x80000, BAD_DUMP CRC(b9d72a03) SHA1(43ee9def1b6c491c6832562d66c1af54d81d9b3c) )
ROM_REGION( 0x20000, "oki1", 0 )
ROM_LOAD( "u13.bin", 0x00000, 0x20000, CRC(90961f37) SHA1(e3d905516b1454f05125fed1f2c679423ad5b5f0) ) // 1ST AND 2ND HALF IDENTICAL
ROM_REGION( 0x20000, "oki2", 0 )
ROM_LOAD( "u12.bin", 0x00000, 0x20000, CRC(0a28eaca) SHA1(392bd5301904ffb92cf97999e406e238717afa45) )
ROM_END
ROM_START( acrobatm )
ROM_REGION( 0x40000, "maincpu", 0 )
ROM_LOAD16_BYTE( "02_ic100.bin", 0x00000, 0x20000, CRC(3fe487f4) SHA1(29aba5debcfddff14e584a1c7c5a403e85fc6ec0) )
ROM_LOAD16_BYTE( "01_ic101.bin", 0x00001, 0x20000, CRC(17175753) SHA1(738865744badb78a0414ff650a94b97e516d0ea0) )
ROM_REGION( 0x20000, "fgtile", 0 )
ROM_LOAD( "03_ic79.bin", 0x000000, 0x10000, CRC(d86c186e) SHA1(2e263d4780f2ba7acc7faa88472c85216fbae6a3) ) // Characters
ROM_REGION( 0x100000, "bgtile", 0 )
ROM_LOAD( "09_ic8.bin", 0x000000, 0x100000, CRC(7c12afed) SHA1(ae793e41599355a126cbcce91cd2c9f212d21853) ) // Foreground
ROM_REGION( 0x180000, "sprites", 0 )
ROM_LOAD( "07_ic42.bin", 0x000000, 0x100000, CRC(5672bdaa) SHA1(5401a104d72904de19b73125451767bc63d36809) ) // Sprites
ROM_LOAD( "08_ic29.bin", 0x100000, 0x080000, CRC(b4c0ace3) SHA1(5d638781d588cfbf4025d002d5a2309049fe1ee5) )
ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "04_ic74.bin", 0x00000, 0x10000, CRC(176905fb) SHA1(135a184f44bedd93b293b9124fa0bd725e0ee93b) )
ROM_REGION( 0x80000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD( "05_ic54.bin", 0x00000, 0x80000, CRC(3b8c2b0e) SHA1(72491da32512823540b67dc5027f21c74af08c7d) ) // 0x20000 - 0x80000 banked
ROM_REGION( 0x80000, "oki2", 0 ) // OKIM6295 samples
ROM_LOAD( "06_ic53.bin", 0x00000, 0x80000, CRC(c1517cd4) SHA1(5a91ddc608c7a6fbdd9f93e503d39eac02ef04a4) ) // 0x20000 - 0x80000 banked
ROM_REGION( 0x0200, "proms", 0 )
ROM_LOAD( "10_ic81.bin", 0x0000, 0x0100, CRC(cfdbb86c) SHA1(588822f6308a860937349c9106c2b4b1a75823ec) ) // unknown
ROM_LOAD( "11_ic80.bin", 0x0100, 0x0100, CRC(633ab1c9) SHA1(acd99fcca41eaab7948ca84988352f1d7d519c61) ) // unknown
ROM_END
/*
S.B.S. Gomorrah (and Bio-ship Paladin with correct ROMs in place)
UPL, 1993
PCB Layout
----------
UPL-90062
|-------------------------------------------------------------------------|
| LA4460 4558 YM2203 6116 NMK004 68000 |
| 3014 M6295 6.IC120 |
| M6295 8MHz 62256 10.IC15 |
| SBS-G_05.IC160 |
| SBS-G_04.IC139 62256 11.IC14 |
|DSW2 DSW1 12MHz |
| 82S129.IC69 |
| NMK005 |
| 82S135.IC94 |
| NMK902 |
|J 6116 NMK903 NMK901 |
|A |
|M 6116 7.IC46 |
|M 82S123.IC154 6116 6264 NMK903 |
|A |
| 6116 6264 |
| 6116 SBS-G_01.IC9|
| 6116 |
| |
| NMK901 |
| |
| NMK903 |
| |
| 62256 62256 8.IC27 SBS-G_02.IC4|
| |
| 62256 62256 9.IC26 |
|SBS-G_03.IC194 10MHz |
|-------------------------------------------------------------------------|
Notes:
68000 @ 10.0MHz
YM2203 @ 1.5MHz [12/8]
M6295 @ 4.0MHz [12/3], pin 7 HIGH
VSync 60Hz
HSync 15.27kHz
*/
ROM_START( bioship )
ROM_REGION( 0x40000, "maincpu", 0 )
ROM_LOAD16_BYTE( "2.ic14", 0x00000, 0x20000, CRC(acf56afb) SHA1(0e8ec494ab406cfee24cf586059878332265de75) )
ROM_LOAD16_BYTE( "1.ic15", 0x00001, 0x20000, CRC(820ef303) SHA1(d2ef29557b05abf8ae79a2c7ce0d15a91b36eeff) )
ROM_REGION( 0x20000, "fgtile", 0 )
ROM_LOAD( "7", 0x000000, 0x10000, CRC(2f3f5a10) SHA1(c1006eb755eec75f69dc7972d78d0c59088eb140) ) // Characters
ROM_REGION( 0x80000, "bgtile", 0 )
ROM_LOAD( "sbs-g_01.ic9", 0x000000, 0x80000, CRC(21302e78) SHA1(a17939c0529c8e9ec2a4edd5e6be4bcb67f86787) ) // Foreground
ROM_REGION( 0x80000, "sprites", 0 )
ROM_LOAD( "sbs-g_03.ic194", 0x000000, 0x80000, CRC(60e00d7b) SHA1(36fd02a7842ce1e79b8c4cfbe9c97052bef4aa62) ) // Sprites
ROM_REGION( 0x80000, "gfx4", 0 )
ROM_LOAD( "sbs-g_02.ic4", 0x000000, 0x80000, CRC(f31eb668) SHA1(67d6d56ea203edfbae4db658399bf61f14134206) ) // Background
ROM_REGION16_BE(0x20000, "tilerom", 0 ) // Background tilemaps (used at runtime)
ROM_LOAD16_BYTE( "8.ic27", 0x00000, 0x10000, CRC(75a46fea) SHA1(3d78cfc482b42779bb5aedb722c4a39cbc71bd10) )
ROM_LOAD16_BYTE( "9.ic26", 0x00001, 0x10000, CRC(d91448ee) SHA1(7f84ca3605edcab4bf226dab8dd7218cd5c3e5a4) )
ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "6.ic120", 0x00000, 0x10000, CRC(5f39a980) SHA1(2a440f86685249f9c317634cad8cdedc8a8f1491) )
ROM_REGION(0x80000, "oki1", 0 ) // Oki sample data
ROM_LOAD( "sbs-g_04.ic139", 0x00000, 0x80000, CRC(7c74cc4e) SHA1(92097b372eacabdb9e8e261b0bc4223821ff9273) ) // 0x20000 - 0x80000 banked
ROM_REGION(0x80000, "oki2", 0 ) // Oki sample data
ROM_LOAD( "sbs-g_05.ic160", 0x00000, 0x80000, CRC(f0a782e3) SHA1(d572226b8e597f1c34d246cb284e047a6e2d9290) ) // 0x20000 - 0x80000 banked
ROM_REGION( 0x0220, "proms", 0 )
ROM_LOAD( "82s135.ic94", 0x0000, 0x0100, CRC(98ed1c97) SHA1(f125ad05c3cbd1b1ab356161f9b1d814781d4c3b) ) // V-sync hw (unused)
ROM_LOAD( "82s129.ic69", 0x0100, 0x0100, CRC(cfdbb86c) SHA1(588822f6308a860937349c9106c2b4b1a75823ec) ) // H-sync hw (unused)
ROM_LOAD( "82s123.ic154",0x0200, 0x0020, CRC(0f789fc7) SHA1(31936c21720802da20e39b4cb030e448353e7f19) ) // ??
ROM_END
ROM_START( sbsgomo )
ROM_REGION( 0x40000, "maincpu", 0 )
ROM_LOAD16_BYTE( "11.ic14", 0x00000, 0x20000, CRC(7916150b) SHA1(cbcc8918f35ded5130058860a7af6f1d3ecdbdd8) )
ROM_LOAD16_BYTE( "10.ic15", 0x00001, 0x20000, CRC(1d7accb8) SHA1(f80fb8748017e545c96bdc7d964aa18dcd42f528) )
ROM_REGION( 0x20000, "fgtile", 0 )
ROM_LOAD( "7.ic46", 0x000000, 0x10000, CRC(f2b77f80) SHA1(6cb9e33994dc2741faef912416ebd57b654dfb36) ) // Characters
ROM_REGION( 0x80000, "bgtile", 0 )
ROM_LOAD( "sbs-g_01.ic9", 0x000000, 0x80000, CRC(21302e78) SHA1(a17939c0529c8e9ec2a4edd5e6be4bcb67f86787) ) // Foreground
ROM_REGION( 0x80000, "sprites", 0 )
ROM_LOAD( "sbs-g_03.ic194", 0x000000, 0x80000, CRC(60e00d7b) SHA1(36fd02a7842ce1e79b8c4cfbe9c97052bef4aa62) ) // Sprites
ROM_REGION( 0x80000, "gfx4", 0 )
ROM_LOAD( "sbs-g_02.ic4", 0x000000, 0x80000, CRC(f31eb668) SHA1(67d6d56ea203edfbae4db658399bf61f14134206) ) // Background
ROM_REGION16_BE(0x20000, "tilerom", 0 ) // Background tilemaps (used at runtime)
ROM_LOAD16_BYTE( "8.ic27", 0x00000, 0x10000, CRC(75a46fea) SHA1(3d78cfc482b42779bb5aedb722c4a39cbc71bd10) )
ROM_LOAD16_BYTE( "9.ic26", 0x00001, 0x10000, CRC(d91448ee) SHA1(7f84ca3605edcab4bf226dab8dd7218cd5c3e5a4) )
ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "6.ic120", 0x00000, 0x10000, CRC(5f39a980) SHA1(2a440f86685249f9c317634cad8cdedc8a8f1491) )
ROM_REGION(0x80000, "oki1", 0 ) // Oki sample data
ROM_LOAD( "sbs-g_04.ic139", 0x00000, 0x80000, CRC(7c74cc4e) SHA1(92097b372eacabdb9e8e261b0bc4223821ff9273) ) // 0x20000 - 0x80000 banked
ROM_REGION(0x80000, "oki2", 0 ) // Oki sample data
ROM_LOAD( "sbs-g_05.ic160", 0x00000, 0x80000, CRC(f0a782e3) SHA1(d572226b8e597f1c34d246cb284e047a6e2d9290) ) // 0x20000 - 0x80000 banked
ROM_REGION( 0x0220, "proms", 0 )
ROM_LOAD( "82s135.ic94", 0x0000, 0x0100, CRC(98ed1c97) SHA1(f125ad05c3cbd1b1ab356161f9b1d814781d4c3b) ) // V-sync hw (unused)
ROM_LOAD( "82s129.ic69", 0x0100, 0x0100, CRC(cfdbb86c) SHA1(588822f6308a860937349c9106c2b4b1a75823ec) ) // H-sync hw (unused)
ROM_LOAD( "82s123.ic154",0x0200, 0x0020, CRC(0f789fc7) SHA1(31936c21720802da20e39b4cb030e448353e7f19) ) // ??
ROM_END
ROM_START( blkheart )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "blkhrt.7", 0x00000, 0x20000, CRC(5bd248c0) SHA1(0649f4f8682404aeb3fc80643fcabc2d7836bb23) )
ROM_LOAD16_BYTE( "blkhrt.6", 0x00001, 0x20000, CRC(6449e50d) SHA1(d8cd126d921c95478346da96c20da01212395d77) )
ROM_REGION( 0x10000, "audiocpu", 0 ) // Code for (unknown?) CPU
ROM_LOAD( "4.bin", 0x00000, 0x10000, CRC(7cefa295) SHA1(408f46613b3620cee31dec43281688d231b47ddd) )
ROM_REGION( 0x020000, "fgtile", 0 )
ROM_LOAD( "3.bin", 0x000000, 0x020000, CRC(a1ab3a16) SHA1(3fb57c9d2ef94ee188cbadd70378ae6f4407e71d) ) // 8x8 tiles
ROM_REGION( 0x100000, "bgtile", 0 )
ROM_LOAD( "90068-5.bin", 0x000000, 0x100000, CRC(a1ab4f24) SHA1(b9f8104d53eda87ccd4000d049ee74ac9aa20b3e) ) // 16x16 tiles
ROM_REGION( 0x100000, "sprites", 0 )
ROM_LOAD16_WORD_SWAP( "90068-8.bin", 0x000000, 0x100000, CRC(9d3204b2) SHA1(b37a246ad37f9ce092b371f01122ddf2bc8b2db6) ) // Sprites
ROM_REGION( 0x080000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD( "90068-2.bin", 0x00000, 0x80000, CRC(3a583184) SHA1(9226f1ea7725e4b48bb055d1c17389cf960d75f8) ) // 0x20000 - 0x80000 banked
ROM_REGION( 0x080000, "oki2", 0 ) // OKIM6295 samples
ROM_LOAD( "90068-1.bin", 0x00000, 0x80000, CRC(e7af69d2) SHA1(da050880e186954bcf0e0adf00750dd5a371551b) ) // 0x20000 - 0x80000 banked
ROM_REGION( 0x0200, "proms", 0 )
ROM_LOAD( "9.bpr", 0x0000, 0x0100, CRC(98ed1c97) SHA1(f125ad05c3cbd1b1ab356161f9b1d814781d4c3b) ) // unknown
ROM_LOAD( "10.bpr", 0x0100, 0x0100, CRC(cfdbb86c) SHA1(588822f6308a860937349c9106c2b4b1a75823ec) ) // unknown
ROM_END
ROM_START( blkheartj )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "7.bin", 0x00000, 0x20000, CRC(e0a5c667) SHA1(3ef39b2dc1f7ffdddf586f0b3080ecd1f362ec37) )
ROM_LOAD16_BYTE( "6.bin", 0x00001, 0x20000, CRC(7cce45e8) SHA1(72491e30d1f9be2eede21fdde5a7484d4f65cfbf) )
ROM_REGION( 0x10000, "audiocpu", 0 ) // Code for (unknown?) CPU
ROM_LOAD( "4.bin", 0x00000, 0x10000, CRC(7cefa295) SHA1(408f46613b3620cee31dec43281688d231b47ddd) )
ROM_REGION( 0x020000, "fgtile", 0 )
ROM_LOAD( "3.bin", 0x000000, 0x020000, CRC(a1ab3a16) SHA1(3fb57c9d2ef94ee188cbadd70378ae6f4407e71d) ) // 8x8 tiles
ROM_REGION( 0x100000, "bgtile", 0 )
ROM_LOAD( "90068-5.bin", 0x000000, 0x100000, CRC(a1ab4f24) SHA1(b9f8104d53eda87ccd4000d049ee74ac9aa20b3e) ) // 16x16 tiles
ROM_REGION( 0x100000, "sprites", 0 )
ROM_LOAD16_WORD_SWAP( "90068-8.bin", 0x000000, 0x100000, CRC(9d3204b2) SHA1(b37a246ad37f9ce092b371f01122ddf2bc8b2db6) ) // Sprites
ROM_REGION( 0x080000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD( "90068-2.bin", 0x00000, 0x80000, CRC(3a583184) SHA1(9226f1ea7725e4b48bb055d1c17389cf960d75f8) ) // 0x20000 - 0x80000 banked
ROM_REGION( 0x080000, "oki2", 0 ) // OKIM6295 samples
ROM_LOAD( "90068-1.bin", 0x00000, 0x80000, CRC(e7af69d2) SHA1(da050880e186954bcf0e0adf00750dd5a371551b) ) // 0x20000 - 0x80000 banked
ROM_REGION( 0x0200, "proms", 0 )
ROM_LOAD( "9.bpr", 0x0000, 0x0100, CRC(98ed1c97) SHA1(f125ad05c3cbd1b1ab356161f9b1d814781d4c3b) ) // unknown
ROM_LOAD( "10.bpr", 0x0100, 0x0100, CRC(cfdbb86c) SHA1(588822f6308a860937349c9106c2b4b1a75823ec) ) // unknown
ROM_END
ROM_START( tdragon )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code -bitswapped-
ROM_LOAD16_BYTE( "91070_68k.8", 0x00000, 0x20000, CRC(121c3ae7) SHA1(b88446df3b177d40e0b59a481f8e4de212e3afbc) )
ROM_LOAD16_BYTE( "91070_68k.7", 0x00001, 0x20000, CRC(6e154d8e) SHA1(29baea24d670ab63149efe281de25cca15b7b863) )
ROM_REGION( 0x020000, "fgtile", 0 )
ROM_LOAD( "91070.6", 0x000000, 0x20000, CRC(fe365920) SHA1(7581931cb95cd5a8ed40e4f5385b533e3d19af22) ) // 8x8 tiles
ROM_REGION( 0x100000, "bgtile", 0 )
ROM_LOAD( "91070.5", 0x000000, 0x100000, CRC(d0bde826) SHA1(3b74d5fc88a4a9329e101ee72f393608d327d816) ) // 16x16 tiles
ROM_REGION( 0x100000, "sprites", 0 )
ROM_LOAD16_WORD_SWAP( "91070.4", 0x000000, 0x100000, CRC(3eedc2fe) SHA1(9f48986c231a8fbc07f2b39b2017d1e967b2ed3c) ) // Sprites
ROM_REGION( 0x010000, "audiocpu", 0 ) // Code for (unknown?) CPU
ROM_LOAD( "91070.1", 0x00000, 0x10000, CRC(bf493d74) SHA1(6f8f5eff4b71fb6cabda10075cfa88a3f607859e) )
ROM_REGION( 0x080000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD( "91070.3", 0x00000, 0x80000, CRC(ae6875a8) SHA1(bfdb350b3d3fce2bead1ac60875beafe427765ed) ) // 0x20000 - 0x80000 banked
ROM_REGION( 0x080000, "oki2", 0 ) // OKIM6295 samples
ROM_LOAD( "91070.2", 0x00000, 0x80000, CRC(ecfea43e) SHA1(d664dfa6698fec8e602523bdae16068f1ff6547b) ) // 0x20000 - 0x80000 banked
ROM_REGION( 0x0200, "proms", 0 )
ROM_LOAD( "91070.9", 0x0000, 0x0100, CRC(cfdbb86c) SHA1(588822f6308a860937349c9106c2b4b1a75823ec) ) // unknown
ROM_LOAD( "91070.10", 0x0100, 0x0100, CRC(e6ead349) SHA1(6d81b1c0233580aa48f9718bade42d640e5ef3dd) ) // unknown
ROM_END
ROM_START( tdragon1 )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code -bitswapped-
ROM_LOAD16_BYTE( "thund.8", 0x00000, 0x20000, CRC(edd02831) SHA1(d6bc8d2c37707768a8bf666090f33eea12dda336) )
ROM_LOAD16_BYTE( "thund.7", 0x00001, 0x20000, CRC(52192fe5) SHA1(9afef197410e7feb71dc48003e181fbbaf5c99b2) )
ROM_REGION( 0x020000, "fgtile", 0 )
ROM_LOAD( "91070.6", 0x000000, 0x20000, CRC(fe365920) SHA1(7581931cb95cd5a8ed40e4f5385b533e3d19af22) ) // 8x8 tiles
ROM_REGION( 0x100000, "bgtile", 0 )
ROM_LOAD( "91070.5", 0x000000, 0x100000, CRC(d0bde826) SHA1(3b74d5fc88a4a9329e101ee72f393608d327d816) ) // 16x16 tiles
ROM_REGION( 0x100000, "sprites", 0 )
ROM_LOAD16_WORD_SWAP( "91070.4", 0x000000, 0x100000, CRC(3eedc2fe) SHA1(9f48986c231a8fbc07f2b39b2017d1e967b2ed3c) ) // Sprites
ROM_REGION( 0x010000, "audiocpu", 0 ) // Code for (unknown?) CPU
ROM_LOAD( "91070.1", 0x00000, 0x10000, CRC(bf493d74) SHA1(6f8f5eff4b71fb6cabda10075cfa88a3f607859e) )
ROM_REGION( 0x080000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD( "91070.3", 0x00000, 0x80000, CRC(ae6875a8) SHA1(bfdb350b3d3fce2bead1ac60875beafe427765ed) ) // 0x20000 - 0x80000 banked
ROM_REGION( 0x080000, "oki2", 0 ) // OKIM6295 samples
ROM_LOAD( "91070.2", 0x00000, 0x80000, CRC(ecfea43e) SHA1(d664dfa6698fec8e602523bdae16068f1ff6547b) ) // 0x20000 - 0x80000 banked
ROM_REGION( 0x0200, "proms", 0 )
ROM_LOAD( "91070.9", 0x0000, 0x0100, CRC(cfdbb86c) SHA1(588822f6308a860937349c9106c2b4b1a75823ec) ) // unknown
ROM_LOAD( "91070.10", 0x0100, 0x0100, CRC(e6ead349) SHA1(6d81b1c0233580aa48f9718bade42d640e5ef3dd) ) // unknown
ROM_END
ROM_START( tdragonb )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code -bitswapped-
ROM_LOAD16_BYTE( "td_04.bin", 0x00000, 0x20000, CRC(e8a62d3e) SHA1(dd221bcd80149fffb1bdddfd3d394996bd2f8ec5) )
ROM_LOAD16_BYTE( "td_03.bin", 0x00001, 0x20000, CRC(2fa1aa04) SHA1(ddf2b2ff179c31a1677d15d0403b00d77f9f0a6c) )
ROM_REGION(0x20000, "audiocpu", 0 ) // 64k for sound CPU code
ROM_LOAD( "td_02.bin", 0x00000, 0x8000, CRC(99ee7505) SHA1(b97c8ee5e26e8554b5de506fba3b32cc2fde53c9) )
ROM_CONTINUE( 0x010000, 0x08000 )
ROM_COPY( "audiocpu", 0x000000, 0x018000, 0x08000 )
ROM_REGION( 0x020000, "fgtile", 0 )
ROM_LOAD( "td_08.bin", 0x000000, 0x20000, CRC(5144dc69) SHA1(e64d88dc0e7672f811868621f74ec209aeafbc6f) ) // 8x8 tiles
ROM_REGION( 0x100000, "bgtile", 0 )
ROM_LOAD( "td_06.bin", 0x000000, 0x80000, CRC(c1be8a4d) SHA1(6269fd7fccf1546a01bab755d8b6b7dcffc1166e) ) // 16x16 tiles
ROM_LOAD( "td_07.bin", 0x080000, 0x80000, CRC(2c3e371f) SHA1(77956425661f4f81c370fff63845d42057fcaec3) ) // 16x16 tiles
ROM_REGION( 0x100000, "sprites", 0 )
ROM_LOAD16_BYTE( "td_10.bin", 0x000000, 0x080000, CRC(bfd0ec5d) SHA1(7983661f74e8695f56e45c6e5c278d7d86431052) ) // Sprites
ROM_LOAD16_BYTE( "td_09.bin", 0x000001, 0x080000, CRC(b6e074eb) SHA1(bdde068f03415391b5edaa42f1389df0f7eef899) ) // Sprites
ROM_REGION( 0x040000, "oki", 0 ) // OKIM6295 samples
ROM_LOAD( "td_01.bin", 0x00000, 0x10000, CRC(f6f6c4bf) SHA1(ea4cf74d968e254ae47c16c2f4c2f4bc1a528808) )
ROM_END
ROM_START( tdragonb2 )
ROM_REGION( 0x40000, "maincpu", 0 )
ROM_LOAD16_BYTE( "a4", 0x00000, 0x20000, CRC(0cd0581b) SHA1(334f0f04623dbef6ab0d647b2da9c49c56e998a5) )
ROM_LOAD16_BYTE( "a3", 0x00001, 0x20000, CRC(f9088e22) SHA1(71c5bcec280e36a72ae3c85a854c24bba55f0863) )
ROM_REGION( 0x20000, "fgtile", 0 )
ROM_LOAD( "1", 0x00000, 0x20000, CRC(fe365920) SHA1(7581931cb95cd5a8ed40e4f5385b533e3d19af22) )
ROM_REGION( 0x100000, "bgtile", 0 )
ROM_LOAD( "a2a205", 0x000000, 0x100000, CRC(d0bde826) SHA1(3b74d5fc88a4a9329e101ee72f393608d327d816) )
ROM_REGION( 0x100000, "sprites", 0 )
ROM_LOAD16_WORD_SWAP( "shinea2a2-04", 0x000000, 0x100000, CRC(3eedc2fe) SHA1(9f48986c231a8fbc07f2b39b2017d1e967b2ed3c) )
ROM_REGION( 0x80000, "oki", 0 )
ROM_LOAD( "shinea2a2-01", 0x00000, 0x80000, CRC(4556e717) SHA1(efdec7c989436f97e8f18b157bfd5f9da55b29ba) )
ROM_END
ROM_START( ssmissin )
ROM_REGION( 0x40000, "maincpu", 0 )
ROM_LOAD16_BYTE( "ssm14.165", 0x00001, 0x20000, CRC(eda61b74) SHA1(6247682c27d2be7dff1fad407ccf86fe2a25f11c) )
ROM_LOAD16_BYTE( "ssm15.166", 0x00000, 0x20000, CRC(aff15927) SHA1(258c2722ac7ca50360bfefa7b4e621373975a835) )
ROM_REGION( 0x020000, "fgtile", 0 )
ROM_LOAD( "ssm16.172", 0x000000, 0x20000, CRC(5cf6eb1f) SHA1(d406b11cf06ae1afc57a50685689e358e5677a45) ) // 8x8 tiles
ROM_REGION( 0x100000, "bgtile", 0 )
ROM_LOAD( "ssm17.147", 0x000000, 0x080000, CRC(c9c28455) SHA1(6a3e754aff3f368bde0e8905c33074084ad6ac30) ) // 16x16 tiles
ROM_LOAD( "ssm18.148", 0x080000, 0x080000, CRC(ebfdaad6) SHA1(0814cdfe83f36a7dd7b5416f9d0478192733dac0) ) // 16x16 tiles
ROM_REGION( 0x100000, "sprites", 0 )
ROM_LOAD16_BYTE( "ssm20.34", 0x000001, 0x080000, CRC(a0c16c4d) SHA1(e198f69b4d8660e33851a2631b5411611b1b2ea6) ) // 16x16 tiles
ROM_LOAD16_BYTE( "ssm19.33", 0x000000, 0x080000, CRC(b1943657) SHA1(97c05483b634315af338434bd2f565cc151a7283) ) // 16x16 tiles
ROM_REGION( 0x010000, "audiocpu", 0 ) // Code for Sound CPU
ROM_LOAD( "ssm11.188", 0x00000, 0x08000, CRC(8be6dce3) SHA1(d9a235c36e0bc44025c291247d6b0b753e4bc0c8) )
ROM_REGION( 0x100000, "oki1", 0 ) // OKIM6295 samples?
ROM_LOAD( "ssm13.190", 0x00000, 0x20000, CRC(618f66f0) SHA1(97637a03d9fd82305e872e9bfa489862c974bb6c) )
ROM_LOAD( "ssm12.189", 0x80000, 0x80000, CRC(e8219c83) SHA1(68673d071a58ca2bfd2de344a830417d10bc5757) ) // banked
ROM_REGION( 0x0300, "proms", 0 )
ROM_LOAD( "ssm-pr2.113", 0x0000, 0x0100, CRC(cfdbb86c) SHA1(588822f6308a860937349c9106c2b4b1a75823ec) ) // unknown
ROM_LOAD( "ssm-pr1.114", 0x0100, 0x0200, CRC(ed0bd072) SHA1(66a6d435d8587c82ae96dd09c39ed5749fe00e24) ) // unknown
ROM_END
/*
Air Attack
Comad, 1996
68000 @ 8MHz
Z80A @ 2MHz [8/4]
M6295 @ 1MHz [8/8]. Pin 7 HIGH
VSync 50Hz
HSync 15.35kHz
XTALs 8MHz (for 68000/Z80/M6295), 12MHz (for FPGAs)
2x 62256 RAM (main program RAM)
4x 62256 RAM (graphics)
2x 6264 RAM (graphics)
1x 6116 RAM (sound program)
6x 6116 RAM (other/ shared RAM etc)
2x PROMs
1x Lattice pLSI1032 FPGA
1x Actel 1020B FPGA
*/
ROM_START( airattck )
ROM_REGION( 0x40000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "ue10.bin", 0x000000, 0x20000, CRC(71deb9d8) SHA1(21da5a68a13c9017d787e88f7b293f263fbc6b20) )
ROM_LOAD16_BYTE( "uc10.bin", 0x000001, 0x20000, CRC(1837d4ba) SHA1(8dd5636a3a75c5d25d8850381e566a150ddc8ef1) )
ROM_REGION( 0x020000, "fgtile", 0 )
ROM_LOAD( "4.ul10", 0x000000, 0x20000, CRC(e9362ab4) SHA1(d3e7d90e459bd4a80a189cc77821a6668103a640) ) // 8x8 tiles
ROM_REGION( 0x100000, "bgtile", 0 )
ROM_LOAD( "9.uw9", 0x000000, 0x80000, CRC(86e59966) SHA1(50944dddb4c9f28e6f9b7c610a205310f4d7a076) )
ROM_LOAD( "10.ux9", 0x080000, 0x80000, CRC(122c8d04) SHA1(70a348b1a94f1bc69532ba92dafc91a2c0e41d58) )
ROM_REGION( 0x100000, "sprites", 0 )
ROM_LOAD16_BYTE( "7.uo81", 0x000000, 0x80000, CRC(3c38d671) SHA1(f9c9aaa1622ee0c20f569f6048e2b78bd507a1e5) ) // 16x16 tiles
ROM_LOAD16_BYTE( "8.uo82", 0x000001, 0x80000, CRC(9a83e3d8) SHA1(c765c4d278cc7f54ccdf6f00f8c6902a56abc2b8) ) // 16x16 tiles
ROM_REGION( 0x010000, "audiocpu", 0 ) // Code for Sound CPU
ROM_LOAD( "3.su6", 0x000000, 0x08000, CRC(3e352370) SHA1(6e84881dc0b09a23f8b589431005459adc334c34) )
ROM_REGION( 0x100000, "oki1", 0 ) // Samples
ROM_LOAD( "2.su12", 0x000000, 0x20000, CRC(93ab615b) SHA1(f670ac60f5f88148e55200e5e3591aa18b81c325) )
ROM_LOAD( "1.su13", 0x080000, 0x80000, CRC(09a836bb) SHA1(43fbd35c2ef3d201a4c82b0d3b7d7b971b385a14) )
ROM_REGION( 0x0300, "proms", 0 )
ROM_LOAD( "82s129.ug6", 0x0000, 0x0100, CRC(cfdbb86c) SHA1(588822f6308a860937349c9106c2b4b1a75823ec) ) // unknown
ROM_LOAD( "82s147.uh6", 0x0100, 0x0200, CRC(ed0bd072) SHA1(66a6d435d8587c82ae96dd09c39ed5749fe00e24) ) // unknown
ROM_END
ROM_START( airattcka )
ROM_REGION( 0x40000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "6.uc10", 0x000000, 0x20000, CRC(3572baf0) SHA1(0a2fe3be16d95896dc757ef231b3708093fc7ffa) )
ROM_LOAD16_BYTE( "5.ue10", 0x000001, 0x20000, CRC(6589c005) SHA1(350a7b8685cacde6b72c10458c33962c5a45a255) )
ROM_REGION( 0x020000, "fgtile", 0 )
ROM_LOAD( "4.ul10", 0x000000, 0x20000, CRC(e9362ab4) SHA1(d3e7d90e459bd4a80a189cc77821a6668103a640) ) // 8x8 tiles
ROM_REGION( 0x100000, "bgtile", 0 )
ROM_LOAD( "9.uw9", 0x000000, 0x80000, CRC(86e59966) SHA1(50944dddb4c9f28e6f9b7c610a205310f4d7a076) )
ROM_LOAD( "10.ux9", 0x080000, 0x80000, CRC(122c8d04) SHA1(70a348b1a94f1bc69532ba92dafc91a2c0e41d58) )
ROM_REGION( 0x100000, "sprites", 0 )
ROM_LOAD16_BYTE( "7.uo81", 0x000000, 0x80000, CRC(3c38d671) SHA1(f9c9aaa1622ee0c20f569f6048e2b78bd507a1e5) ) // 16x16 tiles
ROM_LOAD16_BYTE( "8.uo82", 0x000001, 0x80000, CRC(9a83e3d8) SHA1(c765c4d278cc7f54ccdf6f00f8c6902a56abc2b8) ) // 16x16 tiles
ROM_REGION( 0x010000, "audiocpu", 0 ) // Code for Sound CPU
ROM_LOAD( "3.su6", 0x000000, 0x08000, CRC(3e352370) SHA1(6e84881dc0b09a23f8b589431005459adc334c34) )
ROM_REGION( 0x100000, "oki1", 0 ) // Samples
ROM_LOAD( "2.su12", 0x000000, 0x20000, CRC(93ab615b) SHA1(f670ac60f5f88148e55200e5e3591aa18b81c325) )
ROM_LOAD( "1.su13", 0x080000, 0x80000, CRC(09a836bb) SHA1(43fbd35c2ef3d201a4c82b0d3b7d7b971b385a14) )
ROM_REGION( 0x0300, "proms", 0 )
ROM_LOAD( "82s129.ug6", 0x0000, 0x0100, CRC(cfdbb86c) SHA1(588822f6308a860937349c9106c2b4b1a75823ec) ) // unknown
ROM_LOAD( "82s147.uh6", 0x0100, 0x0200, CRC(ed0bd072) SHA1(66a6d435d8587c82ae96dd09c39ed5749fe00e24) ) // unknown
ROM_END
ROM_START( strahl )
ROM_REGION( 0x40000, "maincpu", 0 )
ROM_LOAD16_BYTE( "strahl-02.ic82", 0x00000, 0x20000, CRC(e6709a0d) SHA1(ec5741f6a708ac2a6831fb65198d81dc7e6c5aea) )
ROM_LOAD16_BYTE( "strahl-01.ic83", 0x00001, 0x20000, CRC(bfd021cf) SHA1(fcf252c42a58e2f7e9982869931447ee8aa5baaa) )
ROM_REGION( 0x20000, "fgtile", 0 )
ROM_LOAD( "strahl-3.73", 0x000000, 0x10000, CRC(2273b33e) SHA1(fa53e91b80dfea3f8b2c1f0ce66e5c6920c4960f) ) // Characters
ROM_REGION( 0x40000, "bgtile", 0 )
ROM_LOAD( "str7b2r0.275", 0x000000, 0x40000, CRC(5769e3e1) SHA1(7d7a16b11027d0a7618df1ec1e3484224b772e90) ) // Tiles
ROM_REGION( 0x180000, "sprites", 0 )
ROM_LOAD( "strl3-01.32", 0x000000, 0x80000, CRC(d8337f15) SHA1(4df23fff2506b66a94dae4e0cf7d25499936b942) ) // Sprites
ROM_LOAD( "strl4-02.57", 0x080000, 0x80000, CRC(2a38552b) SHA1(82335fc6aa3de9145dd84952e5ed423493bf7141) )
ROM_LOAD( "strl5-03.58", 0x100000, 0x80000, CRC(a0e7d210) SHA1(96a762a3a1cdeaa91bde50429e0ac665fb81190b) )
ROM_REGION( 0x80000, "gfx4", 0 )
ROM_LOAD( "str6b1w1.776", 0x000000, 0x80000, CRC(bb1bb155) SHA1(83a02e89180e15f0e7817e0e92b4bf4e209bb69a) ) // Tiles
ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "strahl-4.66", 0x00000, 0x10000, CRC(60a799c4) SHA1(8ade3cf827a389f7cb4080957dc4d67077ea4166) )
ROM_REGION( 0xa0000, "oki1", 0 ) // Oki sample data
ROM_LOAD( "str8pmw1.540", 0x00000, 0x20000, CRC(01d6bb6a) SHA1(b157f6f921483ed8067a7e13e370f73fdb60d136) )
// this is a mess
ROM_CONTINUE( 0x60000, 0x20000 ) // banked
ROM_CONTINUE( 0x40000, 0x20000 ) // banked
ROM_CONTINUE( 0x20000, 0x20000 ) // banked
ROM_REGION( 0xa0000, "oki2", 0 ) // Oki sample data
ROM_LOAD( "str9pew1.639", 0x00000, 0x20000, CRC(6bb3eb9f) SHA1(9c1394df4f8a08f9098c85eb3d38fb862d6eabbb) )
// this is a mess
ROM_CONTINUE( 0x60000, 0x20000 ) // banked
ROM_CONTINUE( 0x40000, 0x20000 ) // banked
ROM_CONTINUE( 0x20000, 0x20000 ) // banked
ROM_END
ROM_START( strahlj )
ROM_REGION( 0x40000, "maincpu", 0 )
ROM_LOAD16_BYTE( "strahl-2.82", 0x00000, 0x20000, CRC(c9d008ae) SHA1(e9218a3143d5887e702df051354a9083a806c69c) )
ROM_LOAD16_BYTE( "strahl-1.83", 0x00001, 0x20000, CRC(afc3c4d6) SHA1(ab3dd7db692eb01e3a87f4216d322a702f3beaad) )
ROM_REGION( 0x20000, "fgtile", 0 )
ROM_LOAD( "strahl-3.73", 0x000000, 0x10000, CRC(2273b33e) SHA1(fa53e91b80dfea3f8b2c1f0ce66e5c6920c4960f) ) // Characters
ROM_REGION( 0x40000, "bgtile", 0 )
ROM_LOAD( "str7b2r0.275", 0x000000, 0x40000, CRC(5769e3e1) SHA1(7d7a16b11027d0a7618df1ec1e3484224b772e90) ) // Tiles
ROM_REGION( 0x180000, "sprites", 0 )
ROM_LOAD( "strl3-01.32", 0x000000, 0x80000, CRC(d8337f15) SHA1(4df23fff2506b66a94dae4e0cf7d25499936b942) ) // Sprites
ROM_LOAD( "strl4-02.57", 0x080000, 0x80000, CRC(2a38552b) SHA1(82335fc6aa3de9145dd84952e5ed423493bf7141) )
ROM_LOAD( "strl5-03.58", 0x100000, 0x80000, CRC(a0e7d210) SHA1(96a762a3a1cdeaa91bde50429e0ac665fb81190b) )
ROM_REGION( 0x80000, "gfx4", 0 )
ROM_LOAD( "str6b1w1.776", 0x000000, 0x80000, CRC(bb1bb155) SHA1(83a02e89180e15f0e7817e0e92b4bf4e209bb69a) ) // Tiles
ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "strahl-4.66", 0x00000, 0x10000, CRC(60a799c4) SHA1(8ade3cf827a389f7cb4080957dc4d67077ea4166) )
ROM_REGION( 0xa0000, "oki1", 0 ) // Oki sample data
ROM_LOAD( "str8pmw1.540", 0x00000, 0x20000, CRC(01d6bb6a) SHA1(b157f6f921483ed8067a7e13e370f73fdb60d136) )
// this is a mess
ROM_CONTINUE( 0x60000, 0x20000 ) // banked
ROM_CONTINUE( 0x40000, 0x20000 ) // banked
ROM_CONTINUE( 0x20000, 0x20000 ) // banked
ROM_REGION( 0xa0000, "oki2", 0 ) // Oki sample data
ROM_LOAD( "str9pew1.639", 0x00000, 0x20000, CRC(6bb3eb9f) SHA1(9c1394df4f8a08f9098c85eb3d38fb862d6eabbb) )
// this is a mess
ROM_CONTINUE( 0x60000, 0x20000 ) // banked
ROM_CONTINUE( 0x40000, 0x20000 ) // banked
ROM_CONTINUE( 0x20000, 0x20000 ) // banked
ROM_END
ROM_START( strahlja )
ROM_REGION( 0x40000, "maincpu", 0 )
ROM_LOAD16_BYTE( "rom2", 0x00000, 0x20000, CRC(f80a22ef) SHA1(22099eb0bbb445702e0276713c3e48d60de60c30) )
ROM_LOAD16_BYTE( "rom1", 0x00001, 0x20000, CRC(802ecbfc) SHA1(cc776023c7bd6b6d6af9659a0c822a2887e50199) )
ROM_REGION( 0x20000, "fgtile", 0 )
ROM_LOAD( "strahl-3.73", 0x000000, 0x10000, CRC(2273b33e) SHA1(fa53e91b80dfea3f8b2c1f0ce66e5c6920c4960f) ) // Characters
ROM_REGION( 0x40000, "bgtile", 0 )
ROM_LOAD( "str7b2r0.275", 0x000000, 0x40000, CRC(5769e3e1) SHA1(7d7a16b11027d0a7618df1ec1e3484224b772e90) ) // Tiles
ROM_REGION( 0x180000, "sprites", 0 )
ROM_LOAD( "strl3-01.32", 0x000000, 0x80000, CRC(d8337f15) SHA1(4df23fff2506b66a94dae4e0cf7d25499936b942) ) // Sprites
ROM_LOAD( "strl4-02.57", 0x080000, 0x80000, CRC(2a38552b) SHA1(82335fc6aa3de9145dd84952e5ed423493bf7141) )
ROM_LOAD( "strl5-03.58", 0x100000, 0x80000, CRC(a0e7d210) SHA1(96a762a3a1cdeaa91bde50429e0ac665fb81190b) )
ROM_REGION( 0x80000, "gfx4", 0 )
ROM_LOAD( "str6b1w1.776", 0x000000, 0x80000, CRC(bb1bb155) SHA1(83a02e89180e15f0e7817e0e92b4bf4e209bb69a) ) // Tiles
ROM_REGION( 0x10000, "audiocpu", 0 )
ROM_LOAD( "strahl-4.66", 0x00000, 0x10000, CRC(60a799c4) SHA1(8ade3cf827a389f7cb4080957dc4d67077ea4166) )
ROM_REGION( 0xa0000, "oki1", 0 ) // Oki sample data
ROM_LOAD( "str8pmw1.540", 0x00000, 0x20000, CRC(01d6bb6a) SHA1(b157f6f921483ed8067a7e13e370f73fdb60d136) )
// this is a mess
ROM_CONTINUE( 0x60000, 0x20000 ) // banked
ROM_CONTINUE( 0x40000, 0x20000 ) // banked
ROM_CONTINUE( 0x20000, 0x20000 ) // banked
ROM_REGION( 0xa0000, "oki2", 0 ) // Oki sample data
ROM_LOAD( "str9pew1.639", 0x00000, 0x20000, CRC(6bb3eb9f) SHA1(9c1394df4f8a08f9098c85eb3d38fb862d6eabbb) )
// this is a mess
ROM_CONTINUE( 0x60000, 0x20000 ) // banked
ROM_CONTINUE( 0x40000, 0x20000 ) // banked
ROM_CONTINUE( 0x20000, 0x20000 ) // banked
ROM_END
ROM_START( strahljbl ) // N0 892 PCB, this bootleg uses SEIBU sound system
ROM_REGION( 0x40000, "maincpu", 0 )
ROM_LOAD16_BYTE( "a7.u3", 0x00000, 0x20000, CRC(3ddca4f7) SHA1(83ab6278fced912759c20eba6254bc544dc1ffdf) )
ROM_LOAD16_BYTE( "a8.u2", 0x00001, 0x20000, CRC(890f74d0) SHA1(50c4781642cb95c82d1a4d2e8e8d0be2baea29a7) )
ROM_REGION( 0x20000, "fgtile", 0 ) // same as original
ROM_LOAD( "cha.38", 0x000000, 0x10000, CRC(2273b33e) SHA1(fa53e91b80dfea3f8b2c1f0ce66e5c6920c4960f) ) // Characters
ROM_REGION( 0x40000, "bgtile", 0 ) // same as original
ROM_LOAD( "6.2m", 0x000000, 0x40000, CRC(5769e3e1) SHA1(7d7a16b11027d0a7618df1ec1e3484224b772e90) ) // Tiles
ROM_REGION( 0x180000, "sprites", 0 ) // same as original, just a bigger ROM
ROM_LOAD( "d.8m", 0x000000, 0x100000, CRC(09ede4d4) SHA1(5c5dcc57f78145b9c6e711a32afc0aab7a5a0450) )
ROM_LOAD( "5.4m", 0x100000, 0x080000, CRC(a0e7d210) SHA1(96a762a3a1cdeaa91bde50429e0ac665fb81190b) )
ROM_REGION( 0x80000, "gfx4", 0 ) // same as original
ROM_LOAD( "4.4m", 0x000000, 0x80000, CRC(bb1bb155) SHA1(83a02e89180e15f0e7817e0e92b4bf4e209bb69a) ) // Tiles
ROM_REGION(0x20000, "audiocpu", 0 )
ROM_LOAD( "a6.u417", 0x000000, 0x08000, CRC(99ee7505) SHA1(b97c8ee5e26e8554b5de506fba3b32cc2fde53c9) )
ROM_CONTINUE( 0x010000, 0x08000 )
ROM_COPY( "audiocpu", 0x000000, 0x018000, 0x08000 )
ROM_REGION( 0x40000, "oki", 0 )
ROM_LOAD( "a5.u304", 0x00000, 0x10000, CRC(f6f6c4bf) SHA1(ea4cf74d968e254ae47c16c2f4c2f4bc1a528808) )
ROM_REGION( 0x800, "p_rom", 0 ) // not used by the emulation
ROM_LOAD( "129.u28", 0x0000, 0x800, CRC(034f68ca) SHA1(377d0951f96d81d389aa96e2f7912a89a136d357) )
ROM_END
ROM_START( hachamf )
ROM_REGION( 0x40000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "7.93", 0x00000, 0x20000, CRC(9d847c31) SHA1(1d370d8db9cadadb9c2cb213e32f681947d81b7f) ) // internally reports as 19th Sep. 1991
ROM_LOAD16_BYTE( "6.94", 0x00001, 0x20000, CRC(de6408a0) SHA1(2df77fecd44d2d8b0444abd4545923213ed76b2d) )
ROM_REGION( 0x10000, "audiocpu", 0 ) // unknown - sound CPU ??????
ROM_LOAD( "1.70", 0x00000, 0x10000, CRC(9e6f48fc) SHA1(aeb5bfecc025b5478f6de874792fc0f7f54932be) )
ROM_REGION( 0x020000, "fgtile", 0 )
ROM_LOAD( "5.95", 0x000000, 0x020000, CRC(29fb04a2) SHA1(9654b90a66d0e2a0f9cd369cab29cdd0c6f77869) ) // 8x8 tiles
ROM_REGION( 0x100000, "bgtile", 0 ) // 16x16 tiles
ROM_LOAD( "91076-4.101", 0x000000, 0x100000, CRC(df9653a4) SHA1(4a3204a98d7738c7895169fcece922fdf355f4fa) )
ROM_REGION( 0x100000, "sprites", 0 )
ROM_LOAD16_WORD_SWAP( "91076-8.57", 0x000000, 0x100000, CRC(7fd0f556) SHA1(d1b4bec0946869d3d7bcb870d9ae3bd17395a231) ) // Sprites
ROM_REGION( 0x080000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD( "91076-2.46", 0x00000, 0x80000, CRC(3f1e67f2) SHA1(413e78587d8a043a0eb94447313ba1b3c5b35be5) ) // 1st & 2nd half identical, needs verifying
// 0x20000 - 0x80000 banked
ROM_REGION( 0x080000, "oki2", 0 ) // OKIM6295 samples
ROM_LOAD( "91076-3.45", 0x00000, 0x80000, CRC(b25ed93b) SHA1(d7bc686bbccf982f40420a11158aa8e5dd4207c5) ) // 1st & 2nd half identical, needs verifying
// 0x20000 - 0x80000 banked
ROM_END
ROM_START( hachamfa) // reportedly a Korean PCB / version
ROM_REGION( 0x40000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "7.ic93", 0x00000, 0x20000, CRC(f437e52b) SHA1(061a75a7a9734034d1c499fc0bc2d8a61bb26da4) ) // internally reports as 19th Sep. 1991
ROM_LOAD16_BYTE( "6.ic94", 0x00001, 0x20000, CRC(60d340d0) SHA1(3c6f862901b403d6ddf58823af7d6e3f67573788) )
ROM_REGION( 0x10000, "audiocpu", 0 ) // unknown - sound CPU ??????
ROM_LOAD( "1.70", 0x00000, 0x10000, CRC(9e6f48fc) SHA1(aeb5bfecc025b5478f6de874792fc0f7f54932be) )
ROM_REGION( 0x020000, "fgtile", 0 ) // Smaller NMK logo plus alternate Distributed by UPL Company Limited starting at tile 0xF80
ROM_LOAD( "5.ic95", 0x000000, 0x020000, CRC(a2c1e25d) SHA1(cf09cbfd9afc7e3907fef6b26fb269b743f2e036) ) // 8x8 tiles
ROM_REGION( 0x100000, "bgtile", 0 ) // 16x16 tiles
ROM_LOAD( "91076-4.101", 0x000000, 0x100000, CRC(df9653a4) SHA1(4a3204a98d7738c7895169fcece922fdf355f4fa) )
ROM_REGION( 0x100000, "sprites", 0 )
ROM_LOAD16_WORD_SWAP( "91076-8.57", 0x000000, 0x100000, CRC(7fd0f556) SHA1(d1b4bec0946869d3d7bcb870d9ae3bd17395a231) ) // Sprites
ROM_REGION( 0x080000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD( "91076-2.46", 0x00000, 0x80000, CRC(3f1e67f2) SHA1(413e78587d8a043a0eb94447313ba1b3c5b35be5) ) // 1st & 2nd half identical, needs verifying
// 0x20000 - 0x80000 banked
ROM_REGION( 0x080000, "oki2", 0 ) // OKIM6295 samples
ROM_LOAD( "91076-3.45", 0x00000, 0x80000, CRC(b25ed93b) SHA1(d7bc686bbccf982f40420a11158aa8e5dd4207c5) ) // 1st & 2nd half identical, needs verifying
// 0x20000 - 0x80000 banked
ROM_END
ROM_START( hachamfb ) // Thunder Dragon conversion - unprotected prototype or bootleg?
ROM_REGION( 0x40000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "8.bin", 0x00000, 0x20000, CRC(14845b65) SHA1(5cafd07a8a6f5ccbb36de7a90571f8b33ecf273e) ) // internally reports as 19th Sep. 1991
ROM_LOAD16_BYTE( "7.bin", 0x00001, 0x20000, CRC(069ca579) SHA1(0db4c3c41e17fca613d11de89b388a4af206ec6b) )
ROM_REGION( 0x10000, "audiocpu", 0 ) // unknown - sound CPU ??????
ROM_LOAD( "1.70", 0x00000, 0x10000, CRC(9e6f48fc) SHA1(aeb5bfecc025b5478f6de874792fc0f7f54932be) )
ROM_REGION( 0x020000, "fgtile", 0 )
ROM_LOAD( "5.95", 0x000000, 0x020000, CRC(29fb04a2) SHA1(9654b90a66d0e2a0f9cd369cab29cdd0c6f77869) ) // 8x8 tiles
ROM_REGION( 0x100000, "bgtile", 0 ) // 16x16 tiles
ROM_LOAD( "91076-4.101", 0x000000, 0x100000, CRC(df9653a4) SHA1(4a3204a98d7738c7895169fcece922fdf355f4fa) )
ROM_REGION( 0x100000, "sprites", 0 )
ROM_LOAD16_WORD_SWAP( "91076-8.57", 0x000000, 0x100000, CRC(7fd0f556) SHA1(d1b4bec0946869d3d7bcb870d9ae3bd17395a231) ) // Sprites
ROM_REGION( 0x080000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD( "91076-2.46", 0x00000, 0x80000, CRC(3f1e67f2) SHA1(413e78587d8a043a0eb94447313ba1b3c5b35be5) ) // 1st & 2nd half identical, needs verifying
// 0x20000 - 0x80000 banked
ROM_REGION( 0x080000, "oki2", 0 ) // OKIM6295 samples
ROM_LOAD( "91076-3.45", 0x00000, 0x80000, CRC(b25ed93b) SHA1(d7bc686bbccf982f40420a11158aa8e5dd4207c5) ) // 1st & 2nd half identical, needs verifying
// 0x20000 - 0x80000 banked
ROM_END
ROM_START( hachamfp ) // Protoype Location Test Release; Hand-written labels with various dates. 68K program ROM has 19th Sep. 1991 string.
ROM_REGION( 0x40000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "kf-68-pe-b.ic7", 0x00000, 0x20000, CRC(b98a525e) SHA1(161c3b3360068e606e4d4104cc172b9736a52eeb) ) // Label says "KF 9/25 II 68 PE B"
ROM_LOAD16_BYTE( "kf-68-po-b.ic6", 0x00001, 0x20000, CRC(b62ad179) SHA1(60a66fb9eb3fc792d172e1f4507a806ac2ad4217) ) // Label says "KF 9/25 II 68 PO B"
ROM_REGION( 0x10000, "audiocpu", 0 ) // External NMK004 data
ROM_LOAD( "kf-snd.ic4", 0x00000, 0x10000, CRC(f7cace47) SHA1(599f6406f5bea69d77f39847d5d5fa361cdb7d00) ) // Label says "KF 9/20 SND"
ROM_REGION( 0x020000, "fgtile", 0 )
ROM_LOAD( "kf-vram.ic3", 0x000000, 0x020000, CRC(a2c1e25d) SHA1(cf09cbfd9afc7e3907fef6b26fb269b743f2e036) ) // Label says "KF 9/24 VRAM"
ROM_REGION( 0x100000, "bgtile", 0 ) // 16x16 tiles
ROM_LOAD( "kf-scl0.ic5", 0x000000, 0x080000, CRC(8604adff) SHA1(a50536990477ee0100b996449330542661e2ea35) ) // Label says "KF 9/9 SCL 0"
ROM_LOAD( "kf-scl1.ic12", 0x080000, 0x080000, CRC(05a624e3) SHA1(e1b686b36c0adedfddf70eeb6411671bbcd897d8) ) // Label says "KF 9/19 SCL 1"
ROM_REGION( 0x100000, "sprites", 0 ) // Sprites
ROM_LOAD16_BYTE( "kf-obj0.ic8", 0x000000, 0x080000, CRC(a471bbd8) SHA1(f8b8b9fee8eb3470b5a1d78327a71e113dc3f1d2) ) // ROM had no label attached
ROM_LOAD16_BYTE( "kf-obj1.ic11", 0x000001, 0x080000, CRC(81594aad) SHA1(87b6ff1817841fe492a0a743386dfef7b32b86ff) ) // ROM had no label attached
ROM_REGION( 0x080000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD( "kf-a0.ic2", 0x00000, 0x80000, CRC(e068d2cf) SHA1(4db81dee6291b3cfa1d8c7edf0c06d54ee072e3d) ) // Label says "KF 9/13 A0"
ROM_REGION( 0x080000, "oki2", 0 ) // OKIM6295 samples
ROM_LOAD( "kf-a1.ic1", 0x00000, 0x80000, CRC(d945aabb) SHA1(3c73bc47b79a8498f68a4b25d9c0f3d21eb0a432) ) // Label says "KF ??? A1"; corner is ripped off containing date
ROM_REGION( 0x0200, "proms", 0 )
ROM_LOAD( "82s135.ic50", 0x0000, 0x0100, CRC(633ab1c9) SHA1(acd99fcca41eaab7948ca84988352f1d7d519c61) ) // On main board near NMK 902
ROM_LOAD( "82s129.ic51", 0x0100, 0x0100, CRC(cfdbb86c) SHA1(588822f6308a860937349c9106c2b4b1a75823ec) ) // On main board near NMK 902
ROM_END
ROM_START( macross )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_WORD_SWAP( "921a03", 0x00000, 0x80000, CRC(33318d55) SHA1(c99f85e09bd334dc8ce138b08cbed2331b0d67dd) )
ROM_REGION( 0x10000, "audiocpu", 0 ) // sound program (unknown CPU)
ROM_LOAD( "921a02", 0x00000, 0x10000, CRC(77c082c7) SHA1(be07aa14d0116f830f98e11a19f1debb48a5230e) )
ROM_REGION( 0x020000, "fgtile", 0 )
ROM_LOAD( "921a01", 0x000000, 0x020000, CRC(bbd8242d) SHA1(7cf4897be1278e1190f499f00bc78384817a5160) ) // 8x8 tiles
ROM_REGION( 0x200000, "bgtile", 0 )
ROM_LOAD( "921a04", 0x000000, 0x200000, CRC(4002e4bb) SHA1(281433d798ac85c84d4f1f3751a3032e8a3b5cd4) ) // 16x16 tiles
ROM_REGION( 0x200000, "sprites", 0 )
ROM_LOAD16_WORD_SWAP( "921a07", 0x000000, 0x200000, CRC(7d2bf112) SHA1(1997c99c2d3998096842abd1cee89e0e6ab43a47) ) // Sprites
ROM_REGION( 0x80000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD( "921a05", 0x00000, 0x80000, CRC(d5a1eddd) SHA1(42b5b255f02b9c6d856b1578af9a5dfc51ea6ebb) ) // 0x20000 - 0x80000 banked
ROM_REGION( 0x80000, "oki2", 0 ) // OKIM6295 samples
ROM_LOAD( "921a06", 0x00000, 0x80000, CRC(89461d0f) SHA1(b7d27d0ee0b7ab44c20ab710b567f64fc3afb90c) ) // 0x20000 - 0x80000 banked
ROM_REGION( 0x0220, "proms", 0 )
ROM_LOAD( "921a08", 0x0000, 0x0100, CRC(cfdbb86c) SHA1(588822f6308a860937349c9106c2b4b1a75823ec) ) // unknown
ROM_LOAD( "921a09", 0x0100, 0x0100, CRC(633ab1c9) SHA1(acd99fcca41eaab7948ca84988352f1d7d519c61) ) // unknown
ROM_LOAD( "921a10", 0x0200, 0x0020, CRC(8371e42d) SHA1(6cfd70dfa00e85ec1df8832d41df331cc3e3733a) ) // unknown
ROM_END
/*
Gun Nail
NMK/Tecmo, 1993
PCB Layout
----------
AK92077
|-------------------------------------------------------------|
| LA4460 VOL YM2203 6116 92077-2.U101 62256 62256 |
|-| 16MHz |------| 62256 62256 |
| 4558 6295 92077-6.U57 |NMK004| 62256 62256 |
|-| 12MHz | | 62256 62256 |
| YM3014 6295 92077-5.U56 |------| |
| |------| DIP2 |------| |------| |
|J |NMK005| |NMK009| |NMK009| |
|A | | DIP1 | | | | |
|M |------| 92077-10.U96 |------| |------| |
|M 6116 |
|A |------| 6116 6116 |------| |----------| |
| |NMK111| 6116 |NMK008| | NMK214 | |
| |------| | | |----------| |
|-| 92077-8.U35 |------|92077-9.U72|------| |
| |NMK902| |----------| |
|-| 6116 |------| | NMK215 | 92077-7.U134 |
| 6116 |------| |----------| |
| |------| 92077-1.U21 |NMK903| 92077-3O.U133|
| |NMK111| |----------| |------| 62256 92077-3E.U131|
| |------| | NMK214 | |------| 62256 |
| |----------| |NMK903| |----------------| |
| |------| |------| 6116 | | |
| |NMK111| 92077-4.U19 |------| | 68000 | |
| |------| |NMK901| 6116 | | |
| 6264 |------| |----------------| |
| 6264 10MHz |
|-------------------------------------------------------------|
Notes:
68000 - Motorola MC68000P12 CPU running at 10MHz (DIP64)
6116 - 2Kb x8 SRAM (x9, DIP24)
6264 - 8Kb x8 SRAM (x2, DIP28)
62256 - 32Kb x8 SRAM (x10, DIP28)
YM2203- Yamaha YM2203 running at 1.5MHz [12/8] (DIP40)
YM3014- Yamaha YM3014 (DIP8)
6295 - OKI M6295 running at 4MHz, pin 7 low [16/4] (x2, QFP44)
4558 - BA4558 Op Amp (DIP8)
LA4460- Power Amplifier
DIP1/2- 8 position DIP Switches
VOL - Volume Potentiometer
OSC - 12MHz, 16MHz, 10MHz
HSync - 15.367kHz
VSync - 56.205Hz
NMK CUSTOM IC'S
- NMK004 marked "NMK004 0840-1324". Actually a TLCS90-based Toshiba TMP90C840AF
Microcontroller with 256 bytes RAM & 8Kb ROM, running at 8.000MHz [16/2] (QFP64)
- NMK005 (x1, Square QFP64)
- NMK008 (x1, Square QFP84)
- NMK009 (x2, Square QFP100)
- NMK111 (x3, QFP64)
- NMK901 (x1, QFP80)
- NMK903 (x2, QFP44)
- NMK214 (x2, SDIP64)
- NMK215 (x1, SDIP64)
*/
ROM_START( gunnail )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "3e.u131", 0x00000, 0x40000, CRC(61d985b2) SHA1(96daca603f18accb47f98a3e584b2c84fc5a2ca4) )
ROM_LOAD16_BYTE( "3o.u133", 0x00001, 0x40000, CRC(f114e89c) SHA1(a12f5278167f446bb5277e87289c41b5aa365c86) )
ROM_REGION( 0x10000, "audiocpu", 0 ) // Code for NMK004 CPU
ROM_LOAD( "92077_2.u101", 0x00000, 0x10000, CRC(cd4e55f8) SHA1(92182767ca0ec37ec4949bd1a88c2efdcdcb60ed) )
ROM_REGION( 0x020000, "fgtile", 0 )
ROM_LOAD( "1.u21", 0x000000, 0x020000, CRC(3d00a9f4) SHA1(91a82e3e74c8774d7f8b2adceb228b97010facfd) ) // 8x8 tiles
ROM_REGION( 0x100000, "bgtile", 0 )
ROM_LOAD( "92077-4.u19", 0x000000, 0x100000, CRC(a9ea2804) SHA1(14dbdb3c7986db5e44dc7c5be6fcf39f3d1e50b0) ) // 16x16 tiles
ROM_REGION( 0x200000, "sprites", 0 )
ROM_LOAD16_WORD_SWAP( "92077-7.u134", 0x000000, 0x200000, CRC(d49169b3) SHA1(565ff7725dd6ace79b55706114132d8d867e81a9) ) // Sprites
ROM_REGION( 0x080000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD( "92077-5.u56", 0x00000, 0x80000, CRC(feb83c73) SHA1(b44e9d20b4af02e218c4bc875d66a7d6b8551cae) ) // 0x20000 - 0x80000 banked
ROM_REGION( 0x080000, "oki2", 0 ) // OKIM6295 samples
ROM_LOAD( "92077-6.u57", 0x00000, 0x80000, CRC(6d133f0d) SHA1(8a5e6e27a297196f20e4de0d060f1188115809bb) ) // 0x20000 - 0x80000 banked
ROM_REGION( 0x0220, "proms", 0 )
ROM_LOAD( "8_82s129.u35", 0x0000, 0x0100, CRC(4299776e) SHA1(683d14d2ace14965f0fcfe0f0540c1b77d2cece5) ) // unknown
ROM_LOAD( "9_82s135.u72", 0x0100, 0x0100, CRC(633ab1c9) SHA1(acd99fcca41eaab7948ca84988352f1d7d519c61) ) // unknown
ROM_LOAD( "10_82s123.u96", 0x0200, 0x0020, CRC(c60103c8) SHA1(dfb05b704bb5e1f75f5aaa4fa36e8ddcc905f8b6) ) // unknown
ROM_END
ROM_START( gunnailp )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_WORD_SWAP( "3.u132", 0x00000, 0x80000, CRC(93570f03) SHA1(54fb203b5bfceb0ac86627bff3e67863f460fe73) )
ROM_REGION( 0x10000, "audiocpu", 0 ) // Code for NMK004 CPU
ROM_LOAD( "92077_2.u101", 0x00000, 0x10000, CRC(cd4e55f8) SHA1(92182767ca0ec37ec4949bd1a88c2efdcdcb60ed) )
ROM_REGION( 0x020000, "fgtile", 0 )
ROM_LOAD( "1.u21", 0x000000, 0x020000, CRC(bdf427e4) SHA1(e9cd178d1d9e2ed72f0fb013385d935f334b8fe3) ) // 8x8 tiles
ROM_REGION( 0x100000, "bgtile", 0 )
ROM_LOAD( "92077-4.u19", 0x000000, 0x100000, CRC(a9ea2804) SHA1(14dbdb3c7986db5e44dc7c5be6fcf39f3d1e50b0) ) // 16x16 tiles
ROM_REGION( 0x200000, "sprites", 0 )
ROM_LOAD16_WORD_SWAP( "92077-7.u134", 0x000000, 0x200000, CRC(d49169b3) SHA1(565ff7725dd6ace79b55706114132d8d867e81a9) ) // Sprites
ROM_REGION( 0x080000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD( "92077-5.u56", 0x00000, 0x80000, CRC(feb83c73) SHA1(b44e9d20b4af02e218c4bc875d66a7d6b8551cae) ) // 0x20000 - 0x80000 banked
ROM_REGION( 0x080000, "oki2", 0 ) // OKIM6295 samples
ROM_LOAD( "92077-6.u57", 0x00000, 0x80000, CRC(6d133f0d) SHA1(8a5e6e27a297196f20e4de0d060f1188115809bb) ) // 0x20000 - 0x80000 banked
ROM_REGION( 0x0220, "proms", 0 )
ROM_LOAD( "8_82s129.u35", 0x0000, 0x0100, CRC(4299776e) SHA1(683d14d2ace14965f0fcfe0f0540c1b77d2cece5) ) // unknown
ROM_LOAD( "9_82s135.u72", 0x0100, 0x0100, CRC(633ab1c9) SHA1(acd99fcca41eaab7948ca84988352f1d7d519c61) ) // unknown
ROM_LOAD( "10_82s123.u96", 0x0200, 0x0020, CRC(c60103c8) SHA1(dfb05b704bb5e1f75f5aaa4fa36e8ddcc905f8b6) ) // unknown
ROM_END
// bootleg board labeled 'GT ELEKTRONIK 16.04.93' with only 1 OKI and no NMK custom chips. Only sprites and bgtile ROMs are identical to the original.
ROM_START( gunnailb )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "27c020.6d", 0x00000, 0x40000, CRC(b9566c46) SHA1(dcecec0d401cdf8054b4b7a5dedee62332d92002) )
ROM_LOAD16_BYTE( "27c020.6e", 0x00001, 0x40000, CRC(6ba7c54d) SHA1(3932b96d2f1f541f8679524de3bb8867aded9f83) )
ROM_REGION( 0x20000, "audiocpu", 0 )
ROM_LOAD( "27c010.3b", 0x00000, 0x20000, CRC(6e0a5df0) SHA1(616b7c7aaf52a9a55b63c60717c1866940635cd4) ) // matches the one for Kaneko's Air Buster
ROM_REGION( 0x020000, "fgtile", 0 )
ROM_LOAD( "27c010.5g", 0x000000, 0x020000, CRC(6d2ca620) SHA1(6ed3b9987d1740f36235e33bdd66867c24f93f7e) ) // 8x8 tiles
ROM_REGION( 0x200000, "bgtile", 0 )
ROM_LOAD( "27c160.k10", 0x000000, 0x200000, CRC(062100a9) SHA1(c7e81656b8112c161d3e9be3edf001da97721727) ) // 16x16 tiles, 1st and 2nd half identical
ROM_REGION( 0x200000, "sprites", 0 )
ROM_LOAD16_WORD_SWAP( "27c160.a9", 0x000000, 0x200000, CRC(d49169b3) SHA1(565ff7725dd6ace79b55706114132d8d867e81a9) ) // Sprites
ROM_REGION( 0x040000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD( "27c020.1c", 0x00000, 0x40000, CRC(c5f7c0d9) SHA1(dea090ee535edb4e9167078f6e6e5fe4e544625a) )
ROM_END
ROM_START( macross2 ) // Title screen shows Kanji characters & Macross II
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_WORD_SWAP( "mcrs2j.3", 0x00000, 0x80000, CRC(36a618fe) SHA1(56fdb2bcb4a39888cfbaf9692d66335524a6ac0c) )
ROM_REGION( 0x20000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "mcrs2j.2", 0x00000, 0x20000, CRC(b4aa8ac7) SHA1(73a6de56cbfb468450d9b39fcbae0362f242f37b) ) // banked
ROM_REGION( 0x020000, "fgtile", 0 )
ROM_LOAD( "mcrs2j.1", 0x000000, 0x020000, CRC(c7417410) SHA1(41431d8f1ff4d66baf1a8518a0b0c0125d1d71d4) ) // 8x8 tiles
ROM_REGION( 0x200000, "bgtile", 0 )
ROM_LOAD( "bp932an.a04", 0x000000, 0x200000, CRC(c4d77ff0) SHA1(aca60a3f5f89265e7e3799e5d80ea8196fb11ff3) ) // 16x16 tiles
ROM_REGION( 0x400000, "sprites", 0 )
ROM_LOAD16_WORD_SWAP( "bp932an.a07", 0x000000, 0x200000, CRC(aa1b21b9) SHA1(133822e3d8628aa4eb3e62fbd054956799423b98) ) // Sprites
ROM_LOAD16_WORD_SWAP( "bp932an.a08", 0x200000, 0x200000, CRC(67eb2901) SHA1(25e0f9fda1a8c0c2b59616dd153cb6dcb459d2d9) )
ROM_REGION( 0x240000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD( "bp932an.a06", 0x040000, 0x200000, CRC(ef0ffec0) SHA1(fd72cc77e02d1a00bf27e77a33d7dab5f6ba1cb4) ) // all banked
ROM_REGION( 0x140000, "oki2", 0 ) // OKIM6295 samples
ROM_LOAD( "bp932an.a05", 0x040000, 0x100000, CRC(b5335abb) SHA1(f4eaf4e465eeca31741d432ee46ed39ffcd92cca) ) // all banked
ROM_REGION( 0x0200, "proms", 0 )
ROM_LOAD( "mcrs2bpr.9", 0x0000, 0x0100, CRC(435653a2) SHA1(575b4a46ea65179de3042614da438d2f6d8b572e) ) // unknown
ROM_LOAD( "mcrs2bpr.10", 0x0100, 0x0100, CRC(e6ead349) SHA1(6d81b1c0233580aa48f9718bade42d640e5ef3dd) ) // unknown
ROM_END
ROM_START( macross2k ) // Title screen only shows Macross II, no Kanji. Suspected Korean version - Language dip still used for Stage info screens
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_WORD_SWAP( "1.3", 0x00000, 0x80000, CRC(1506fcfc) SHA1(638ccc90effde3be20ab9b4da3a0d75af2577e51) ) // non descript ROM label "1"
ROM_REGION( 0x20000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "mcrs2j.2", 0x00000, 0x20000, CRC(b4aa8ac7) SHA1(73a6de56cbfb468450d9b39fcbae0362f242f37b) ) // banked
ROM_REGION( 0x020000, "fgtile", 0 )
ROM_LOAD( "2.1", 0x000000, 0x020000, CRC(372dfa11) SHA1(92934128c82191a08a359ec690576bc5888f085e) ) // 8x8 tiles - non descript ROM label "2"
ROM_REGION( 0x200000, "bgtile", 0 )
ROM_LOAD( "bp932an.a04", 0x000000, 0x200000, CRC(c4d77ff0) SHA1(aca60a3f5f89265e7e3799e5d80ea8196fb11ff3) ) // 16x16 tiles
ROM_REGION( 0x400000, "sprites", 0 )
ROM_LOAD16_WORD_SWAP( "bp932an.a07", 0x000000, 0x200000, CRC(aa1b21b9) SHA1(133822e3d8628aa4eb3e62fbd054956799423b98) ) // Sprites
ROM_LOAD16_WORD_SWAP( "bp932an.a08", 0x200000, 0x200000, CRC(67eb2901) SHA1(25e0f9fda1a8c0c2b59616dd153cb6dcb459d2d9) )
ROM_REGION( 0x240000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD( "bp932an.a06", 0x040000, 0x200000, CRC(ef0ffec0) SHA1(fd72cc77e02d1a00bf27e77a33d7dab5f6ba1cb4) ) // all banked
ROM_REGION( 0x140000, "oki2", 0 ) // OKIM6295 samples
ROM_LOAD( "bp932an.a05", 0x040000, 0x100000, CRC(b5335abb) SHA1(f4eaf4e465eeca31741d432ee46ed39ffcd92cca) ) // all banked
ROM_REGION( 0x0200, "proms", 0 )
ROM_LOAD( "mcrs2bpr.9", 0x0000, 0x0100, CRC(435653a2) SHA1(575b4a46ea65179de3042614da438d2f6d8b572e) ) // unknown
ROM_LOAD( "mcrs2bpr.10", 0x0100, 0x0100, CRC(e6ead349) SHA1(6d81b1c0233580aa48f9718bade42d640e5ef3dd) ) // unknown
ROM_END
ROM_START( macross2g )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_WORD_SWAP( "3.u11", 0x00000, 0x80000, CRC(151f9d39) SHA1(d0454627f019c60615cc8bd11e6cbec1f885cf13) )
ROM_REGION( 0x20000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "mcrs2j.2", 0x00000, 0x20000, CRC(b4aa8ac7) SHA1(73a6de56cbfb468450d9b39fcbae0362f242f37b) ) // banked
ROM_REGION( 0x020000, "fgtile", 0 )
ROM_LOAD( "mcrs2j.1", 0x000000, 0x020000, CRC(c7417410) SHA1(41431d8f1ff4d66baf1a8518a0b0c0125d1d71d4) ) // 8x8 tiles
ROM_REGION( 0x200000, "bgtile", 0 )
ROM_LOAD( "bp932an.a04", 0x000000, 0x200000, CRC(c4d77ff0) SHA1(aca60a3f5f89265e7e3799e5d80ea8196fb11ff3) ) // 16x16 tiles
ROM_REGION( 0x400000, "sprites", 0 )
ROM_LOAD16_WORD_SWAP( "bp932an.a07", 0x000000, 0x200000, CRC(aa1b21b9) SHA1(133822e3d8628aa4eb3e62fbd054956799423b98) ) // Sprites
ROM_LOAD16_WORD_SWAP( "bp932an.a08", 0x200000, 0x200000, CRC(67eb2901) SHA1(25e0f9fda1a8c0c2b59616dd153cb6dcb459d2d9) )
ROM_REGION( 0x240000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD( "bp932an.a06", 0x040000, 0x200000, CRC(ef0ffec0) SHA1(fd72cc77e02d1a00bf27e77a33d7dab5f6ba1cb4) ) // all banked
ROM_REGION( 0x140000, "oki2", 0 ) // OKIM6295 samples
ROM_LOAD( "bp932an.a05", 0x040000, 0x100000, CRC(b5335abb) SHA1(f4eaf4e465eeca31741d432ee46ed39ffcd92cca) ) // all banked
ROM_REGION( 0x0200, "proms", 0 )
ROM_LOAD( "mcrs2bpr.9", 0x0000, 0x0100, CRC(435653a2) SHA1(575b4a46ea65179de3042614da438d2f6d8b572e) ) // unknown
ROM_LOAD( "mcrs2bpr.10", 0x0100, 0x0100, CRC(e6ead349) SHA1(6d81b1c0233580aa48f9718bade42d640e5ef3dd) ) // unknown
ROM_END
ROM_START( tdragon2 )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_WORD_SWAP( "6.rom", 0x00000, 0x80000, CRC(ca348caf) SHA1(7c5b0b92560baf413591230e061d2d57b25deafe) )
ROM_REGION( 0x20000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "5.bin", 0x00000, 0x20000, CRC(b870be61) SHA1(ea5d45c3a3ab805e55806967f00167cf6366212e) ) // banked
ROM_REGION( 0x020000, "fgtile", 0 )
ROM_LOAD( "1.bin", 0x000000, 0x020000, CRC(d488aafa) SHA1(4d05e7ca075b638dd90ae4c9f224817a8a3ae9f3) ) // 8x8 tiles
ROM_REGION( 0x200000, "bgtile", 0 )
ROM_LOAD( "ww930914.2", 0x000000, 0x200000, CRC(f968c65d) SHA1(fd6d21bba53f945b1597d7d0735bc62dd44d5498) ) // 16x16 tiles
ROM_REGION( 0x400000, "sprites", 0 )
ROM_LOAD16_WORD_SWAP( "ww930917.7", 0x000000, 0x200000, CRC(b98873cb) SHA1(cc19200865176e940ff68e12de81f029b51c2084) ) // Sprites
ROM_LOAD16_WORD_SWAP( "ww930918.8", 0x200000, 0x200000, CRC(baee84b2) SHA1(b325b00e6147266dbdc840e03556004531dc2038) )
ROM_REGION( 0x240000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD( "ww930916.4", 0x040000, 0x200000, CRC(07c35fe6) SHA1(33547bd88764704310f2ef8cf3bfe21ceb56d5b7) ) // all banked
ROM_REGION( 0x240000, "oki2", 0 ) // OKIM6295 samples
ROM_LOAD( "ww930915.3", 0x040000, 0x200000, CRC(82025bab) SHA1(ac6053700326ea730d00ec08193e2c8a2a019f0b) ) // all banked
ROM_REGION( 0x0200, "proms", 0 )
ROM_LOAD( "9.bpr", 0x0000, 0x0100, CRC(435653a2) SHA1(575b4a46ea65179de3042614da438d2f6d8b572e) ) // unknown
ROM_LOAD( "10.bpr", 0x0100, 0x0100, CRC(e6ead349) SHA1(6d81b1c0233580aa48f9718bade42d640e5ef3dd) ) // unknown
ROM_END
ROM_START( tdragon3h )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "h.27c2001", 0x00000, 0x40000, CRC(0091f4a3) SHA1(025e5f7ff12eaa90c5cfe757c71d58ba7040cba7) )
ROM_LOAD16_BYTE( "l.27c020", 0x00001, 0x40000, CRC(4699c313) SHA1(1851a4b5ad9c2bac230126d195e239a5ebe827f9) )
ROM_REGION( 0x20000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "1.27c1000", 0x00000, 0x20000, CRC(b870be61) SHA1(ea5d45c3a3ab805e55806967f00167cf6366212e) ) // banked
ROM_REGION( 0x020000, "fgtile", 0 )
ROM_LOAD( "12.27c1000", 0x000000, 0x020000, CRC(f809d616) SHA1(c6a4d776fee770ec197204b855b85bcc719469a5) ) // 8x8 tiles
ROM_REGION( 0x200000, "bgtile", 0 ) // identical to tdragon2, only split
ROM_LOAD( "conny.3", 0x000000, 0x100000, CRC(5951c031) SHA1(c262aeda0befcf4ac30638d42f2d40ba54c66ea7) ) // 16x16 tiles
ROM_LOAD( "conny.4", 0x100000, 0x100000, CRC(a7772524) SHA1(fcf980272c5e4088f492b429cb288bc0c46cf5a2) )
ROM_REGION( 0x400000, "sprites", 0 ) // identical to tdragon2, only split
ROM_LOAD16_BYTE( "conny.2", 0x000000, 0x100000, CRC(fefe8384) SHA1(a68069691cef0454059bd383f6c85ce19af2c0e7) ) // Sprites
ROM_LOAD16_BYTE( "conny.1", 0x000001, 0x100000, CRC(37b32460) SHA1(7b689a7e23a9428c6d36f0791a64e7a9a41e7cfa) )
ROM_LOAD16_WORD_SWAP( "conny.5", 0x200000, 0x200000, CRC(baee84b2) SHA1(b325b00e6147266dbdc840e03556004531dc2038) )
ROM_REGION( 0x240000, "oki1", ROMREGION_ERASEFF ) // only 1 oki on this PCB
ROM_REGION( 0x240000, "oki2", 0 ) // OKIM6295 samples
ROM_LOAD( "conny.6", 0x040000, 0x100000, CRC(564f87ed) SHA1(010dd001fda28d9c15ca09a0d12cac438a46cd54) ) // all banked
ROM_LOAD( "conny.7", 0x140000, 0x100000, CRC(2e767f6f) SHA1(34e3f747716eb7a585340791c2cfbfde57681d69) )
ROM_REGION( 0x0200, "proms", 0 ) // not dumped for this set
ROM_LOAD( "9.bpr", 0x0000, 0x0100, BAD_DUMP CRC(435653a2) SHA1(575b4a46ea65179de3042614da438d2f6d8b572e) ) // unknown
ROM_LOAD( "10.bpr", 0x0100, 0x0100, BAD_DUMP CRC(e6ead349) SHA1(6d81b1c0233580aa48f9718bade42d640e5ef3dd) ) // unknown
ROM_END
ROM_START( tdragon2a )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_WORD_SWAP( "6.bin", 0x00000, 0x80000, CRC(310d6bca) SHA1(f46ad1d13cf5014aef1f0e8862b369ab31c22866) )
ROM_REGION( 0x20000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "5.bin", 0x00000, 0x20000, CRC(b870be61) SHA1(ea5d45c3a3ab805e55806967f00167cf6366212e) ) // banked
ROM_REGION( 0x020000, "fgtile", 0 )
ROM_LOAD( "1.bin", 0x000000, 0x020000, CRC(d488aafa) SHA1(4d05e7ca075b638dd90ae4c9f224817a8a3ae9f3) ) // 8x8 tiles
ROM_REGION( 0x200000, "bgtile", 0 )
ROM_LOAD( "ww930914.2", 0x000000, 0x200000, CRC(f968c65d) SHA1(fd6d21bba53f945b1597d7d0735bc62dd44d5498) ) // 16x16 tiles
ROM_REGION( 0x400000, "sprites", 0 )
ROM_LOAD16_WORD_SWAP( "ww930917.7", 0x000000, 0x200000, CRC(b98873cb) SHA1(cc19200865176e940ff68e12de81f029b51c2084) ) // Sprites
ROM_LOAD16_WORD_SWAP( "ww930918.8", 0x200000, 0x200000, CRC(baee84b2) SHA1(b325b00e6147266dbdc840e03556004531dc2038) )
ROM_REGION( 0x240000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD( "ww930916.4", 0x040000, 0x200000, CRC(07c35fe6) SHA1(33547bd88764704310f2ef8cf3bfe21ceb56d5b7) ) // all banked
ROM_REGION( 0x240000, "oki2", 0 ) // OKIM6295 samples
ROM_LOAD( "ww930915.3", 0x040000, 0x200000, CRC(82025bab) SHA1(ac6053700326ea730d00ec08193e2c8a2a019f0b) ) // all banked
ROM_REGION( 0x0200, "proms", 0 )
ROM_LOAD( "9.bpr", 0x0000, 0x0100, CRC(435653a2) SHA1(575b4a46ea65179de3042614da438d2f6d8b572e) ) // unknown
ROM_LOAD( "10.bpr", 0x0100, 0x0100, CRC(e6ead349) SHA1(6d81b1c0233580aa48f9718bade42d640e5ef3dd) ) // unknown
ROM_END
ROM_START( bigbang )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_WORD_SWAP( "eprom.3", 0x00000, 0x80000, CRC(28e5957a) SHA1(fe4f870a9c2235cc02b4e036a2a4116f071d59ad) )
ROM_REGION( 0x20000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "5.bin", 0x00000, 0x20000, CRC(b870be61) SHA1(ea5d45c3a3ab805e55806967f00167cf6366212e) ) // banked
ROM_REGION( 0x020000, "fgtile", 0 )
ROM_LOAD( "1.bin", 0x000000, 0x020000, CRC(d488aafa) SHA1(4d05e7ca075b638dd90ae4c9f224817a8a3ae9f3) ) // 8x8 tiles
ROM_REGION( 0x200000, "bgtile", 0 )
ROM_LOAD( "ww930914.2", 0x000000, 0x200000, CRC(f968c65d) SHA1(fd6d21bba53f945b1597d7d0735bc62dd44d5498) ) // 16x16 tiles
ROM_REGION( 0x400000, "sprites", 0 )
ROM_LOAD16_WORD_SWAP( "ww930917.7", 0x000000, 0x200000, CRC(b98873cb) SHA1(cc19200865176e940ff68e12de81f029b51c2084) ) // Sprites
ROM_LOAD16_WORD_SWAP( "ww930918.8", 0x200000, 0x200000, CRC(baee84b2) SHA1(b325b00e6147266dbdc840e03556004531dc2038) )
ROM_REGION( 0x240000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD( "ww930916.4", 0x040000, 0x200000, CRC(07c35fe6) SHA1(33547bd88764704310f2ef8cf3bfe21ceb56d5b7) ) // all banked
ROM_REGION( 0x240000, "oki2", 0 ) // OKIM6295 samples
ROM_LOAD( "ww930915.3", 0x040000, 0x200000, CRC(82025bab) SHA1(ac6053700326ea730d00ec08193e2c8a2a019f0b) ) // all banked
ROM_REGION( 0x0200, "proms", 0 )
ROM_LOAD( "9.bpr", 0x0000, 0x0100, CRC(435653a2) SHA1(575b4a46ea65179de3042614da438d2f6d8b572e) ) // unknown
ROM_LOAD( "10.bpr", 0x0100, 0x0100, CRC(e6ead349) SHA1(6d81b1c0233580aa48f9718bade42d640e5ef3dd) ) // unknown
ROM_END
/*
Rapid Hero
NMK, 1994
The main board has no ROMs at all except 3 PROMs. There is a plug-in daughter
board that holds all the ROMs. It has the capacity for 3 socketed EPROMS and 7x
16M mask ROMs total.
PCB Layout (Main board)
-----------------------
AWA94099
-----------------------------------------------------------------------
| YM2203 TMP90C841 6264 DSW2(8) 62256 62256 6116 62256 62256 6116 |
| 6295 NMK112 12MHz DSW1(8) |
| YM3014B 6295 16MHz NMK005 62256 62256 6116 62256 62256 6116 |
|J ----------------- |
|A | | |
|M ----------------- |
|M PROM3 NMK009 NMK009 |
|A NMK111 6116 6116 NMK008 |
| |-| 6116 6116 |
|6116 | | NMK902 ----------------- |
|6116 | | | | |
|PROM1 | | ----------------- |
| | | |
|NMK111 | | NMK903 |
| | | NMK903 PROM2 |
|NMK111 | | |
| |-| 6116 TMP68HC000P-16 |
| 62256 NMK901 6116 14MHz |
| 62256 |
-----------------------------------------------------------------------
Notes:
68k clock: 14.00MHz
VSync: 56Hz
HSync: 15.35kHz
90c841 clock: 8.000MHz
PCB Layout (Daughter board)
---------------------------
AWA94099-ROME
--------------------------
| 2 6 7 5 3 |
| |
| 1 |
| |
| |
| |
| 4 8 9 10 |
| |
| |
| |
--------------------------
*/
ROM_START( arcadian )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_WORD_SWAP( "arcadia.3", 0x00000, 0x80000, CRC(8b46d609) SHA1(793870d74c9d7d04c53d898610c682b2dc90d0af) )
ROM_REGION( 0x20000, "audiocpu", 0 ) // tmp90c841
ROM_LOAD( "rhp94099.2", 0x00000, 0x20000, CRC(fe01ece1) SHA1(c469fb79f2774089848c814f92ddd3c9e384050f) )
ROM_REGION( 0x020000, "fgtile", 0 )
ROM_LOAD( "arcadia.1", 0x000000, 0x020000, CRC(1c2c4008) SHA1(583d74a0a44519a7050b1d8490011ff60222f466) ) // 8x8 tiles
ROM_REGION( 0x200000, "bgtile", 0 )
ROM_LOAD( "rhp94099.4", 0x000000, 0x200000, CRC(076eee7b) SHA1(7c315fe33d0fcd92e0ce2f274996c8059228b005) ) // 16x16 tiles
ROM_REGION( 0x600000, "sprites", 0 ) // Sprites
ROM_LOAD16_WORD_SWAP( "rhp94099.8", 0x000000, 0x200000, CRC(49892f07) SHA1(2f5d20cd193cffcba9041aa11d6665adebeffffa) ) // 16x16 tiles
ROM_LOAD16_WORD_SWAP( "rhp94099.9", 0x200000, 0x200000, CRC(ea2e47f0) SHA1(97dfa8f95f27b36deb5ce1c80e3d727bad24e52b) ) // 16x16 tiles
ROM_LOAD16_WORD_SWAP( "rhp94099.10",0x400000, 0x200000, CRC(512cb839) SHA1(4a2c5ac88e4bf8a6f07c703277c4d33e649fd192) ) // 16x16 tiles
ROM_REGION( 0x440000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD( "rhp94099.6", 0x040000, 0x200000, CRC(f1a80e5a) SHA1(218bd7b0c3d8b283bf96b95bf888228810699370) ) // all banked
ROM_LOAD( "rhp94099.7", 0x240000, 0x200000, CRC(0d99547e) SHA1(2d9630bd55d27010f9d1d2dbdbd07ac265e8ebe6) ) // all banked
ROM_REGION( 0x440000, "oki2", 0 ) // OKIM6295 samples
ROM_LOAD( "rhp94099.5", 0x040000, 0x200000, CRC(515eba93) SHA1(c35cb5f31f4bc7327be5777624af168f9fb364a5) ) // all banked
ROM_LOAD( "rhp94099.6", 0x240000, 0x200000, CRC(f1a80e5a) SHA1(218bd7b0c3d8b283bf96b95bf888228810699370) ) // all banked
ROM_REGION( 0x0300, "proms", 0 )
ROM_LOAD( "prom1.u19", 0x0000, 0x0100, CRC(4299776e) SHA1(683d14d2ace14965f0fcfe0f0540c1b77d2cece5) ) // unknown
ROM_LOAD( "prom2.u53", 0x0100, 0x0100, CRC(e6ead349) SHA1(6d81b1c0233580aa48f9718bade42d640e5ef3dd) ) // unknown
ROM_LOAD( "prom3.u60", 0x0200, 0x0100, CRC(304f98c6) SHA1(8dfd9bf719087ec30c83efe95c4561666c7d1801) ) // unknown
ROM_END
ROM_START( raphero )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_WORD_SWAP( "3", 0x00000, 0x80000, CRC(3257bfbd) SHA1(12ba7bbbf811c9a574a7751979edaaf1f33b0764) )
ROM_REGION( 0x20000, "audiocpu", 0 ) // tmp90c841
ROM_LOAD( "rhp94099.2", 0x00000, 0x20000, CRC(fe01ece1) SHA1(c469fb79f2774089848c814f92ddd3c9e384050f) )
ROM_REGION( 0x020000, "fgtile", 0 )
ROM_LOAD( "rhp94099.1", 0x000000, 0x020000, CRC(55a7a011) SHA1(87ded56bfdd38cbf8d3bd8b3789831f768550a12) ) // 8x8 tiles
ROM_REGION( 0x200000, "bgtile", 0 )
ROM_LOAD( "rhp94099.4", 0x000000, 0x200000, CRC(076eee7b) SHA1(7c315fe33d0fcd92e0ce2f274996c8059228b005) ) // 16x16 tiles
ROM_REGION( 0x600000, "sprites", 0 ) // Sprites
ROM_LOAD16_WORD_SWAP( "rhp94099.8", 0x000000, 0x200000, CRC(49892f07) SHA1(2f5d20cd193cffcba9041aa11d6665adebeffffa) ) // 16x16 tiles
ROM_LOAD16_WORD_SWAP( "rhp94099.9", 0x200000, 0x200000, CRC(ea2e47f0) SHA1(97dfa8f95f27b36deb5ce1c80e3d727bad24e52b) ) // 16x16 tiles
ROM_LOAD16_WORD_SWAP( "rhp94099.10",0x400000, 0x200000, CRC(512cb839) SHA1(4a2c5ac88e4bf8a6f07c703277c4d33e649fd192) ) // 16x16 tiles
ROM_REGION( 0x440000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD( "rhp94099.6", 0x040000, 0x200000, CRC(f1a80e5a) SHA1(218bd7b0c3d8b283bf96b95bf888228810699370) ) // all banked
ROM_LOAD( "rhp94099.7", 0x240000, 0x200000, CRC(0d99547e) SHA1(2d9630bd55d27010f9d1d2dbdbd07ac265e8ebe6) ) // all banked
ROM_REGION( 0x440000, "oki2", 0 ) // OKIM6295 samples
ROM_LOAD( "rhp94099.5", 0x040000, 0x200000, CRC(515eba93) SHA1(c35cb5f31f4bc7327be5777624af168f9fb364a5) ) // all banked
ROM_LOAD( "rhp94099.6", 0x240000, 0x200000, CRC(f1a80e5a) SHA1(218bd7b0c3d8b283bf96b95bf888228810699370) ) // all banked
ROM_REGION( 0x0300, "proms", 0 )
ROM_LOAD( "prom1.u19", 0x0000, 0x0100, CRC(4299776e) SHA1(683d14d2ace14965f0fcfe0f0540c1b77d2cece5) ) // unknown
ROM_LOAD( "prom2.u53", 0x0100, 0x0100, CRC(e6ead349) SHA1(6d81b1c0233580aa48f9718bade42d640e5ef3dd) ) // unknown
ROM_LOAD( "prom3.u60", 0x0200, 0x0100, CRC(304f98c6) SHA1(8dfd9bf719087ec30c83efe95c4561666c7d1801) ) // unknown
ROM_END
ROM_START( rapheroa )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_WORD_SWAP( "rhp94099.3", 0x00000, 0x80000, CRC(ec9b4f05) SHA1(e5bd797620dc449fd78b41d87e9ba5a764eb8b44) )
ROM_REGION( 0x20000, "audiocpu", 0 ) // tmp90c841
ROM_LOAD( "rhp94099.2", 0x00000, 0x20000, CRC(fe01ece1) SHA1(c469fb79f2774089848c814f92ddd3c9e384050f) )
ROM_REGION( 0x020000, "fgtile", 0 )
ROM_LOAD( "rhp94099.1", 0x000000, 0x020000, CRC(55a7a011) SHA1(87ded56bfdd38cbf8d3bd8b3789831f768550a12) ) // 8x8 tiles
ROM_REGION( 0x200000, "bgtile", 0 )
ROM_LOAD( "rhp94099.4", 0x000000, 0x200000, CRC(076eee7b) SHA1(7c315fe33d0fcd92e0ce2f274996c8059228b005) ) // 16x16 tiles
ROM_REGION( 0x600000, "sprites", 0 ) // Sprites
ROM_LOAD16_WORD_SWAP( "rhp94099.8", 0x000000, 0x200000, CRC(49892f07) SHA1(2f5d20cd193cffcba9041aa11d6665adebeffffa) ) // 16x16 tiles
ROM_LOAD16_WORD_SWAP( "rhp94099.9", 0x200000, 0x200000, CRC(ea2e47f0) SHA1(97dfa8f95f27b36deb5ce1c80e3d727bad24e52b) ) // 16x16 tiles
ROM_LOAD16_WORD_SWAP( "rhp94099.10",0x400000, 0x200000, CRC(512cb839) SHA1(4a2c5ac88e4bf8a6f07c703277c4d33e649fd192) ) // 16x16 tiles
ROM_REGION( 0x440000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD( "rhp94099.6", 0x040000, 0x200000, CRC(f1a80e5a) SHA1(218bd7b0c3d8b283bf96b95bf888228810699370) ) // all banked
ROM_LOAD( "rhp94099.7", 0x240000, 0x200000, CRC(0d99547e) SHA1(2d9630bd55d27010f9d1d2dbdbd07ac265e8ebe6) ) // all banked
ROM_REGION( 0x440000, "oki2", 0 ) // OKIM6295 samples
ROM_LOAD( "rhp94099.5", 0x040000, 0x200000, CRC(515eba93) SHA1(c35cb5f31f4bc7327be5777624af168f9fb364a5) ) // all banked
ROM_LOAD( "rhp94099.6", 0x240000, 0x200000, CRC(f1a80e5a) SHA1(218bd7b0c3d8b283bf96b95bf888228810699370) ) // all banked
ROM_REGION( 0x0300, "proms", 0 )
ROM_LOAD( "prom1.u19", 0x0000, 0x0100, CRC(4299776e) SHA1(683d14d2ace14965f0fcfe0f0540c1b77d2cece5) ) // unknown
ROM_LOAD( "prom2.u53", 0x0100, 0x0100, CRC(e6ead349) SHA1(6d81b1c0233580aa48f9718bade42d640e5ef3dd) ) // unknown
ROM_LOAD( "prom3.u60", 0x0200, 0x0100, CRC(304f98c6) SHA1(8dfd9bf719087ec30c83efe95c4561666c7d1801) ) // unknown
ROM_END
ROM_START( sabotenb )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "ic76.sb1", 0x00000, 0x40000, CRC(b2b0b2cf) SHA1(219f1cefdb107d8404f4f8bfa0700fd3218d9320) )
ROM_LOAD16_BYTE( "ic75.sb2", 0x00001, 0x40000, CRC(367e87b7) SHA1(c950041529b5117686e4bb1ae77db82fe758c1d0) )
ROM_REGION( 0x010000, "fgtile", 0 )
ROM_LOAD( "ic35.sb3", 0x000000, 0x010000, CRC(eb7bc99d) SHA1(b3063afd58025a441d4750c22483e9129da402e7) ) // 8x8 tiles
ROM_REGION( 0x200000, "bgtile", 0 )
ROM_LOAD( "ic32.sb4", 0x000000, 0x200000, CRC(24c62205) SHA1(3ab0ca5d7c698328d91421ccf6f7dafc20df3c8d) ) // 8x8 tiles
ROM_REGION( 0x200000, "sprites", 0 )
ROM_LOAD16_WORD_SWAP( "ic100.sb5", 0x000000, 0x200000, CRC(b20f166e) SHA1(074d770fd6d233040a80a92f4467d81f961c650b) ) // Sprites
ROM_REGION( 0x140000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD( "ic30.sb6", 0x040000, 0x100000, CRC(288407af) SHA1(78c08fae031337222681c593dc86a08df6a34a4b) ) // all banked
ROM_REGION( 0x140000, "oki2", 0 ) // OKIM6295 samples
ROM_LOAD( "ic27.sb7", 0x040000, 0x100000, CRC(43e33a7e) SHA1(51068b63f4415712eaa25dcf1ee6b0cc2850974e) ) // all banked
ROM_END
ROM_START( sabotenba )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "sb1.76", 0x00000, 0x40000, CRC(df6f65e2) SHA1(6ad9e9f13539310646895c5e7992c6546e75684b) )
ROM_LOAD16_BYTE( "sb2.75", 0x00001, 0x40000, CRC(0d2c1ab8) SHA1(abb43a8c5398195c0ad48d8d772ef47635bf25c2) )
ROM_REGION( 0x010000, "fgtile", 0 )
ROM_LOAD( "ic35.sb3", 0x000000, 0x010000, CRC(eb7bc99d) SHA1(b3063afd58025a441d4750c22483e9129da402e7) ) // 8x8 tiles
ROM_REGION( 0x200000, "bgtile", 0 )
ROM_LOAD( "ic32.sb4", 0x000000, 0x200000, CRC(24c62205) SHA1(3ab0ca5d7c698328d91421ccf6f7dafc20df3c8d) ) // 8x8 tiles
ROM_REGION( 0x200000, "sprites", 0 )
ROM_LOAD16_WORD_SWAP( "ic100.sb5", 0x000000, 0x200000, CRC(b20f166e) SHA1(074d770fd6d233040a80a92f4467d81f961c650b) ) // Sprites
ROM_REGION( 0x140000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD( "ic30.sb6", 0x040000, 0x100000, CRC(288407af) SHA1(78c08fae031337222681c593dc86a08df6a34a4b) ) // all banked
ROM_REGION( 0x140000, "oki2", 0 ) // OKIM6295 samples
ROM_LOAD( "ic27.sb7", 0x040000, 0x100000, CRC(43e33a7e) SHA1(51068b63f4415712eaa25dcf1ee6b0cc2850974e) ) // all banked
ROM_END
ROM_START( cactus )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "02.bin", 0x00000, 0x40000, CRC(15b2ff2f) SHA1(432cfd58daa0fdbe62157b36ca73eb9af6ce91e9) ) // PCB is marked 'Cactus', actual game has no title screen
ROM_LOAD16_BYTE( "01.bin", 0x00001, 0x40000, CRC(5b8ba46a) SHA1(617e414fda1bd3e9f391676d312b0cdd4700adee) )
ROM_REGION( 0x010000, "fgtile", 0 )
ROM_LOAD( "i03.bin", 0x000000, 0x010000, CRC(eb7bc99d) SHA1(b3063afd58025a441d4750c22483e9129da402e7) ) // 8x8 tiles
ROM_REGION( 0x200000, "bgtile", 0 )
ROM_LOAD( "s-05.bin", 0x000000, 0x100000, CRC(fce962b9) SHA1(abd4311a17dac819d5bf8d81fe289a8b3a793b32) )
ROM_LOAD( "s-06.bin", 0x100000, 0x100000, CRC(16768fbc) SHA1(fe3667fc2e8fd0c6690e09f7b24466cc3eb34403) )
ROM_REGION( 0x200000, "sprites", 0 )
ROM_LOAD16_BYTE( "s-03.bin", 0x000001, 0x100000, CRC(bc1781b8) SHA1(5000f2111c5981428a772a9dcae2c7c8f1f6958b) )
ROM_LOAD16_BYTE( "s-04.bin", 0x000000, 0x100000, CRC(f823885e) SHA1(558b2bed207ccff8f1425cbb9dadc1ec0b70a65b) )
ROM_REGION( 0x140000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD( "s-01.bin", 0x040000, 0x100000, CRC(288407af) SHA1(78c08fae031337222681c593dc86a08df6a34a4b) ) // all banked
ROM_REGION( 0x140000, "oki2", 0 ) // OKIM6295 samples
ROM_LOAD( "s-02.bin", 0x040000, 0x100000, CRC(43e33a7e) SHA1(51068b63f4415712eaa25dcf1ee6b0cc2850974e) ) // all banked
ROM_END
ROM_START( bjtwin )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "93087-1.bin", 0x00000, 0x20000, CRC(93c84e2d) SHA1(ad0755cabfef78e7e689856379d6f8c88a9b27c1) )
ROM_LOAD16_BYTE( "93087-2.bin", 0x00001, 0x20000, CRC(30ff678a) SHA1(aa3ce4905e448e371e254545ef9ed7edb00b1cc3) )
ROM_REGION( 0x010000, "fgtile", 0 )
ROM_LOAD( "93087-3.bin", 0x000000, 0x010000, CRC(aa13df7c) SHA1(162d4f12364c68028e86fe97ee75c262daa4c699) ) // 8x8 tiles
ROM_REGION( 0x100000, "bgtile", 0 )
ROM_LOAD( "93087-4.bin", 0x000000, 0x100000, CRC(8a4f26d0) SHA1(be057a2b6d28c623ac1f16cf02ddbe12ca430b4a) ) // 8x8 tiles
ROM_REGION( 0x100000, "sprites", 0 )
ROM_LOAD16_WORD_SWAP( "93087-5.bin", 0x000000, 0x100000, CRC(bb06245d) SHA1(c91e2284d95370b8ef2eb1b9d6305fdd6cde23a0) ) // Sprites
ROM_REGION( 0x140000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD( "93087-6.bin", 0x040000, 0x100000, CRC(372d46dd) SHA1(18f44e777241af50787730652fa018c51b65ea15) ) // all banked
ROM_REGION( 0x140000, "oki2", 0 ) // OKIM6295 samples
ROM_LOAD( "93087-7.bin", 0x040000, 0x100000, CRC(8da67808) SHA1(f042574c097f5a8c2684fcc23f2c817c168254ef) ) // all banked
ROM_REGION( 0x0200, "proms", 0 )
ROM_LOAD( "8.bpr", 0x0000, 0x0100, CRC(633ab1c9) SHA1(acd99fcca41eaab7948ca84988352f1d7d519c61) ) // unknown
ROM_LOAD( "9.bpr", 0x0000, 0x0100, CRC(435653a2) SHA1(575b4a46ea65179de3042614da438d2f6d8b572e) ) // unknown
ROM_END
ROM_START( bjtwina )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "93087.1", 0x00000, 0x20000, CRC(c82b3d8e) SHA1(74435ba7842f1be9968006894cfa5eef05c47395) )
ROM_LOAD16_BYTE( "93087.2", 0x00001, 0x20000, CRC(9be1ec47) SHA1(bf37d9254a7bbdf49b006971886ed9845d72e4b3) )
ROM_REGION( 0x010000, "fgtile", 0 )
ROM_LOAD( "93087-3.bin", 0x000000, 0x010000, CRC(aa13df7c) SHA1(162d4f12364c68028e86fe97ee75c262daa4c699) ) // 8x8 tiles
ROM_REGION( 0x100000, "bgtile", 0 )
ROM_LOAD( "93087-4.bin", 0x000000, 0x100000, CRC(8a4f26d0) SHA1(be057a2b6d28c623ac1f16cf02ddbe12ca430b4a) ) // 8x8 tiles
ROM_REGION( 0x100000, "sprites", 0 )
ROM_LOAD16_WORD_SWAP( "93087-5.bin", 0x000000, 0x100000, CRC(bb06245d) SHA1(c91e2284d95370b8ef2eb1b9d6305fdd6cde23a0) ) // Sprites
ROM_REGION( 0x140000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD( "93087-6.bin", 0x040000, 0x100000, CRC(372d46dd) SHA1(18f44e777241af50787730652fa018c51b65ea15) ) // all banked
ROM_REGION( 0x140000, "oki2", 0 ) // OKIM6295 samples
ROM_LOAD( "93087-7.bin", 0x040000, 0x100000, CRC(8da67808) SHA1(f042574c097f5a8c2684fcc23f2c817c168254ef) ) // all banked
ROM_REGION( 0x0200, "proms", 0 )
ROM_LOAD( "8.bpr", 0x0000, 0x0100, CRC(633ab1c9) SHA1(acd99fcca41eaab7948ca84988352f1d7d519c61) ) // unknown
ROM_LOAD( "9.bpr", 0x0000, 0x0100, CRC(435653a2) SHA1(575b4a46ea65179de3042614da438d2f6d8b572e) ) // unknown
ROM_END
ROM_START( bjtwinp )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "ic76", 0x00000, 0x20000, CRC(c2847f0d) SHA1(2659e642586fcd199928d3f10ec300a1f13f2e3b) )
ROM_LOAD16_BYTE( "ic75", 0x00001, 0x20000, CRC(dd8fdfce) SHA1(8b2da3b97acd07783b68ee270ae678dab6e538ec) )
ROM_REGION( 0x010000, "fgtile", 0 )
ROM_LOAD( "ic35", 0x000000, 0x010000, CRC(45d67683) SHA1(004a85ecf34e97fad40195e7e20a11bf8cafe41e) ) // 8x8 tiles
ROM_REGION( 0x200000, "bgtile", 0 )
ROM_LOAD( "u1.ic32", 0x000000, 0x080000, CRC(b4960ba0) SHA1(4194bcd55fe48da08d5e951dc78daa457b1d76af) )
ROM_LOAD( "u2.ic32", 0x080000, 0x080000, CRC(99ee571d) SHA1(85db0c9c3bdf5367dd4868daf9de40bdeeda9426) )
ROM_LOAD( "u3.ic32", 0x100000, 0x080000, CRC(25720ffb) SHA1(361961e06467c7f4126e774a179087fe424160f5) ) // Contains Gun Dealer + Dooyong logos + lots of adult pics! - these are used after the bonus game in this set...
ROM_REGION( 0x100000, "sprites", 0 )
ROM_LOAD16_BYTE( "u4.ic100", 0x000000, 0x080000, CRC(6501b1fb) SHA1(1c0832c3bb33aac1e5cd8845d77bc09222548ef8) )
ROM_LOAD16_BYTE( "u5.ic100", 0x000001, 0x080000, CRC(8394e2ba) SHA1(bb921ccf1f5221611449ed3537d60395d8a1c1e9) )
ROM_REGION( 0x140000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD( "bottom.ic30", 0x040000, 0x80000, CRC(b5ef197f) SHA1(89d675f921dead585c2fef44105a7aea2f1f399c) ) // all banked
ROM_LOAD( "top.ic30", 0x0c0000, 0x80000, CRC(ab50531d) SHA1(918987f01a8b1b007721d2b365e2b2fc536bd676) )
ROM_REGION( 0x140000, "oki2", 0 ) // OKIM6295 samples
ROM_LOAD( "top.ic27", 0x040000, 0x80000, CRC(adb2f256) SHA1(ab7bb6683799203d0f46705f2fd241c6de914e77) ) // all banked
ROM_LOAD( "bottom.ic27", 0x0c0000, 0x80000, CRC(6ebeb9e4) SHA1(b547b2fbcc0a35d6183dd4f19684b04839690a2b) )
ROM_END
ROM_START( bjtwinpa )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "ic76.bin", 0x00000, 0x20000, CRC(81106d1e) SHA1(81c195173cf859f6266c160ee94ac4734edef085) )
ROM_LOAD16_BYTE( "ic75.bin", 0x00001, 0x20000, CRC(7c99b97f) SHA1(36e34b7a5bb876b7bbee46ace7acc03faeee211e) )
ROM_REGION( 0x010000, "fgtile", 0 )
ROM_LOAD( "ic35.bin", 0x000000, 0x010000, CRC(aa13df7c) SHA1(162d4f12364c68028e86fe97ee75c262daa4c699) ) // 8x8 tiles
ROM_REGION( 0x200000, "bgtile", 0 )
ROM_LOAD( "ic32_1.bin", 0x000000, 0x080000, CRC(e2d2b331) SHA1(d8fdbff497303a00fc866f0ef07ba74b369c0636) )
ROM_LOAD( "ic32_2.bin", 0x080000, 0x080000, CRC(28a3a845) SHA1(4daf71dce5e598ee7ee7e09bb08ec1b2f06f2b01) )
ROM_LOAD( "ic32_3.bin", 0x100000, 0x080000, CRC(ecce80c9) SHA1(ae7410f47e911988f654e78d585d78cf40e0ae5e) )
ROM_REGION( 0x100000, "sprites", 0 )
ROM_LOAD16_BYTE( "ic100_1.bin", 0x000000, 0x080000, CRC(2ea7e460) SHA1(b8dc13994ae2433fc7c38412c9ea6f10f945bca5) )
ROM_LOAD16_BYTE( "ic100_2.bin", 0x000001, 0x080000, CRC(ec85e1b7) SHA1(2f9a60ad2beb22d1b41dab7db3634b8e36cfce3e) )
ROM_REGION( 0x140000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD( "bottom.ic30", 0x040000, 0x80000, CRC(b5ef197f) SHA1(89d675f921dead585c2fef44105a7aea2f1f399c) ) // all banked
ROM_LOAD( "top.ic30", 0x0c0000, 0x80000, CRC(ab50531d) SHA1(918987f01a8b1b007721d2b365e2b2fc536bd676) )
ROM_REGION( 0x140000, "oki2", 0 ) // OKIM6295 samples
ROM_LOAD( "top.ic27", 0x040000, 0x80000, CRC(adb2f256) SHA1(ab7bb6683799203d0f46705f2fd241c6de914e77) ) // all banked
ROM_LOAD( "bottom.ic27", 0x0c0000, 0x80000, CRC(6ebeb9e4) SHA1(b547b2fbcc0a35d6183dd4f19684b04839690a2b) )
ROM_END
ROM_START( nouryoku )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "ic76.1", 0x00000, 0x40000, CRC(26075988) SHA1(c3d0eef0417be3f78008c026915fd7e2fd589563) )
ROM_LOAD16_BYTE( "ic75.2", 0x00001, 0x40000, CRC(75ab82cd) SHA1(fb828f87eebbe9d61766535efc18de9dfded110c) )
ROM_REGION( 0x010000, "fgtile", 0 )
ROM_LOAD( "ic35.3", 0x000000, 0x010000, CRC(03d0c3b1) SHA1(4d5427c324e2141d0a953cc5133d10b327827e0b) ) // 8x8 tiles
ROM_REGION( 0x200000, "bgtile", 0 )
ROM_LOAD( "ic32.4", 0x000000, 0x200000, CRC(88d454fd) SHA1(c79c48d9b3602266499a5dd0b15fd2fb032809be) ) // 8x8 tiles
ROM_REGION( 0x200000, "sprites", 0 )
ROM_LOAD16_WORD_SWAP( "ic100.5", 0x000000, 0x200000, CRC(24d3e24e) SHA1(71e38637953ec98bf308824aaef5628803aead21) ) // Sprites
ROM_REGION( 0x140000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD( "ic30.6", 0x040000, 0x100000, CRC(feea34f4) SHA1(bee467e74dbad497c6f5f6b38b7e52001e767012) ) // all banked
ROM_REGION( 0x140000, "oki2", 0 ) // OKIM6295 samples
ROM_LOAD( "ic27.7", 0x040000, 0x100000, CRC(8a69fded) SHA1(ee73f1789bcc672232606a4b3b28087fea1c5c69) ) // all banked
ROM_END
ROM_START( nouryokup )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "ic76.1", 0x00000, 0x40000, CRC(26075988) SHA1(c3d0eef0417be3f78008c026915fd7e2fd589563) )
ROM_LOAD16_BYTE( "ic75.2", 0x00001, 0x40000, CRC(75ab82cd) SHA1(fb828f87eebbe9d61766535efc18de9dfded110c) )
ROM_REGION( 0x010000, "fgtile", 0 )
ROM_LOAD( "ic35.3", 0x000000, 0x010000, CRC(03d0c3b1) SHA1(4d5427c324e2141d0a953cc5133d10b327827e0b) ) // 8x8 tiles
ROM_REGION( 0x200000, "bgtile", 0 )
ROM_LOAD( "bg0.u1.ic32", 0x000000, 0x080000, CRC(1fec8e14) SHA1(7c596a455f829f31a801ea3d9fbb6a63810436a6) )
ROM_LOAD( "bg1.u2.ic32", 0x080000, 0x080000, CRC(7b8ea3f0) SHA1(14722f7dcf5e86f32126ccb975f0a592c065f836) )
ROM_LOAD( "bg2.u3.ic32", 0x100000, 0x080000, CRC(6f4eb408) SHA1(7f10676b7263bdf0fd5cfc4e5449f932984d4eb3) )
ROM_LOAD( "bg3.u4.ic32", 0x180000, 0x080000, CRC(dea8c120) SHA1(c3f36fc0c97ee54f8ae3a55098c743980496eaa5) )
ROM_REGION( 0x200000, "sprites", 0 )
ROM_LOAD16_BYTE( "obj0even.u7.ic100", 0x000000, 0x080000, CRC(7966ce07) SHA1(231644bafd8970da2c57aeffc2fdaab60f4a512a) )
ROM_LOAD16_BYTE( "obj0odd.u6.ic100", 0x000001, 0x080000, CRC(d4913a08) SHA1(49082a71c71176ff0e122844a40ac4f893342e45) )
ROM_LOAD16_BYTE( "obj1even.u9.ic100", 0x100000, 0x080000, CRC(e01567e8) SHA1(69775752b61ce103d91e127f1fbf7c94b960b835) )
ROM_LOAD16_BYTE( "obj1odd.u8.ic100", 0x100001, 0x080000, CRC(4a383085) SHA1(45351eb67c90936e500b527e9f93c1f70b67bd9a) )
ROM_REGION( 0x140000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD("soundpcm0.bottom.ic30", 0x040000, 0x080000, CRC(34ded136) SHA1(00fe1d6327483bb9e73802beca3ce6d808a20ceb) )
ROM_LOAD("soundpcm1.top.ic30", 0x0c0000, 0x080000, CRC(a8d2abf7) SHA1(5619437e3e1f70f78cb2aeb2d619511be11e02e1) )
ROM_REGION( 0x140000, "oki2", 0 ) // OKIM6295 samples
ROM_LOAD("soundpcm2.top.ic27", 0x040000, 0x080000, CRC(29d0a15d) SHA1(a235eec225dd5006dd1f4e21d78fd647335f45dc) )
ROM_LOAD("soundpcm3.bottom.ic27", 0x0c0000, 0x080000, CRC(c764e749) SHA1(8399d3b6807bd263eee607c5625618d19688b394) )
ROM_END
ROM_START( manybloc )
ROM_REGION( 0x200000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "1-u33.bin", 0x00001, 0x20000, CRC(07473154) SHA1(e67f637e74dfe5f1be558f963c0b3225254afe33) )
ROM_LOAD16_BYTE( "2-u35.bin", 0x00000, 0x20000, CRC(04acd8c1) SHA1(3ef329e8d25565c7f7166f12137f4df5a057022f) )
ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80? CPU
ROM_LOAD( "3-u146.bin", 0x00000, 0x10000, CRC(7bf5fafa) SHA1(d17feca628775860d6c7019a9725bd40fbc5b7d7) )
ROM_REGION( 0x80000, "fgtile", 0 )
ROM_LOAD( "12-u39.bin", 0x000000, 0x10000, CRC(413b5438) SHA1(af366ce998ebe0d25255cc0cb1cd81689d3696ec) ) // 8x8 tiles
ROM_REGION( 0x80000, "bgtile", 0 )
ROM_LOAD( "5-u97.bin", 0x000000, 0x40000, CRC(536699e6) SHA1(13ec233f5e4f2a65ac7bc55511e988508269acd5) )
ROM_LOAD( "4-u96.bin", 0x040000, 0x40000, CRC(28af2640) SHA1(08fa57de66cf58fe2256455538261c2d05d27e1e) )
ROM_REGION( 0x080000, "sprites", 0 ) // 16x16 sprite tiles
ROM_LOAD16_BYTE( "8-u54b.bin", 0x000000, 0x20000, CRC(03eede77) SHA1(2476a488bb0d39790b2cc7f261ddb973378022ff) )
ROM_LOAD16_BYTE( "10-u86b.bin", 0x000001, 0x20000, CRC(9eab216f) SHA1(616f3ee2d06aa7151af634773a5e8633bff9588e) )
ROM_LOAD16_BYTE( "9-u53b.bin", 0x040000, 0x20000, CRC(dfcfa040) SHA1(f1561defe9746afdb1a5327d0a4435a6f3e87a77) )
ROM_LOAD16_BYTE( "11-u85b.bin", 0x040001, 0x20000, CRC(fe747dd5) SHA1(6ba57a45f4d77e2574de95d4a2f0718c601e7214) )
ROM_REGION( 0x80000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD( "6-u131.bin", 0x00000, 0x40000, CRC(79a4ae75) SHA1(f7609d0ca18b4af8c5f37daa1795a7a6c6d768ae) )
ROM_LOAD( "7-u132.bin", 0x40000, 0x40000, CRC(21db875e) SHA1(e1d96155b6d8825f7c449f276d02f9769258345d) ) // banked
ROM_REGION( 0x80000, "oki2", ROMREGION_ERASE00 ) // OKIM6295 samples
// empty
ROM_REGION( 0x0420, "proms", 0 )
ROM_LOAD( "u200.bpr", 0x0000, 0x0020, CRC(1823600b) SHA1(7011156ebcb815b176856bd67898ce655ea1b5ab) ) // unknown
ROM_LOAD( "u7.bpr", 0x0020, 0x0100, CRC(cfdbb86c) SHA1(588822f6308a860937349c9106c2b4b1a75823ec) ) // unknown
ROM_LOAD( "u10.bpr", 0x0120, 0x0200, CRC(8e9b569a) SHA1(1d8d633fbeb72d5e55ad4b282df02e9ca5e240eb) ) // unknown
ROM_LOAD( "u120.bpr", 0x0320, 0x0100, CRC(576c5984) SHA1(6e9b7f30de0d91cb766a62abc5888ec9af085a27) ) // unknown
ROM_END
/*
There are many gambling related strings in the Tom Tom Magic ROMs
An alt version is called Lucky Ball TomTom Magic, possibly that one is a gambling title and this isn't?
There is also known to exsist and alternate titled version called Tong Tong Magic
*/
ROM_START( tomagic )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000
ROM_LOAD16_BYTE( "4.bin", 0x00000, 0x40000, CRC(5055664a) SHA1(d078bd5ab30aedb760bf0a0237484fb56a51d759) )
ROM_LOAD16_BYTE( "3.bin", 0x00001, 0x40000, CRC(3731ecbb) SHA1(25814bd78902cc341cc9d6b19d0a6f837cd802c6) )
ROM_REGION( 0x20000, "audiocpu", 0 ) // Z80
ROM_LOAD( "2.bin", 0x00000, 0x20000, CRC(10359b6a) SHA1(ce59750d2fa57049c424c62e0cbefc604e224e78) )
ROM_REGION( 0x20000, "fgtile", 0 )
ROM_LOAD( "9.bin", 0x000000, 0x20000, CRC(fcceb24b) SHA1(49e3162c34dfa2ef54ffe190ba91bff73cebe12b) )
ROM_REGION( 0x80000, "bgtile", 0 )
ROM_LOAD( "10.bin", 0x000000, 0x80000, CRC(14ef466c) SHA1(02711bd44e146dc30d68cd199023834a63170b0f) )
ROM_REGION( 0x200000, "sprites", 0 ) // 16x16 sprite tiles
ROM_LOAD16_BYTE( "7.bin", 0x100001, 0x80000, CRC(0a297c78) SHA1(effe1ee2ab64cb9fbeae0d168346168245942034) )
ROM_LOAD16_BYTE( "5.bin", 0x100000, 0x80000, CRC(88ef65e0) SHA1(20b50ffe6a9a3c17f7c2cbf90461fafa7a7bcf8d) )
ROM_LOAD16_BYTE( "8.bin", 0x000001, 0x80000, CRC(1708d3fb) SHA1(415b6a5079fced0306213953e6124ad4fecc680b) )
ROM_LOAD16_BYTE( "6.bin", 0x000000, 0x80000, CRC(83ae90ba) SHA1(84b0779d18dabcb6086880433b1c4620dcc722cb) )
ROM_REGION( 0x80000, "oki1", 0 ) // OKIM6295 samples
ROM_LOAD( "1.bin", 0x00000, 0x40000, CRC(02b042e3) SHA1(05fca0f83292be49cef457633aba36fed3dc0114) )
// & undumped PROMs - N82S123N, N82S129N & N82S147AN
ROM_END
/***************************************************************************
Stagger I
(AFEGA 1998)
Parts:
1 MC68HC000P10
1 Z80
2 Lattice ispLSI 1032E
***************************************************************************/
ROM_START( stagger1 ) // Japan only, with later (c) year of 1998
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "2.bin", 0x000000, 0x020000, CRC(8555929b) SHA1(b405d81c2a45191111b1a4458ac6b5c0a129b8f1) )
ROM_LOAD16_BYTE( "3.bin", 0x000001, 0x020000, CRC(5b0b63ac) SHA1(239f793b6845a88d1630da790a2762da730a450d) )
ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "1.bin", 0x00000, 0x10000, CRC(5d8cf28e) SHA1(2a440bf5136f95af137b6688e566a14e65be94b1) )
ROM_REGION( 0x100000, "sprites", 0 ) // Sprites, 16x16x4
ROM_LOAD16_BYTE( "7.bin", 0x00000, 0x80000, CRC(048f7683) SHA1(7235b7dcfbb72abf44e60b114e3f504f16d29ebf) )
ROM_LOAD16_BYTE( "6.bin", 0x00001, 0x80000, CRC(051d4a77) SHA1(664182748e72b3e44202caa20f337d02e946ca62) )
ROM_REGION( 0x080000, "bgtile", 0 ) // Layer 0, 16x16x4
ROM_LOAD( "4.bin", 0x00000, 0x80000, CRC(46463d36) SHA1(4265bc4d24ff64e39d9273965701c740d7e3fee0) )
ROM_REGION( 0x00100, "fgtile", ROMREGION_ERASEFF ) // Layer 1, 8x8x4
// Unused
ROM_REGION( 0x40000, "oki1", 0 ) // Samples
ROM_LOAD( "5", 0x00000, 0x40000, CRC(e911ce33) SHA1(a29c4dea98a22235122303325c63c15fadd3431d) )
ROM_END
/***************************************************************************
Red Hawk (c)1997 Afega
CPU: MC68HC000P10 (68000)
Sound: Z0840006PSC (Z80)
AD-65 rebadged OKI M6295
PD2001 rebadged YM2151, 24 pin DIP
KA3002 rebadged YM3012, 16 pin DIP
OSC: 12.000MHz & 4.000MHz
RAM: GM76C256CLL-70 x 6, HT6116-70 x 5, GM76C88AL-12 X 2
Dips: 2 x 8 position
Other: Lattice pLSI 1032 x 2
GAL22V10B x 2, GAL16V8B
+-----------------------------------------+
| 6116 YM3012 YM2151 M6295 5 4MHz |
|VOL 1 |
| Z80 pLSI1032 4 |
| 76C88 |
|J 6116 76C256 76C88 |
|A 6116 76C256 |
|M 2 76C256 76C256 |
|M 3 76C256 76C256 GAL |
|A SW1 |
| 68000-10 6116 |
| 6116 |
| 6 |
| SW2 pLSI1032 7 |
| 12MHz GAL GAL |
+-----------------------------------------+
***************************************************************************/
void afega_state::init_redhawk()
{
decryptcode( machine(), 23, 22, 21, 20, 19, 18, 16, 15, 14, 17, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 );
}
ROM_START( redhawk ) // U.S.A., Canada & South America, (c) 1997
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "2", 0x000000, 0x020000, CRC(3ef5f326) SHA1(e89c7c24a05886a14995d7c399958dc00ad35d63) )
ROM_LOAD16_BYTE( "3", 0x000001, 0x020000, CRC(9b3a10ef) SHA1(d03480329b23474e5a9e42a75b09d2140eed4443) )
ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "1.bin", 0x00000, 0x10000, CRC(5d8cf28e) SHA1(2a440bf5136f95af137b6688e566a14e65be94b1) )
ROM_REGION( 0x100000, "sprites", 0 ) // Sprites, 16x16x4
ROM_LOAD16_BYTE( "6", 0x000001, 0x080000, CRC(61560164) SHA1(d727ab2d037dab40745dec9c4389744534fdf07d) )
ROM_LOAD16_BYTE( "7", 0x000000, 0x080000, CRC(66a8976d) SHA1(dd9b89cf29eb5557845599d55ef3a15f53c070a4) )
ROM_REGION( 0x080000, "bgtile", 0 ) // Layer 0, 16x16x8
ROM_LOAD( "4", 0x000000, 0x080000, CRC(d6427b8a) SHA1(556de1b5ce29d1c3c54bb315dcaa4dd0848ca462) )
ROM_REGION( 0x00100, "fgtile", ROMREGION_ERASEFF ) // Layer 1, 8x8x4
// Unused
ROM_REGION( 0x40000, "oki1", 0 ) // Samples
ROM_LOAD( "5", 0x00000, 0x40000, CRC(e911ce33) SHA1(a29c4dea98a22235122303325c63c15fadd3431d) )
ROM_END
ROM_START( redhawke ) // Excellent Co., Ldt license (no code scramble), (c) 1997
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "rhawk2.bin", 0x000000, 0x020000, CRC(6d2e23b4) SHA1(54579d460844e022ab61f32bfec28f00f2d27140) )
ROM_LOAD16_BYTE( "rhawk3.bin", 0x000001, 0x020000, CRC(5e0d6188) SHA1(c6ce8a3adf940893fcb6281348fdb0cdd65fe654) )
ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "1.bin", 0x00000, 0x10000, CRC(5d8cf28e) SHA1(2a440bf5136f95af137b6688e566a14e65be94b1) )
ROM_REGION( 0x100000, "sprites", 0 ) // Sprites, 16x16x4
ROM_LOAD16_BYTE( "rhawk6.bin", 0x000001, 0x080000, CRC(3f980ab6) SHA1(2b9202555f09d99e3575123dfed415bfd815bb2e) )
ROM_LOAD16_BYTE( "rhawk7.bin", 0x000000, 0x080000, CRC(0264ef54) SHA1(1124007538161dfc582f9c7692a20cdee459720c) )
ROM_REGION( 0x080000, "bgtile", 0 ) // Layer 0, 16x16x8
ROM_LOAD( "rhawk4.bin", 0x000000, 0x080000, CRC(d79aa288) SHA1(b8598ab77d2019e5943b22f551e0a38eee5e52b6) )
ROM_REGION( 0x00100, "fgtile", ROMREGION_ERASEFF ) // Layer 1, 8x8x4
// Unused
ROM_REGION( 0x40000, "oki1", 0 ) // Samples
ROM_LOAD( "5", 0x00000, 0x40000, CRC(e911ce33) SHA1(a29c4dea98a22235122303325c63c15fadd3431d) )
ROM_END
void afega_state::init_redhawki()
{
decryptcode( machine(), 23, 22, 21, 20, 19, 18, 15, 16, 17, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 );
}
ROM_START( redhawki )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "rhit-2.bin", 0x000000, 0x020000, CRC(30cade0e) SHA1(2123ca858bcaed5165739107ccc2830561af0b38) )
ROM_LOAD16_BYTE( "rhit-3.bin", 0x000001, 0x020000, CRC(37dbb3c2) SHA1(d1f8258f357b885d38f87d288f98046dbd7d56aa) )
ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "1.bin", 0x00000, 0x10000, CRC(5d8cf28e) SHA1(2a440bf5136f95af137b6688e566a14e65be94b1) )
ROM_REGION( 0x100000, "sprites", 0 ) // Sprites, 16x16x4
ROM_LOAD16_BYTE( "rhit-6.bin", 0x000001, 0x080000, CRC(7cbd5c60) SHA1(69bd728861ea5a02f514d5aed837b549f3c86019) )
ROM_LOAD16_BYTE( "rhit-7.bin", 0x000000, 0x080000, CRC(bcb367c7) SHA1(a8f0527bf75a227cdfd98385549892fb16330aea) )
ROM_REGION( 0x080000, "bgtile", 0 ) // Layer 0, 16x16x8
ROM_LOAD( "rhit-4.bin", 0x000000, 0x080000, CRC(aafb3cc4) SHA1(b5f6608c1e05470fdfb22e0a35a8a74974c4d3cf) )
ROM_REGION( 0x00100, "fgtile", ROMREGION_ERASEFF ) // Layer 1, 8x8x4
// Unused
ROM_REGION( 0x40000, "oki1", 0 ) // Samples
ROM_LOAD( "5", 0x00000, 0x40000, CRC(e911ce33) SHA1(a29c4dea98a22235122303325c63c15fadd3431d) )
ROM_END
ROM_START( redhawks )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "2.bin", 0x000000, 0x020000, CRC(8b427ef8) SHA1(ba615b1a5ed9c1a97bb0b6d121a0d752d138adee) )
ROM_LOAD16_BYTE( "3.bin", 0x000001, 0x020000, CRC(117e3813) SHA1(415b115a96f139094b5927637c5ec8438cc9bd44) )
ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "1.bin", 0x00000, 0x10000, CRC(5d8cf28e) SHA1(2a440bf5136f95af137b6688e566a14e65be94b1) )
ROM_REGION( 0x100000, "sprites", 0 ) // Sprites, 16x16x4
ROM_LOAD16_BYTE( "6.bin", 0x000001, 0x080000, CRC(aa6564e6) SHA1(f8335cddc0bb0674e86ccaca079ca828ed7a6790) )
ROM_LOAD16_BYTE( "7.bin", 0x000000, 0x080000, CRC(5c5b5fa1) SHA1(41946d763f9d72a6322a2f7e3c54a9f6114afe01) )
ROM_REGION( 0x080000, "bgtile", 0 ) // Layer 0, 16x16x8
ROM_LOAD( "4.bin", 0x000000, 0x080000, CRC(03a8d952) SHA1(44252f90e21d6f3841bcdcdac0aba318f94e33b0) )
ROM_REGION( 0x00100, "fgtile", ROMREGION_ERASEFF ) // Layer 1, 8x8x4
// Unused
ROM_REGION( 0x40000, "oki1", 0 ) // Samples
ROM_LOAD( "5.bin", 0x00000, 0x40000, CRC(e911ce33) SHA1(a29c4dea98a22235122303325c63c15fadd3431d) )
ROM_REGION( 0x300, "proms", 0 ) // Bipolar PROMs, not dumped
ROM_LOAD( "n82s147an.bin", 0x000, 0x200, NO_DUMP )
ROM_LOAD( "n82s129n.bin", 0x200, 0x100, NO_DUMP )
ROM_REGION( 0x26e, "plds", 0 ) // PLDs, not dumped
ROM_LOAD( "gal16v8d.bin", 0x000, 0x117, NO_DUMP )
ROM_LOAD( "gal20v8b.bin", 0x117, 0x157, NO_DUMP )
ROM_END
void afega_state::init_redhawkg()
{
decryptcode( machine(), 23, 22, 21, 20, 19, 18, 15, 14, 16, 17, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 );
}
ROM_START( redhawkg ) // original Afega PCB with Delta Coin sticker
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "2.bin", 0x000000, 0x020000, CRC(ccd459eb) SHA1(677b03f1e3973f0e1f09272d336c2dd9da8f843c) )
ROM_LOAD16_BYTE( "3.bin", 0x000001, 0x020000, CRC(483802fd) SHA1(4ec2b15bc89c12806dab78ae30f5fe24e26d46eb) )
ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "1.bin", 0x00000, 0x10000, CRC(5d8cf28e) SHA1(2a440bf5136f95af137b6688e566a14e65be94b1) )
ROM_REGION( 0x100000, "sprites", 0 ) // Sprites, 16x16x4
ROM_LOAD16_BYTE( "6.bin", 0x000001, 0x080000, CRC(710c9e3c) SHA1(0fcefffa5334554729d5c278bceb48ba66921361) )
ROM_LOAD16_BYTE( "7.bin", 0x000000, 0x080000, CRC(a28c8454) SHA1(c4e14d18c24de73da196230f8ea824300d53e64d) )
ROM_REGION( 0x080000, "bgtile", 0 ) // Layer 0, 16x16x8
ROM_LOAD( "4.bin", 0x000000, 0x080000, CRC(aafb3cc4) SHA1(b5f6608c1e05470fdfb22e0a35a8a74974c4d3cf) )
ROM_REGION( 0x00100, "fgtile", ROMREGION_ERASEFF ) // Layer 1, 8x8x4
// Unused
ROM_REGION( 0x40000, "oki1", 0 ) // Samples
ROM_LOAD( "5", 0x00000, 0x40000, CRC(e911ce33) SHA1(a29c4dea98a22235122303325c63c15fadd3431d) )
ROM_END
ROM_START( redhawkb )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "rhb-1.bin", 0x000000, 0x020000, CRC(e733ea07) SHA1(b1ffeda633d5e701f0e97c79930a54d7b89a85c5) )
ROM_LOAD16_BYTE( "rhb-2.bin", 0x000001, 0x020000, CRC(f9fa5684) SHA1(057ea3eebbaa1a208a72beef21b9368df7032ce1) )
ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "1.bin", 0x00000, 0x10000, CRC(5d8cf28e) SHA1(2a440bf5136f95af137b6688e566a14e65be94b1) )
ROM_REGION( 0x100000, "sprites", 0 ) // Sprites, 16x16x4
ROM_LOAD( "rhb-3.bin", 0x000000, 0x080000, CRC(0318d68b) SHA1(c773de7b6f9c706e62349dc73af4339d1a3f9af6) )
ROM_LOAD( "rhb-4.bin", 0x080000, 0x080000, CRC(ba21c1ef) SHA1(66b0dee67acb5b3a21c7dba057be4093a92e10a9) )
ROM_REGION( 0x080000, "bgtile", 0 ) // Layer 0, 16x16x8
ROM_LOAD( "rhb-5.bin", 0x000000, 0x080000, CRC(d0eaf6f2) SHA1(6e946e13b06df897a63e885c9842816ec908a709) )
ROM_REGION( 0x080000, "fgtile", ROMREGION_ERASEFF ) // Layer 1, 8x8x4
ROM_REGION( 0x40000, "oki1", 0 ) // Samples
ROM_LOAD( "5", 0x00000, 0x40000, CRC(e911ce33) SHA1(a29c4dea98a22235122303325c63c15fadd3431d) )
ROM_END
ROM_START( redhawkk )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "2", 0x000000, 0x020000, CRC(8c02e81d) SHA1(e79b0369adfe4111d7596df5270c1db8e3618ce5) )
ROM_LOAD16_BYTE( "3", 0x000001, 0x020000, CRC(ab3597ee) SHA1(e9a2e085fa24cb2f500600b84ce2fe3924cf0827) )
ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "1", 0x00000, 0x10000, CRC(5d8cf28e) SHA1(2a440bf5136f95af137b6688e566a14e65be94b1) )
ROM_REGION( 0x100000, "sprites", 0 ) // Sprites, 16x16x4
ROM_LOAD16_BYTE( "6", 0x000001, 0x080000, CRC(6a0b8224) SHA1(07e68a6d13534ff51964d5abeb991508e8c8ea1a) )
ROM_LOAD16_BYTE( "7", 0x000000, 0x080000, CRC(f4fa8211) SHA1(c3fed284127c9f837ab6cbd41d89ad827b423c9e) )
ROM_REGION( 0x080000, "bgtile", 0 ) // Layer 0, 16x16x8
ROM_LOAD( "4", 0x000000, 0x080000, CRC(6255d6a1) SHA1(dcde3149c15717d624ca184454703a15db54bcde) )
ROM_REGION( 0x080000, "fgtile", ROMREGION_ERASEFF ) // Layer 1, 8x8x4
ROM_REGION( 0x40000, "oki1", 0 ) // Samples
ROM_LOAD( "5", 0x00000, 0x40000, CRC(e911ce33) SHA1(a29c4dea98a22235122303325c63c15fadd3431d) )
ROM_END
/***************************************************************************
Guardian Storm / Sen Jin - Guardian Storm
(C) Afega 1998
CPU: 68HC000FN10 (68000, 68 pin PLCC)
Sound: Z84C000FEC (Z80, 44 pin PQFP), AD-65 (OKI M6295),
BS901 (YM2151, 24 pin DIP), BS901 (YM3012, 16 pin DIP)
OSC: 12.000MHz (near 68000), 4.000MHz (Near Z84000)
RAM: LH52B256-70LL x 6, HM61S16 x 7, UM6264BK-10L X 2 (6264* on some boards are 52B256)
Dips: 2 x 8 position
Other: AFEGA AFI-GFSK (68 pin PLCC, located next to 68000)
AFEGA AFI-GFLK (208 pin PQFP)
+-------------------------------------------------------------+
| YM3012 4MHz |
| AD-65 AFEGA1.U95 +-------+ +-------+ AFEGA4.U112|
| VOL YM2151 | AFEGA | |MC68000| |
+-+ 6116 Z80 |AF1-GFS| | FN10 | AFEGA5.U107|
| AFEGA7.U92 | | | | |
+-+ AFEGA1.U4 +-------+ +-------+ 52B256 |
| 6116 6116 |
|J 6116 6116 12MHz 52B256 |
|A |
|M 6116 |
|M 6116 |
|A +--------+ 52B256 |
| | | |
+-+ 6264* | AFEGA | 52B256 |
| |AF1-GFLK| AF1-SP.UC13 |
+-+ 6264* | | 52B256 AF1-B2.UC8 |
| +--------+ AF1-B1.UC3 |
| 52B256 |
| |
+-------------------------------------------------------------+
ROMS:
AFEGA7.U92 27C512 - Z80 sound CPU code
AFEGA1.U95 27C020 - OKI M6295 sound samples
AFEGA1.U4 27C512 - Graphics / text Layer
AFEGA4.U112 27C020 + M68000 program code
AFEGA5.U107 27C020 |
AFEGA3.UC13 ST M27C160 - Sprites
AF1-B2.UC8 mask ROM read as 27C160 - Backgrounds
AF1-B1.UC3 mask ROM read as 27C160 - Backgrounds
ROMS for Sen Jin:
AFEGA7.U92 27C512 - Z80 sound CPU code
AFEGA1.U95 27C2000 - OKI M6295 sound samples
GST-03.U4 27C512 - Graphics / text Layer
GST-04.U112 27C2000 + M68000 program code
GST-05.U107 27C2000 |
AF1-SP.UC13 mask ROM read as 27C160 - Sprites
AF1-B2.UC8 mask ROM read as 27C160 - Backgrounds
AF1-B1.UC3 mask ROM read as 27C160 - Backgrounds
***************************************************************************/
void afega_state::init_grdnstrm()
{
decryptcode( machine(), 23, 22, 21, 20, 19, 18, 16, 17, 14, 15, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 );
}
ROM_START( grdnstrm )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "afega4.u112", 0x000000, 0x040000, CRC(2244713a) SHA1(41ae66a38931c12462ecae53e1e44c3420d0d235) )
ROM_LOAD16_BYTE( "afega5.u107", 0x000001, 0x040000, CRC(5815c806) SHA1(f6b7809b2e3b29b89289ecc994909434fe34e10d) )
ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "afega7.u92", 0x00000, 0x10000, CRC(5d8cf28e) SHA1(2a440bf5136f95af137b6688e566a14e65be94b1) ) // mask ROM (read as 27C020)
ROM_REGION( 0x200000, "sprites", 0 ) // Sprites, 16x16x4
ROM_LOAD( "afega3.uc13", 0x000000, 0x200000, CRC(0218017c) SHA1(5a8a4f07cd3f9dcf62455ddaceaec0cfba8c2de9) ) // ST M27C160 EPROM
ROM_REGION( 0x400000, "bgtile", 0 ) // Layer 0, 16x16x8
ROM_LOAD( "afega_af1-b2.uc8", 0x000000, 0x200000, CRC(d68588c2) SHA1(c5f397d74a6ecfd2e375082f82e37c5a330fba62) ) // mask ROM (read as 27C160)
ROM_LOAD( "afega_af1-b1.uc3", 0x200000, 0x200000, CRC(f8b200a8) SHA1(a6c43dd57b752d87138d7125b47dc0df83df8987) ) // mask ROM (read as 27C160)
ROM_REGION( 0x10000, "fgtile", 0 ) // Layer 1, 8x8x4
ROM_LOAD( "afega1.u4", 0x00000, 0x10000, CRC(9e7ef086) SHA1(db086bb2ceb11f3e24548aa131cc74fe79a2b516) )
ROM_REGION( 0x40000, "oki1", 0 ) // Samples
ROM_LOAD( "afega1.u95", 0x00000, 0x40000, CRC(e911ce33) SHA1(a29c4dea98a22235122303325c63c15fadd3431d) )
ROM_END
ROM_START( grdnstrmk )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "gst-04.u112", 0x000000, 0x040000, CRC(922c931a) SHA1(1d1511033c8c424535a73f5c5bf58560a8b1842e) )
ROM_LOAD16_BYTE( "gst-05.u107", 0x000001, 0x040000, CRC(d22ca2dc) SHA1(fa21c8ec804570d64f4b167b7f65fd5811435e46) )
ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "afega7.u92", 0x00000, 0x10000, CRC(5d8cf28e) SHA1(2a440bf5136f95af137b6688e566a14e65be94b1) )
ROM_REGION( 0x200000, "sprites", 0 ) // Sprites, 16x16x4
ROM_LOAD( "afega_af1-sp.uc13", 0x000000, 0x200000, CRC(7d4d4985) SHA1(15c6c1aecd3f12050c1db2376f929f1a26a1d1cf) ) // mask ROM (read as 27C160)
ROM_REGION( 0x400000, "bgtile", 0 ) // Layer 0, 16x16x8
ROM_LOAD( "afega_af1-b2.uc8", 0x000000, 0x200000, CRC(d68588c2) SHA1(c5f397d74a6ecfd2e375082f82e37c5a330fba62) ) // mask ROM (read as 27C160)
ROM_LOAD( "afega_af1-b1.uc3", 0x200000, 0x200000, CRC(f8b200a8) SHA1(a6c43dd57b752d87138d7125b47dc0df83df8987) ) // mask ROM (read as 27C160)
ROM_REGION( 0x10000, "fgtile", 0 ) // Layer 1, 8x8x4
ROM_LOAD( "gst-03.u4", 0x00000, 0x10000, CRC(a1347297) SHA1(583f4da991eeedeb523cf4fa3b6900d40e342063) )
ROM_REGION( 0x40000, "oki1", 0 ) // Samples
ROM_LOAD( "afega1.u95", 0x00000, 0x40000, CRC(e911ce33) SHA1(a29c4dea98a22235122303325c63c15fadd3431d) )
ROM_END
ROM_START( grdnstrmj )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "afega_3.u112", 0x000000, 0x040000, CRC(e51a35fb) SHA1(acb733d0e5c9c54477d0475a64f53d68a84218c6) )
ROM_LOAD16_BYTE( "afega_4.u107", 0x000001, 0x040000, CRC(cb10aa54) SHA1(bb0cb837b5651df4ff8f215854353631a39b730c) )
ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "afega7.u92", 0x00000, 0x10000, CRC(5d8cf28e) SHA1(2a440bf5136f95af137b6688e566a14e65be94b1) )
ROM_REGION( 0x200000, "sprites", 0 ) // Sprites, 16x16x4
ROM_LOAD( "afega_af1-sp.uc13", 0x000000, 0x200000, CRC(7d4d4985) SHA1(15c6c1aecd3f12050c1db2376f929f1a26a1d1cf) ) // mask ROM (read as 27C160)
ROM_REGION( 0x400000, "bgtile", 0 ) // Layer 0, 16x16x8
ROM_LOAD( "afega_af1-b2.uc8", 0x000000, 0x200000, CRC(d68588c2) SHA1(c5f397d74a6ecfd2e375082f82e37c5a330fba62) ) // mask ROM (read as 27C160)
ROM_LOAD( "afega_af1-b1.uc3", 0x200000, 0x200000, CRC(f8b200a8) SHA1(a6c43dd57b752d87138d7125b47dc0df83df8987) ) // mask ROM (read as 27C160)
ROM_REGION( 0x10000, "fgtile", 0 ) // Layer 1, 8x8x4
ROM_LOAD( "gst-03.u4", 0x00000, 0x10000, CRC(a1347297) SHA1(583f4da991eeedeb523cf4fa3b6900d40e342063) )
ROM_REGION( 0x40000, "oki1", 0 ) // Samples
ROM_LOAD( "afega1.u95", 0x00000, 0x40000, CRC(e911ce33) SHA1(a29c4dea98a22235122303325c63c15fadd3431d) )
ROM_END
ROM_START( grdnstrmv ) // Apples Industries license - Vertical version
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "afega2.u112", 0x000000, 0x040000, CRC(16d41050) SHA1(79b6621dccb286e5adf60c40690083a37746a4f9) )
ROM_LOAD16_BYTE( "afega3.u107", 0x000001, 0x040000, CRC(05920a99) SHA1(ee77da303d6b766c529c426a836777827ac31676) )
ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "afega7.u92", 0x00000, 0x10000, CRC(5d8cf28e) SHA1(2a440bf5136f95af137b6688e566a14e65be94b1) ) // mask ROM (read as 27C020)
ROM_REGION( 0x200000, "sprites", 0 ) // Sprites, 16x16x4
ROM_LOAD( "afega6.uc13", 0x000000, 0x200000, CRC(9b54ff84) SHA1(9e120d85cf2fa899e6426dcb4302c8051746facc) ) // ST M27C160 EPROM
ROM_REGION( 0x400000, "bgtile", 0 ) // Layer 0, 16x16x8
ROM_LOAD( "afega_af1-b2.uc8", 0x000000, 0x200000, CRC(d68588c2) SHA1(c5f397d74a6ecfd2e375082f82e37c5a330fba62) ) // mask ROM (read as 27C160)
ROM_LOAD( "afega_af1-b1.uc3", 0x200000, 0x200000, CRC(f8b200a8) SHA1(a6c43dd57b752d87138d7125b47dc0df83df8987) ) // mask ROM (read as 27C160)
ROM_REGION( 0x10000, "fgtile", 0 ) // Layer 1, 8x8x4
ROM_LOAD( "afega1.u4", 0x00000, 0x10000, CRC(9e7ef086) SHA1(db086bb2ceb11f3e24548aa131cc74fe79a2b516) )
ROM_REGION( 0x40000, "oki1", 0 ) // Samples
ROM_LOAD( "afega1.u95", 0x00000, 0x40000, CRC(e911ce33) SHA1(a29c4dea98a22235122303325c63c15fadd3431d) )
ROM_END
void afega_state::init_grdnstrmg()
{
decryptcode( machine(), 23, 22, 21, 20, 19, 18, 13, 16, 15, 14, 17, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 );
}
ROM_START( grdnstrmg ) // Germany
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "gs5_c1.uc1", 0x000001, 0x040000, CRC(c0263e4a) SHA1(8cae60bd59730aaba215f825016a780eced3a12d) )
ROM_LOAD16_BYTE( "gs6_c2.uc9", 0x000000, 0x040000, CRC(ea363e4d) SHA1(2958dcddc409a11006beb52485975689182f3677) )
ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "gs1_s1.uc14", 0x00000, 0x10000, CRC(5d8cf28e) SHA1(2a440bf5136f95af137b6688e566a14e65be94b1) ) //
ROM_REGION( 0x200000, "sprites", 0 ) // Sprites, 16x16x4
ROM_LOAD16_BYTE( "gs8_br3.uc10", 0x000001, 0x080000, CRC(7b42a57a) SHA1(f45d9d86bc0388bbf220633e59f7a749c42e9046) )
ROM_LOAD16_BYTE( "gs7_br1.uc3", 0x000000, 0x080000, CRC(e6794265) SHA1(39a6ebf2377aaf3a10b4c9c51607d81599eec35d) )
ROM_LOAD16_BYTE( "gs10_br4.uc11",0x100001, 0x080000, CRC(1d3b57e1) SHA1(a2da598d6cbe257de5b66905a5ad9de90711ccc7) )
ROM_LOAD16_BYTE( "gs9_br2.uc4", 0x100000, 0x080000, CRC(4d2c220b) SHA1(066067f7e80973ba0483559ac04f99292cc82dce) )
// some other sets have larger regions here because they contain 2 sets of tiles in the ROMs, one for each orientation.
// this set only contains the tile data for the required orientation.
ROM_REGION( 0x200000, "bgtile", 0 ) // Layer 0, 16x16x8
ROM_LOAD( "gs10_cr5.uc15", 0x000000, 0x080000, CRC(2c8c23e3) SHA1(4c1a460dfc250f9aea77e2ddd82278ee816365be) )
ROM_LOAD( "gs4_cr7.uc19", 0x080000, 0x080000, CRC(c3f6c908) SHA1(37873e28ca337d97ce301a4f79668fad8e6fca66) )
ROM_LOAD( "gs8_cr1.uc6", 0x100000, 0x080000, CRC(dc0125f0) SHA1(f215b53378ec0366b1dc1614f19a67288ff7a865) )
ROM_LOAD( "gs9_cr3.uc12", 0x180000, 0x080000, CRC(d8a0636b) SHA1(d278a4a19e6573e5aa02486a9b68b2e147b7b292) )
ROM_REGION( 0x10000, "fgtile", 0 ) // Layer 1, 8x8x4
ROM_LOAD( "gs3_t1.uc2", 0x00000, 0x10000, CRC(88c423ef) SHA1(44e000f38312a1775a1207fd553eac1fe0f5e089) )
ROM_REGION( 0x40000, "oki1", 0 ) // Samples
ROM_LOAD( "gs2_s2.uc18", 0x00000, 0x40000, CRC(e911ce33) SHA1(a29c4dea98a22235122303325c63c15fadd3431d) ) //
ROM_END
void afega_state::init_grdnstrmau()
{
decryptcode( machine(), 23, 22, 21, 20, 19, 18, 13, 16, 14, 15, 17, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 );
}
ROM_START( grdnstrmau )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "uc9_27c020.10", 0x000000, 0x040000, CRC(548932b4) SHA1(c90c7e769235d12b07b24deac436202c650cf3e8) )
ROM_LOAD16_BYTE( "uc1_27c020.9", 0x000001, 0x040000, CRC(269e2fbc) SHA1(17c3511a44f044927c23f2e5bb8e75c29e3fbcc2) )
ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "uc14_27c512.8", 0x00000, 0x10000, CRC(5d8cf28e) SHA1(2a440bf5136f95af137b6688e566a14e65be94b1) )
ROM_REGION( 0x200000, "sprites", 0 ) // Sprites, 16x16x4
ROM_LOAD16_BYTE( "uc3_27c040.8", 0x000000, 0x80000, CRC(9fc36932) SHA1(bc1617b1c4452114171b0d4fc4478346e8db4e00) )
ROM_LOAD16_BYTE( "uc10_27c040.9", 0x000001, 0x80000, CRC(6e809d09) SHA1(c884b387a30930df7cd60b9bd80431577de9f356) )
ROM_LOAD16_BYTE( "uc4_27c040.10", 0x100000, 0x80000, CRC(73bd6451) SHA1(a620d115f9c1b33f2c37a5263d6e53255af87cfb) )
ROM_LOAD16_BYTE( "uc11_27c040.8", 0x100001, 0x80000, CRC(e699a3c9) SHA1(db9337581a8231c72c8dd5e05b0a35121c3a1552) )
ROM_REGION( 0x200000, "bgtile", 0 ) // Layer 0, 16x16x8
ROM_LOAD( "uc15_27c040.10", 0x000000, 0x80000, CRC(0822f7e0) SHA1(b6ce51bbeeea021d4f8678e35df4e14166bd4d8b) )
ROM_LOAD( "uc19_27c040.8", 0x080000, 0x80000, CRC(fa078e35) SHA1(e65175cc5a5e7214068b3f4686e37b872396424d) )
ROM_LOAD( "uc6_27c040.9", 0x100000, 0x80000, CRC(ec288b95) SHA1(59e3728ce553d1af81bd023700669345b114c8e3) )
ROM_LOAD( "uc12_27c040.10", 0x180000, 0x80000, CRC(a9ceec33) SHA1(d4f76f7a8203755fe756a9e17100f830db34eaab) )
ROM_REGION( 0x10000, "fgtile", 0 ) // Layer 1, 8x8x4
ROM_LOAD( "uc2_27c512.9", 0x00000, 0x10000, CRC(b38d8446) SHA1(b2c8efb3db71b7428fcadc0d7098f8bc77dd6670) )
ROM_REGION( 0x40000, "oki1", 0 ) // Samples
ROM_LOAD( "uc18_27c020.9", 0x00000, 0x40000, CRC(e911ce33) SHA1(a29c4dea98a22235122303325c63c15fadd3431d) )
ROM_END
// 紅狐戰機 II (Hóng Hú Zhànjī II)
ROM_START( redfoxwp2 )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "u112", 0x000000, 0x040000, CRC(3f31600b) SHA1(6c56e36178effb60ec27dfcd205393e2cfac4ed6) ) // No label
ROM_LOAD16_BYTE( "u107", 0x000001, 0x040000, CRC(daa44ab4) SHA1(7edaf8c7383dd31250478aeebc3247c525c75fef) ) // No label
ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "u92", 0x00000, 0x10000, CRC(864b55c2) SHA1(43475b05e35549ad301c3d4a25d4f4f0bcbe3f2c) ) // Winbond W27E512-12 with no label
ROM_REGION( 0x200000, "sprites", 0 ) // Sprites, 16x16x4
ROM_LOAD( "afega_af1-sp.uc13", 0x000000, 0x200000, CRC(7d4d4985) SHA1(15c6c1aecd3f12050c1db2376f929f1a26a1d1cf) ) // mask ROM (read as 27C160)
ROM_REGION( 0x400000, "bgtile", 0 ) // Layer 0, 16x16x8
ROM_LOAD( "afega_af1-b2.uc8", 0x000000, 0x200000, CRC(d68588c2) SHA1(c5f397d74a6ecfd2e375082f82e37c5a330fba62) ) // mask ROM (read as 27C160)
ROM_LOAD( "afega_af1-b1.uc3", 0x200000, 0x200000, CRC(f8b200a8) SHA1(a6c43dd57b752d87138d7125b47dc0df83df8987) ) // mask ROM (read as 27C160)
ROM_REGION( 0x10000, "fgtile", 0 ) // Layer 1, 8x8x4
ROM_LOAD( "u4", 0x00000, 0x10000, CRC(19239401) SHA1(7876335dd97418bd9130dc894a517f3ceca20135) ) // Winbond W27E512-12 with no label
ROM_REGION( 0x40000, "oki1", 0 ) // Samples
ROM_LOAD( "afega1.u95", 0x00000, 0x40000, CRC(e911ce33) SHA1(a29c4dea98a22235122303325c63c15fadd3431d) )
ROM_END
void afega_state::init_redfoxwp2a()
{
decryptcode( machine(), 23, 22, 21, 20, 19, 18, 16, 17, 13, 14, 15, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 );
}
// 紅狐戰機 II (Hóng Hú Zhànjī II)
ROM_START( redfoxwp2a )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "afega_4.u112", 0x000000, 0x040000, CRC(e6e6682a) SHA1(1a70ca3881b4ecc6d329814ff1fdafce16550ca2) )
ROM_LOAD16_BYTE( "afega_5.u107", 0x000001, 0x040000, CRC(2faa2ed6) SHA1(c6ca3ca0cff85379007a44648c6de87864095c2e) )
ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "afega_1.u92", 0x00000, 0x10000, CRC(5d8cf28e) SHA1(2a440bf5136f95af137b6688e566a14e65be94b1) )
ROM_REGION( 0x200000, "sprites", 0 ) // Sprites, 16x16x4 // not dumped, it is correct?
ROM_LOAD( "afega_af1-sp.uc13", 0x000000, 0x200000, CRC(7d4d4985) SHA1(15c6c1aecd3f12050c1db2376f929f1a26a1d1cf) )
ROM_REGION( 0x400000, "bgtile", 0 ) // Layer 0, 16x16x8 // not dumped, it is correct?
ROM_LOAD( "afega_af1-b2.uc8", 0x000000, 0x200000, CRC(d68588c2) SHA1(c5f397d74a6ecfd2e375082f82e37c5a330fba62) )
ROM_LOAD( "afega_af1-b1.uc3", 0x200000, 0x200000, CRC(f8b200a8) SHA1(a6c43dd57b752d87138d7125b47dc0df83df8987) )
ROM_REGION( 0x10000, "fgtile", ROMREGION_ERASEFF ) // Layer 1, 8x8x4
ROM_LOAD( "afega_3.u4", 0x000000, 0x10000, CRC(64608687) SHA1(c13e55429171653437c8e8c7c8e9c6c5ffa2d2dc) )
ROM_REGION( 0x40000, "oki1", 0 ) // Samples
ROM_LOAD( "afega_2.u95", 0x00000, 0x40000, CRC(e911ce33) SHA1(a29c4dea98a22235122303325c63c15fadd3431d) )
ROM_END
/***************************************************************************
Pop's Pop's by Afega (1999)
The pcb might be missing an EPROM in a socket
--- i just think it uses a generic PCB but no sprites in this case,.
1x 68k
1x z80
1x Ad65 (oki 6295)
1x OSC 12mhz (near 68k)
1x OSC 4mhz (near z80)
1x ym2151
1x Afega AF1-CFLK custom chip Smt
1x Afega AF1-CF5K custom chip socketed
2x dipswitch banks
****************************************************************************/
ROM_START( popspops )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "afega4.u112", 0x000000, 0x040000, CRC(db191762) SHA1(901fdc20374473127d694513d4291e29e65eafe8) )
ROM_LOAD16_BYTE( "afega5.u107", 0x000001, 0x040000, CRC(17e0c48b) SHA1(833c61c4b3ee293b0bcddfa86dfa9c1014375115) )
ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "afega1.u92", 0x00000, 0x10000, CRC(5d8cf28e) SHA1(2a440bf5136f95af137b6688e566a14e65be94b1) )
ROM_REGION( 0x400000, "sprites", ROMREGION_ERASEFF ) // Sprites, 16x16x4
// no sprite ROMs?
ROM_REGION( 0x400000, "bgtile", 0 ) // Layer 0, 16x16x8
ROM_LOAD( "afega6.uc8", 0x000000, 0x200000, CRC(6d506c97) SHA1(4909c0b530f9526c8bf76e502c914ef10a50d1fc) )
ROM_LOAD( "afega7.uc3", 0x200000, 0x200000, CRC(02d7f9de) SHA1(10102ffbf37a57afa300b01cb5067b7e672f4999) )
ROM_REGION( 0x10000, "fgtile", 0 ) // Layer 1, 8x8x4
ROM_LOAD( "afega3.u4", 0x00000, 0x10000, CRC(f39dd5d2) SHA1(80d05d57a621b0063f63ce05be9314f718b3c111) )
ROM_REGION( 0x40000, "oki1", 0 ) // Samples
ROM_LOAD( "afega2.u95", 0x00000, 0x40000, CRC(ecd8eeac) SHA1(849beba8f04cc322bb8435fa4c26551a6d0dec64) )
ROM_END
/****************************************************************************
Mang-chi by Afega
1x osc 4mhz
1x osc 12mhz
1x tmp68hc0000p-10
1x z80c006
1x AD65 (MSM6295)
1x CY5001 (YM2151 rebadged)
2x dipswitch
1x fpga
1x smd ASIC not marked
Dumped by Corrado Tomaselli
****************************************************************************/
ROM_START( mangchi )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "afega9.u112", 0x00000, 0x40000, CRC(0b1517a5) SHA1(50e307641759bb2a35aff56ef9598364740803a0) )
ROM_LOAD16_BYTE( "afega10.u107", 0x00001, 0x40000, CRC(b1d0f33d) SHA1(68b5be3f7911f7299566c5bf5801e90099433613) )
ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "sound.u92", 0x00000, 0x10000, CRC(bec4f9aa) SHA1(18fb2ee06892983c117a62b70cd72a98f60a08b6) )
ROM_REGION( 0x080000, "sprites", 0 ) // Sprites, 16x16x4
ROM_LOAD16_BYTE( "afega6.uc11", 0x000000, 0x040000, CRC(979efc30) SHA1(227fe1e20137253aac04585d2bbf67091d032e56) )
ROM_LOAD16_BYTE( "afega7.uc14", 0x000001, 0x040000, CRC(c5cbcc38) SHA1(86070a9598e80f90ec7892d623e1a975ccc68178) )
ROM_REGION( 0x100000, "bgtile", 0 ) // Layer 0, 16x16x8
ROM_LOAD( "afega5.uc6", 0x000000, 0x80000, CRC(c73261e0) SHA1(0bb66aa315aaecb26169812cf47a6504a74f0db5) )
ROM_LOAD( "afega4.uc1", 0x080000, 0x80000, CRC(73940917) SHA1(070305c81de959c9d00b6cf1cc20bbafa204976a) )
ROM_REGION( 0x100000, "fgtile", ROMREGION_ERASEFF ) // Layer 1, 8x8x4
ROM_REGION( 0x40000, "oki1", 0 ) // Samples
ROM_LOAD( "afega2.u95", 0x00000, 0x40000, CRC(78c8c1f9) SHA1(eee0d03164a0ac0ddc5186ab56090320e9d33aa7) )
ROM_END
/***************************************************************************
Bubble 2000 (c)1998 Tuning
Bubble 2000
Tuning, 1998
CPU : TMP68HC000P-10 (68000)
SOUND : Z840006 (Z80, 44 pin QFP), YM2151, OKI M6295
OSC : 4.000MHZ, 12.000MHz
DIPSW : 8 position (x2)
RAM : 6116 (x5, gfx related?) 6116 (x1, sound program ram), 6116 (x1, near ROM 3)
64256 (x4, gfx related?), 62256 (x2, main program ram), 6264 (x2, gfx related?)
PALs/PROMs: None
Custom: Unknown 208 pin QFP labelled LTC2 (Graphics generator)
Unknown 68 pin PLCC labelled LTC1 (?, near ROM 2 and ROM 3)
ROMs :
Filename Type Possible Use
----------------------------------------------
rom01.92 27C512 Sound Program
rom02.95 27C020 Oki Samples
rom03.4 27C512 ? (located near ROM 1 and 2 and near LTC1)
rom04.1 27C040 \
rom05.3 27C040 |
rom06.6 27C040 |
rom07.9 27C040 | Gfx
rom08.11 27C040 |
rom09.14 27C040 |
rom12.2 27C040 |
rom13.7 27C040 /
rom10.112 27C040 \ Main Program
rom11.107 27C040 /
*************************************
bubl2000a program ROMs where labeled:
B-2000 N B-2000 N
U107 U112
V1.2 V1.2
The PCB had a genuine Tuning stick with 11 & 98 struck out for month and year
***************************************************************************/
void afega_state::init_bubl2000()
{
decryptcode( machine(), 23, 22, 21, 20, 19, 18, 13, 14, 15, 16, 17, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 );
}
ROM_START( bubl2000 )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "rom10.112", 0x00000, 0x20000, CRC(87f960d7) SHA1(d22fe1740217ac20963bd9003245850598ccecf2) ) // Has dipswitch control for Demo Sounds
ROM_LOAD16_BYTE( "rom11.107", 0x00001, 0x20000, CRC(b386041a) SHA1(cac36e22a39b5be0c5cd54dce5c912ff811edb28) )
ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "rom01.92", 0x00000, 0x10000, CRC(5d8cf28e) SHA1(2a440bf5136f95af137b6688e566a14e65be94b1) ) // same as the other games on this driver
ROM_REGION( 0x080000, "sprites", 0 ) // Sprites, 16x16x4
ROM_LOAD16_BYTE( "rom08.11", 0x000000, 0x040000, CRC(519dfd82) SHA1(116b06f6e7b283a5417338f716bbaab6cfadb41d) )
ROM_LOAD16_BYTE( "rom09.14", 0x000001, 0x040000, CRC(04fcb5c6) SHA1(7594fa6bf98fc01b8848473a222a621c7c9ff00d) )
ROM_REGION( 0x300000, "bgtile", 0 ) // Layer 0, 16x16x8
ROM_LOAD( "rom06.6", 0x000000, 0x080000, CRC(ac1aabf5) SHA1(abce6ba381b189ab3ec703a8ef74bccbe10876e0) )
ROM_LOAD( "rom07.9", 0x080000, 0x080000, CRC(69aff769) SHA1(89b98c1023710861e622c8a186b6ec48f5109d42) )
ROM_LOAD( "rom13.7", 0x100000, 0x080000, CRC(3a5b7226) SHA1(1127740c5bc2f830d73a77c8831e1b0db6606375) )
ROM_LOAD( "rom04.1", 0x180000, 0x080000, CRC(46acd054) SHA1(1bd7a1b6b2ce6a3daa8c92843c546beb377af8fb) )
ROM_LOAD( "rom05.3", 0x200000, 0x080000, CRC(37deb6a1) SHA1(3a8a3d961800bb15fd389429b92fa1e5b5f416df) )
ROM_LOAD( "rom12.2", 0x280000, 0x080000, CRC(1fdc59dd) SHA1(d38e21c878241b4315a36e0590397211ca63f2c4) )
ROM_REGION( 0x10000, "fgtile", 0 ) // Layer 1, 8x8x4
ROM_LOAD( "rom03.4", 0x00000, 0x10000, CRC(f4c15588) SHA1(a21ae71c0a8c7c1df63f9905fd86303bc2d3991c) )
ROM_REGION( 0x40000, "oki1", 0 ) // Samples
ROM_LOAD( "rom02.95", 0x00000, 0x40000, CRC(859a86e5) SHA1(7b51964227411a40aac54b9cd9ff64f091bdf2b0) )
ROM_END
ROM_START( bubl2000a )
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "b-2000_n_v1.2.112", 0x00000, 0x20000, CRC(da28624b) SHA1(01447f32bd4d3588ec5458cb9996d49808883e1c) ) // Has no Demo Sounds?? Earlier version??
ROM_LOAD16_BYTE( "b-2000_n_v1.2.107", 0x00001, 0x20000, CRC(c766c1fb) SHA1(54b54021d05a3b41afe954bc3763e809a5eb3b55) ) // Tuning sticker shows production was 11/98
ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "rom01.92", 0x00000, 0x10000, CRC(5d8cf28e) SHA1(2a440bf5136f95af137b6688e566a14e65be94b1) ) // same as the other games on this driver
ROM_REGION( 0x080000, "sprites", 0 ) // Sprites, 16x16x4
ROM_LOAD16_BYTE( "rom08.11", 0x000000, 0x040000, CRC(519dfd82) SHA1(116b06f6e7b283a5417338f716bbaab6cfadb41d) )
ROM_LOAD16_BYTE( "rom09.14", 0x000001, 0x040000, CRC(04fcb5c6) SHA1(7594fa6bf98fc01b8848473a222a621c7c9ff00d) )
ROM_REGION( 0x300000, "bgtile", 0 ) // Layer 0, 16x16x8
ROM_LOAD( "rom06.6", 0x000000, 0x080000, CRC(ac1aabf5) SHA1(abce6ba381b189ab3ec703a8ef74bccbe10876e0) )
ROM_LOAD( "rom07.9", 0x080000, 0x080000, CRC(69aff769) SHA1(89b98c1023710861e622c8a186b6ec48f5109d42) )
ROM_LOAD( "rom13.7", 0x100000, 0x080000, CRC(3a5b7226) SHA1(1127740c5bc2f830d73a77c8831e1b0db6606375) )
ROM_LOAD( "rom04.1", 0x180000, 0x080000, CRC(46acd054) SHA1(1bd7a1b6b2ce6a3daa8c92843c546beb377af8fb) )
ROM_LOAD( "rom05.3", 0x200000, 0x080000, CRC(37deb6a1) SHA1(3a8a3d961800bb15fd389429b92fa1e5b5f416df) )
ROM_LOAD( "rom12.2", 0x280000, 0x080000, CRC(1fdc59dd) SHA1(d38e21c878241b4315a36e0590397211ca63f2c4) )
ROM_REGION( 0x10000, "fgtile", 0 ) // Layer 1, 8x8x4
ROM_LOAD( "rom03.4", 0x00000, 0x10000, CRC(f4c15588) SHA1(a21ae71c0a8c7c1df63f9905fd86303bc2d3991c) )
ROM_REGION( 0x40000, "oki1", 0 ) // Samples
ROM_LOAD( "rom02.95", 0x00000, 0x40000, CRC(859a86e5) SHA1(7b51964227411a40aac54b9cd9ff64f091bdf2b0) )
ROM_END
/***************************************************************************
Hot Bubble
Afega, 1998
PCB Layout
----------
Bottom Board
|------------------------------------------|
| BS902 BS901 Z80 4MHz |
| |
| 6116 6295 |
| 62256 |
| 6116 62256 |
| 6116 |
|J 6116 |------------| |
|A 6116 | 68000 | |
|M |------------| |
|M DSW2 6264 |
|A 6264 |
| |
| |-------| |
| | | |
| | | |
| DSW1 | | 62256 62256 |
| |-------| |
| 6116 62256 62256 |
|12MHz 6116 |
|------------------------------------------|
Notes:
68000 - running at 12.000MHz
Z80 - running at 4.000MHz
62256 - 32K x8 SRAM
6264 - 8K x8 SRAM
6116 - 2K x8 SRAM
BS901 - YM2151, running at 4.000MHz
BS902 - YM3012
6295 - OKI MSM6295 running at 1.000MHz [4/4], sample rate = 1000000 / 132
* - Unknown QFP208
VSync - 56.2Hz (measured on 68000 IPL1)
Top Board
|---------------------------|
| |
| S1 S2 T1 |
| |
| CR5 CR7 C1 |
| |
| CR6 +CR8 C2 |
| |
| BR1 BR3 |
| |
| +BR2 +BR4 |
| |
| CR1 CR3 |------| |
| | * | |
| CR2 +CR4 | | |
| |------| |
|---------------------------|
Notes:
* - Unknown PLCC68 IC
+ - Not populated
NOTE:
The hotbubl set is also known to use double sized EPROMs with the identical halves:
Program data on a 27C020 EPROM:
ROM @ C1 with a CRC32 of 0x7bb240e9
ROM @ C2 with a CRC32 of 0x7917b95d
Sprite data on a 27C040 EPROM:
ROM @ BR1 with a CRC32 of 0x6fc18de4
ROM @ BR3 with a CRC32 of 0xbb677240
All EPROMs had identical AFEGA 8, AFEGA 9 or AFEGA 10 labels, so each was named as found
and are distinguished by PCB / IC locations.
The hotbubla set also has program data with identical halves. While not confirmed, there
may be a PCB out there using the smaller 27C010's for the program data. IE:
ROM @ C1 with a CRC32 of 0x41c3edbc and 0x20000 bytes in length
ROM @ C2 with a CRC32 of 0xf59aea4a and 0x20000 bytes in length
It was not uncommon for manufacturers to use whatever size EPROMs were readily
available and either double the data or padded the empty space with a fill byte.
***************************************************************************/
ROM_START( hotbubl ) // Korean release - Nude images of women for backgrounds
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "afega8.c1.uc1", 0x00001, 0x20000, CRC(d1e72a31) SHA1(abe9113c1dd31fc1a6fc0f479b42e629650ecb1c) )
ROM_LOAD16_BYTE( "afega9.c2.uc9", 0x00000, 0x20000, CRC(4537c6d9) SHA1(0b6ea74311389dc592615f0073629d07500cc2c4) )
ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "afega8.s1.uc14", 0x00000, 0x10000, CRC(5d8cf28e) SHA1(2a440bf5136f95af137b6688e566a14e65be94b1) ) // same as the other games on this driver
ROM_REGION( 0x80000, "sprites", 0 ) // Sprites, 16x16x4
ROM_LOAD16_BYTE( "afega10.br1.uc3", 0x000000, 0x040000, CRC(7e132eff) SHA1(f3ec5750c73017f0a2eb87f6f39ab49e59d39711) )
ROM_LOAD16_BYTE( "afega8.br3.uc10", 0x000001, 0x040000, CRC(22707728) SHA1(8a27aa2d1b6f902276c02bd7098526243661cff8) )
ROM_REGION( 0x300000, "bgtile", 0 ) // Layer 0, 16x16x8
ROM_LOAD( "afega9.cr6.uc16", 0x100000, 0x080000, CRC(99d6523c) SHA1(0b628585d749e175d5a4dc600af1ba9cb936bfeb) )
ROM_LOAD( "afega10.cr7.uc19", 0x080000, 0x080000, CRC(a89d9ce4) SHA1(5965b2b4b67bc91bc0e7474e593c7e1953b75adc) )
ROM_LOAD( "afega10.cr5.uc15", 0x000000, 0x080000, CRC(65bd5159) SHA1(627ccc0ab131e643c3c52ee9bb41c7a85153c35e) )
ROM_LOAD( "afega9.cr2.uc7", 0x280000, 0x080000, CRC(27ad6fc8) SHA1(00b1a5c5e1a245590b300b9baf71585d41813e3e) )
ROM_LOAD( "afega9.cr3.uc12", 0x200000, 0x080000, CRC(c841a4f6) SHA1(9b0ee5623c87a0cfc63d3741a65d399bd6593f18) )
ROM_LOAD( "afega8.cr1.uc6", 0x180000, 0x080000, CRC(fc9101d2) SHA1(1d5b8484264b6d73fe032946096a469226cce901) )
ROM_REGION( 0x10000, "fgtile", 0 ) // Layer 1, 8x8x4
ROM_LOAD( "afega9.t1.uc2", 0x00000, 0x10000, CRC(ce683a93) SHA1(aeee2671051f1badf2255375cd7c5fa847d1746c) )
ROM_REGION( 0x40000, "oki1", 0 ) // Samples
ROM_LOAD( "afega8.s2.uc18", 0x00000, 0x40000, CRC(401c980f) SHA1(e47710c47cfeecce3ccf87f845b219a9c9f21ee3) )
ROM_END
ROM_START( hotbubla ) // Korean release - Nude images replaced with pictures of satellite dishes
ROM_REGION( 0x80000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "6_c1.uc1", 0x00001, 0x40000, CRC(7c65bf47) SHA1(fe578d3336c5f437bfd1bc81bfe3763b12f3e63f) ) // 1st and 2nd half identical
ROM_LOAD16_BYTE( "7_c2.uc9", 0x00000, 0x40000, CRC(74eb11c3) SHA1(88aeb02c4088706a56b4c930ffe6fdfbc99031c6) ) // 1st and 2nd half identical
ROM_REGION( 0x10000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "1_s1.uc14", 0x00000, 0x10000, CRC(5d8cf28e) SHA1(2a440bf5136f95af137b6688e566a14e65be94b1) ) // same as the other games on this driver
ROM_REGION( 0x100000, "sprites", 0 ) // Sprites, 16x16x4
ROM_LOAD16_BYTE( "8_br1.uc3", 0x000000, 0x040000, CRC(7e132eff) SHA1(f3ec5750c73017f0a2eb87f6f39ab49e59d39711) )
ROM_LOAD16_BYTE( "9_br3.uc10", 0x000001, 0x040000, CRC(22707728) SHA1(8a27aa2d1b6f902276c02bd7098526243661cff8) )
ROM_REGION( 0x300000, "bgtile", 0 ) // Layer 0, 16x16x8
ROM_LOAD( "5_cr6.uc16", 0x100000, 0x080000, CRC(324429c5) SHA1(8cf90abf32697b269d4ec03b5b20bf4046fa53aa) )
ROM_LOAD( "5_cr7.uc19", 0x080000, 0x080000, CRC(d293f1d0) SHA1(33c40c67bda477a2112cca4bfe9661edbcdf7689) )
ROM_LOAD( "2_cr5.uc15", 0x000000, 0x080000, CRC(dd7e92de) SHA1(954f18887ac7737abce363985255a747c0de1fa2) )
ROM_LOAD( "9_cr2.uc7", 0x280000, 0x080000, CRC(c5516087) SHA1(ae3692ecd7cd96b5d3653afb4c3a3b8f5931cbad) )
ROM_LOAD( "10_cr3.uc12", 0x200000, 0x080000, CRC(312c38d8) SHA1(1e706b3e8b381083575ef4a01c615408940d5d0f) )
ROM_LOAD( "8_cr1.uc6", 0x180000, 0x080000, CRC(7e2840b4) SHA1(333bf5631ee033ce528348d26888854eb1b063a0) )
ROM_REGION( 0x10000, "fgtile", 0 ) // Layer 1, 8x8x4
ROM_LOAD( "2_t1.uc2", 0x00000, 0x10000, CRC(ce683a93) SHA1(aeee2671051f1badf2255375cd7c5fa847d1746c) )
ROM_REGION( 0x40000, "oki1", 0 ) // Samples
ROM_LOAD( "1_s2.uc18", 0x00000, 0x40000, CRC(401c980f) SHA1(e47710c47cfeecce3ccf87f845b219a9c9f21ee3) )
ROM_END
ROM_START( dolmen ) // Original source of the caveman concept for Bubble 2000 / Hot Bubble, much earlier and completely different hardware
ROM_REGION( 0x40000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "afega8.uj3", 0x00000, 0x20000, CRC(f1b73e4c) SHA1(fe5bbd1e91d1a81744c373effbd96adbbc896133) )
ROM_LOAD16_BYTE( "afega7.uj2", 0x00001, 0x20000, CRC(c91bda0b) SHA1(8c09e3020e72e8ab2ca3a3dad708d64f9bf75a4f) )
ROM_REGION( 0x8000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "afega1.su6", 0x0000, 0x8000, CRC(166b53cb) SHA1(44864d1518205bdc445dc95e5825924f73d334b2) ) // 1111xxxxxxxxxxx = 0x00
ROM_REGION( 0x100000, "sprites", 0 ) // Sprites, 16x16x4
ROM_LOAD16_BYTE( "afega4.ub11", 0x00000, 0x80000, CRC(5a259393) SHA1(62c41ef4f398295d5cc1122c64487e12c4226ede) )
ROM_LOAD16_BYTE( "afega5.ub13", 0x00001, 0x80000, CRC(7f6a683d) SHA1(ab7026906b68aa9f4d75b0e56564216727decfde) )
ROM_REGION( 0x80000, "bgtile", 0 ) // Layer 0, 16x16x8
ROM_LOAD( "afega9.ui20", 0x00000, 0x80000, CRC(b3fa7be6) SHA1(7ef8d902bd954960fbae727aae02dce9750f740e) )
ROM_REGION( 0x20000, "fgtile", 0 ) // Layer 1, 8x8x4
ROM_LOAD( "afega6.uj11", 0x00000, 0x20000, CRC(13fa4415) SHA1(193524ebccbaae6b8c00893c42399c38cafdbd79) )
ROM_REGION( 0x80000, "oki1", 0 ) // Samples
ROM_LOAD( "afega2.su12", 0x000000, 0x20000, CRC(1a2ce1c2) SHA1(ae6991fbfe57d35f32b541367d3b31244456713e) )
ROM_RELOAD( 0x020000, 0x20000 )
ROM_LOAD( "afega3.su13", 0x040000, 0x40000, CRC(d3531018) SHA1(940067a8634339258666c89319cb0e1b43f2af56) )
ROM_END
/***************************************************************************
Fire Hawk - ESD, 2001
---------------------
- To enter test mode, hold on button 1 at boot up
PCB Layout
----------
ESD-PROT-002
|------------------------------------------------|
| FHAWK_S1.U40 FHAWK_S2.U36 |
| 6116 6295 FHAWK_S3.U41 |
| 6295 FHAWK_G1.UC6|
| PAL Z80 FHAWK_G2.UC5|
| 4MHz |--------| |
| | ACTEL | |
|J 6116 62256 |A54SX16A| |
|A 6116 62256 | | |
|M |(QFP208)| |
|M |--------| |
|A DSW1 FHAWK_G3.UC2 |
| DSW2 |--------| |
| DSW3 | ACTEL | |
| 6116 |A54SX16A| |
| 6116 | | |
| 62256 |(QFP208)| |
| FHAWK_P1.U59 |--------| |
| FHAWK_P2.U60 PAL 62256 62256|
| |
|12MHz 62256 68000 62256 62256|
|------------------------------------------------|
Notes:
68000 clock: 12.000MHz
Z80 clock: 4.000MHz
6295 clocks: 1.000MHz (both), sample rate = 1000000 / 132 (both)
VSync: 56Hz
***************************************************************************/
ROM_START( firehawk )
ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "fhawk_p1.u59", 0x00001, 0x80000, CRC(d6d71a50) SHA1(e947720a0600d049b7ea9486442e1ba5582536c2) )
ROM_LOAD16_BYTE( "fhawk_p2.u60", 0x00000, 0x80000, CRC(9f35d245) SHA1(5a22146f16bff7db924550970ed2a3048bc3edab) )
ROM_REGION( 0x20000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "fhawk_s1.u40", 0x00000, 0x20000, CRC(c6609c39) SHA1(fe9b5f6c3ab42c48cb493fecb1181901efabdb58) )
ROM_REGION( 0x200000, "sprites",0 ) // Sprites, 16x16x4
ROM_LOAD( "fhawk_g3.uc2", 0x00000, 0x200000, CRC(cae72ff4) SHA1(7dca7164015228ea039deffd234778d0133971ab) )
ROM_REGION( 0x400000, "bgtile", 0 ) // Layer 0, 16x16x8
ROM_LOAD( "fhawk_g1.uc6", 0x000000, 0x200000, CRC(2ab0b06b) SHA1(25362f6a517f188c62bac28b1a7b7b49622b1518) )
ROM_LOAD( "fhawk_g2.uc5", 0x200000, 0x200000, CRC(d11bfa20) SHA1(15142004ab49f7f1e666098211dff0835c61df8d) )
ROM_REGION( 0x00100, "fgtile", ROMREGION_ERASEFF ) // Layer 1, 8x8x4
// Unused
ROM_REGION( 0x040000, "oki1", 0 ) // Samples
ROM_LOAD( "fhawk_s2.u36", 0x00000, 0x40000, CRC(d16aaaad) SHA1(96ca173ca433164ed0ae51b41b42343bd3cfb5fe) )
ROM_REGION( 0x040000, "oki2", 0 ) // Samples
ROM_LOAD( "fhawk_s3.u41", 0x00000, 0x40000, CRC(3fdcfac2) SHA1(c331f2ea6fd682cfb00f73f9a5b995408eaab5cf) )
ROM_END
ROM_START( firehawkv )
ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "fire_hawk_cn1.u53", 0x00001, 0x80000, CRC(c09db3ec) SHA1(5beab9f837d8821fea1ceeac1be01c2c3ceaabf2) )
ROM_LOAD16_BYTE( "fire_hawk_cn2.u59", 0x00000, 0x80000, CRC(68b0737c) SHA1(d8eac5b0f4023556f39ffb187f6d75270a5b782f) )
ROM_REGION( 0x20000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "fhawk_s1.u38", 0x00000, 0x20000, CRC(c6609c39) SHA1(fe9b5f6c3ab42c48cb493fecb1181901efabdb58) )
ROM_REGION( 0x400000, "sprites",0 ) // Sprites, 16x16x4
ROM_LOAD( "rom.uc1", 0x000000, 0x200000, NO_DUMP ) // for vertical mode, missing
ROM_LOAD( "fhawk_g3.uc2", 0x200000, 0x200000, BAD_DUMP CRC(cae72ff4) SHA1(7dca7164015228ea039deffd234778d0133971ab) ) // for horizontal mode, taken from above
ROM_REGION( 0x800000, "bgtile", 0 ) // Layer 0, 16x16x8
ROM_LOAD( "rom.uc3", 0x000000, 0x200000, NO_DUMP ) // for vertical mode, missing
ROM_LOAD( "rom.uc4", 0x400000, 0x200000, NO_DUMP ) // for vertical mode, missing
ROM_LOAD( "fhawk_g1.uc6", 0x200000, 0x200000, BAD_DUMP CRC(2ab0b06b) SHA1(25362f6a517f188c62bac28b1a7b7b49622b1518) ) // for horizontal mode, taken from above
ROM_LOAD( "fhawk_g2.uc5", 0x600000, 0x200000, BAD_DUMP CRC(d11bfa20) SHA1(15142004ab49f7f1e666098211dff0835c61df8d) ) // for horizontal mode, taken from above
ROM_REGION( 0x00100, "fgtile", ROMREGION_ERASEFF ) // Layer 1, 8x8x4
// Unused
ROM_REGION( 0x040000, "oki1", 0 ) // Samples
ROM_LOAD( "fhawk_s2.u36", 0x00000, 0x40000, CRC(d16aaaad) SHA1(96ca173ca433164ed0ae51b41b42343bd3cfb5fe) )
ROM_REGION( 0x040000, "oki2", 0 ) // Samples
ROM_LOAD( "fhawk_s3.u41", 0x00000, 0x40000, CRC(3fdcfac2) SHA1(c331f2ea6fd682cfb00f73f9a5b995408eaab5cf) )
ROM_END
/***************************************************************************
Spectrum 2000 (c) 2000 YONA Tech
CPU: 68HC000FN10 (68000, 68 pin PLCC)
Sound: Z84C000FEC (Z80, 44 pin PQFP)
AD-65 x 2 rebadged OKI M6295
OSC: 12.000MHz & 4.000MHz
RAM: IS61C256AH-20N x 6, HT6116-70 x 7, UM6164DK-12 X 2
Dips: 2 x 8 position
Other: 208 pin PQFP labeled YONA Tech 2000 K (silkscreened on the PCB as LTC1)
GAL16V8B (not dumped)
+-----------------------------------------------------+
| 6116 4MHz AD-65 2.U101 29F1610.UC1 |
|VOL 1.U103 AD-65 3.U106 |
| Z80 61C256 |
+-+ 6116 61C256 |
| SW1 SW2 6116 61C256 |
+-+ 61C256 |
| |
|J +--------+ |
|A | YONA | |
|M | Tech | |
|M 61C256 61C256 | 2000 K | |
|A 5.U124 6.U120 GAL | | |
| +-------+ +--------+ 6116 |
+-+ |MC68000| 6116 |
| | FN10 | 6164 |
+-+ | | 6164 29F1610.UC2 |
| +-------+ 29F1610.UC3 |
| 6116 12MHz|
| 6116 4.U3 |
+-----------------------------------------------------+
ROMs
YONATech1 is a TMS27C512
YONATech3 is a MX27C4000
YONATech2 & YONATech4 are TMS27C010A
YONATech5 & YONATech6 are TMS27C020
UC1, UC2 & UC3 are all Micronix MX29F1610ML 16Mb Flash ROMs
UC1, UC2 & UC3 have solder pads for both MX29F1610 Flash & 27C160 EPROMs
***************************************************************************/
void afega_state::init_spec2k()
{
decryptcode( machine(), 23, 22, 21, 20, 19, 18, 17, 13, 14, 15, 16, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 );
}
ROM_START( spec2kh )
ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "yonatech5.u124", 0x00000, 0x40000, CRC(72ab5c05) SHA1(182a811982b89b8cda0677547ef0625c274f5c6b) )
ROM_LOAD16_BYTE( "yonatech6.u120", 0x00001, 0x40000, CRC(7e44bd9c) SHA1(da59685be14a09ec037743fcec34fb293f7d588d) )
ROM_REGION( 0x20000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "yonatech1.u103", 0x00000, 0x10000, CRC(ef5acda7) SHA1(e55b36a1598ecbbbad984997d61599dfa3958f60) )
ROM_REGION( 0x200000, "sprites",0 ) // Sprites, 16x16x4
ROM_LOAD( "u154.bin", 0x00000, 0x200000, CRC(f77b764e) SHA1(37e249bd4d7174c5232261880ce8debf42723716) ) // UC1 MX29F1610ML Flash ROM
ROM_REGION( 0x400000, "bgtile", 0 ) // Layer 0, 16x16x8
ROM_LOAD( "u153.bin", 0x000000, 0x200000, CRC(a00bbf8f) SHA1(622f52ef50d52cdd5e6b250d68439caae5c13404) ) // UC2 MX29F1610ML Flash ROM
ROM_LOAD( "u152.bin", 0x200000, 0x200000, CRC(f6423fab) SHA1(253e0791eb58efa1df42e9c74d397e6e65c8c252) ) // UC3 MX29F1610ML Flash ROM
ROM_REGION( 0x20000, "fgtile", ROMREGION_ERASEFF ) // Layer 1, 8x8x4
ROM_LOAD( "yonatech4.u3", 0x00000, 0x20000, CRC(5626b08e) SHA1(63207ed6b4fc8684690bf3fe1991a4f3babd73e8) )
ROM_REGION( 0x40000, "oki1", 0 ) // Samples
ROM_LOAD( "yonatech2.u101", 0x00000, 0x20000, CRC(4160f172) SHA1(0478a5a4bbba115e6cfb5501aa55aa2836c963bf) )
ROM_REGION( 0x080000, "oki2", 0 ) // Samples
ROM_LOAD( "yonatech3.u106", 0x00000, 0x80000, CRC(6644c404) SHA1(b7ad3f9f08971432d024ef8be3fa3140f0bbae67) )
ROM_END
ROM_START( spec2k )
ROM_REGION( 0x100000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "u124", 0x00000, 0x40000, CRC(dbd6f65d) SHA1(0fad9836689fcbee60904ccad59a2a5be09f3139) )
ROM_LOAD16_BYTE( "u120", 0x00001, 0x40000, CRC(be53e243) SHA1(38144b90a35ba144921824a0c4f133339e07f9a1) )
ROM_REGION( 0x20000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "u103", 0x00000, 0x10000, CRC(f4e4fb10) SHA1(d19953d37e31fc753b50f0047d5be16f1f2daf09) )
ROM_REGION( 0x200000, "sprites",0 ) // Sprites, 16x16x4
ROM_LOAD( "uc1", 0x00000, 0x200000, CRC(3139a213) SHA1(5ec4be0e27cbf1c4556ab10d7e1408ea64aa9e17) )
ROM_REGION( 0x400000, "bgtile", 0 ) // Layer 0, 16x16x8
ROM_LOAD( "uc3", 0x000000, 0x200000, CRC(1d087122) SHA1(9e82c5f26c1387c6006cbd9248b333921388146c) )
ROM_LOAD( "uc2", 0x200000, 0x200000, CRC(998dc05c) SHA1(cadf8bb0b8944372fbce9934b93684749ebc3ba0) )
ROM_REGION( 0x20000, "fgtile", ROMREGION_ERASEFF ) // Layer 1, 8x8x4
ROM_LOAD( "u3", 0x00000, 0x20000, CRC(921503b8) SHA1(dea6e9d47c9db83e79907bc0609a64176aff26bc) )
ROM_REGION( 0x40000, "oki1", 0 ) // Samples
ROM_LOAD( "u101", 0x00000, 0x40000, CRC(d16aaaad) SHA1(96ca173ca433164ed0ae51b41b42343bd3cfb5fe) )
ROM_REGION( 0x080000, "oki2", 0 ) // Samples
ROM_LOAD( "u106", 0x00000, 0x80000, CRC(65d61f3a) SHA1(a8f7ad61ae29a5c852820e5cbe886a8cd437634a) )
ROM_END
/***************************************************************************
1995, Afega
1x TMP68000P-10 (main)
1x GOLDSTAR Z8400A (sound)
1x AD-65 (equivalent to OKI6295)
1x LATTICE pLSI 1032 60LJ A428A48
1x oscillator 8.000MHz
1x oscillator 12.000MHz
1x 27256 (SU6)
1x 27C010 (SU12)
1x 27C020 (SU13)
2x 27c4001 (UB11, UB13)
3x 27C010 (UJ11, UJ12, UJ13)
1x 27C4001 (UI20)
1x JAMMA edge connector
1x trimmer (volume)
***************************************************************************/
ROM_START( twinactn )
ROM_REGION( 0x40000, "maincpu", 0 ) // 68000 code
ROM_LOAD16_BYTE( "afega.uj13", 0x00000, 0x20000, CRC(9187701d) SHA1(1da8d1e3969f60c7b0521cd22c723cb51619df9d) )
ROM_LOAD16_BYTE( "afega.uj12", 0x00001, 0x20000, CRC(fe8cff9c) SHA1(a1a04deff9e2cb54c69601898cf4e5133c2bc437) )
ROM_REGION( 0x8000, "audiocpu", 0 ) // Z80 code
ROM_LOAD( "afega.su6", 0x0000, 0x8000, CRC(3a52dc88) SHA1(87941987d34d93df6df9ff33ccfbd1f5d4a39c51) ) // 1111xxxxxxxxxxx = 0x00
ROM_REGION( 0x100000, "sprites", 0 ) // Sprites, 16x16x4
ROM_LOAD16_BYTE( "afega.ub11", 0x00000, 0x80000, CRC(287f20d8) SHA1(11faa36b97593c0b5cee70343750ae1ecd2f5b71) )
ROM_LOAD16_BYTE( "afega.ub13", 0x00001, 0x80000, CRC(f525f819) SHA1(78ffcb709a3a900d3851392630a11ab58fc0bc75) )
ROM_REGION( 0x80000, "bgtile", 0 ) // Layer 0, 16x16x8
ROM_LOAD( "afega.ui20", 0x00000, 0x80000, CRC(237c8f92) SHA1(bb3131b450bd78d03b789626a465fb9e7a4604a7) )
ROM_REGION( 0x20000, "fgtile", 0 ) // Layer 1, 8x8x4
ROM_LOAD( "afega.uj11", 0x00000, 0x20000, CRC(3f439e92) SHA1(27e5b1b0aa3b13fa35e3f83793037314b2942aa2) )
ROM_REGION( 0x80000, "oki1", 0 ) // Samples
ROM_LOAD( "afega.su12", 0x000000, 0x20000, CRC(91d665f3) SHA1(10b5b07ed28ea78b6d3493afc03e003a8468c007) )
ROM_RELOAD( 0x020000, 0x20000 )
ROM_LOAD( "afega.su13", 0x040000, 0x40000, CRC(30e1c306) SHA1(c859f11fd329793b11e96264e91c79a557b488a4) )
ROM_END
/***************************************************************************
Game Drivers
***************************************************************************/
GAME( 1989, tharrier, 0, tharrier, tharrier, nmk16_state, init_tharrier, ROT270, "UPL", "Task Force Harrier", 0 )
GAME( 1989, tharrieru, tharrier, tharrier, tharrier, nmk16_state, init_tharrier, ROT270, "UPL (American Sammy license)", "Task Force Harrier (US)", 0 ) // US version but no regional notice
GAME( 1990, mustang, 0, mustang, mustang, nmk16_state, empty_init, ROT0, "UPL", "US AAF Mustang (25th May. 1990)", 0 )
GAME( 1990, mustangs, mustang, mustang, mustang, nmk16_state, empty_init, ROT0, "UPL (Seoul Trading license)", "US AAF Mustang (25th May. 1990 / Seoul Trading)", 0 )
GAME( 1990, bioship, 0, bioship, bioship, nmk16_state, empty_init, ROT0, "UPL (American Sammy license)", "Bio-ship Paladin", 0 ) // US version but no regional notice
GAME( 1990, sbsgomo, bioship, bioship, bioship, nmk16_state, empty_init, ROT0, "UPL", "Space Battle Ship Gomorrah", 0 )
GAME( 1990, vandyke, 0, vandyke, vandyke, nmk16_state, empty_init, ROT270, "UPL", "Vandyke (Japan)", 0 )
GAME( 1990, vandykejal, vandyke, vandyke, vandyke, nmk16_state, empty_init, ROT270, "UPL (Jaleco license)", "Vandyke (Jaleco, set 1)", 0 )
GAME( 1990, vandykejal2,vandyke, vandyke, vandyke, nmk16_state, empty_init, ROT270, "UPL (Jaleco license)", "Vandyke (Jaleco, set 2)", 0 )
GAME( 1990, vandykeb, vandyke, vandykeb, vandykeb, nmk16_state, init_vandykeb, ROT270, "bootleg", "Vandyke (bootleg with PIC16c57)", MACHINE_NO_SOUND )
GAME( 1991, blkheart, 0, blkheart, blkheart, nmk16_state, empty_init, ROT0, "UPL", "Black Heart", 0 )
GAME( 1991, blkheartj, blkheart, blkheart, blkheart, nmk16_state, empty_init, ROT0, "UPL", "Black Heart (Japan)", 0 )
GAME( 1991, acrobatm, 0, acrobatm, acrobatm, nmk16_state, empty_init, ROT270, "UPL (Taito license)", "Acrobat Mission", 0 )
GAME( 1992, strahl, 0, strahl, strahl, nmk16_state, empty_init, ROT0, "UPL", "Koutetsu Yousai Strahl (World)", 0 )
GAME( 1992, strahlj, strahl, strahl, strahl, nmk16_state, empty_init, ROT0, "UPL", "Koutetsu Yousai Strahl (Japan set 1)", 0 )
GAME( 1992, strahlja, strahl, strahl, strahl, nmk16_state, empty_init, ROT0, "UPL", "Koutetsu Yousai Strahl (Japan set 2)", 0 )
GAME( 1991, tdragon, 0, tdragon, tdragon, nmk16_state, empty_init, ROT270, "NMK (Tecmo license)", "Thunder Dragon (8th Jan. 1992, unprotected)", 0 )
GAME( 1991, tdragon1, tdragon, tdragon_prot, tdragon_prot, nmk16_state, init_tdragon_prot, ROT270, "NMK (Tecmo license)", "Thunder Dragon (4th Jun. 1991, protected)", MACHINE_UNEMULATED_PROTECTION | MACHINE_NO_SOUND )
GAME( 1991, hachamf, 0, hachamf_prot, hachamf_prot, nmk16_state, init_hachamf_prot, ROT0, "NMK", "Hacha Mecha Fighter (19th Sep. 1991, protected, set 1)", MACHINE_UNEMULATED_PROTECTION | MACHINE_NO_SOUND ) // lots of things wrong due to protection
GAME( 1991, hachamfa, hachamf, hachamf_prot, hachamf_prot, nmk16_state, init_hachamf_prot, ROT0, "NMK", "Hacha Mecha Fighter (19th Sep. 1991, protected, set 2)", MACHINE_UNEMULATED_PROTECTION | MACHINE_NO_SOUND ) // lots of things wrong due to protection
GAME( 1991, hachamfb, hachamf, hachamf, hachamfb, nmk16_state, empty_init, ROT0, "bootleg", "Hacha Mecha Fighter (19th Sep. 1991, unprotected, bootleg Thunder Dragon conversion)", 0 ) // appears to be a Thunder Dragon conversion, could be bootleg?
GAME( 1991, hachamfp, hachamf, hachamf, hachamfp, nmk16_state, empty_init, ROT0, "NMK", "Hacha Mecha Fighter (Location Test Prototype, 19th Sep. 1991)", 0 ) // Prototype with hand-written labels showing dates of 9/9, 9/13, 9/24, 9/25. The ROM contains the same 19th Sep. 1991 build string as all the prior releases, so that string was likely never updated in later builds.
GAME( 1992, macross, 0, macross, macross, nmk16_state, init_nmk, ROT270, "Banpresto", "Super Spacefortress Macross / Chou-Jikuu Yousai Macross", 0 )
GAME( 1993, gunnail, 0, gunnail, gunnail, nmk16_state, init_nmk, ROT270, "NMK / Tecmo", "GunNail (28th May. 1992)", 0 ) // Tecmo is displayed only when set to Japan
GAME( 1992, gunnailp, gunnail, gunnail, gunnail, nmk16_state, init_nmk, ROT270, "NMK", "GunNail (location test)", 0 ) // still has the 28th May. 1992 string, so unlikely that was the release date for either version.
// a 1992 version of Gunnail exists, see https://www.youtube.com/watch?v=tf15Wz0zUiA 3:10; is this bootleg version 'gunnailb'?
GAME( 1993, macross2, 0, macross2, macross2, nmk16_state, init_banked_audiocpu, ROT0, "Banpresto", "Super Spacefortress Macross II / Chou-Jikuu Yousai Macross II", MACHINE_NO_COCKTAIL )
GAME( 1993, macross2g, macross2, macross2, macross2, nmk16_state, init_banked_audiocpu, ROT0, "Banpresto", "Super Spacefortress Macross II / Chou-Jikuu Yousai Macross II (Gamest review build)", MACHINE_NO_COCKTAIL ) // Service switch pauses game
GAME( 1993, macross2k, macross2, macross2, macross2, nmk16_state, init_banked_audiocpu, ROT0, "Banpresto", "Macross II (Korea)", MACHINE_NO_COCKTAIL ) // Title screen only shows Macross II
GAME( 1993, tdragon2, 0, tdragon2, tdragon2, nmk16_state, init_banked_audiocpu, ROT270, "NMK", "Thunder Dragon 2 (9th Nov. 1993)", MACHINE_NO_COCKTAIL )
GAME( 1993, tdragon2a, tdragon2, tdragon2, tdragon2, nmk16_state, init_banked_audiocpu, ROT270, "NMK", "Thunder Dragon 2 (1st Oct. 1993)", MACHINE_NO_COCKTAIL )
GAME( 1993, bigbang, tdragon2, tdragon2, tdragon2, nmk16_state, init_banked_audiocpu, ROT270, "NMK", "Big Bang (9th Nov. 1993)", MACHINE_NO_COCKTAIL )
GAME( 1996, tdragon3h, tdragon2, tdragon3h, tdragon2, nmk16_state, init_banked_audiocpu, ROT270, "bootleg (Conny Co Ltd.)", "Thunder Dragon 3 (bootleg of Thunder Dragon 2)", MACHINE_NO_SOUND | MACHINE_NO_COCKTAIL ) // based on 1st Oct. 1993 set, needs emulation of the mechanism used to simulate the missing YM2203' IRQs
GAME( 1994, arcadian, 0, raphero, raphero, nmk16_state, init_banked_audiocpu, ROT270, "NMK", "Arcadia (NMK)", 0 ) // 23rd July 1993 in test mode, (c)1994 on title screen
GAME( 1994, raphero, arcadian, raphero, raphero, nmk16_state, init_banked_audiocpu, ROT270, "NMK", "Rapid Hero (NMK)", 0 ) // ^^
GAME( 1994, rapheroa, arcadian, raphero, raphero, nmk16_state, init_banked_audiocpu, ROT270, "NMK (Media Trading license)", "Rapid Hero (Media Trading)", 0 ) // ^^ - note that all ROM sets have Media Trading(aka Media Shoji) in the tile graphics, but this is the only set that shows it on the titlescreen
// both sets of both these games show a date of 9th Mar 1992 in the test mode, they look like different revisions so I doubt this is accurate
GAME( 1992, sabotenb, 0, bjtwin, sabotenb, nmk16_state, init_nmk, ROT0, "NMK / Tecmo", "Saboten Bombers (set 1)", MACHINE_NO_COCKTAIL )
GAME( 1992, sabotenba, sabotenb, bjtwin, sabotenb, nmk16_state, init_nmk, ROT0, "NMK / Tecmo", "Saboten Bombers (set 2)", MACHINE_NO_COCKTAIL )
GAME( 1992, cactus, sabotenb, bjtwin, sabotenb, nmk16_state, init_nmk, ROT0, "bootleg", "Cactus (bootleg of Saboten Bombers)", MACHINE_NO_COCKTAIL ) // PCB marked 'Cactus', no title screen
GAME( 1993, bjtwin, 0, bjtwin, bjtwin, nmk16_state, init_bjtwin, ROT270, "NMK", "Bombjack Twin (set 1)", MACHINE_NO_COCKTAIL )
GAME( 1993, bjtwina, bjtwin, bjtwin, bjtwin, nmk16_state, init_bjtwin, ROT270, "NMK", "Bombjack Twin (set 2)", MACHINE_NO_COCKTAIL )
GAME( 1993, bjtwinp, bjtwin, bjtwin, bjtwin, nmk16_state, empty_init, ROT270, "NMK", "Bombjack Twin (prototype? with adult pictures, set 1)", MACHINE_NO_COCKTAIL ) // Cheap looking PCB, but Genuine NMK PCB, GFX aren't encrypted (maybe Korean version not proto?)
GAME( 1993, bjtwinpa, bjtwin, bjtwin, bjtwin, nmk16_state, init_bjtwin, ROT270, "NMK", "Bombjack Twin (prototype? with adult pictures, set 2)", MACHINE_NO_COCKTAIL ) // same PCB as above, different program revision, GFX are encrypted
GAME( 1995, nouryoku, 0, bjtwin, nouryoku, nmk16_state, init_nmk, ROT0, "Tecmo", "Nouryoku Koujou Iinkai", MACHINE_NO_COCKTAIL )
GAME( 1995, nouryokup, nouryoku, bjtwin, nouryoku, nmk16_state, empty_init, ROT0, "Tecmo", "Nouryoku Koujou Iinkai (prototype)", MACHINE_NO_COCKTAIL ) // GFX aren't encrypted
// Non NMK boards
// bee-oh board - different display / interrupt timing to others?
GAME( 1991, manybloc, 0, manybloc, manybloc, nmk16_state, init_tharrier, ROT270, "Bee-Oh", "Many Block", MACHINE_NO_COCKTAIL | MACHINE_IMPERFECT_SOUND )
// clone board, different sound / bg hardware, but similar memory maps, same tx layer, sprites etc.
GAME( 1997, tomagic, 0, tomagic, tomagic, nmk16_tomagic_state, init_tomagic, ROT0, "Hobbitron T.K.Trading Co. Ltd.", "Tom Tom Magic", 0 )
// these use the Seibu sound system (sound / music stolen from Raiden) rather than the bootleggers copying the nmk004
GAME( 1990, mustangb, mustang, mustangb, mustang, nmk16_state, empty_init, ROT0, "bootleg", "US AAF Mustang (bootleg, set 1)", 0 )
GAME( 1990, mustangb2, mustang, mustangb, mustang, nmk16_state, empty_init, ROT0, "bootleg (TAB Austria)", "US AAF Mustang (TAB Austria bootleg)", 0 ) // PCB and ROMs have TAB Austria stickers
GAME( 1991, tdragonb, tdragon, tdragonb, tdragonb, nmk16_state, init_tdragonb, ROT270, "bootleg", "Thunder Dragon (bootleg, set 1)", 0 )
GAME( 1992, strahljbl, strahl, strahljbl, strahljbl, nmk16_state, empty_init, ROT0, "bootleg", "Koutetsu Yousai Strahl (Japan, bootleg)", 0 )
// these are bootlegs with tharrier like sound hw
GAME( 1990, mustangb3, mustang, mustangb3, mustang, nmk16_state, empty_init, ROT0, "bootleg (Lettering)", "US AAF Mustang (Lettering bootleg)", 0 )
GAME( 1989, tharrierb, tharrier, tharrier, tharrier, nmk16_state, init_tharrier, ROT270, "bootleg (Lettering)", "Task Force Harrier (Lettering bootleg)", 0 )
// bootleg with no audio CPU and only 1 Oki
GAME( 1991, tdragonb2, tdragon, tdragonb2, tdragon, nmk16_state, empty_init, ROT270, "bootleg", "Thunder Dragon (bootleg, set 2)", MACHINE_NOT_WORKING ) // GFX and input problems. IRQs related?
// bootleg with cloned airbustr sound hardware
GAME( 1992, gunnailb, gunnail, gunnailb, gunnail, nmk16_state, init_gunnailb, ROT270, "bootleg", "GunNail (bootleg)", MACHINE_IMPERFECT_SOUND ) // crappy sound, unknown how much of it is incomplete emulation and how much bootleg quality
// these are from Comad, based on the Thunder Dragon code?
GAME( 1992, ssmissin, 0, ssmissin, ssmissin, nmk16_state, init_ssmissin, ROT270, "Comad", "S.S. Mission", MACHINE_NO_COCKTAIL )
GAME( 1996, airattck, 0, ssmissin, airattck, nmk16_state, init_ssmissin, ROT270, "Comad", "Air Attack (set 1)", MACHINE_NO_COCKTAIL )
GAME( 1996, airattcka, airattck, ssmissin, airattck, nmk16_state, init_ssmissin, ROT270, "Comad", "Air Attack (set 2)", MACHINE_NO_COCKTAIL )
// afega & clones
GAME( 1995, twinactn, 0, twinactn, twinactn, nmk16_state, init_twinactn, ROT0, "Afega", "Twin Action", 0 ) // hacked from USSAF Mustang
GAME( 1995, dolmen, 0, twinactn, dolmen, nmk16_state, init_twinactn, ROT0, "Afega", "Dolmen", 0 )
GAME( 1998, stagger1, 0, stagger1, stagger1, afega_state, empty_init, ROT270, "Afega", "Stagger I (Japan)", 0 )
GAME( 1997, redhawk, stagger1, stagger1, stagger1, afega_state, init_redhawk, ROT270, "Afega (New Vision Ent. license)", "Red Hawk (USA, Canada & South America)", 0 )
GAME( 1997, redhawki, stagger1, redhawki, stagger1, afega_state, init_redhawki, ROT0, "Afega (Hae Dong Corp license)", "Red Hawk (horizontal, Italy)", 0 ) // bootleg? strange scroll regs
GAME( 1997, redhawks, stagger1, redhawki, stagger1, afega_state, empty_init, ROT0, "Afega (Hae Dong Corp license)", "Red Hawk (horizontal, Spain)", 0 )
GAME( 1997, redhawkg, stagger1, redhawki, stagger1, afega_state, init_redhawkg, ROT0, "Afega", "Red Hawk (horizontal, Greece)", 0 )
GAME( 1997, redhawke, stagger1, stagger1, stagger1, afega_state, empty_init, ROT270, "Afega (Excellent Co. license)", "Red Hawk (Excellent Co., Ltd)", 0 ) // earlier revision? different afega logo and score and credit number fonts compared to other sets
GAME( 1997, redhawkk, stagger1, stagger1, stagger1, afega_state, empty_init, ROT270, "Afega", "Red Hawk (Korea)", 0 )
GAME( 1997, redhawkb, stagger1, redhawkb, redhawkb, afega_state, empty_init, ROT0, "bootleg (Vince)", "Red Hawk (horizontal, bootleg)", 0 )
GAME( 1998, grdnstrm, 0, grdnstrm, grdnstrm, afega_state, empty_init, ORIENTATION_FLIP_Y, "Afega (Apples Industries license)", "Guardian Storm (horizontal, not encrypted)", 0 )
GAME( 1998, grdnstrmv, grdnstrm, grdnstrmk, grdnstrk, afega_state, init_grdnstrm, ROT270, "Afega (Apples Industries license)", "Guardian Storm (vertical)", 0 )
GAME( 1998, grdnstrmj, grdnstrm, grdnstrmk, grdnstrk, afega_state, init_grdnstrmg, ROT270, "Afega", "Sen Jing - Guardian Storm (Japan)", 0 )
GAME( 1998, grdnstrmk, grdnstrm, grdnstrmk, grdnstrk, afega_state, init_grdnstrm, ROT270, "Afega", "Jeon Sin - Guardian Storm (Korea)", 0 )
GAME( 1998, redfoxwp2, grdnstrm, grdnstrmk, grdnstrk, afega_state, init_grdnstrm, ROT270, "Afega", "Hong Hu Zhanji II (China, set 1)", 0 )
GAME( 1998, redfoxwp2a, grdnstrm, grdnstrmk, grdnstrk, afega_state, init_redfoxwp2a, ROT270, "Afega", "Hong Hu Zhanji II (China, set 2)", 0 )
GAME( 1998, grdnstrmg, grdnstrm, grdnstrmk, grdnstrk, afega_state, init_grdnstrmg, ROT270, "Afega", "Guardian Storm (Germany)", 0 )
GAME( 1998, grdnstrmau, grdnstrm, grdnstrm, grdnstrm, afega_state, init_grdnstrmau, ORIENTATION_FLIP_Y, "Afega", "Guardian Storm (horizontal, Australia)", 0 )
// is there a 'bubble 2000' / 'hot bubble' version with Afega copyright, or is the only Afega release dolmen above, this seems like a sequel, not a clone?
GAME( 1998, bubl2000, 0, popspops, bubl2000, afega_state, init_bubl2000, ROT0, "Afega (Tuning license)", "Bubble 2000", 0 ) // on a tuning board - Has a Demo Sound DSW
GAME( 1998, bubl2000a, bubl2000, popspops, bubl2000a, afega_state, init_bubl2000, ROT0, "Afega (Tuning license)", "Bubble 2000 V1.2", 0 ) // on a tuning board - No Demo Sounds
GAME( 1998, hotbubl, bubl2000, popspops, bubl2000, afega_state, init_bubl2000, ROT0, "Afega (Pandora license)", "Hot Bubble (Korea, with adult pictures)", 0 ) // on an afega board ..
GAME( 1998, hotbubla, bubl2000, popspops, bubl2000, afega_state, init_bubl2000, ROT0, "Afega (Pandora license)", "Hot Bubble (Korea)", 0 ) // on an afega board ..
GAME( 1999, popspops, 0, popspops, popspops, afega_state, init_grdnstrm, ROT0, "Afega", "Pop's Pop's", 0 )
GAME( 2000, mangchi, 0, popspops, mangchi, afega_state, init_bubl2000, ROT0, "Afega", "Mang-Chi", 0 )
// these two are very similar games, but the exact parent/clone relationship is unknown
GAME( 2000, spec2k, 0, spec2k, spec2k, afega_state, init_spec2k, ROT270, "Yona Tech", "Spectrum 2000 (vertical, Korea)", MACHINE_IMPERFECT_GRAPHICS ) // the ships sometimes scroll off the screen if you insert a coin during the attract demo? verify it doesn't happen on real hw(!)
GAME( 2000, spec2kh, spec2k, spec2k, spec2k, afega_state, init_spec2k, ORIENTATION_FLIP_Y, "Yona Tech", "Spectrum 2000 (horizontal, buggy) (Europe)", 0 ) // this has odd bugs even on real hardware, eg glitchy 3 step destruction sequence of some larger enemies
GAME( 2001, firehawk, spec2k, firehawk, firehawk, afega_state, empty_init, ORIENTATION_FLIP_Y, "ESD", "Fire Hawk (World) / Huohu Chuanshuo (China) (horizontal)", 0 )
GAME( 2001, firehawkv, spec2k, firehawk, firehawkv, afega_state, empty_init, ORIENTATION_FLIP_Y, "ESD", "Fire Hawk (World) / Huohu Chuanshuo (China) (switchable orientation)", MACHINE_NOT_WORKING ) // incomplete dump, vertical mode gfx not dumped
| 49.862899
| 421
| 0.700354
|
Robbbert
|
43463d548094f54c7e5cf389576ae9143e901a70
| 3,322
|
cc
|
C++
|
content/public/common/content_client.cc
|
maidiHaitai/haitaibrowser
|
a232a56bcfb177913a14210e7733e0ea83a6b18d
|
[
"BSD-3-Clause"
] | 1
|
2020-09-15T08:43:34.000Z
|
2020-09-15T08:43:34.000Z
|
content/public/common/content_client.cc
|
maidiHaitai/haitaibrowser
|
a232a56bcfb177913a14210e7733e0ea83a6b18d
|
[
"BSD-3-Clause"
] | null | null | null |
content/public/common/content_client.cc
|
maidiHaitai/haitaibrowser
|
a232a56bcfb177913a14210e7733e0ea83a6b18d
|
[
"BSD-3-Clause"
] | null | null | null |
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/public/common/content_client.h"
#include "base/logging.h"
#include "base/strings/string_piece.h"
#include "build/build_config.h"
#include "content/public/common/origin_util.h"
#include "content/public/common/user_agent.h"
#include "ui/gfx/image/image.h"
namespace content {
static ContentClient* g_client;
class InternalTestInitializer {
public:
static ContentBrowserClient* SetBrowser(ContentBrowserClient* b) {
ContentBrowserClient* rv = g_client->browser_;
g_client->browser_ = b;
return rv;
}
static ContentRendererClient* SetRenderer(ContentRendererClient* r) {
ContentRendererClient* rv = g_client->renderer_;
g_client->renderer_ = r;
return rv;
}
static ContentUtilityClient* SetUtility(ContentUtilityClient* u) {
ContentUtilityClient* rv = g_client->utility_;
g_client->utility_ = u;
return rv;
}
};
void SetContentClient(ContentClient* client) {
g_client = client;
// TODO(jam): find out which static on Windows is causing this to have to be
// called on startup.
if (client)
client->GetUserAgent();
}
ContentClient* GetContentClient() {
return g_client;
}
ContentBrowserClient* SetBrowserClientForTesting(ContentBrowserClient* b) {
return InternalTestInitializer::SetBrowser(b);
}
ContentRendererClient* SetRendererClientForTesting(ContentRendererClient* r) {
return InternalTestInitializer::SetRenderer(r);
}
ContentUtilityClient* SetUtilityClientForTesting(ContentUtilityClient* u) {
return InternalTestInitializer::SetUtility(u);
}
ContentClient::ContentClient()
: browser_(NULL),
gpu_(NULL),
renderer_(NULL),
utility_(NULL) {}
ContentClient::~ContentClient() {
}
bool ContentClient::CanSendWhileSwappedOut(const IPC::Message* message) {
return false;
}
std::string ContentClient::GetProduct() const {
return std::string();
}
std::string ContentClient::GetUserAgent() const {
return std::string();
}
base::string16 ContentClient::GetLocalizedString(int message_id) const {
return base::string16();
}
base::StringPiece ContentClient::GetDataResource(
int resource_id,
ui::ScaleFactor scale_factor) const {
return base::StringPiece();
}
base::RefCountedStaticMemory* ContentClient::GetDataResourceBytes(
int resource_id) const {
return NULL;
}
gfx::Image& ContentClient::GetNativeImageNamed(int resource_id) const {
CR_DEFINE_STATIC_LOCAL(gfx::Image, kEmptyImage, ());
return kEmptyImage;
}
std::string ContentClient::GetProcessTypeNameInEnglish(int type) {
NOTIMPLEMENTED();
return std::string();
}
#if defined(OS_MACOSX)
bool ContentClient::GetSandboxProfileForSandboxType(
int sandbox_type,
int* sandbox_profile_resource_id) const {
return false;
}
#endif
bool ContentClient::IsSupplementarySiteIsolationModeEnabled() {
return false;
}
base::StringPiece ContentClient::GetOriginTrialPublicKey() {
return base::StringPiece();
}
#if defined(OS_ANDROID)
bool ContentClient::UsingSynchronousCompositing() {
return false;
}
media::MediaClientAndroid* ContentClient::GetMediaClientAndroid() {
return nullptr;
}
#endif // OS_ANDROID
} // namespace content
| 24.248175
| 78
| 0.752559
|
maidiHaitai
|
43469e8d2db6b4e321b9f51e6b035ac8d2e50f45
| 13,751
|
cxx
|
C++
|
code/plugins/xray_re/xr_scene.cxx
|
Rikoshet-234/xray-oxygen
|
eaac3fa4780639152684f3251b8b4452abb8e439
|
[
"Apache-2.0"
] | 7
|
2018-03-27T12:36:07.000Z
|
2020-06-26T11:31:52.000Z
|
code/plugins/xray_re/xr_scene.cxx
|
Rikoshet-234/xray-oxygen
|
eaac3fa4780639152684f3251b8b4452abb8e439
|
[
"Apache-2.0"
] | 2
|
2018-05-26T23:17:14.000Z
|
2019-04-14T18:33:27.000Z
|
code/plugins/xray_re/xr_scene.cxx
|
Rikoshet-234/xray-oxygen
|
eaac3fa4780639152684f3251b8b4452abb8e439
|
[
"Apache-2.0"
] | 5
|
2020-10-18T11:55:26.000Z
|
2022-03-28T07:21:35.000Z
|
#include "xr_scene.h"
#include "xr_scene_ai_map.h"
#include "xr_scene_details.h"
#include "xr_scene_glows.h"
#include "xr_scene_groups.h"
#include "xr_scene_lights.h"
#include "xr_scene_particles.h"
#include "xr_scene_portals.h"
#include "xr_scene_sectors.h"
#include "xr_scene_shapes.h"
#include "xr_scene_sound_envs.h"
#include "xr_scene_sound_srcs.h"
#include "xr_scene_spawns.h"
#include "xr_scene_visuals.h"
#include "xr_scene_wallmarks.h"
#include "xr_scene_ways.h"
#include "xr_file_system.h"
#include "xr_motion.h"
#include "xr_utils.h"
using namespace xray_re;
void b_params::init()
{
sm_angle = 75.f;
weld_distance = 0.005f;
lm_rms_zero = 4;
lm_rms = 4;
lm_jitter_samples = 9;
lm_pixels_per_meter = 10.0;
convert_progressive = 0;
pm_uv = 0;
pm_pos = 0;
pm_curv = 0;
pm_border_h_angle = 0;
pm_border_h_distance = 0;
pm_heuristic = 0;
}
void b_params::set_debug()
{
lm_pixels_per_meter = 0.1f;
lm_jitter_samples = 1;
convert_progressive = XRLC_QUALITY_DRAFT;
}
void b_params::set_release()
{
lm_pixels_per_meter = 10.f;
lm_jitter_samples = 9;
convert_progressive = XRLC_QUALITY_HIGH;
}
void b_params::save_v12(xr_ini_writer *w)
{
w->open_section("build_params");
w->write("light_jitter_samples", lm_jitter_samples);
w->write("light_pixel_per_meter", lm_pixels_per_meter);
w->write("light_quality", 2); // TEMP
w->write("light_quality_reserved", 0); // TEMP
w->write("light_rms", lm_rms);
w->write("light_rms_zero", lm_rms_zero);
w->write("reserved_0", pm_uv);
w->write("reserved_1", pm_pos);
w->write("reserved_2", pm_curv);
w->write("reserved_3", pm_border_h_angle);
w->write("reserved_4", pm_border_h_distance);
w->write("reserved_5", pm_heuristic);
w->write("smooth_angle", sm_angle);
w->write("weld_distance", weld_distance);
w->close_section();
}
////////////////////////////////////////////////////////////////////////////////
xr_scene::xr_scene():
m_name("level"), m_name_prefix("level_prefix")
{
m_parts.push_back(new xr_scene_ai_map(*this));
m_parts.push_back(new xr_scene_details(*this));
m_parts.push_back(new xr_scene_glows(*this));
m_parts.push_back(new xr_scene_groups(*this));
m_parts.push_back(new xr_scene_lights(*this));
m_parts.push_back(new xr_scene_visuals(*this));
m_parts.push_back(new xr_scene_particles(*this));
m_parts.push_back(new xr_scene_portals(*this));
m_parts.push_back(new xr_scene_sectors(*this));
m_parts.push_back(new xr_scene_shapes(*this));
m_parts.push_back(new xr_scene_sound_envs(*this));
m_parts.push_back(new xr_scene_sound_srcs(*this));
m_parts.push_back(new xr_scene_spawns(*this));
m_parts.push_back(new xr_scene_wallmarks(*this));
m_parts.push_back(new xr_scene_ways(*this));
m_camera_pos.set();
m_camera_orient.set();
m_bparams.init();
set_quality(XRLC_QUALITY_HIGH);
m_guid.reset();
}
xr_scene::~xr_scene()
{
delete_elements(m_parts);
delete_elements(m_objects);
}
void xr_scene::set_quality(unsigned xrlc_quality)
{
switch (xrlc_quality) {
case XRLC_QUALITY_DRAFT:
m_hemi_quality = 0;
m_sun_quality = 0;
m_bparams.set_debug();
break;
case XRLC_QUALITY_HIGH:
case XRLC_QUALITY_CUSTOM:
default:
m_hemi_quality = 3;
m_sun_quality = 3;
m_bparams.set_release();
break;
}
}
xr_scene_part* xr_scene::part(scene_chunk_id chunk_id)
{
for (xr_scene_part_vec_it it = m_parts.begin(), end = m_parts.end(); it != end; ++it) {
if ((*it)->chunk_id() == chunk_id)
return *it;
}
return 0;
}
xr_scene_ai_map* xr_scene::ai_map() { return dynamic_cast<xr_scene_ai_map*>(part(SCENE_CHUNK_AI_MAP)); }
xr_scene_details* xr_scene::details() { return dynamic_cast<xr_scene_details*>(part(SCENE_CHUNK_DETAIL_OBJECTS)); }
xr_scene_glows* xr_scene::glows() { return dynamic_cast<xr_scene_glows*>(part(SCENE_CHUNK_GLOWS)); }
xr_scene_groups* xr_scene::groups() { return dynamic_cast<xr_scene_groups*>(part(SCENE_CHUNK_GROUPS)); }
xr_scene_lights* xr_scene::lights() { return dynamic_cast<xr_scene_lights*>(part(SCENE_CHUNK_LIGHTS)); }
xr_scene_particles* xr_scene::particles() { return dynamic_cast<xr_scene_particles*>(part(SCENE_CHUNK_PARTICLES)); }
xr_scene_portals* xr_scene::portals() { return dynamic_cast<xr_scene_portals*>(part(SCENE_CHUNK_PORTALS)); }
xr_scene_sectors* xr_scene::sectors() { return dynamic_cast<xr_scene_sectors*>(part(SCENE_CHUNK_SECTORS)); }
xr_scene_shapes* xr_scene::shapes() { return dynamic_cast<xr_scene_shapes*>(part(SCENE_CHUNK_SHAPES)); }
xr_scene_sound_envs* xr_scene::sound_envs() { return dynamic_cast<xr_scene_sound_envs*>(part(SCENE_CHUNK_SOUND_ENVS)); }
xr_scene_sound_srcs* xr_scene::sound_srcs() { return dynamic_cast<xr_scene_sound_srcs*>(part(SCENE_CHUNK_SOUND_SRCS)); }
xr_scene_spawns* xr_scene::spawns() { return dynamic_cast<xr_scene_spawns*>(part(SCENE_CHUNK_SPAWNS)); }
xr_scene_visuals* xr_scene::visuals() { return dynamic_cast<xr_scene_visuals*>(part(SCENE_CHUNK_SCENE_OBJECTS)); }
xr_scene_wallmarks* xr_scene::wallmarks() { return dynamic_cast<xr_scene_wallmarks*>(part(SCENE_CHUNK_WALLMARKS)); }
xr_scene_ways* xr_scene::ways() { return dynamic_cast<xr_scene_ways*>(part(SCENE_CHUNK_WAYS)); }
xr_custom_object* xr_scene::create_object(tools_class_id class_id)
{
switch (class_id) {
case TOOLS_CLASS_GROUP:
return new xr_group_object(*this);
case TOOLS_CLASS_GLOW:
return new xr_glow_object(*this);
case TOOLS_CLASS_SCENE_OBJECT:
return new xr_visual_object(*this);
case TOOLS_CLASS_LIGHT:
return new xr_light_object(*this);
case TOOLS_CLASS_SHAPE:
return new xr_shape_object(*this);
case TOOLS_CLASS_SOUND_ENV:
return new xr_sound_env_object(*this);
case TOOLS_CLASS_SOUND_SRC:
return new xr_sound_src_object(*this);
case TOOLS_CLASS_SPAWN:
return new xr_spawn_object(*this);
case TOOLS_CLASS_WAY:
return new xr_way_object(*this);
case TOOLS_CLASS_SECTOR:
return new xr_sector_object(*this);
case TOOLS_CLASS_PORTAL:
return new xr_portal_object(*this);
case TOOLS_CLASS_PARTICLE:
return new xr_particle_object(*this);
default:
return 0;
}
}
struct read_object {
explicit read_object(xr_scene& _scene): scene(_scene) {}
void operator()(xr_custom_object*& object, xr_reader& r) {
xr_assert(sizeof(tools_class_id) == 4);
tools_class_id class_id;
if (!r.r_chunk(TOOLS_CHUNK_OBJECT_CLASS, class_id))
xr_not_expected();
object = scene.create_object(class_id);
xr_assert(object);
xr_reader* s = r.open_chunk(TOOLS_CHUNK_OBJECT_DATA);
xr_assert(s);
object->load(*s);
r.close_chunk(s);
}
xr_scene& scene;
};
void xr_scene::load_objects(xr_reader& r, uint32_t chunk_id, xr_custom_object_vec& objects)
{
xr_reader* s = r.open_chunk(chunk_id);
if (s) {
s->r_chunks(objects, read_object(*this));
r.close_chunk(s);
}
}
struct write_object { void operator()(xr_custom_object* const& object, xr_writer& w) const {
tools_class_id class_id = object->class_id();
w.w_chunk(TOOLS_CHUNK_OBJECT_CLASS, class_id);
w.open_chunk(TOOLS_CHUNK_OBJECT_DATA);
object->save(w);
w.close_chunk();
}};
void xr_scene::save_objects(xr_writer& w, uint32_t chunk_id, const xr_custom_object_vec& objects) const
{
w.open_chunk(chunk_id);
w.w_chunks(objects, write_object());
w.close_chunk();
}
struct ini_write_object { void operator()(xr_custom_object* const& object, xr_ini_writer* w) const {
object->save_v12(w);
}};
void xr_scene::save_objects(xr_ini_writer* w, const std::vector<xr_custom_object*>& objects, const char* prefix) const
{
w->w_sections(objects, ini_write_object(), prefix);
}
void xr_scene::load_options(xr_reader& r)
{
uint32_t version;
if (!r.r_chunk<uint32_t>(SCENE_CHUNK_LO_VERSION, version))
xr_not_expected();
xr_assert(version == SCENE_LO_VERSION);
if (!r.r_chunk(SCENE_CHUNK_LO_NAMES, m_name))
xr_not_expected();
r.r_chunk(SCENE_CHUNK_LO_NAME_PREFIX, m_name_prefix);
r.r_chunk(SCENE_CHUNK_LO_BOP, m_custom_data);
if (r.r_chunk(SCENE_CHUNK_LO_BPARAMS_VERSION, version) &&
version == SCENE_LO_BPARAMS_VERSION) {
r.r_chunk<b_params>(SCENE_CHUNK_LO_BPARAMS, m_bparams);
}
if (r.find_chunk(SCENE_CHUNK_LO_QUALITY)) {
m_hemi_quality = r.r_u8();
m_sun_quality = r.r_u8();
r.debug_find_chunk();
}
}
void xr_scene::save_options(xr_writer& w)
{
w.w_chunk<uint32_t>(SCENE_CHUNK_LO_VERSION, SCENE_LO_VERSION);
w.w_chunk(SCENE_CHUNK_LO_NAMES, m_name);
w.w_chunk(SCENE_CHUNK_LO_NAME_PREFIX, m_name_prefix);
w.w_chunk(SCENE_CHUNK_LO_BOP, m_custom_data);
w.w_chunk<uint32_t>(SCENE_CHUNK_LO_BPARAMS_VERSION, SCENE_LO_BPARAMS_VERSION);
w.w_chunk(SCENE_CHUNK_LO_BPARAMS, m_bparams);
w.open_chunk(SCENE_CHUNK_LO_QUALITY);
w.w_u8(m_hemi_quality);
w.w_u8(m_sun_quality);
w.close_chunk();
}
bool xr_scene::load(const char* name)
{
xr_file_system& fs = xr_file_system::instance();
xr_reader* r = fs.r_open(PA_MAPS, std::string(name) + ".level");
if (r == 0)
return false;
uint32_t version;
if (!r->r_chunk<uint32_t>(SCENE_CHUNK_VERSION, version)) {
msg("no scene version chunk");
xr_not_expected();
}
xr_assert(version == SCENE_VERSION);
if (version != SCENE_VERSION) {
msg("unexpected scene version %" PRIu32, version);
xr_not_expected();
}
xr_reader* s = r->open_chunk(SCENE_CHUNK_OPTIONS);
if (s) {
load_options(*s);
r->close_chunk(s);
} else {
msg("no level options chunk");
xr_not_expected();
}
if (r->find_chunk(SCENE_CHUNK_CAMERA)) {
r->r_fvector3(m_camera_pos);
r->r_fvector3(m_camera_orient);
r->debug_find_chunk();
} else {
msg("no scene camera chunk");
xr_not_expected();
}
if (!r->r_chunk<xr_guid>(TOOLS_CHUNK_GUID, m_guid)) {
msg("no tools GUID chunk");
xr_not_expected();
}
m_revision.load(*r);
size_t num_objects = 0;
if (r->find_chunk(SCENE_CHUNK_COUNT)) {
num_objects = r->r_u32();
r->debug_find_chunk();
}
load_objects(*r, SCENE_CHUNK_OBJECTS, m_objects);
if (r->find_chunk(SCENE_CHUNK_SNAP_OBJECTS))
r->r_seq(r->r_u32(), m_snap_objects, xr_reader::f_r_sz());
fs.r_close(r);
std::string parts_path(name);
parts_path += '\\';
for (xr_scene_part_vec_it it = m_parts.begin(), end = m_parts.end();
it != end; ++it) {
xr_scene_part* part = *it;
r = fs.r_open(PA_MAPS, parts_path + part->file_name());
if (r == 0)
msg("can't load scene part %s", part->file_name());
xr_assert(r);
xr_guid guid;
if (!r->r_chunk<xr_guid>(TOOLS_CHUNK_GUID, guid) || guid != m_guid)
xr_not_expected();
xr_reader* s = r->open_chunk(part->chunk_id());
xr_assert(s);
if (s) {
part->load(*s);
r->close_chunk(s);
}
fs.r_close(r);
}
return true;
}
bool xr_scene::save(const char* name)
{
xr_memory_writer* w = new xr_memory_writer();
w->w_chunk<uint32_t>(SCENE_CHUNK_VERSION, SCENE_VERSION);
w->open_chunk(SCENE_CHUNK_OPTIONS);
save_options(*w);
w->close_chunk();
w->w_chunk(TOOLS_CHUNK_GUID, m_guid);
m_revision.save(*w);
w->open_chunk(SCENE_CHUNK_CAMERA);
w->w_fvector3(m_camera_pos);
w->w_fvector3(m_camera_orient);
w->close_chunk();
w->open_chunk(SCENE_CHUNK_SNAP_OBJECTS);
w->w_size_u32(m_snap_objects.size());
w->w_seq(m_snap_objects, xr_writer::f_w_sz());
w->close_chunk();
if (!m_objects.empty())
save_objects(*w, SCENE_CHUNK_OBJECTS, m_objects);
bool status = w->save_to(PA_MAPS, std::string(name) + ".level");
delete w;
xr_file_system& fs = xr_file_system::instance();
fs.create_folder(PA_MAPS, name);
std::string parts_path(name);
parts_path += '\\';
for (xr_scene_part_vec_it it = m_parts.begin(), end = m_parts.end();
it != end; ++it) {
xr_scene_part* part = *it;
w = new xr_memory_writer();
w->w_chunk(TOOLS_CHUNK_GUID, m_guid);
w->open_chunk(part->chunk_id());
part->save(*w);
w->close_chunk();
if (!w->save_to(PA_MAPS, parts_path + part->file_name()))
msg("can't save scene part %s", part->file_name());
delete w;
}
return status;
}
bool xr_scene::save_v12(const char* name)
{
xr_ini_writer *w = new xr_ini_writer();
m_bparams.save_v12(w);
w->open_section("camera");
w->write("hpb", m_camera_orient);
w->write("pos", m_camera_pos);
w->close_section();
write_guid(w);
w->open_section("level_options");
w->write("bop", "");
w->write("game_type", 1);
w->write("level_path", m_name, false);
w->write("level_prefix", m_name_prefix, false);
w->write("light_hemi_quality", m_hemi_quality);
w->write("light_sun_quality", m_sun_quality);
w->write("map_version", 1.0f);
w->write("version", 12);
w->write("version_bp", SCENE_LO_BPARAMS_VERSION);
w->close_section();
m_revision.save_v12(w);
w->open_section("version");
w->write("value", SCENE_VERSION);
w->close_section();
w->save_to(PA_MAPS, std::string(name) + ".level");
delete w;
xr_file_system& fs = xr_file_system::instance();
fs.create_folder(PA_MAPS, name);
std::string parts_path(name);
parts_path += '\\';
for (xr_scene_part_vec_it it = m_parts.begin(), end = m_parts.end();
it != end; ++it) {
xr_scene_part* part = *it;
const type_info& type = typeid(*part);
w = new xr_ini_writer();
if (type == typeid(xr_scene_ai_map) ||
type == typeid(xr_scene_details) ||
type == typeid(xr_scene_wallmarks))
{
w->w_chunk(TOOLS_CHUNK_GUID, m_guid);
w->open_chunk(part->chunk_id());
part->save(*w);
w->close_chunk();
}
else
{
write_guid(w);
part->save_v12(w);
}
if (!w->save_to(PA_MAPS, parts_path + part->file_name()))
msg("can't save scene part %s", part->file_name());
delete w;
}
return true;
}
void xr_scene::write_guid(xr_ini_writer* w)
{
//msg("%s", "guid save_v12");
w->open_section("guid");
uint32_t tmp[4];
memcpy(tmp, ((char *)m_guid.g) + 1, sizeof(uint32_t) * 4);
xr_guid *guid2 = new xr_guid;
memcpy(&guid2->g, tmp, sizeof(uint32_t) * 4);
w->write("guid_g0", &m_guid);
w->write("guid_g1", guid2);
w->close_section();
}
void xr_scene::write_revision(xr_ini_writer* w, bool scene_part)
{
m_revision.save_v12(w, scene_part);
}
| 27.668008
| 120
| 0.726056
|
Rikoshet-234
|
4348e96186c368e175b686cee615ba2a261d8e69
| 9,572
|
cpp
|
C++
|
rviz_default_plugins/test/rviz_default_plugins/view_controllers/fps/fps_view_controller_test.cpp
|
Tobias-Fischer/rviz-1
|
2d84e191873befa86c1b4060ddf7e25b39d095c1
|
[
"BSD-3-Clause-Clear"
] | 108
|
2017-08-29T11:01:08.000Z
|
2022-03-31T06:07:52.000Z
|
rviz_default_plugins/test/rviz_default_plugins/view_controllers/fps/fps_view_controller_test.cpp
|
Tobias-Fischer/rviz-1
|
2d84e191873befa86c1b4060ddf7e25b39d095c1
|
[
"BSD-3-Clause-Clear"
] | 741
|
2017-08-29T06:30:27.000Z
|
2022-03-29T14:46:07.000Z
|
rviz_default_plugins/test/rviz_default_plugins/view_controllers/fps/fps_view_controller_test.cpp
|
Tobias-Fischer/rviz-1
|
2d84e191873befa86c1b4060ddf7e25b39d095c1
|
[
"BSD-3-Clause-Clear"
] | 141
|
2017-08-31T08:31:26.000Z
|
2022-03-31T14:46:36.000Z
|
/*
* Copyright (c) 2018, Bosch Software Innovations GmbH.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted (subject to the limitations in the disclaimer
* below) provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS
* LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <gmock/gmock.h>
#include <memory>
#include <QApplication> // NOLINT cpplint cannot handle include order
#include <QKeyEvent> // NOLINT cpplint cannot handle include order
#include <OgreCamera.h>
#include <OgreRoot.h>
#include "rviz_common/render_panel.hpp"
#include "rviz_common/viewport_mouse_event.hpp"
#include "rviz_default_plugins/view_controllers/fps/fps_view_controller.hpp"
#include "rviz_default_plugins/view_controllers/orbit/orbit_view_controller.hpp"
#include "../../displays/display_test_fixture.hpp"
#include "../../scene_graph_introspection.hpp"
#include "../view_controller_test_fixture.hpp"
using namespace ::testing; // NOLINT
class FPSViewControllerTestFixture : public ViewControllerTestFixture
{
public:
FPSViewControllerTestFixture()
{
fps_ = std::make_shared<rviz_default_plugins::view_controllers::FPSViewController>();
fps_->initialize(context_.get());
testing_environment_->createOgreRenderWindow()->addViewport(fps_->getCamera());
}
void dragMouse(
int to_x, int to_y, int from_x, int from_y,
Qt::MouseButton button, Qt::KeyboardModifiers modifiers = Qt::NoModifier)
{
dragMouseInViewport(fps_, to_x, to_y, from_x, from_y, button, modifiers);
}
void setCameraToDefaultPosition()
{
auto yaw_property = fps_->childAt(4);
auto pitch_property = fps_->childAt(5);
ASSERT_THAT(yaw_property->getNameStd(), StrEq("Yaw"));
ASSERT_THAT(pitch_property->getNameStd(), StrEq("Pitch"));
yaw_property->setValue(0); // set to zero to make result easier to check
pitch_property->setValue(0); // set to zeor to make result easier to check
auto position_property = fps_->childAt(6);
ASSERT_THAT(position_property->getNameStd(), StrEq("Position"));
position_property->childAt(0)->setValue(0);
position_property->childAt(1)->setValue(0);
position_property->childAt(2)->setValue(0);
fps_->update(0, 0); // Camera now looks in x-direction, located at the origin
EXPECT_THAT(yaw_property->getValue().toFloat(), FloatNear(0, 0.001f));
EXPECT_THAT(pitch_property->getValue().toFloat(), FloatNear(0, 0.001f));
auto x_position = position_property->childAt(0);
auto y_position = position_property->childAt(1);
auto z_position = position_property->childAt(2);
EXPECT_THAT(x_position->getValue().toFloat(), FloatNear(0, 0.001f));
EXPECT_THAT(y_position->getValue().toFloat(), FloatNear(0, 0.001f));
EXPECT_THAT(z_position->getValue().toFloat(), FloatNear(0, 0.001f));
}
std::shared_ptr<rviz_default_plugins::view_controllers::FPSViewController> fps_;
};
TEST_F(FPSViewControllerTestFixture, moving_the_mouse_to_the_left_rotates_left)
{
setCameraToDefaultPosition();
dragMouse(0, 10, 10, 10, Qt::LeftButton);
auto yaw_property = fps_->childAt(4);
auto pitch_property = fps_->childAt(5);
EXPECT_THAT(yaw_property->getValue().toFloat(), FloatNear(0.05f, 0.001f));
EXPECT_THAT(pitch_property->getValue().toFloat(), FloatNear(0, 0.001f));
}
TEST_F(FPSViewControllerTestFixture, moving_the_mouse_up_rotates_up)
{
setCameraToDefaultPosition();
dragMouse(10, 20, 10, 10, Qt::LeftButton);
auto yaw_property = fps_->childAt(4);
auto pitch_property = fps_->childAt(5);
EXPECT_THAT(yaw_property->getValue().toFloat(), FloatNear(0, 0.001f));
EXPECT_THAT(pitch_property->getValue().toFloat(), FloatNear(0.05f, 0.001f));
}
TEST_F(FPSViewControllerTestFixture, moving_the_wheel_moves_camera_in_looking_direction) {
setCameraToDefaultPosition();
auto event = generateMouseWheelEvent(100);
fps_->handleMouseEvent(event);
auto position_property = fps_->childAt(6);
auto x_position = position_property->childAt(0);
auto y_position = position_property->childAt(1);
auto z_position = position_property->childAt(2);
EXPECT_THAT(x_position->getValue().toFloat(), FloatNear(1, 0.001f));
EXPECT_THAT(y_position->getValue().toFloat(), FloatNear(0, 0.001f));
EXPECT_THAT(z_position->getValue().toFloat(), FloatNear(0, 0.001f));
}
TEST_F(
FPSViewControllerTestFixture,
moving_the_mouse_with_right_button_moves_camera_in_looking_direction) {
setCameraToDefaultPosition();
dragMouse(10, 0, 10, 10, Qt::RightButton);
auto position_property = fps_->childAt(6);
auto x_position = position_property->childAt(0);
auto y_position = position_property->childAt(1);
auto z_position = position_property->childAt(2);
EXPECT_THAT(x_position->getValue().toFloat(), FloatNear(1, 0.001f));
EXPECT_THAT(y_position->getValue().toFloat(), FloatNear(0, 0.001f));
EXPECT_THAT(z_position->getValue().toFloat(), FloatNear(0, 0.001f));
}
TEST_F(FPSViewControllerTestFixture, moving_the_mouse_with_shift_moves_camera_in_xy_plane) {
setCameraToDefaultPosition();
dragMouse(10, 10, 0, 0, Qt::LeftButton, Qt::ShiftModifier);
auto position_property = fps_->childAt(6);
auto x_position = position_property->childAt(0);
auto y_position = position_property->childAt(1);
auto z_position = position_property->childAt(2);
EXPECT_THAT(x_position->getValue().toFloat(), FloatNear(0, 0.001f));
EXPECT_THAT(y_position->getValue().toFloat(), FloatNear(-0.1f, 0.001f));
EXPECT_THAT(z_position->getValue().toFloat(), FloatNear(-0.1f, 0.001f));
}
TEST_F(FPSViewControllerTestFixture, reset_sets_to_some_point_looking_at_origin) {
setCameraToDefaultPosition();
fps_->reset();
auto yaw_property = fps_->childAt(4);
auto pitch_property = fps_->childAt(5);
EXPECT_THAT(yaw_property->getValue().toFloat(), FloatNear(3.92699f, 0.001f));
EXPECT_THAT(pitch_property->getValue().toFloat(), FloatNear(0.955317f, 0.001f));
auto position_property = fps_->childAt(6);
auto x_position = position_property->childAt(0);
auto y_position = position_property->childAt(1);
auto z_position = position_property->childAt(2);
EXPECT_THAT(x_position->getValue().toFloat(), FloatNear(5, 0.001f));
EXPECT_THAT(y_position->getValue().toFloat(), FloatNear(5, 0.001f));
EXPECT_THAT(z_position->getValue().toFloat(), FloatNear(10, 0.001f));
}
TEST_F(FPSViewControllerTestFixture, mimic_does_not_change_view_when_given_any_view_controller) {
auto orbit_view =
std::make_shared<rviz_default_plugins::view_controllers::OrbitViewController>();
orbit_view->setClassId("rviz_default_plugins/XYOrbit");
orbit_view->initialize(context_.get());
auto old_yaw_property = orbit_view->childAt(7);
auto old_pitch_property = orbit_view->childAt(8);
old_yaw_property->setValue(1);
old_pitch_property->setValue(2);
orbit_view->move(10, 12, 0);
orbit_view->update(0, 0);
fps_->mimic(orbit_view.get());
fps_->update(0, 0);
// Yaw and Pitch cannot be equal since the orbit view's yaw and pitch are relative to its focal
// point, while the fps yaw and pitch are absolute. However, the orientation of the camera
// scene node should be equivalent.
auto fps_camera_orientation = fps_->getCamera()->getParentSceneNode()->getOrientation();
auto orbit_camera_orientation = orbit_view->getCamera()->getParentSceneNode()->getOrientation();
EXPECT_THAT(fps_camera_orientation, QuaternionEq(orbit_camera_orientation));
auto position_property = fps_->childAt(6);
auto x_position = position_property->childAt(0);
auto y_position = position_property->childAt(1);
auto z_position = position_property->childAt(2);
auto orbit_camera_position = orbit_view->getCamera()->getParentSceneNode()->getPosition();
EXPECT_THAT(x_position->getValue().toFloat(), FloatNear(orbit_camera_position.x, 0.001f));
EXPECT_THAT(y_position->getValue().toFloat(), FloatNear(orbit_camera_position.y, 0.001f));
EXPECT_THAT(z_position->getValue().toFloat(), FloatNear(orbit_camera_position.z, 0.001f));
}
int main(int argc, char ** argv)
{
QApplication app(argc, argv);
InitGoogleMock(&argc, argv);
return RUN_ALL_TESTS();
}
| 42.923767
| 98
| 0.752925
|
Tobias-Fischer
|
43490df917e86965b41f011d1c725cfd4adec159
| 1,306
|
hpp
|
C++
|
llarp/dns/question.hpp
|
da4089/llarp
|
e223f5d023b1794638b9e9b47a86ed03c8c25306
|
[
"Zlib"
] | 28
|
2018-01-25T17:39:25.000Z
|
2022-03-26T15:23:12.000Z
|
llarp/dns/question.hpp
|
gjyoung1974/loki-network
|
6559bb8f9e80095b4a7462ccb8fdf12e8ce19527
|
[
"Zlib"
] | 2
|
2019-12-19T15:37:07.000Z
|
2020-01-31T19:42:28.000Z
|
llarp/dns/question.hpp
|
gjyoung1974/loki-network
|
6559bb8f9e80095b4a7462ccb8fdf12e8ce19527
|
[
"Zlib"
] | 7
|
2018-05-21T12:34:50.000Z
|
2021-05-05T11:57:50.000Z
|
#ifndef LLARP_DNS_QUESTION_HPP
#define LLARP_DNS_QUESTION_HPP
#include <dns/serialize.hpp>
#include <dns/name.hpp>
#include <net/net_int.hpp>
namespace llarp
{
namespace dns
{
using QType_t = uint16_t;
using QClass_t = uint16_t;
struct Question : public Serialize
{
Question() = default;
Question(Question&& other);
Question(const Question& other);
bool
Encode(llarp_buffer_t* buf) const override;
bool
Decode(llarp_buffer_t* buf) override;
std::ostream&
print(std::ostream& stream, int level, int spaces) const;
bool
operator==(const Question& other) const
{
return qname == other.qname && qtype == other.qtype
&& qclass == other.qclass;
}
Name_t qname;
QType_t qtype;
QClass_t qclass;
/// determine if we match a name
bool
IsName(const std::string& other) const;
/// return qname with no trailing .
std::string
Name() const;
/// determine if we are using this TLD
bool
HasTLD(const std::string& tld) const;
};
inline std::ostream&
operator<<(std::ostream& out, const Question& q)
{
q.print(out, -1, -1);
return out;
}
} // namespace dns
} // namespace llarp
#endif
| 20.730159
| 63
| 0.603369
|
da4089
|
43494642380d832641ce016fea4e5180ebfe1caa
| 8,080
|
cpp
|
C++
|
test/test_conversions.cpp
|
nuclearsandwich-ros/octomap_ros-release
|
48838155654ca76d5eb4c421f30e1898408a6086
|
[
"BSD-3-Clause"
] | null | null | null |
test/test_conversions.cpp
|
nuclearsandwich-ros/octomap_ros-release
|
48838155654ca76d5eb4c421f30e1898408a6086
|
[
"BSD-3-Clause"
] | null | null | null |
test/test_conversions.cpp
|
nuclearsandwich-ros/octomap_ros-release
|
48838155654ca76d5eb4c421f30e1898408a6086
|
[
"BSD-3-Clause"
] | null | null | null |
// Copyright 2021, Daisuke Nishimatsu. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
//
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// * Neither the name of the Willow Garage nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#include <sensor_msgs/point_cloud2_iterator.hpp>
#include <octomap_ros/conversions.hpp>
#include <gtest/gtest.h>
constexpr double epsilon = 1e-6;
TEST(conversions, pointOctomapToMsg)
{
using octomap::pointOctomapToMsg;
const double x = 1.0;
const double y = 2.0;
const double z = 3.0;
const auto octo_p = octomap::point3d(x, y, z);
const auto geom_p = pointOctomapToMsg(octo_p);
EXPECT_DOUBLE_EQ(geom_p.x, x);
EXPECT_DOUBLE_EQ(geom_p.y, y);
EXPECT_DOUBLE_EQ(geom_p.z, z);
}
TEST(conversions, pointMsgToOctomap)
{
using octomap::pointMsgToOctomap;
const double x = 1.0;
const double y = 2.0;
const double z = 3.0;
const auto geom_p = geometry_msgs::build<geometry_msgs::msg::Point>().x(x).y(y).z(z);
const auto octo_p = pointMsgToOctomap(geom_p);
EXPECT_DOUBLE_EQ(octo_p.x(), x);
EXPECT_DOUBLE_EQ(octo_p.y(), y);
EXPECT_DOUBLE_EQ(octo_p.z(), z);
}
TEST(conversions, pointOctomapToTf)
{
using octomap::pointOctomapToTf;
const double x = 1.0;
const double y = 2.0;
const double z = 3.0;
const auto octo_p = octomap::point3d(x, y, z);
const auto tf_v = pointOctomapToTf(octo_p);
EXPECT_DOUBLE_EQ(tf_v.x(), x);
EXPECT_DOUBLE_EQ(tf_v.y(), y);
EXPECT_DOUBLE_EQ(tf_v.z(), z);
}
TEST(conversions, pointTfToOctomap)
{
using octomap::pointTfToOctomap;
const double x = 1.0;
const double y = 2.0;
const double z = 3.0;
const auto tf_v = tf2::Vector3(x, y, z);
const auto octo_p = pointTfToOctomap(tf_v);
EXPECT_DOUBLE_EQ(octo_p.x(), x);
EXPECT_DOUBLE_EQ(octo_p.y(), y);
EXPECT_DOUBLE_EQ(octo_p.z(), z);
}
TEST(conversions, quaternionOctomapToTf)
{
using octomap::quaternionOctomapToTf;
const double u = 1.0;
const double x = 2.0;
const double y = 3.0;
const double z = 4.0;
const auto octo_q = octomath::Quaternion(u, x, y, z);
const auto tf_q = quaternionOctomapToTf(octo_q);
EXPECT_DOUBLE_EQ(tf_q.w(), u);
EXPECT_DOUBLE_EQ(tf_q.x(), x);
EXPECT_DOUBLE_EQ(tf_q.y(), y);
EXPECT_DOUBLE_EQ(tf_q.z(), z);
}
TEST(conversions, quaternionTfToOctomap)
{
using octomap::quaternionTfToOctomap;
const double w = 1.0;
const double x = 2.0;
const double y = 3.0;
const double z = 4.0;
const auto tf_q = tf2::Quaternion(x, y, z, w);
const auto octo_q = quaternionTfToOctomap(tf_q);
EXPECT_DOUBLE_EQ(octo_q.u(), w);
EXPECT_DOUBLE_EQ(octo_q.x(), x);
EXPECT_DOUBLE_EQ(octo_q.y(), y);
EXPECT_DOUBLE_EQ(octo_q.z(), z);
}
TEST(conversions, poseOctomapToTf)
{
using octomap::poseOctomapToTf;
const double x = 1.0;
const double y = 2.0;
const double z = 3.0;
const auto octo_p = octomap::point3d(x, y, z);
const double rot_u = 1.0;
const double rot_x = 2.0;
const double rot_y = 3.0;
const double rot_z = 4.0;
const auto octo_q = octomath::Quaternion(rot_u, rot_x, rot_y, rot_z);
const auto octo_pose = octomap::pose6d(octo_p, octo_q);
const auto tf_trans = poseOctomapToTf(octo_pose);
const auto length = octo_q.norm();
EXPECT_DOUBLE_EQ(tf_trans.getOrigin().x(), x);
EXPECT_DOUBLE_EQ(tf_trans.getOrigin().y(), y);
EXPECT_DOUBLE_EQ(tf_trans.getOrigin().z(), z);
EXPECT_NEAR(tf_trans.getRotation().w() * length, rot_u, epsilon);
EXPECT_NEAR(tf_trans.getRotation().x() * length, rot_x, epsilon);
EXPECT_NEAR(tf_trans.getRotation().y() * length, rot_y, epsilon);
EXPECT_NEAR(tf_trans.getRotation().z() * length, rot_z, epsilon);
}
TEST(conversions, poseTfToOctomap)
{
using octomap::poseTfToOctomap;
const double x = 1.0;
const double y = 2.0;
const double z = 3.0;
const auto tf_v = tf2::Vector3(x, y, z);
const double rot_w = 1.0;
const double rot_x = 2.0;
const double rot_y = 3.0;
const double rot_z = 4.0;
const auto tf_q = tf2::Quaternion(rot_x, rot_y, rot_z, rot_w);
const auto tf_trans = tf2::Transform(tf_q, tf_v);
const auto octo_pose = poseTfToOctomap(tf_trans);
const auto length = tf_q.length();
EXPECT_DOUBLE_EQ(octo_pose.trans().x(), x);
EXPECT_DOUBLE_EQ(octo_pose.trans().y(), y);
EXPECT_DOUBLE_EQ(octo_pose.trans().z(), z);
EXPECT_NEAR(octo_pose.rot().u() * length, rot_w, epsilon);
EXPECT_NEAR(octo_pose.rot().x() * length, rot_x, epsilon);
EXPECT_NEAR(octo_pose.rot().y() * length, rot_y, epsilon);
EXPECT_NEAR(octo_pose.rot().z() * length, rot_z, epsilon);
}
TEST(conversions, pointsOctomapToPointCloud2)
{
using octomap::pointsOctomapToPointCloud2;
octomap::point3d_list points{{1.0, 2.0, 3.0}, {4.0, 5.0, 6.0}, {7.0, 8.0, 9.0}};
sensor_msgs::msg::PointCloud2 ros_points{};
sensor_msgs::PointCloud2Modifier modifier{ros_points};
modifier.setPointCloud2FieldsByString(1, "xyz");
pointsOctomapToPointCloud2(points, ros_points);
sensor_msgs::PointCloud2Iterator<float> iter_x(ros_points, "x");
sensor_msgs::PointCloud2Iterator<float> iter_y(ros_points, "y");
sensor_msgs::PointCloud2Iterator<float> iter_z(ros_points, "z");
EXPECT_EQ(modifier.size(), 3U);
EXPECT_DOUBLE_EQ(*iter_x, 1.0);
EXPECT_DOUBLE_EQ(*iter_y, 2.0);
EXPECT_DOUBLE_EQ(*iter_z, 3.0);
++iter_x;
++iter_y;
++iter_z;
EXPECT_DOUBLE_EQ(*iter_x, 4.0);
EXPECT_DOUBLE_EQ(*iter_y, 5.0);
EXPECT_DOUBLE_EQ(*iter_z, 6.0);
++iter_x;
++iter_y;
++iter_z;
EXPECT_DOUBLE_EQ(*iter_x, 7.0);
EXPECT_DOUBLE_EQ(*iter_y, 8.0);
EXPECT_DOUBLE_EQ(*iter_z, 9.0);
}
TEST(conversions, pointCloud2ToOctomap)
{
using octomap::pointCloud2ToOctomap;
sensor_msgs::msg::PointCloud2 ros_points{};
sensor_msgs::PointCloud2Modifier modifier{ros_points};
modifier.setPointCloud2FieldsByString(1, "xyz");
modifier.resize(3);
sensor_msgs::PointCloud2Iterator<float> iter_x(ros_points, "x");
sensor_msgs::PointCloud2Iterator<float> iter_y(ros_points, "y");
sensor_msgs::PointCloud2Iterator<float> iter_z(ros_points, "z");
int val{0};
for (size_t i = 0; i < modifier.size(); ++i, ++iter_x, ++iter_y, ++iter_z) {
*iter_x = static_cast<float>(++val);
*iter_y = static_cast<float>(++val);
*iter_z = static_cast<float>(++val);
}
octomap::Pointcloud octo_points{};
pointCloud2ToOctomap(ros_points, octo_points);
EXPECT_EQ(octo_points.size(), 3U);
EXPECT_DOUBLE_EQ(octo_points[0].x(), 1.0);
EXPECT_DOUBLE_EQ(octo_points[0].y(), 2.0);
EXPECT_DOUBLE_EQ(octo_points[0].z(), 3.0);
EXPECT_DOUBLE_EQ(octo_points[1].x(), 4.0);
EXPECT_DOUBLE_EQ(octo_points[1].y(), 5.0);
EXPECT_DOUBLE_EQ(octo_points[1].z(), 6.0);
EXPECT_DOUBLE_EQ(octo_points[2].x(), 7.0);
EXPECT_DOUBLE_EQ(octo_points[2].y(), 8.0);
EXPECT_DOUBLE_EQ(octo_points[2].z(), 9.0);
}
| 31.076923
| 87
| 0.71151
|
nuclearsandwich-ros
|
434a512f05e53fd9827c861245143c832012ecc9
| 25,850
|
cxx
|
C++
|
GPU/GPUTracking/Base/hip/GPUReconstructionHIP.hip.cxx
|
aknospe/AliRoot
|
96d76b2078d6b757a2843ae4a890a85021241e70
|
[
"BSD-3-Clause"
] | null | null | null |
GPU/GPUTracking/Base/hip/GPUReconstructionHIP.hip.cxx
|
aknospe/AliRoot
|
96d76b2078d6b757a2843ae4a890a85021241e70
|
[
"BSD-3-Clause"
] | null | null | null |
GPU/GPUTracking/Base/hip/GPUReconstructionHIP.hip.cxx
|
aknospe/AliRoot
|
96d76b2078d6b757a2843ae4a890a85021241e70
|
[
"BSD-3-Clause"
] | null | null | null |
//**************************************************************************\
//* This file is property of and copyright by the ALICE Project *\
//* ALICE Experiment at CERN, All rights reserved. *\
//* *\
//* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *\
//* for The ALICE HLT Project. *\
//* *\
//* Permission to use, copy, modify and distribute this software and its *\
//* documentation strictly for non-commercial purposes is hereby granted *\
//* without fee, provided that the above copyright notice appears in all *\
//* copies and that both the copyright notice and this permission notice *\
//* appear in the supporting documentation. The authors make no claims *\
//* about the suitability of this software for any purpose. It is *\
//* provided "as is" without express or implied warranty. *\
//**************************************************************************
/// \file GPUReconstructionHIP.hip.cxx
/// \author David Rohr
#define GPUCA_GPUTYPE_VEGA
#define GPUCA_UNROLL(CUDA, HIP) GPUCA_M_UNROLL_##HIP
#include <hip/hip_runtime.h>
#ifdef __CUDACC__
#define hipExtLaunchKernelGGL(...)
#else
#include <hip/hip_ext.h>
#endif
#include "GPUDef.h"
// clang-format off
#ifndef GPUCA_NO_CONSTANT_MEMORY
#ifdef GPUCA_CONSTANT_AS_ARGUMENT
#define GPUCA_CONSMEM_PTR const GPUConstantMemCopyable gGPUConstantMemBufferByValue,
#define GPUCA_CONSMEM_CALL gGPUConstantMemBufferHost,
#define GPUCA_CONSMEM (const_cast<GPUConstantMem&>(gGPUConstantMemBufferByValue.v))
#else
#define GPUCA_CONSMEM_PTR
#define GPUCA_CONSMEM_CALL
#define GPUCA_CONSMEM (gGPUConstantMemBuffer.v)
#endif
#else
#define GPUCA_CONSMEM_PTR const GPUConstantMem *gGPUConstantMemBuffer,
#define GPUCA_CONSMEM_CALL me->mDeviceConstantMem,
#define GPUCA_CONSMEM const_cast<GPUConstantMem&>(*gGPUConstantMemBuffer)
#endif
#define GPUCA_KRNL_BACKEND_CLASS GPUReconstructionHIPBackend
// clang-format on
#include "GPUReconstructionHIP.h"
#include "GPUReconstructionHIPInternals.h"
#include "GPUReconstructionIncludes.h"
#ifdef GPUCA_HAS_GLOBAL_SYMBOL_CONSTANT_MEM
__global__ void gGPUConstantMemBuffer_dummy(int* p) { *p = *(int*)&gGPUConstantMemBuffer; }
#endif
using namespace GPUCA_NAMESPACE::gpu;
__global__ void dummyInitKernel(void* foo) {}
#if defined(HAVE_O2HEADERS) && !defined(GPUCA_NO_ITS_TRAITS)
#include "ITStrackingHIP/VertexerTraitsHIP.h"
#else
namespace o2
{
namespace its
{
class VertexerTraitsHIP : public VertexerTraits
{
};
class TrackerTraitsHIP : public TrackerTraits
{
};
} // namespace its
} // namespace o2
#endif
class GPUDebugTiming
{
public:
GPUDebugTiming(bool d, void** t, hipStream_t* s, GPUReconstruction::krnlSetup& x, GPUReconstructionHIPBackend* r = nullptr) : mDeviceTimers(t), mStreams(s), mXYZ(x), mRec(r), mDo(d)
{
if (mDo) {
if (mDeviceTimers) {
GPUFailedMsg(hipEventRecord((hipEvent_t)mDeviceTimers[0], mStreams[mXYZ.x.stream]));
} else {
mTimer.ResetStart();
}
}
}
~GPUDebugTiming()
{
if (mDo) {
if (mDeviceTimers) {
GPUFailedMsg(hipEventRecord((hipEvent_t)mDeviceTimers[1], mStreams[mXYZ.x.stream]));
GPUFailedMsg(hipEventSynchronize((hipEvent_t)mDeviceTimers[1]));
float v;
GPUFailedMsg(hipEventElapsedTime(&v, (hipEvent_t)mDeviceTimers[0], (hipEvent_t)mDeviceTimers[1]));
mXYZ.t = v * 1.e-3;
} else {
GPUFailedMsg(hipStreamSynchronize(mStreams[mXYZ.x.stream]));
mXYZ.t = mTimer.GetCurrentElapsedTime();
}
}
}
private:
void** mDeviceTimers;
hipStream_t* mStreams;
GPUReconstruction::krnlSetup& mXYZ;
GPUReconstructionHIPBackend* mRec;
HighResTimer mTimer;
bool mDo;
};
#include "GPUReconstructionIncludesDevice.h"
/*
// Not using templated kernel any more, since nvidia profiler does not resolve template names
template <class T, int I, typename... Args>
GPUg() void runKernelHIP(GPUCA_CONSMEM_PTR int iSlice_internal, Args... args)
{
GPUshared() typename T::GPUSharedMemory smem;
T::template Thread<I>(get_num_groups(0), get_local_size(0), get_group_id(0), get_local_id(0), smem, T::Processor(GPUCA_CONSMEM)[iSlice_internal], args...);
}
*/
#undef GPUCA_KRNL_REG
#define GPUCA_KRNL_REG(args) __launch_bounds__(GPUCA_M_STRIP(args))
#undef GPUCA_KRNL_CUSTOM
#define GPUCA_KRNL_CUSTOM(args) GPUCA_M_STRIP(args)
#undef GPUCA_KRNL_BACKEND_XARGS
#define GPUCA_KRNL_BACKEND_XARGS hipEvent_t *start, hipEvent_t *stop,
#define GPUCA_KRNL(x_class, x_attributes, x_arguments, x_forward) \
GPUCA_KRNL_PROP(x_class, x_attributes) \
GPUCA_KRNL_WRAP(GPUCA_KRNL_, x_class, x_attributes, x_arguments, x_forward)
#define GPUCA_KRNL_CALL_single(x_class, x_attributes, x_arguments, x_forward) \
if (start == nullptr) { \
hipLaunchKernelGGL(HIP_KERNEL_NAME(GPUCA_M_CAT(krnl_, GPUCA_M_KRNL_NAME(x_class))), dim3(x.nBlocks), dim3(x.nThreads), 0, me->mInternals->Streams[x.stream], GPUCA_CONSMEM_CALL y.start, args...); \
} else { \
hipExtLaunchKernelGGL(HIP_KERNEL_NAME(GPUCA_M_CAT(krnl_, GPUCA_M_KRNL_NAME(x_class))), dim3(x.nBlocks), dim3(x.nThreads), 0, me->mInternals->Streams[x.stream], *start, *stop, 0, GPUCA_CONSMEM_CALL y.start, args...); \
}
#define GPUCA_KRNL_CALL_multi(x_class, x_attributes, x_arguments, x_forward) \
if (start == nullptr) { \
hipLaunchKernelGGL(HIP_KERNEL_NAME(GPUCA_M_CAT3(krnl_, GPUCA_M_KRNL_NAME(x_class), _multi)), dim3(x.nBlocks), dim3(x.nThreads), 0, me->mInternals->Streams[x.stream], GPUCA_CONSMEM_CALL y.start, y.num, args...); \
} else { \
hipExtLaunchKernelGGL(HIP_KERNEL_NAME(GPUCA_M_CAT3(krnl_, GPUCA_M_KRNL_NAME(x_class), _multi)), dim3(x.nBlocks), dim3(x.nThreads), 0, me->mInternals->Streams[x.stream], *start, *stop, 0, GPUCA_CONSMEM_CALL y.start, y.num, args...); \
}
#include "GPUReconstructionKernels.h"
#undef GPUCA_KRNL
template <>
void GPUReconstructionHIPBackend::runKernelBackendInternal<GPUMemClean16, 0>(krnlSetup& _xyz, void* const& ptr, unsigned long const& size)
{
GPUDebugTiming timer(mDeviceProcessingSettings.debugLevel, nullptr, mInternals->Streams, _xyz, this);
GPUFailedMsg(hipMemsetAsync(ptr, 0, size, mInternals->Streams[_xyz.x.stream]));
}
template <class T, int I, typename... Args>
void GPUReconstructionHIPBackend::runKernelBackendInternal(krnlSetup& _xyz, const Args&... args)
{
if (mDeviceProcessingSettings.deviceTimers) {
#ifdef __CUDACC__
GPUFailedMsg(hipEventRecord((hipEvent_t)mDebugEvents->DebugStart, mInternals->Streams[x.stream]));
#endif
backendInternal<T, I>::runKernelBackendMacro(_xyz, this, (hipEvent_t*)&mDebugEvents->DebugStart, (hipEvent_t*)&mDebugEvents->DebugStop, args...);
#ifdef __CUDACC__
GPUFailedMsg(hipEventRecord((hipEvent_t)mDebugEvents->DebugStop, mInternals->Streams[x.stream]));
#endif
GPUFailedMsg(hipEventSynchronize((hipEvent_t)mDebugEvents->DebugStop));
float v;
GPUFailedMsg(hipEventElapsedTime(&v, (hipEvent_t)mDebugEvents->DebugStart, (hipEvent_t)mDebugEvents->DebugStop));
_xyz.t = v * 1.e-3;
} else {
backendInternal<T, I>::runKernelBackendMacro(_xyz, this, nullptr, nullptr, args...);
}
}
template <class T, int I, typename... Args>
int GPUReconstructionHIPBackend::runKernelBackend(krnlSetup& _xyz, const Args&... args)
{
auto& x = _xyz.x;
auto& z = _xyz.z;
if (z.evList) {
for (int k = 0; k < z.nEvents; k++) {
GPUFailedMsg(hipStreamWaitEvent(mInternals->Streams[x.stream], ((hipEvent_t*)z.evList)[k], 0));
}
}
runKernelBackendInternal<T, I>(_xyz, args...);
GPUFailedMsg(hipGetLastError());
if (z.ev) {
GPUFailedMsg(hipEventRecord(*(hipEvent_t*)z.ev, mInternals->Streams[x.stream]));
}
return 0;
}
GPUReconstructionHIPBackend::GPUReconstructionHIPBackend(const GPUSettingsProcessing& cfg) : GPUReconstructionDeviceBase(cfg, sizeof(GPUReconstructionDeviceBase))
{
if (mMaster == nullptr) {
mInternals = new GPUReconstructionHIPInternals;
}
mProcessingSettings.deviceType = DeviceType::HIP;
}
GPUReconstructionHIPBackend::~GPUReconstructionHIPBackend()
{
Exit(); // Make sure we destroy everything (in particular the ITS tracker) before we exit
if (mMaster == nullptr) {
delete mInternals;
}
}
GPUReconstruction* GPUReconstruction_Create_HIP(const GPUSettingsProcessing& cfg) { return new GPUReconstructionHIP(cfg); }
void GPUReconstructionHIPBackend::GetITSTraits(std::unique_ptr<o2::its::TrackerTraits>* trackerTraits, std::unique_ptr<o2::its::VertexerTraits>* vertexerTraits)
{
// if (trackerTraits) {
// trackerTraits->reset(new o2::its::TrackerTraitsNV);
// }
if (vertexerTraits) {
vertexerTraits->reset(new o2::its::VertexerTraitsHIP);
}
}
void GPUReconstructionHIPBackend::UpdateSettings()
{
GPUCA_GPUReconstructionUpdateDefailts();
}
int GPUReconstructionHIPBackend::InitDevice_Runtime()
{
if (mMaster == nullptr) {
hipDeviceProp_t hipDeviceProp;
int count, bestDevice = -1;
double bestDeviceSpeed = -1, deviceSpeed;
if (GPUFailedMsgI(hipGetDeviceCount(&count))) {
GPUError("Error getting HIP Device Count");
return (1);
}
if (mDeviceProcessingSettings.debugLevel >= 2) {
GPUInfo("Available HIP devices:");
}
std::vector<bool> devicesOK(count, false);
for (int i = 0; i < count; i++) {
if (mDeviceProcessingSettings.debugLevel >= 4) {
GPUInfo("Examining device %d", i);
}
if (mDeviceProcessingSettings.debugLevel >= 4) {
GPUInfo("Obtained current memory usage for device %d", i);
}
if (GPUFailedMsgI(hipGetDeviceProperties(&hipDeviceProp, i))) {
continue;
}
if (mDeviceProcessingSettings.debugLevel >= 4) {
GPUInfo("Obtained device properties for device %d", i);
}
int deviceOK = true;
const char* deviceFailure = "";
deviceSpeed = (double)hipDeviceProp.multiProcessorCount * (double)hipDeviceProp.clockRate * (double)hipDeviceProp.warpSize * (double)hipDeviceProp.major * (double)hipDeviceProp.major;
if (mDeviceProcessingSettings.debugLevel >= 2) {
GPUImportant("Device %s%2d: %s (Rev: %d.%d - Mem %lld)%s %s", deviceOK ? " " : "[", i, hipDeviceProp.name, hipDeviceProp.major, hipDeviceProp.minor, (long long int)hipDeviceProp.totalGlobalMem, deviceOK ? " " : " ]", deviceOK ? "" : deviceFailure);
}
if (!deviceOK) {
continue;
}
devicesOK[i] = true;
if (deviceSpeed > bestDeviceSpeed) {
bestDevice = i;
bestDeviceSpeed = deviceSpeed;
} else {
if (mDeviceProcessingSettings.debugLevel >= 2 && mDeviceProcessingSettings.deviceNum < 0) {
GPUInfo("Skipping: Speed %f < %f\n", deviceSpeed, bestDeviceSpeed);
}
}
}
if (bestDevice == -1) {
GPUWarning("No %sHIP Device available, aborting HIP Initialisation (Required mem: %lld)", count ? "appropriate " : "", (long long int)mDeviceMemorySize);
return (1);
}
if (mDeviceProcessingSettings.deviceNum > -1) {
if (mDeviceProcessingSettings.deviceNum >= (signed)count) {
GPUWarning("Requested device ID %d does not exist", mDeviceProcessingSettings.deviceNum);
return (1);
} else if (!devicesOK[mDeviceProcessingSettings.deviceNum]) {
GPUWarning("Unsupported device requested (%d)", mDeviceProcessingSettings.deviceNum);
return (1);
} else {
bestDevice = mDeviceProcessingSettings.deviceNum;
}
}
mDeviceId = bestDevice;
GPUFailedMsgI(hipGetDeviceProperties(&hipDeviceProp, mDeviceId));
hipDeviceProp.totalConstMem = 65536; // TODO: Remove workaround, fixes incorrectly reported HIP constant memory
if (mDeviceProcessingSettings.debugLevel >= 2) {
GPUInfo("Using HIP Device %s with Properties:", hipDeviceProp.name);
GPUInfo("\ttotalGlobalMem = %lld", (unsigned long long int)hipDeviceProp.totalGlobalMem);
GPUInfo("\tsharedMemPerBlock = %lld", (unsigned long long int)hipDeviceProp.sharedMemPerBlock);
GPUInfo("\tregsPerBlock = %d", hipDeviceProp.regsPerBlock);
GPUInfo("\twarpSize = %d", hipDeviceProp.warpSize);
GPUInfo("\tmaxThreadsPerBlock = %d", hipDeviceProp.maxThreadsPerBlock);
GPUInfo("\tmaxThreadsDim = %d %d %d", hipDeviceProp.maxThreadsDim[0], hipDeviceProp.maxThreadsDim[1], hipDeviceProp.maxThreadsDim[2]);
GPUInfo("\tmaxGridSize = %d %d %d", hipDeviceProp.maxGridSize[0], hipDeviceProp.maxGridSize[1], hipDeviceProp.maxGridSize[2]);
GPUInfo("\ttotalConstMem = %lld", (unsigned long long int)hipDeviceProp.totalConstMem);
GPUInfo("\tmajor = %d", hipDeviceProp.major);
GPUInfo("\tminor = %d", hipDeviceProp.minor);
GPUInfo("\tclockRate = %d", hipDeviceProp.clockRate);
GPUInfo("\tmemoryClockRate = %d", hipDeviceProp.memoryClockRate);
GPUInfo("\tmultiProcessorCount = %d", hipDeviceProp.multiProcessorCount);
GPUInfo(" ");
}
mBlockCount = hipDeviceProp.multiProcessorCount;
mMaxThreads = std::max<int>(mMaxThreads, hipDeviceProp.maxThreadsPerBlock * mBlockCount);
mWarpSize = 64;
mDeviceName = hipDeviceProp.name;
mDeviceName += " (HIP GPU)";
if (hipDeviceProp.major < 3) {
GPUError("Unsupported HIP Device");
return (1);
}
#ifndef GPUCA_NO_CONSTANT_MEMORY
if (gGPUConstantMemBufferSize > hipDeviceProp.totalConstMem) {
GPUError("Insufficient constant memory available on GPU %d < %d!", (int)hipDeviceProp.totalConstMem, (int)gGPUConstantMemBufferSize);
return (1);
}
#endif
if (GPUFailedMsgI(hipSetDevice(mDeviceId))) {
GPUError("Could not set HIP Device!");
return (1);
}
/*if (GPUFailedMsgI(hipDeviceSetLimit(hipLimitStackSize, GPUCA_GPU_STACK_SIZE)))
{
GPUError("Error setting HIP stack size");
GPUFailedMsgI(hipDeviceReset());
return(1);
}*/
if (mDeviceMemorySize > hipDeviceProp.totalGlobalMem || GPUFailedMsgI(hipMalloc(&mDeviceMemoryBase, mDeviceMemorySize))) {
GPUError("HIP Memory Allocation Error (trying %lld bytes, %lld available)", (long long int)mDeviceMemorySize, (long long int)hipDeviceProp.totalGlobalMem);
GPUFailedMsgI(hipDeviceReset());
return (1);
}
if (GPUFailedMsgI(hipHostMalloc(&mHostMemoryBase, mHostMemorySize))) {
GPUError("Error allocating Page Locked Host Memory (trying %lld bytes)", (long long int)mHostMemorySize);
GPUFailedMsgI(hipDeviceReset());
return (1);
}
if (mDeviceProcessingSettings.debugLevel >= 1) {
GPUInfo("Memory ptrs: GPU (%lld bytes): %p - Host (%lld bytes): %p", (long long int)mDeviceMemorySize, mDeviceMemoryBase, (long long int)mHostMemorySize, mHostMemoryBase);
memset(mHostMemoryBase, 0, mHostMemorySize);
if (GPUFailedMsgI(hipMemset(mDeviceMemoryBase, 0xDD, mDeviceMemorySize))) {
GPUError("Error during HIP memset");
GPUFailedMsgI(hipDeviceReset());
return (1);
}
}
for (int i = 0; i < mNStreams; i++) {
if (GPUFailedMsgI(hipStreamCreate(&mInternals->Streams[i]))) {
GPUError("Error creating HIP Stream");
GPUFailedMsgI(hipDeviceReset());
return (1);
}
}
void* devPtrConstantMem;
#ifndef GPUCA_NO_CONSTANT_MEMORY
if (GPUFailedMsgI(hipGetSymbolAddress(&devPtrConstantMem, HIP_SYMBOL(gGPUConstantMemBuffer)))) {
GPUError("Error getting ptr to constant memory");
GPUFailedMsgI(hipDeviceReset());
return 1;
}
#else
if (GPUFailedMsgI(hipMalloc(&devPtrConstantMem, gGPUConstantMemBufferSize))) {
GPUError("HIP Memory Allocation Error");
GPUFailedMsgI(hipDeviceReset());
return (1);
}
#endif
mDeviceConstantMem = (GPUConstantMem*)devPtrConstantMem;
hipLaunchKernelGGL(HIP_KERNEL_NAME(dummyInitKernel), dim3(mBlockCount), dim3(256), 0, 0, mDeviceMemoryBase);
GPUInfo("HIP Initialisation successfull (Device %d: %s (Frequency %d, Cores %d), %lld / %lld bytes host / global memory, Stack frame %d, Constant memory %lld)", mDeviceId, hipDeviceProp.name, hipDeviceProp.clockRate, hipDeviceProp.multiProcessorCount, (long long int)mHostMemorySize,
(long long int)mDeviceMemorySize, (int)GPUCA_GPU_STACK_SIZE, (long long int)gGPUConstantMemBufferSize);
} else {
GPUReconstructionHIPBackend* master = dynamic_cast<GPUReconstructionHIPBackend*>(mMaster);
mDeviceId = master->mDeviceId;
mBlockCount = master->mBlockCount;
mWarpSize = master->mWarpSize;
mMaxThreads = master->mMaxThreads;
mDeviceName = master->mDeviceName;
mDeviceConstantMem = master->mDeviceConstantMem;
mInternals = master->mInternals;
}
for (unsigned int i = 0; i < mEvents.size(); i++) {
hipEvent_t* events = (hipEvent_t*)mEvents[i].data();
for (unsigned int j = 0; j < mEvents[i].size(); j++) {
if (GPUFailedMsgI(hipEventCreate(&events[j]))) {
GPUError("Error creating event");
GPUFailedMsgI(hipDeviceReset());
return 1;
}
}
}
return (0);
}
int GPUReconstructionHIPBackend::ExitDevice_Runtime()
{
// Uninitialize HIP
SynchronizeGPU();
for (unsigned int i = 0; i < mEvents.size(); i++) {
hipEvent_t* events = (hipEvent_t*)mEvents[i].data();
for (unsigned int j = 0; j < mEvents[i].size(); j++) {
GPUFailedMsgI(hipEventDestroy(events[j]));
}
}
if (mMaster == nullptr) {
GPUFailedMsgI(hipFree(mDeviceMemoryBase));
#ifdef GPUCA_NO_CONSTANT_MEMORY
GPUFailedMsgI(hipFree(mDeviceConstantMem));
#endif
for (int i = 0; i < mNStreams; i++) {
GPUFailedMsgI(hipStreamDestroy(mInternals->Streams[i]));
}
GPUFailedMsgI(hipHostFree(mHostMemoryBase));
GPUInfo("HIP Uninitialized");
}
mHostMemoryBase = nullptr;
mDeviceMemoryBase = nullptr;
/*if (GPUFailedMsgI(hipDeviceReset())) { // No longer doing this, another thread might use the GPU
GPUError("Could not uninitialize GPU");
return (1);
}*/
return (0);
}
size_t GPUReconstructionHIPBackend::GPUMemCpy(void* dst, const void* src, size_t size, int stream, int toGPU, deviceEvent* ev, deviceEvent* evList, int nEvents)
{
if (mDeviceProcessingSettings.debugLevel >= 3) {
stream = -1;
}
if (stream == -1) {
SynchronizeGPU();
GPUFailedMsg(hipMemcpy(dst, src, size, toGPU ? hipMemcpyHostToDevice : hipMemcpyDeviceToHost));
} else {
if (evList == nullptr) {
nEvents = 0;
}
for (int k = 0; k < nEvents; k++) {
GPUFailedMsg(hipStreamWaitEvent(mInternals->Streams[stream], ((hipEvent_t*)evList)[k], 0));
}
GPUFailedMsg(hipMemcpyAsync(dst, src, size, toGPU == -2 ? hipMemcpyDeviceToDevice : toGPU ? hipMemcpyHostToDevice : hipMemcpyDeviceToHost, mInternals->Streams[stream]));
}
if (ev) {
GPUFailedMsg(hipEventRecord(*(hipEvent_t*)ev, mInternals->Streams[stream == -1 ? 0 : stream]));
}
return size;
}
size_t GPUReconstructionHIPBackend::TransferMemoryInternal(GPUMemoryResource* res, int stream, deviceEvent* ev, deviceEvent* evList, int nEvents, bool toGPU, const void* src, void* dst)
{
if (!(res->Type() & GPUMemoryResource::MEMORY_GPU)) {
if (mDeviceProcessingSettings.debugLevel >= 4) {
GPUInfo("Skipped transfer of non-GPU memory resource: %s", res->Name());
}
return 0;
}
if (mDeviceProcessingSettings.debugLevel >= 3) {
GPUInfo("Copying to %s: %s - %lld bytes", toGPU ? "GPU" : "Host", res->Name(), (long long int)res->Size());
}
return GPUMemCpy(dst, src, res->Size(), stream, toGPU, ev, evList, nEvents);
}
size_t GPUReconstructionHIPBackend::WriteToConstantMemory(size_t offset, const void* src, size_t size, int stream, deviceEvent* ev)
{
#ifdef GPUCA_CONSTANT_AS_ARGUMENT
memcpy(((char*)&gGPUConstantMemBufferHost) + offset, src, size);
#endif
#ifndef GPUCA_NO_CONSTANT_MEMORY
if (stream == -1) {
GPUFailedMsg(hipMemcpyToSymbol(HIP_SYMBOL(gGPUConstantMemBuffer), src, size, offset, hipMemcpyHostToDevice));
} else {
GPUFailedMsg(hipMemcpyToSymbolAsync(HIP_SYMBOL(gGPUConstantMemBuffer), src, size, offset, hipMemcpyHostToDevice, mInternals->Streams[stream]));
}
if (ev && stream != -1) {
GPUFailedMsg(hipEventRecord(*(hipEvent_t*)ev, mInternals->Streams[stream]));
}
#else
if (stream == -1) {
GPUFailedMsg(hipMemcpy(((char*)mDeviceConstantMem) + offset, src, size, hipMemcpyHostToDevice));
} else {
GPUFailedMsg(hipMemcpyAsync(((char*)mDeviceConstantMem) + offset, src, size, hipMemcpyHostToDevice, mInternals->Streams[stream]));
}
#endif
return size;
}
void GPUReconstructionHIPBackend::ReleaseEvent(deviceEvent* ev) {}
void GPUReconstructionHIPBackend::RecordMarker(deviceEvent* ev, int stream) { GPUFailedMsg(hipEventRecord(*(hipEvent_t*)ev, mInternals->Streams[stream])); }
void GPUReconstructionHIPBackend::SynchronizeGPU() { GPUFailedMsg(hipDeviceSynchronize()); }
void GPUReconstructionHIPBackend::SynchronizeStream(int stream) { GPUFailedMsg(hipStreamSynchronize(mInternals->Streams[stream])); }
void GPUReconstructionHIPBackend::SynchronizeEvents(deviceEvent* evList, int nEvents)
{
for (int i = 0; i < nEvents; i++) {
GPUFailedMsg(hipEventSynchronize(((hipEvent_t*)evList)[i]));
}
}
void GPUReconstructionHIPBackend::StreamWaitForEvents(int stream, deviceEvent* evList, int nEvents)
{
for (int i = 0; i < nEvents; i++) {
GPUFailedMsg(hipStreamWaitEvent(mInternals->Streams[stream], ((hipEvent_t*)evList)[i], 0));
}
}
bool GPUReconstructionHIPBackend::IsEventDone(deviceEvent* evList, int nEvents)
{
for (int i = 0; i < nEvents; i++) {
hipError_t retVal = hipEventSynchronize(((hipEvent_t*)evList)[i]);
if (retVal == hipErrorNotReady) {
return false;
}
GPUFailedMsg(retVal);
}
return (true);
}
int GPUReconstructionHIPBackend::GPUDebug(const char* state, int stream)
{
// Wait for HIP-Kernel to finish and check for HIP errors afterwards, in case of debugmode
hipError_t cuErr;
cuErr = hipGetLastError();
if (cuErr != hipSuccess) {
GPUError("HIP Error %s while running kernel (%s) (Stream %d)", hipGetErrorString(cuErr), state, stream);
return (1);
}
if (mDeviceProcessingSettings.debugLevel == 0) {
return (0);
}
if (GPUFailedMsgI(hipDeviceSynchronize())) {
GPUError("HIP Error while synchronizing (%s) (Stream %d)", state, stream);
return (1);
}
if (mDeviceProcessingSettings.debugLevel >= 3) {
GPUInfo("GPU Sync Done");
}
return (0);
}
int GPUReconstructionHIPBackend::registerMemoryForGPU(const void* ptr, size_t size)
{
return GPUFailedMsgI(hipHostRegister((void*)ptr, size, hipHostRegisterDefault));
}
int GPUReconstructionHIPBackend::unregisterMemoryForGPU(const void* ptr)
{
return GPUFailedMsgI(hipHostUnregister((void*)ptr));
}
void* GPUReconstructionHIPBackend::getGPUPointer(void* ptr)
{
void* retVal = nullptr;
GPUFailedMsg(hipHostGetDevicePointer(&retVal, ptr, 0));
return retVal;
}
void GPUReconstructionHIPBackend::PrintKernelOccupancies()
{
unsigned int maxBlocks, threads, suggestedBlocks;
#define GPUCA_KRNL(x_class, x_attributes, x_arguments, x_forward) GPUCA_KRNL_WRAP(GPUCA_KRNL_LOAD_, x_class, x_attributes, x_arguments, x_forward)
#define GPUCA_KRNL_LOAD_single(x_class, x_attributes, x_arguments, x_forward) \
GPUFailedMsg(hipOccupancyMaxPotentialBlockSize(&suggestedBlocks, &threads, GPUCA_M_CAT(krnl_, GPUCA_M_KRNL_NAME(x_class)), 0, 0)); \
GPUFailedMsg(hipOccupancyMaxActiveBlocksPerMultiprocessor(&maxBlocks, GPUCA_M_CAT(krnl_, GPUCA_M_KRNL_NAME(x_class)), threads, 0)); \
GPUInfo("Kernel: %50s Block size: %34d, Maximum active blocks: %3d, Suggested blocks: %3d", GPUCA_M_STR(GPUCA_M_CAT(krnl_, GPUCA_M_KRNL_NAME(x_class))), threads, maxBlocks, suggestedBlocks);
#define GPUCA_KRNL_LOAD_multi(x_class, x_attributes, x_arguments, x_forward) \
GPUFailedMsg(hipOccupancyMaxPotentialBlockSize(&suggestedBlocks, &threads, GPUCA_M_CAT3(krnl_, GPUCA_M_KRNL_NAME(x_class), _multi), 0, 0)); \
GPUFailedMsg(hipOccupancyMaxActiveBlocksPerMultiprocessor(&maxBlocks, GPUCA_M_CAT3(krnl_, GPUCA_M_KRNL_NAME(x_class), _multi), threads, 0)); \
GPUInfo("Kernel: %50s Block size: %4d, Maximum active blocks: %3d, Suggested blocks: %3d", GPUCA_M_STR(GPUCA_M_CAT3(krnl_, GPUCA_M_KRNL_NAME(x_class), _multi)), threads, maxBlocks, suggestedBlocks);
#include "GPUReconstructionKernels.h"
#undef GPUCA_KRNL
#undef GPUCA_KRNL_LOAD_single
#undef GPUCA_KRNL_LOAD_multi
}
| 42.727273
| 287
| 0.670097
|
aknospe
|
434cdbfcf15052e3f8bba86220f599a4623b631c
| 1,203
|
hpp
|
C++
|
Hog_HLS/solution1/csim/build/HOG.hpp
|
DoubleGithub/HOG_Zedboard
|
6fc55c37ee210d7fc8bca919213e96bfc5c9d811
|
[
"MIT"
] | 29
|
2018-07-09T10:12:47.000Z
|
2022-01-14T18:57:52.000Z
|
Hog_HLS/solution1/csim/build/HOG.hpp
|
DoubleGithub/HOG_Zedboard
|
6fc55c37ee210d7fc8bca919213e96bfc5c9d811
|
[
"MIT"
] | 10
|
2018-10-30T10:38:12.000Z
|
2021-04-14T00:43:29.000Z
|
Hog_HLS/solution1/csim/build/HOG.hpp
|
DoubleGithub/HOG_Zedboard
|
6fc55c37ee210d7fc8bca919213e96bfc5c9d811
|
[
"MIT"
] | 10
|
2019-07-04T07:39:38.000Z
|
2021-05-11T13:54:07.000Z
|
#ifndef HOG_HPP_
#define HOG_HPP_
#include "types.h"
#include <iostream>
#include "consts.h"
#include <string.h>
#include "math.h"
#define VECTOR_SIZE 3780
using namespace std;
// void computeHOG(unsigned char *inputImage , unsigned char *output);
void hog(int *specs,unsigned char *image0);
//void hog(unsigned int *specs,
// unsigned char *image0,
// unsigned char *image1,
// unsigned char *image2,
// unsigned char *image3,
// unsigned char *image4,
// unsigned char *image5,
// unsigned char *image6,
// unsigned char *image7,
// int *vector);
//void hog(unsigned int *specs,
// unsigned char *image0,
// unsigned char *image1,
// unsigned char *image2,
// unsigned char *image3,
// unsigned char *vector0
//// unsigned char *vector1,
//// unsigned char *vector2,
//// unsigned char *vector3
// );
// void computeGradient(unsigned int _windowX, unsigned int _windowY,int width,unsigned char *image,float *gradientX,float *gradientY);
// void computeHistogram(float *hogDsc,float *gradientX,float *gradientY);
// void normalizeHisto(float *hogDsc_in,float *hogDsc_out);
void imageDownScale(unsigned char *inputImage,int imageX,int imageY,double scale);
#endif /* HOG_HPP_ */
| 27.976744
| 135
| 0.719867
|
DoubleGithub
|
434d9303b5bf4fe27f58b07da1dacda0c7dd54af
| 7,583
|
cpp
|
C++
|
android-31/android/animation/ValueAnimator.cpp
|
YJBeetle/QtAndroidAPI
|
1468b5dc6eafaf7709f0b00ba1a6ec2b70684266
|
[
"Apache-2.0"
] | 12
|
2020-03-26T02:38:56.000Z
|
2022-03-14T08:17:26.000Z
|
android-28/android/animation/ValueAnimator.cpp
|
YJBeetle/QtAndroidAPI
|
1468b5dc6eafaf7709f0b00ba1a6ec2b70684266
|
[
"Apache-2.0"
] | 1
|
2021-01-27T06:07:45.000Z
|
2021-11-13T19:19:43.000Z
|
android-30/android/animation/ValueAnimator.cpp
|
YJBeetle/QtAndroidAPI
|
1468b5dc6eafaf7709f0b00ba1a6ec2b70684266
|
[
"Apache-2.0"
] | 3
|
2021-02-02T12:34:55.000Z
|
2022-03-08T07:45:57.000Z
|
#include "../../JFloatArray.hpp"
#include "../../JIntArray.hpp"
#include "../../JArray.hpp"
#include "../../JObjectArray.hpp"
#include "./Animator.hpp"
#include "../../JObject.hpp"
#include "../../JString.hpp"
#include "./ValueAnimator.hpp"
namespace android::animation
{
// Fields
jint ValueAnimator::INFINITE()
{
return getStaticField<jint>(
"android.animation.ValueAnimator",
"INFINITE"
);
}
jint ValueAnimator::RESTART()
{
return getStaticField<jint>(
"android.animation.ValueAnimator",
"RESTART"
);
}
jint ValueAnimator::REVERSE()
{
return getStaticField<jint>(
"android.animation.ValueAnimator",
"REVERSE"
);
}
// QJniObject forward
ValueAnimator::ValueAnimator(QJniObject obj) : android::animation::Animator(obj) {}
// Constructors
ValueAnimator::ValueAnimator()
: android::animation::Animator(
"android.animation.ValueAnimator",
"()V"
) {}
// Methods
jboolean ValueAnimator::areAnimatorsEnabled()
{
return callStaticMethod<jboolean>(
"android.animation.ValueAnimator",
"areAnimatorsEnabled",
"()Z"
);
}
jlong ValueAnimator::getFrameDelay()
{
return callStaticMethod<jlong>(
"android.animation.ValueAnimator",
"getFrameDelay",
"()J"
);
}
android::animation::ValueAnimator ValueAnimator::ofArgb(JIntArray arg0)
{
return callStaticObjectMethod(
"android.animation.ValueAnimator",
"ofArgb",
"([I)Landroid/animation/ValueAnimator;",
arg0.object<jintArray>()
);
}
android::animation::ValueAnimator ValueAnimator::ofFloat(JFloatArray arg0)
{
return callStaticObjectMethod(
"android.animation.ValueAnimator",
"ofFloat",
"([F)Landroid/animation/ValueAnimator;",
arg0.object<jfloatArray>()
);
}
android::animation::ValueAnimator ValueAnimator::ofInt(JIntArray arg0)
{
return callStaticObjectMethod(
"android.animation.ValueAnimator",
"ofInt",
"([I)Landroid/animation/ValueAnimator;",
arg0.object<jintArray>()
);
}
android::animation::ValueAnimator ValueAnimator::ofObject(JObject arg0, JObjectArray arg1)
{
return callStaticObjectMethod(
"android.animation.ValueAnimator",
"ofObject",
"(Landroid/animation/TypeEvaluator;[Ljava/lang/Object;)Landroid/animation/ValueAnimator;",
arg0.object(),
arg1.object<jobjectArray>()
);
}
android::animation::ValueAnimator ValueAnimator::ofPropertyValuesHolder(JArray arg0)
{
return callStaticObjectMethod(
"android.animation.ValueAnimator",
"ofPropertyValuesHolder",
"([Landroid/animation/PropertyValuesHolder;)Landroid/animation/ValueAnimator;",
arg0.object<jarray>()
);
}
void ValueAnimator::setFrameDelay(jlong arg0)
{
callStaticMethod<void>(
"android.animation.ValueAnimator",
"setFrameDelay",
"(J)V",
arg0
);
}
void ValueAnimator::addUpdateListener(JObject arg0) const
{
callMethod<void>(
"addUpdateListener",
"(Landroid/animation/ValueAnimator$AnimatorUpdateListener;)V",
arg0.object()
);
}
void ValueAnimator::cancel() const
{
callMethod<void>(
"cancel",
"()V"
);
}
android::animation::ValueAnimator ValueAnimator::clone() const
{
return callObjectMethod(
"clone",
"()Landroid/animation/ValueAnimator;"
);
}
void ValueAnimator::end() const
{
callMethod<void>(
"end",
"()V"
);
}
jfloat ValueAnimator::getAnimatedFraction() const
{
return callMethod<jfloat>(
"getAnimatedFraction",
"()F"
);
}
JObject ValueAnimator::getAnimatedValue() const
{
return callObjectMethod(
"getAnimatedValue",
"()Ljava/lang/Object;"
);
}
JObject ValueAnimator::getAnimatedValue(JString arg0) const
{
return callObjectMethod(
"getAnimatedValue",
"(Ljava/lang/String;)Ljava/lang/Object;",
arg0.object<jstring>()
);
}
jlong ValueAnimator::getCurrentPlayTime() const
{
return callMethod<jlong>(
"getCurrentPlayTime",
"()J"
);
}
jlong ValueAnimator::getDuration() const
{
return callMethod<jlong>(
"getDuration",
"()J"
);
}
JObject ValueAnimator::getInterpolator() const
{
return callObjectMethod(
"getInterpolator",
"()Landroid/animation/TimeInterpolator;"
);
}
jint ValueAnimator::getRepeatCount() const
{
return callMethod<jint>(
"getRepeatCount",
"()I"
);
}
jint ValueAnimator::getRepeatMode() const
{
return callMethod<jint>(
"getRepeatMode",
"()I"
);
}
jlong ValueAnimator::getStartDelay() const
{
return callMethod<jlong>(
"getStartDelay",
"()J"
);
}
jlong ValueAnimator::getTotalDuration() const
{
return callMethod<jlong>(
"getTotalDuration",
"()J"
);
}
JArray ValueAnimator::getValues() const
{
return callObjectMethod(
"getValues",
"()[Landroid/animation/PropertyValuesHolder;"
);
}
jboolean ValueAnimator::isRunning() const
{
return callMethod<jboolean>(
"isRunning",
"()Z"
);
}
jboolean ValueAnimator::isStarted() const
{
return callMethod<jboolean>(
"isStarted",
"()Z"
);
}
void ValueAnimator::pause() const
{
callMethod<void>(
"pause",
"()V"
);
}
void ValueAnimator::removeAllUpdateListeners() const
{
callMethod<void>(
"removeAllUpdateListeners",
"()V"
);
}
void ValueAnimator::removeUpdateListener(JObject arg0) const
{
callMethod<void>(
"removeUpdateListener",
"(Landroid/animation/ValueAnimator$AnimatorUpdateListener;)V",
arg0.object()
);
}
void ValueAnimator::resume() const
{
callMethod<void>(
"resume",
"()V"
);
}
void ValueAnimator::reverse() const
{
callMethod<void>(
"reverse",
"()V"
);
}
void ValueAnimator::setCurrentFraction(jfloat arg0) const
{
callMethod<void>(
"setCurrentFraction",
"(F)V",
arg0
);
}
void ValueAnimator::setCurrentPlayTime(jlong arg0) const
{
callMethod<void>(
"setCurrentPlayTime",
"(J)V",
arg0
);
}
android::animation::ValueAnimator ValueAnimator::setDuration(jlong arg0) const
{
return callObjectMethod(
"setDuration",
"(J)Landroid/animation/ValueAnimator;",
arg0
);
}
void ValueAnimator::setEvaluator(JObject arg0) const
{
callMethod<void>(
"setEvaluator",
"(Landroid/animation/TypeEvaluator;)V",
arg0.object()
);
}
void ValueAnimator::setFloatValues(JFloatArray arg0) const
{
callMethod<void>(
"setFloatValues",
"([F)V",
arg0.object<jfloatArray>()
);
}
void ValueAnimator::setIntValues(JIntArray arg0) const
{
callMethod<void>(
"setIntValues",
"([I)V",
arg0.object<jintArray>()
);
}
void ValueAnimator::setInterpolator(JObject arg0) const
{
callMethod<void>(
"setInterpolator",
"(Landroid/animation/TimeInterpolator;)V",
arg0.object()
);
}
void ValueAnimator::setObjectValues(JObjectArray arg0) const
{
callMethod<void>(
"setObjectValues",
"([Ljava/lang/Object;)V",
arg0.object<jobjectArray>()
);
}
void ValueAnimator::setRepeatCount(jint arg0) const
{
callMethod<void>(
"setRepeatCount",
"(I)V",
arg0
);
}
void ValueAnimator::setRepeatMode(jint arg0) const
{
callMethod<void>(
"setRepeatMode",
"(I)V",
arg0
);
}
void ValueAnimator::setStartDelay(jlong arg0) const
{
callMethod<void>(
"setStartDelay",
"(J)V",
arg0
);
}
void ValueAnimator::setValues(JArray arg0) const
{
callMethod<void>(
"setValues",
"([Landroid/animation/PropertyValuesHolder;)V",
arg0.object<jarray>()
);
}
void ValueAnimator::start() const
{
callMethod<void>(
"start",
"()V"
);
}
JString ValueAnimator::toString() const
{
return callObjectMethod(
"toString",
"()Ljava/lang/String;"
);
}
} // namespace android::animation
| 19.645078
| 93
| 0.678359
|
YJBeetle
|
4350204c4b39af95b64e3d43058cd7f9c46b4bd4
| 2,425
|
cpp
|
C++
|
EngineTests/Platforms.GAPI/Compute/CApp_UpdateBuffer.cpp
|
azhirnov/GraphicsGenFramework-modular
|
348be601f1991f102defa0c99250529f5e44c4d3
|
[
"BSD-2-Clause"
] | 12
|
2017-12-23T14:24:57.000Z
|
2020-10-02T19:52:12.000Z
|
EngineTests/Platforms.GAPI/Compute/CApp_UpdateBuffer.cpp
|
azhirnov/ModularGraphicsFramework
|
348be601f1991f102defa0c99250529f5e44c4d3
|
[
"BSD-2-Clause"
] | null | null | null |
EngineTests/Platforms.GAPI/Compute/CApp_UpdateBuffer.cpp
|
azhirnov/ModularGraphicsFramework
|
348be601f1991f102defa0c99250529f5e44c4d3
|
[
"BSD-2-Clause"
] | null | null | null |
// Copyright (c) Zhirnov Andrey. For more information see 'LICENSE.txt'
#include "CApp.h"
bool CApp::_Test_UpdateBuffer ()
{
// generate data
BinaryArray data; data.Resize( 512 );
BinaryArray data2; data2.Resize( 256 );
FOR( i, data ) {
data[i] = Random::Int<ubyte>();
}
FOR( i, data2 ) {
data2[i] = Random::Int<ubyte>();
}
// create resources
auto factory = ms->GlobalSystems()->modulesFactory;
GpuMsg::CreateFence fence_ctor;
syncManager->Send( fence_ctor );
ModulePtr cmd_buffer;
CHECK_ERR( factory->Create(
gpuIDs.commandBuffer,
gpuThread->GlobalSystems(),
CreateInfo::GpuCommandBuffer{},
OUT cmd_buffer ) );
cmdBuilder->Send( ModuleMsg::AttachModule{ cmd_buffer });
ModulePtr buffer;
CHECK_ERR( factory->Create(
gpuIDs.buffer,
gpuThread->GlobalSystems(),
CreateInfo::GpuBuffer{
BufferDescription{ data.Size(), EBufferUsage::TransferSrc | EBufferUsage::TransferDst },
EGpuMemory::CoherentWithCPU },
OUT buffer ) );
ModuleUtils::Initialize({ cmd_buffer, buffer });
// write data to buffer
GpuMsg::WriteToGpuMemory write_cmd{ data };
buffer->Send( write_cmd );
CHECK_ERR( *write_cmd.wasWritten == data.Size() );
// build command buffer
cmdBuilder->Send( GpuMsg::CmdBegin{ cmd_buffer });
const usize subdata_size = 128;
BinArrayCRef subdata1 = data2.SubArray( 0, subdata_size );
BinArrayCRef subdata2 = data2.SubArray( subdata_size, data2.Count() - subdata_size );
cmdBuilder->Send( GpuMsg::CmdUpdateBuffer{ buffer, subdata1, data.Size() - data2.Size() });
cmdBuilder->Send( GpuMsg::CmdUpdateBuffer{ buffer, subdata2, data.Size() - subdata2.Size() });
GpuMsg::CmdEnd cmd_end;
cmdBuilder->Send( cmd_end );
// submit and sync
gpuThread->Send( GpuMsg::SubmitCommands{ *cmd_end.result }.SetFence( *fence_ctor.result ));
syncManager->Send( GpuMsg::ClientWaitFence{ *fence_ctor.result });
// read
BinaryArray dst_data; dst_data.Resize( data.Count() );
GpuMsg::ReadFromGpuMemory read_cmd{ dst_data };
buffer->Send( read_cmd );
CHECK_ERR( data.Size() == read_cmd.result->Size() );
bool equals = true;
usize offset = usize(data.Size() - data2.Size());
FOR( i, data )
{
if ( i < offset )
equals &= (data[i] == read_cmd.result->operator[](i));
else
equals &= (data2[i - offset] == read_cmd.result->operator[](i));
}
CHECK_ERR( equals );
LOG( "UpdateBuffer - OK", ELog::Info );
return true;
}
| 25.526316
| 95
| 0.686598
|
azhirnov
|
435145bddef934ff52ae533a1b85648ac45db1d9
| 4,818
|
cpp
|
C++
|
src/lib/src/sat/dimacs/parser.cpp
|
black-sat/black
|
80902240987312fb0e6f00227a06e9f9c9728a67
|
[
"MIT"
] | 4
|
2020-09-30T15:16:22.000Z
|
2021-09-20T15:02:39.000Z
|
src/lib/src/sat/dimacs/parser.cpp
|
teodorov/black
|
4de280ded5e99cc515141b4acc35137ba32c2469
|
[
"MIT"
] | 42
|
2020-07-15T13:46:11.000Z
|
2022-03-10T09:42:43.000Z
|
src/lib/src/sat/dimacs/parser.cpp
|
teodorov/black
|
4de280ded5e99cc515141b4acc35137ba32c2469
|
[
"MIT"
] | 3
|
2020-03-30T14:39:17.000Z
|
2022-03-18T14:05:33.000Z
|
//
// BLACK - Bounded Ltl sAtisfiability ChecKer
//
// (C) 2021 Nicola Gigante
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#include <black/sat/dimacs.hpp>
#include <black/support/config.hpp>
#include <cctype>
#include <cmath>
#include <fmt/format.h>
namespace black::sat::dimacs::internal
{
struct _parser_t {
std::istream ∈
std::function<void(std::string)> handler;
_parser_t(std::istream &_in, std::function<void(std::string)> _handler)
: in{_in}, handler{_handler} { }
void skip_comment();
void skip();
bool parse_header();
std::optional<literal> parse_literal();
std::vector<clause> parse_clauses();
std::optional<problem> parse();
};
void _parser_t::skip_comment() {
if(in.peek() != 'c')
return;
while(in.good() && in.peek() != '\n')
in.get();
}
void _parser_t::skip() {
while(in.good() && (isspace(in.peek()) || in.peek() == 'c')) {
skip_comment();
in.get();
}
}
bool _parser_t::parse_header() {
if(!in.good())
return false;
std::string h;
for(int i = 0; i < 5; ++i)
h += (char)in.get();
if(h != "p cnf") {
handler("expected problem header");
return false;
}
uint32_t nvars = 0;
uint64_t nclauses = 0;
in >> nvars; // we ignore nvars and nclauses, but they must be there
in >> nclauses;
if(in.fail()) {
handler("expected nbvars and nbclauses in problem header");
return false;
}
return true;
}
std::optional<literal> _parser_t::parse_literal()
{
if(in.eof())
return std::nullopt;
int32_t v = 0;
if(!(in >> v)) {
handler("expected literal");
return std::nullopt;
}
return literal{ // LCOV_EXCL_LINE
/*sign=*/ (v >= 0),
/*var=*/ static_cast<uint32_t>(abs(v))
};
}
std::vector<clause> _parser_t::parse_clauses()
{
std::vector<clause> clauses;
clause cl;
do
{
skip();
std::optional<literal> l = parse_literal();
if(!l) {
if(cl.literals.size() > 0)
handler("expected '0' at the end of clause");
return clauses;
}
if(l->var == 0) {
clauses.push_back(cl);
cl.literals.clear();
} else {
cl.literals.push_back(*l);
}
} while (!in.eof());
return clauses;
}
std::optional<problem> _parser_t::parse()
{
skip();
if(!parse_header())
return std::nullopt;
skip();
return problem{parse_clauses()};
}
std::optional<problem> parse(
std::istream &in, std::function<void(std::string)> handler
) {
_parser_t parser{in, handler};
return parser.parse();
}
std::string to_string(literal l) {
return fmt::format("{}{}", l.sign ? "" : "-", l.var);
}
// void print(std::ostream &out, problem p) {
// out << fmt::format("c BLACK v{}\n", black::version);
// size_t nclauses = p.clauses.size();
// uint32_t nvars = 0;
// for(dimacs::clause c : p.clauses)
// for(dimacs::literal l : c.literals)
// nvars = l.var > nvars ? l.var : nvars;
// out << fmt::format("p cnf {} {}\n", nvars, nclauses);
// for(dimacs::clause c : p.clauses) {
// for(dimacs::literal l : c.literals) {
// out << to_string(l) << ' ';
// }
// out << "0\n";
// }
// }
void print(std::ostream &out, std::optional<solution> const& s) {
out << fmt::format("c BLACK v{}\n", black::version);
if(!s) {
out << "s UNSATISFIABLE\n";
return;
}
out << "s SATISFIABLE\n";
out << "v ";
int i = 0;
for(dimacs::literal l : s->assignments) {
if(i % 4 == 0)
out << "\nv ";
out << to_string(l) << ' ';
++i;
}
out << '\n';
}
}
| 24.835052
| 80
| 0.585305
|
black-sat
|
43517c785d6fc5a398a8df3ccbe4ec4568611f3a
| 4,377
|
cpp
|
C++
|
SimpleSocks/cl_TCPServer.cpp
|
SimpleRepos/SimpleSocks
|
7c5fe41d8a119d2ad285d0e98087cd4a0ed45859
|
[
"MIT"
] | null | null | null |
SimpleSocks/cl_TCPServer.cpp
|
SimpleRepos/SimpleSocks
|
7c5fe41d8a119d2ad285d0e98087cd4a0ed45859
|
[
"MIT"
] | null | null | null |
SimpleSocks/cl_TCPServer.cpp
|
SimpleRepos/SimpleSocks
|
7c5fe41d8a119d2ad285d0e98087cd4a0ed45859
|
[
"MIT"
] | null | null | null |
#include "cl_TCPServer.h"
#include <WS2tcpip.h>
//Set members to default values.
//SOCKET_ERROR is used here to indicate that the socket is closed
SSocks::TCPServer::TCPServer() : sock(SOCKET_ERROR), blocking(true) {
//nothing
}
//invoke the default constructor and then call start()
SSocks::TCPServer::TCPServer(uint16_t port, bool forceBind, const std::string& localHostAddr) : TCPServer() {
start(port, forceBind, localHostAddr);
}
//release the socket
SSocks::TCPServer::~TCPServer() {
stop();
}
//copy values from source and then break its ownership of the socket
SSocks::TCPServer::TCPServer(TCPServer&& moveFrom) : sock(moveFrom.sock), blocking(moveFrom.blocking) {
//force source to disown resource so that it won't be released when source destructs
moveFrom.sock = SOCKET_ERROR;
}
void SSocks::TCPServer::operator=(TCPServer&& moveFrom) {
sock = moveFrom.sock;
blocking = moveFrom.blocking;
moveFrom.sock = SOCKET_ERROR;
}
void SSocks::TCPServer::start(uint16_t port, bool forceBind, const std::string& localHostAddr) {
//halt service if already running
if(isOpen()) { stop(); }
//We need a sockaddr_in to bind the server to a port and interface.
sockaddr_in sain = {0};
sain.sin_family = AF_INET;
sain.sin_port = htons(port);
if(port == 0) { throw std::runtime_error("SSocks::TCPSever does not support port zero."); }
//This shouldn't fail unless the user types in gibberish, but let's be safe.
int result = inet_pton(AF_INET, localHostAddr.c_str(), &sain.sin_addr);
switch(result) {
case 0: throw std::runtime_error("Attempted to start server on interaface with invalid address string.");
case -1: throw std::runtime_error(Utility::lastErrStr(WSAGetLastError()));
}
//TSock helps here because if an exception is thrown it ensures that the socket resource is released.
Utility::TSock tsock(SOCK_STREAM, IPPROTO_TCP);
//forceBind will allow the bind to take over from an existing bind. See comments in header.
if(forceBind) {
//Here's another nasty legacy call...
BOOL temp = TRUE;
result = setsockopt(tsock, SOL_SOCKET, SO_REUSEADDR, reinterpret_cast<char*>(&temp), sizeof(temp));
if(result) { throw std::runtime_error(Utility::lastErrStr(WSAGetLastError())); }
}
//bind the socket
result = bind(tsock, reinterpret_cast<sockaddr*>(&sain), sizeof(sain));
if(result) { throw std::runtime_error(Utility::lastErrStr(WSAGetLastError())); }
//start listening for connections
result = listen(tsock, SOMAXCONN);
if(result) { throw std::runtime_error(Utility::lastErrStr(WSAGetLastError())); }
//everything seems okay, so take ownership of the resource
sock = tsock.validate();
}
void SSocks::TCPServer::stop() {
//release the resource if it exists
if(isOpen()) { closesocket(sock); }
//and reset to defaults
sock = SOCKET_ERROR;
blocking = true;
}
SSocks::TCPSocket SSocks::TCPServer::accept() {
if(!isOpen()) { throw std::runtime_error("Attemtped to wait for connections on closed TCPServer."); }
//Create a TCPSocket object
TCPSocket nuSock;
//and inject the incoming connection into it
nuSock.sock = ::accept(sock, nullptr, nullptr);
if(nuSock.sock == SOCKET_ERROR) {
//WSAEWOULDBLOCK happens on a non-blocking socket when there's no incoming connection.
//We can just return the unconnected socket to indicate that. (It will simply be an unopened TCPSocket.)
int err = WSAGetLastError();
if(err != WSAEWOULDBLOCK) { throw std::runtime_error(Utility::lastErrStr(err)); }
}
return nuSock;
}
bool SSocks::TCPServer::isOpen() const {
return sock != SOCKET_ERROR;
}
bool SSocks::TCPServer::isBlocking() const {
return blocking;
}
void SSocks::TCPServer::setBlocking(bool block) {
if(!isOpen()) { throw std::runtime_error("Attemtped to set blocking state on closed TCPServer."); }
//avoid needless system calls
if(block == blocking) { return; }
//I really hate all this legacy crap that tries to make one function do everything.
//It makes the interfaces really unpleasant.
unsigned long temp = block ? 0 : 1;
//set actual socket behavior according to state info
int result = ioctlsocket(sock, FIONBIO, &temp);
if(result == SOCKET_ERROR) {
stop(); //assume socket is invalidated
throw std::runtime_error(Utility::lastErrStr(WSAGetLastError()));
}
//update state info
blocking = block;
}
| 33.930233
| 109
| 0.720356
|
SimpleRepos
|
43518db909e026f9a4e402d831480b411057e047
| 2,120
|
cpp
|
C++
|
core/driver/disk.cpp
|
JartC0ding/horizon
|
2b9a75b45ac768a8da0f7a98f164a37690dc583f
|
[
"MIT"
] | 4
|
2022-01-06T09:19:46.000Z
|
2022-03-27T18:08:36.000Z
|
core/driver/disk.cpp
|
JartC0ding/horizon
|
2b9a75b45ac768a8da0f7a98f164a37690dc583f
|
[
"MIT"
] | null | null | null |
core/driver/disk.cpp
|
JartC0ding/horizon
|
2b9a75b45ac768a8da0f7a98f164a37690dc583f
|
[
"MIT"
] | 1
|
2022-03-22T19:10:05.000Z
|
2022-03-22T19:10:05.000Z
|
#include <driver/disk.h>
#include <utils/log.h>
using namespace driver;
disk_driver_manager* driver::global_disk_manager;
disk_device::disk_device() {
}
disk_device::~disk_device() {
}
void disk_device::read(uint64_t sector, uint32_t sector_count, void* buffer) {
}
void disk_device::write(uint64_t sector, uint32_t sector_count, void* buffer) {
}
bool disk_device::get_disk_label(char* out, fs::vfs::vfs_mount* mount) {
fs::vfs::file_t* file = mount->open((char*) "/FOXCFG/dn.fox");
if (file == nullptr) {
debugf("Failed to open /dn.fox\n");
return false;
}
mount->read(file, out, file->size, 0);
out[file->size] = 0;
mount->close(file);
debugf("Disk label: %s\n", out);
return true;
}
disk_driver_manager::disk_driver_manager() {
this->num_disks = 0;
}
int disk_driver_manager::add_disk(disk_device* disk) {
this->disks[this->num_disks] = disk;
debugf("Adding new disk at idx %d!\n", this->num_disks);
this->num_disks++;
return this->num_disks - 1;
}
void disk_driver_manager::read(int disk_num, uint64_t sector, uint32_t sector_count, void* buffer) {
this->disks[disk_num]->read(sector, sector_count, buffer);
}
void disk_driver_manager::write(int disk_num, uint64_t sector, uint32_t sector_count, void* buffer) {
this->disks[disk_num]->write(sector, sector_count, buffer);
}
raw_disk_dev_fs::raw_disk_dev_fs(int disk_num) {
memset(this->name, 0, 32);
sprintf(this->name, "disk_%d", disk_num);
this->disk_num = disk_num;
}
char* raw_disk_dev_fs::get_name() {
return this->name;
}
void raw_disk_dev_fs::write(fs::file_t* file, void* buffer, size_t size, size_t offset) {
raw_disk_dev_fs_command* cmd = (raw_disk_dev_fs_command*) buffer;
switch (cmd->command) {
case 0: // opcode read
{
driver::global_disk_manager->read(this->disk_num, cmd->sector, cmd->sector_count, (void*) cmd->buffer);
}
break;
case 1: // opcode write
{
driver::global_disk_manager->write(this->disk_num, cmd->sector, cmd->sector_count, (void*) cmd->buffer);
}
break;
default:
{
debugf("Unknown disk command %d\n", cmd->command);
}
break;
}
}
| 21.85567
| 108
| 0.696226
|
JartC0ding
|
43527ff00fdf820bd0b4b098fdac7dea51d80805
| 1,444
|
cpp
|
C++
|
src/BLDCM-control-ino.cpp
|
Infineon/motor-system-ic-tle956x
|
8147c362d1bde2a5d10c07fd87b580bc5844e4a8
|
[
"MIT"
] | 5
|
2021-08-02T08:20:08.000Z
|
2022-03-17T08:56:24.000Z
|
src/BLDCM-control-ino.cpp
|
Infineon/motor-system-ic-tle956x
|
8147c362d1bde2a5d10c07fd87b580bc5844e4a8
|
[
"MIT"
] | 1
|
2022-02-28T12:26:57.000Z
|
2022-02-28T12:26:57.000Z
|
src/BLDCM-control-ino.cpp
|
Infineon/motor-system-ic-tle956x
|
8147c362d1bde2a5d10c07fd87b580bc5844e4a8
|
[
"MIT"
] | null | null | null |
/*!
* \file BLDCM-control-ino.cpp
* \name BLDCM-control-ino.cpp - basic motor control functions for Arduino
* \author Infineon Technologies AG
* \copyright 2020-2021 Infineon Technologies AG
* \version 1.0.0
* \brief This library includes the basic common functions to control a BLDC motor using an instance of TLE9563
* \ref tle9563corelib
*
* SPDX-License-Identifier: MIT
*
*/
#include "BLDCM-control-ino.hpp"
#if (TLE9563_FRAMEWORK == TLE9563_FRMWK_ARDUINO)
BLDCMcontrolIno::BLDCMcontrolIno(void)
{
BLDCMcontrol::pwmU = new ADCIno(ARDUINO_UNO.PWM_U);
BLDCMcontrol::pwmV = new ADCIno(ARDUINO_UNO.PWM_V);
BLDCMcontrol::pwmW = new ADCIno(ARDUINO_UNO.PWM_W);
BLDCMcontrol::bemfU = new GPIOIno(ARDUINO_UNO.BEMF_U_IO, INPUT, GPIOIno::POSITIVE );
BLDCMcontrol::bemfV = new GPIOIno(ARDUINO_UNO.BEMF_V_IO, INPUT, GPIOIno::POSITIVE );
BLDCMcontrol::bemfW = new GPIOIno(ARDUINO_UNO.BEMF_W_IO, INPUT, GPIOIno::POSITIVE );
BLDCMcontrol::hallA = new GPIOIno(ARDUINO_UNO.HALL_A, INPUT, GPIOIno::POSITIVE );
BLDCMcontrol::hallB = new GPIOIno(ARDUINO_UNO.HALL_B, INPUT, GPIOIno::POSITIVE );
BLDCMcontrol::hallC = new GPIOIno(ARDUINO_UNO.HALL_C, INPUT, GPIOIno::POSITIVE );
BLDCMcontrol::timer = new TimerIno();
BLDCMcontrol::rpmtimer = new TimerIno();
BLDCMcontrol::controller = new TLE9563Ino();
}
/** @} */
#endif /** TLE9563_FRAMEWORK **/
| 33.581395
| 118
| 0.705679
|
Infineon
|
435406e012dea6e5c12e53e7d73c44ce9abab01b
| 14,358
|
cpp
|
C++
|
src/external/open_dynamics_engine-ef/ode/ode_collision_quadtreespace.cpp
|
Benefit-Zebra/ballistica
|
eb85df82cff22038e74a2d93abdcbe9cd755d782
|
[
"MIT"
] | 317
|
2020-04-04T00:33:10.000Z
|
2022-03-28T01:07:09.000Z
|
src/external/open_dynamics_engine-ef/ode/ode_collision_quadtreespace.cpp
|
Alshahriah/ballistica
|
326f6677a0118667e93ce9034849622ebef706fa
|
[
"MIT"
] | 315
|
2020-04-04T22:33:10.000Z
|
2022-03-31T22:50:02.000Z
|
src/external/open_dynamics_engine-ef/ode/ode_collision_quadtreespace.cpp
|
Alshahriah/ballistica
|
326f6677a0118667e93ce9034849622ebef706fa
|
[
"MIT"
] | 97
|
2020-04-04T01:32:17.000Z
|
2022-03-16T19:02:59.000Z
|
/*************************************************************************
* *
* Open Dynamics Engine, Copyright (C) 2001-2003 Russell L. Smith. *
* All rights reserved. Email: russ@q12.org Web: www.q12.org *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of EITHER: *
* (1) The GNU Lesser General Public License as published by the Free *
* Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. The text of the GNU Lesser *
* General Public License is included with this library in the *
* file LICENSE.TXT. *
* (2) The BSD-style license that is included with this library in *
* the file LICENSE-BSD.TXT. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files *
* LICENSE.TXT and LICENSE-BSD.TXT for more details. *
* *
*************************************************************************/
// QuadTreeSpace by Erwin de Vries.
#include "ode/ode_common.h"
#include "ode/ode_matrix.h"
#include "ode/ode_collision_space.h"
#include "ode/ode_collision.h"
#include "ode/ode_collision_kernel.h"
#include "ode/ode_collision_space_internal.h"
#define AXIS0 0
#define AXIS1 1
#define UP 2
//#define DRAWBLOCKS
const int SPLITAXIS = 2;
const int SPLITS = SPLITAXIS * SPLITAXIS;
#define GEOM_ENABLED(g) (g)->gflags & GEOM_ENABLED
class Block{
public:
dReal MinX, MaxX;
dReal MinZ, MaxZ;
dGeomID First;
int GeomCount;
Block* Parent;
Block* Children;
void Create(const dVector3 Center, const dVector3 Extents, Block* Parent, int Depth, Block*& Blocks);
void Collide(void* UserData, dNearCallback* Callback);
void Collide(dGeomID Object, dGeomID g, void* UserData, dNearCallback* Callback);
void CollideLocal(dGeomID Object, void* UserData, dNearCallback* Callback);
void AddObject(dGeomID Object);
void DelObject(dGeomID Object);
void Traverse(dGeomID Object);
bool Inside(const dReal* AABB);
Block* GetBlock(const dReal* AABB);
Block* GetBlockChild(const dReal* AABB);
};
#ifdef DRAWBLOCKS
#include "ode/ode_drawstuff.h"
static void DrawBlock(Block* Block){
dVector3 v[8];
v[0][AXIS0] = Block->MinX;
v[0][UP] = REAL(-1.0);
v[0][AXIS1] = Block->MinZ;
v[1][AXIS0] = Block->MinX;
v[1][UP] = REAL(-1.0);
v[1][AXIS1] = Block->MaxZ;
v[2][AXIS0] = Block->MaxX;
v[2][UP] = REAL(-1.0);
v[2][AXIS1] = Block->MinZ;
v[3][AXIS0] = Block->MaxX;
v[3][UP] = REAL(-1.0);
v[3][AXIS1] = Block->MaxZ;
v[4][AXIS0] = Block->MinX;
v[4][UP] = REAL(1.0);
v[4][AXIS1] = Block->MinZ;
v[5][AXIS0] = Block->MinX;
v[5][UP] = REAL(1.0);
v[5][AXIS1] = Block->MaxZ;
v[6][AXIS0] = Block->MaxX;
v[6][UP] = REAL(1.0);
v[6][AXIS1] = Block->MinZ;
v[7][AXIS0] = Block->MaxX;
v[7][UP] = REAL(1.0);
v[7][AXIS1] = Block->MaxZ;
// Bottom
dsDrawLine(v[0], v[1]);
dsDrawLine(v[1], v[3]);
dsDrawLine(v[3], v[2]);
dsDrawLine(v[2], v[0]);
// Top
dsDrawLine(v[4], v[5]);
dsDrawLine(v[5], v[7]);
dsDrawLine(v[7], v[6]);
dsDrawLine(v[6], v[4]);
// Sides
dsDrawLine(v[0], v[4]);
dsDrawLine(v[1], v[5]);
dsDrawLine(v[2], v[6]);
dsDrawLine(v[3], v[7]);
}
#endif //DRAWBLOCKS
void Block::Create(const dVector3 Center, const dVector3 Extents, Block* Parent, int Depth, Block*& Blocks){
GeomCount = 0;
First = 0;
MinX = Center[AXIS0] - Extents[AXIS0];
MaxX = Center[AXIS0] + Extents[AXIS0];
MinZ = Center[AXIS1] - Extents[AXIS1];
MaxZ = Center[AXIS1] + Extents[AXIS1];
this->Parent = Parent;
if (Depth > 0){
Children = Blocks;
Blocks += SPLITS;
dVector3 ChildExtents;
ChildExtents[AXIS0] = Extents[AXIS0] / SPLITAXIS;
ChildExtents[AXIS1] = Extents[AXIS1] / SPLITAXIS;
ChildExtents[UP] = Extents[UP];
for (int i = 0; i < SPLITAXIS; i++){
for (int j = 0; j < SPLITAXIS; j++){
int Index = i * SPLITAXIS + j;
dVector3 ChildCenter;
ChildCenter[AXIS0] = Center[AXIS0] - Extents[AXIS0] + ChildExtents[AXIS0] + i * (ChildExtents[AXIS0] * 2);
ChildCenter[AXIS1] = Center[AXIS1] - Extents[AXIS1] + ChildExtents[AXIS1] + j * (ChildExtents[AXIS1] * 2);
ChildCenter[UP] = Center[UP];
Children[Index].Create(ChildCenter, ChildExtents, this, Depth - 1, Blocks);
}
}
}
else Children = 0;
}
void Block::Collide(void* UserData, dNearCallback* Callback){
#ifdef DRAWBLOCKS
DrawBlock(this);
#endif
// Collide the local list
dxGeom* g = First;
while (g){
if (GEOM_ENABLED(g)){
Collide(g, g->next, UserData, Callback);
}
g = g->next;
}
// Recurse for children
if (Children){
for (int i = 0; i < SPLITS; i++){
if (Children[i].GeomCount <= 1){ // Early out
continue;
}
Children[i].Collide(UserData, Callback);
}
}
}
void Block::Collide(dxGeom* g1, dxGeom* g2, void* UserData, dNearCallback* Callback){
#ifdef DRAWBLOCKS
DrawBlock(this);
#endif
// Collide against local list
while (g2){
if (GEOM_ENABLED(g2)){
collideAABBs (g1, g2, UserData, Callback);
}
g2 = g2->next;
}
// Collide against children
if (Children){
for (int i = 0; i < SPLITS; i++){
// Early out for empty blocks
if (Children[i].GeomCount == 0){
continue;
}
// Does the geom's AABB collide with the block?
// Dont do AABB tests for single geom blocks.
if (Children[i].GeomCount == 1 && Children[i].First){
//
}
else if (true){
if (g1->aabb[AXIS0 * 2 + 0] > Children[i].MaxX ||
g1->aabb[AXIS0 * 2 + 1] < Children[i].MinX ||
g1->aabb[AXIS1 * 2 + 0] > Children[i].MaxZ ||
g1->aabb[AXIS1 * 2 + 1] < Children[i].MinZ) continue;
}
Children[i].Collide(g1, Children[i].First, UserData, Callback);
}
}
}
void Block::CollideLocal(dxGeom* g1, void* UserData, dNearCallback* Callback){
// Collide against local list
dxGeom* g2 = First;
while (g2){
if (GEOM_ENABLED(g2)){
collideAABBs (g1, g2, UserData, Callback);
}
g2 = g2->next;
}
}
void Block::AddObject(dGeomID Object){
// Add the geom
Object->next = First;
First = Object;
Object->tome = (dxGeom**)this;
// Now traverse upwards to tell that we have a geom
Block* Block = this;
do{
Block->GeomCount++;
Block = Block->Parent;
}
while (Block);
}
void Block::DelObject(dGeomID Object){
// Del the geom
dxGeom* g = First;
dxGeom* Last = 0;
while (g){
if (g == Object){
if (Last){
Last->next = g->next;
}
else First = g->next;
break;
}
Last = g;
g = g->next;
}
Object->tome = 0;
// Now traverse upwards to tell that we have lost a geom
Block* Block = this;
do{
Block->GeomCount--;
Block = Block->Parent;
}
while (Block);
}
void Block::Traverse(dGeomID Object){
Block* NewBlock = GetBlock(Object->aabb);
if (NewBlock != this){
// Remove the geom from the old block and add it to the new block.
// This could be more optimal, but the loss should be very small.
DelObject(Object);
NewBlock->AddObject(Object);
}
}
bool Block::Inside(const dReal* AABB){
return AABB[AXIS0 * 2 + 0] >= MinX && AABB[AXIS0 * 2 + 1] <= MaxX && AABB[AXIS1 * 2 + 0] >= MinZ && AABB[AXIS1 * 2 + 1] <= MaxZ;
}
Block* Block::GetBlock(const dReal* AABB){
if (Inside(AABB)){
return GetBlockChild(AABB); // Child or this will have a good block
}
else if (Parent){
return Parent->GetBlock(AABB); // Parent has a good block
}
else return this; // We are at the root, so we have little choice
}
Block* Block::GetBlockChild(const dReal* AABB){
if (Children){
for (int i = 0; i < SPLITS; i++){
if (Children[i].Inside(AABB)){
return Children[i].GetBlockChild(AABB); // Child will have good block
}
}
}
return this; // This is the best block
}
//****************************************************************************
// quadtree space
struct dxQuadTreeSpace : public dxSpace{
Block* Blocks; // Blocks[0] is the root
dArray<dxGeom*> DirtyList;
dxQuadTreeSpace(dSpaceID _space, dVector3 Center, dVector3 Extents, int Depth);
~dxQuadTreeSpace();
dxGeom* getGeom(int i);
void add(dxGeom* g);
void remove(dxGeom* g);
void dirty(dxGeom* g);
void computeAABB();
void cleanGeoms();
void collide(void* UserData, dNearCallback* Callback);
void collide2(void* UserData, dxGeom* g1, dNearCallback* Callback);
// Temp data
Block* CurrentBlock; // Only used while enumerating
int* CurrentChild; // Only used while enumerating
int CurrentLevel; // Only used while enumerating
dxGeom* CurrentObject; // Only used while enumerating
int CurrentIndex;
};
dxQuadTreeSpace::dxQuadTreeSpace(dSpaceID _space, dVector3 Center, dVector3 Extents, int Depth) : dxSpace(_space){
type = dQuadTreeSpaceClass;
int BlockCount = 0;
for (int i = 0; i <= Depth; i++){
BlockCount += (int)pow(dReal(SPLITS), i);
}
Blocks = (Block*)dAlloc(BlockCount * sizeof(Block));
Block* Blocks = this->Blocks + 1; // This pointer gets modified!
this->Blocks[0].Create(Center, Extents, 0, Depth, Blocks);
CurrentBlock = 0;
CurrentChild = (int*)dAlloc((Depth + 1) * sizeof(int));
CurrentLevel = 0;
CurrentObject = 0;
CurrentIndex = -1;
// Init AABB. We initialize to infinity because it is not illegal for an object to be outside of the tree. Its simply inserted in the root block
aabb[0] = -dInfinity;
aabb[1] = dInfinity;
aabb[2] = -dInfinity;
aabb[3] = dInfinity;
aabb[4] = -dInfinity;
aabb[5] = dInfinity;
}
dxQuadTreeSpace::~dxQuadTreeSpace(){
int Depth = 0;
Block* Current = &Blocks[0];
while (Current){
Depth++;
Current = Current->Children;
}
int BlockCount = 0;
for (int i = 0; i < Depth; i++){
BlockCount += (int)pow(dReal(SPLITS), i);
}
dFree(Blocks, BlockCount * sizeof(Block));
dFree(CurrentChild, (Depth + 1) * sizeof(int));
}
dxGeom* dxQuadTreeSpace::getGeom(int Index){
dUASSERT(Index >= 0 && Index < count, "index out of range");
//@@@
dDebug (0,"dxQuadTreeSpace::getGeom() not yet implemented");
return 0;
// This doesnt work
/*if (CurrentIndex == Index){
// Loop through all objects in the local list
CHILDRECURSE:
if (CurrentObject){
dGeomID g = CurrentObject;
CurrentObject = CurrentObject->next;
CurrentIndex++;
#ifdef DRAWBLOCKS
DrawBlock(CurrentBlock);
#endif //DRAWBLOCKS
return g;
}
else{
// Now lets loop through our children. Starting at index 0.
if (CurrentBlock->Children){
CurrentChild[CurrentLevel] = 0;
PARENTRECURSE:
for (int& i = CurrentChild[CurrentLevel]; i < SPLITS; i++){
if (CurrentBlock->Children[i].GeomCount == 0){
continue;
}
CurrentBlock = &CurrentBlock->Children[i];
CurrentObject = CurrentBlock->First;
i++;
CurrentLevel++;
goto CHILDRECURSE;
}
}
}
// Now lets go back to the parent so it can continue processing its other children.
if (CurrentBlock->Parent){
CurrentBlock = CurrentBlock->Parent;
CurrentLevel--;
goto PARENTRECURSE;
}
}
else{
CurrentBlock = &Blocks[0];
CurrentLevel = 0;
CurrentObject = CurrentObject;
CurrentIndex = 0;
// Other states are already set
CurrentObject = CurrentBlock->First;
}
if (current_geom && current_index == Index - 1){
//current_geom = current_geom->next; // next
current_index = Index;
return current_geom;
}
else for (int i = 0; i < Index; i++){ // this will be verrrrrrry slow
getGeom(i);
}*/
return 0;
}
void dxQuadTreeSpace::add(dxGeom* g){
CHECK_NOT_LOCKED (this);
dAASSERT(g);
dUASSERT(g->parent_space == 0 && g->next == 0, "geom is already in a space");
g->gflags |= GEOM_DIRTY | GEOM_AABB_BAD;
DirtyList.push(g);
// add
g->parent_space = this;
Blocks[0].GetBlock(g->aabb)->AddObject(g); // Add to best block
count++;
// enumerator has been invalidated
current_geom = 0;
dGeomMoved(this);
}
void dxQuadTreeSpace::remove(dxGeom* g){
CHECK_NOT_LOCKED(this);
dAASSERT(g);
dUASSERT(g->parent_space == this,"object is not in this space");
// remove
((Block*)g->tome)->DelObject(g);
count--;
for (int i = 0; i < DirtyList.size(); i++){
if (DirtyList[i] == g){
DirtyList.remove(i);
break;
}
}
// safeguard
g->next = 0;
g->tome = 0;
g->parent_space = 0;
// enumerator has been invalidated
current_geom = 0;
// the bounding box of this space (and that of all the parents) may have
// changed as a consequence of the removal.
dGeomMoved(this);
}
void dxQuadTreeSpace::dirty(dxGeom* g){
DirtyList.push(g);
}
void dxQuadTreeSpace::computeAABB(){
//
}
void dxQuadTreeSpace::cleanGeoms(){
// compute the AABBs of all dirty geoms, and clear the dirty flags
lock_count++;
for (int i = 0; i < DirtyList.size(); i++){
dxGeom* g = DirtyList[i];
if (IS_SPACE(g)){
((dxSpace*)g)->cleanGeoms();
}
g->recomputeAABB();
g->gflags &= (~(GEOM_DIRTY|GEOM_AABB_BAD));
((Block*)g->tome)->Traverse(g);
}
DirtyList.setSize(0);
lock_count--;
}
void dxQuadTreeSpace::collide(void* UserData, dNearCallback* Callback){
dAASSERT(Callback);
lock_count++;
cleanGeoms();
Blocks[0].Collide(UserData, Callback);
lock_count--;
}
void dxQuadTreeSpace::collide2(void* UserData, dxGeom* g1, dNearCallback* Callback){
dAASSERT(g1 && Callback);
lock_count++;
cleanGeoms();
g1->recomputeAABB();
if (g1->parent_space == this){
// The block the geom is in
Block* CurrentBlock = (Block*)g1->tome;
// Collide against block and its children
CurrentBlock->Collide(g1, CurrentBlock->First, UserData, Callback);
// Collide against parents
while (true){
CurrentBlock = CurrentBlock->Parent;
if (!CurrentBlock){
break;
}
CurrentBlock->CollideLocal(g1, UserData, Callback);
}
}
else Blocks[0].Collide(g1, Blocks[0].First, UserData, Callback);
lock_count--;
}
dSpaceID dQuadTreeSpaceCreate(dxSpace* space, dVector3 Center, dVector3 Extents, int Depth){
return new dxQuadTreeSpace(space, Center, Extents, Depth);
}
| 24.585616
| 145
| 0.625296
|
Benefit-Zebra
|
4354429a7f3731314acf1f40f94f8661a6e197e9
| 8,839
|
hpp
|
C++
|
include/boost/compute/types/tuple.hpp
|
roshanr95/compute
|
377e509acd16af466cdb133d70e2dcd525ec1a87
|
[
"BSL-1.0"
] | null | null | null |
include/boost/compute/types/tuple.hpp
|
roshanr95/compute
|
377e509acd16af466cdb133d70e2dcd525ec1a87
|
[
"BSL-1.0"
] | null | null | null |
include/boost/compute/types/tuple.hpp
|
roshanr95/compute
|
377e509acd16af466cdb133d70e2dcd525ec1a87
|
[
"BSL-1.0"
] | 1
|
2020-04-09T15:56:37.000Z
|
2020-04-09T15:56:37.000Z
|
//---------------------------------------------------------------------------//
// Copyright (c) 2013 Kyle Lutz <kyle.r.lutz@gmail.com>
//
// Distributed under the Boost Software License, Version 1.0
// See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt
//
// See http://boostorg.github.com/compute for more information.
//---------------------------------------------------------------------------//
#ifndef BOOST_COMPUTE_TYPES_TUPLE_HPP
#define BOOST_COMPUTE_TYPES_TUPLE_HPP
#include <string>
#include <utility>
#include <boost/preprocessor/enum.hpp>
#include <boost/preprocessor/expr_if.hpp>
#include <boost/preprocessor/repetition.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/compute/config.hpp>
#include <boost/compute/functional/get.hpp>
#include <boost/compute/type_traits/type_name.hpp>
#include <boost/compute/detail/meta_kernel.hpp>
#ifndef BOOST_COMPUTE_DETAIL_NO_STD_TUPLE
#include <tuple>
#endif
namespace boost {
namespace compute {
namespace detail {
// meta_kernel operators for boost::tuple literals
#define BOOST_COMPUTE_PRINT_ELEM(z, n, unused) \
BOOST_PP_EXPR_IF(n, << ", ") \
<< kernel.make_lit(boost::get<n>(x))
#define BOOST_COMPUTE_PRINT_TUPLE(z, n, unused) \
template<BOOST_PP_ENUM_PARAMS(n, class T)> \
inline meta_kernel& \
operator<<(meta_kernel &kernel, \
const boost::tuple<BOOST_PP_ENUM_PARAMS(n, T)> &x) \
{ \
return kernel \
<< "(" \
<< type_name<boost::tuple<BOOST_PP_ENUM_PARAMS(n, T)> >() \
<< ")" \
<< "{" \
BOOST_PP_REPEAT(n, BOOST_COMPUTE_PRINT_ELEM, ~) \
<< "}"; \
}
BOOST_PP_REPEAT_FROM_TO(1, BOOST_COMPUTE_MAX_ARITY, BOOST_COMPUTE_PRINT_TUPLE, ~)
#undef BOOST_COMPUTE_PRINT_TUPLE
#undef BOOST_COMPUTE_PRINT_ELEM
// inject_type() specializations for boost::tuple
#define BOOST_COMPUTE_INJECT_TYPE(z, n, unused) \
kernel.inject_type<T ## n>();
#define BOOST_COMPUTE_INJECT_DECL(z, n, unused) \
<< " " << type_name<T ## n>() << " v" #n ";\n"
#define BOOST_COMPUTE_INJECT_IMPL(z, n, unused) \
template<BOOST_PP_ENUM_PARAMS(n, class T)> \
struct inject_type_impl<boost::tuple<BOOST_PP_ENUM_PARAMS(n, T)> > \
{ \
void operator()(meta_kernel &kernel) \
{ \
typedef boost::tuple<BOOST_PP_ENUM_PARAMS(n, T)> tuple_type; \
BOOST_PP_REPEAT(n, BOOST_COMPUTE_INJECT_TYPE, ~) \
std::stringstream declaration; \
declaration << "typedef struct {\n" \
BOOST_PP_REPEAT(n, BOOST_COMPUTE_INJECT_DECL, ~) \
<< "} " << type_name<tuple_type>() << ";\n"; \
kernel.add_type_declaration<tuple_type>(declaration.str()); \
} \
};
BOOST_PP_REPEAT_FROM_TO(1, BOOST_COMPUTE_MAX_ARITY, BOOST_COMPUTE_INJECT_IMPL, ~)
#undef BOOST_COMPUTE_INJECT_IMPL
#undef BOOST_COMPUTE_INJECT_DECL
#undef BOOST_COMPUTE_INJECT_TYPE
#ifdef BOOST_COMPUTE_DETAIL_NO_VARIADIC_TEMPLATES
// type_name() specializations for boost::tuple (without variadic templates)
#define BOOST_COMPUTE_PRINT_TYPE(z, n, unused) \
+ type_name<T ## n>() + "_"
#define BOOST_COMPUTE_PRINT_TYPE_NAME(z, n, unused) \
template<BOOST_PP_ENUM_PARAMS(n, class T)> \
struct type_name_trait<boost::tuple<BOOST_PP_ENUM_PARAMS(n, T)> > \
{ \
static const char* value() \
{ \
static std::string name = \
std::string("boost_tuple_") \
BOOST_PP_REPEAT(n, BOOST_COMPUTE_PRINT_TYPE, ~) \
"t"; \
return name.c_str(); \
} \
};
BOOST_PP_REPEAT_FROM_TO(1, BOOST_COMPUTE_MAX_ARITY, BOOST_COMPUTE_PRINT_TYPE_NAME, ~)
#undef BOOST_COMPUTE_PRINT_TYPE_NAME
#undef BOOST_COMPUTE_PRINT_TYPE
#else
template<size_t N, class T, class... Rest>
struct write_tuple_type_names
{
void operator()(std::ostream &os)
{
os << type_name<T>() << "_";
write_tuple_type_names<N-1, Rest...>()(os);
}
};
template<class T, class... Rest>
struct write_tuple_type_names<1, T, Rest...>
{
void operator()(std::ostream &os)
{
os << type_name<T>();
}
};
// type_name<> specialization for boost::tuple<...> (with variadic templates)
template<class... T>
struct type_name_trait<boost::tuple<T...>>
{
static const char* value()
{
static std::string str = make_type_name();
return str.c_str();
}
static std::string make_type_name()
{
typedef typename boost::tuple<T...> tuple_type;
std::stringstream s;
s << "boost_tuple_";
write_tuple_type_names<
boost::tuples::length<tuple_type>::value, T...
>()(s);
s << "_t";
return s.str();
}
};
#endif // BOOST_COMPUTE_DETAIL_NO_VARIADIC_TEMPLATES
#ifndef BOOST_COMPUTE_DETAIL_NO_STD_TUPLE
// type_name<> specialization for std::tuple<T...>
template<class... T>
struct type_name_trait<std::tuple<T...>>
{
static const char* value()
{
static std::string str = make_type_name();
return str.c_str();
}
static std::string make_type_name()
{
typedef typename std::tuple<T...> tuple_type;
std::stringstream s;
s << "std_tuple_";
write_tuple_type_names<
std::tuple_size<tuple_type>::value, T...
>()(s);
s << "_t";
return s.str();
}
};
#endif // BOOST_COMPUTE_DETAIL_NO_STD_TUPLE
// get<N>() result type specialization for boost::tuple<>
#define BOOST_COMPUTE_GET_RESULT_TYPE(z, n, unused) \
template<size_t N, BOOST_PP_ENUM_PARAMS(n, class T)> \
struct get_result_type<N, boost::tuple<BOOST_PP_ENUM_PARAMS(n, T)> > \
{ \
typedef typename boost::tuple<BOOST_PP_ENUM_PARAMS(n, T)> T; \
typedef typename boost::tuples::element<N, T>::type type; \
};
BOOST_PP_REPEAT_FROM_TO(1, BOOST_COMPUTE_MAX_ARITY, BOOST_COMPUTE_GET_RESULT_TYPE, ~)
#undef BOOST_COMPUTE_GET_RESULT_TYPE
// get<N>() specialization for boost::tuple<>
#define BOOST_COMPUTE_GET_N(z, n, unused) \
template<size_t N, class Arg, BOOST_PP_ENUM_PARAMS(n, class T)> \
inline meta_kernel& operator<<(meta_kernel &kernel, \
const invoked_get<N, Arg, boost::tuple<BOOST_PP_ENUM_PARAMS(n, T)> > &expr) \
{ \
typedef typename boost::tuple<BOOST_PP_ENUM_PARAMS(n, T)> T; \
BOOST_STATIC_ASSERT(N < size_t(boost::tuples::length<T>::value)); \
kernel.inject_type<T>(); \
return kernel << expr.m_arg << ".v" << uint_(N); \
}
BOOST_PP_REPEAT_FROM_TO(1, BOOST_COMPUTE_MAX_ARITY, BOOST_COMPUTE_GET_N, ~)
#undef BOOST_COMPUTE_GET_N
} // end detail namespace
} // end compute namespace
} // end boost namespace
#endif // BOOST_COMPUTE_TYPES_TUPLE_HPP
| 39.995475
| 85
| 0.489874
|
roshanr95
|
4354fd8c8bc205aea0c35010ebf1c532539fe372
| 24,512
|
cpp
|
C++
|
Project/Source/Scene.cpp
|
TBD-org/RealBugEngine
|
0131fde0abc2d86137500acd6f63ed8f0fc2835f
|
[
"MIT"
] | 7
|
2021-04-26T21:32:12.000Z
|
2022-02-14T13:48:53.000Z
|
Project/Source/Scene.cpp
|
TBD-org/RealBugEngine
|
0131fde0abc2d86137500acd6f63ed8f0fc2835f
|
[
"MIT"
] | 66
|
2021-04-24T10:08:07.000Z
|
2021-10-05T16:52:56.000Z
|
Project/Source/Scene.cpp
|
TBD-org/Tesseract
|
0131fde0abc2d86137500acd6f63ed8f0fc2835f
|
[
"MIT"
] | 1
|
2021-07-13T21:26:13.000Z
|
2021-07-13T21:26:13.000Z
|
#include "Scene.h"
#include "GameObject.h"
#include "Application.h"
#include "Modules/ModuleTime.h"
#include "Modules/ModuleEditor.h"
#include "Modules/ModuleRender.h"
#include "Modules/ModulePhysics.h"
#include "Modules/ModuleTime.h"
#include "Modules/ModuleCamera.h"
#include "Modules/ModuleWindow.h"
#include "Modules/ModuleProject.h"
#include "Modules/ModuleResources.h"
#include "Scripting/PropertyMap.h"
#include "Resources/ResourceMesh.h"
#include "Utils/Logging.h"
#include "Utils/Leaks.h"
#define JSON_TAG_ROOT "Root"
#define JSON_TAG_QUADTREE_BOUNDS "QuadtreeBounds"
#define JSON_TAG_QUADTREE_MAX_DEPTH "QuadtreeMaxDepth"
#define JSON_TAG_QUADTREE_ELEMENTS_PER_NODE "QuadtreeElementsPerNode"
#define JSON_TAG_GAME_CAMERA "GameCamera"
#define JSON_TAG_AMBIENTLIGHT "AmbientLight"
#define JSON_TAG_NAVMESH "NavMesh"
#define JSON_TAG_CURSOR_WIDTH "CursorWidth"
#define JSON_TAG_CURSOR_HEIGHT "CursorHeight"
#define JSON_TAG_CURSOR "Cursor"
Scene::Scene(unsigned numGameObjects) {
gameObjects.Allocate(numGameObjects);
transformComponents.Allocate(numGameObjects);
meshRendererComponents.Allocate(numGameObjects);
boundingBoxComponents.Allocate(numGameObjects);
cameraComponents.Allocate(numGameObjects);
lightComponents.Allocate(numGameObjects);
canvasComponents.Allocate(numGameObjects);
canvasRendererComponents.Allocate(numGameObjects);
imageComponents.Allocate(numGameObjects);
transform2DComponents.Allocate(numGameObjects);
boundingBox2DComponents.Allocate(numGameObjects);
eventSystemComponents.Allocate(numGameObjects);
toggleComponents.Allocate(numGameObjects);
textComponents.Allocate(numGameObjects);
buttonComponents.Allocate(numGameObjects);
selectableComponents.Allocate(numGameObjects);
sliderComponents.Allocate(numGameObjects);
skyboxComponents.Allocate(numGameObjects);
scriptComponents.Allocate(numGameObjects);
animationComponents.Allocate(numGameObjects);
particleComponents.Allocate(numGameObjects);
trailComponents.Allocate(numGameObjects);
audioSourceComponents.Allocate(numGameObjects);
audioListenerComponents.Allocate(numGameObjects);
progressbarsComponents.Allocate(numGameObjects);
billboardComponents.Allocate(numGameObjects);
sphereColliderComponents.Allocate(numGameObjects);
boxColliderComponents.Allocate(numGameObjects);
capsuleColliderComponents.Allocate(numGameObjects);
agentComponents.Allocate(numGameObjects);
obstacleComponents.Allocate(numGameObjects);
fogComponents.Allocate(numGameObjects);
videoComponents.Allocate(numGameObjects);
}
Scene::~Scene() {
ClearScene();
}
void Scene::ClearScene() {
App->resources->DecreaseReferenceCount(cursorId);
DestroyGameObject(root);
root = nullptr;
quadtree.Clear();
assert(gameObjects.Count() == 0); // There should be no GameObjects outside the scene hierarchy
gameObjects.Clear(); // This looks redundant, but it resets the free list so that GameObject order is mantained when saving/loading
staticShadowCasters.clear();
dynamicShadowCasters.clear();
mainEntitiesShadowCasters.clear();
}
void Scene::RebuildQuadtree() {
quadtree.Initialize(quadtreeBounds, quadtreeMaxDepth, quadtreeElementsPerNode);
for (ComponentBoundingBox& boundingBox : boundingBoxComponents) {
GameObject& gameObject = boundingBox.GetOwner();
if (gameObject.IsStatic()) {
boundingBox.CalculateWorldBoundingBox();
const AABB& worldAABB = boundingBox.GetWorldAABB();
quadtree.Add(&gameObject, AABB2D(worldAABB.minPoint.xz(), worldAABB.maxPoint.xz()));
gameObject.isInQuadtree = true;
}
}
quadtree.Optimize();
}
void Scene::ClearQuadtree() {
quadtree.Clear();
for (GameObject& gameObject : gameObjects) {
gameObject.isInQuadtree = false;
}
}
void Scene::Init() {
App->resources->IncreaseReferenceCount(cursorId);
root->Init();
}
void Scene::Start() {
App->time->ResetDeltaTime();
if (App->camera->GetGameCamera()) {
// Set the Game Camera as active
App->camera->ChangeActiveCamera(App->camera->GetGameCamera(), true);
App->camera->ChangeCullingCamera(App->camera->GetGameCamera(), true);
} else {
LOG("Error: Game camera not set.");
}
App->window->SetCursor(cursorId, widthCursor, heightCursor);
App->window->ActivateCursor(true);
root->Start();
}
void Scene::Load(JsonValue jScene) {
ClearScene();
// Load GameObjects
JsonValue jRoot = jScene[JSON_TAG_ROOT];
root = gameObjects.Obtain(0);
root->scene = this;
root->Load(jRoot);
// Quadtree generation
JsonValue jQuadtreeBounds = jScene[JSON_TAG_QUADTREE_BOUNDS];
quadtreeBounds = {{jQuadtreeBounds[0], jQuadtreeBounds[1]}, {jQuadtreeBounds[2], jQuadtreeBounds[3]}};
quadtreeMaxDepth = jScene[JSON_TAG_QUADTREE_MAX_DEPTH];
quadtreeElementsPerNode = jScene[JSON_TAG_QUADTREE_ELEMENTS_PER_NODE];
RebuildQuadtree();
// Game Camera
gameCameraId = jScene[JSON_TAG_GAME_CAMERA];
// Ambient Light
JsonValue ambientLight = jScene[JSON_TAG_AMBIENTLIGHT];
ambientColor = {ambientLight[0], ambientLight[1], ambientLight[2]};
// NavMesh
navMeshId = jScene[JSON_TAG_NAVMESH];
// Cursor
heightCursor = jScene[JSON_TAG_CURSOR_HEIGHT];
widthCursor = jScene[JSON_TAG_CURSOR_WIDTH];
cursorId = jScene[JSON_TAG_CURSOR];
}
void Scene::Save(JsonValue jScene) const {
// Save scene information
JsonValue jQuadtreeBounds = jScene[JSON_TAG_QUADTREE_BOUNDS];
jQuadtreeBounds[0] = quadtreeBounds.minPoint.x;
jQuadtreeBounds[1] = quadtreeBounds.minPoint.y;
jQuadtreeBounds[2] = quadtreeBounds.maxPoint.x;
jQuadtreeBounds[3] = quadtreeBounds.maxPoint.y;
jScene[JSON_TAG_QUADTREE_MAX_DEPTH] = quadtreeMaxDepth;
jScene[JSON_TAG_QUADTREE_ELEMENTS_PER_NODE] = quadtreeElementsPerNode;
jScene[JSON_TAG_GAME_CAMERA] = gameCameraId;
JsonValue ambientLight = jScene[JSON_TAG_AMBIENTLIGHT];
ambientLight[0] = ambientColor.x;
ambientLight[1] = ambientColor.y;
ambientLight[2] = ambientColor.z;
// NavMesh
jScene[JSON_TAG_NAVMESH] = navMeshId;
// Cursor
jScene[JSON_TAG_CURSOR_HEIGHT] = heightCursor;
jScene[JSON_TAG_CURSOR_WIDTH] = widthCursor;
jScene[JSON_TAG_CURSOR] = cursorId;
// Save GameObjects
JsonValue jRoot = jScene[JSON_TAG_ROOT];
root->Save(jRoot);
}
GameObject* Scene::CreateGameObject(GameObject* parent, UID id, const char* name) {
GameObject* gameObject = gameObjects.Obtain(id);
gameObject->scene = this;
gameObject->id = id;
gameObject->name = name;
gameObject->SetParent(parent);
return gameObject;
}
void Scene::DestroyGameObject(GameObject* gameObject) {
if (gameObject == nullptr) return;
// If the removed GameObject is the directionalLight of the scene, set it to nullptr
if (gameObject == directionalLight) directionalLight = nullptr;
// We need a copy because we are invalidating the iterator by removing GameObjects
std::vector<GameObject*> children = gameObject->GetChildren();
for (GameObject* child : children) {
DestroyGameObject(child);
}
if (gameObject->isInQuadtree) {
quadtree.Remove(gameObject);
}
bool selected = App->editor->selectedGameObject == gameObject;
if (selected) App->editor->selectedGameObject = nullptr;
gameObject->RemoveAllComponents();
gameObject->SetParent(nullptr);
gameObjects.Release(gameObject->GetID());
}
GameObject* Scene::GetGameObject(UID id) const {
return gameObjects.Find(id);
}
Component* Scene::GetComponentByTypeAndId(ComponentType type, UID componentId) {
switch (type) {
case ComponentType::TRANSFORM:
return transformComponents.Find(componentId);
case ComponentType::MESH_RENDERER:
return meshRendererComponents.Find(componentId);
case ComponentType::BOUNDING_BOX:
return boundingBoxComponents.Find(componentId);
case ComponentType::CAMERA:
return cameraComponents.Find(componentId);
case ComponentType::LIGHT:
return lightComponents.Find(componentId);
case ComponentType::CANVAS:
return canvasComponents.Find(componentId);
case ComponentType::CANVASRENDERER:
return canvasRendererComponents.Find(componentId);
case ComponentType::IMAGE:
return imageComponents.Find(componentId);
case ComponentType::TRANSFORM2D:
return transform2DComponents.Find(componentId);
case ComponentType::BUTTON:
return buttonComponents.Find(componentId);
case ComponentType::EVENT_SYSTEM:
return eventSystemComponents.Find(componentId);
case ComponentType::BOUNDING_BOX_2D:
return boundingBox2DComponents.Find(componentId);
case ComponentType::TOGGLE:
return toggleComponents.Find(componentId);
case ComponentType::TEXT:
return textComponents.Find(componentId);
case ComponentType::SELECTABLE:
return selectableComponents.Find(componentId);
case ComponentType::SLIDER:
return sliderComponents.Find(componentId);
case ComponentType::SKYBOX:
return skyboxComponents.Find(componentId);
case ComponentType::ANIMATION:
return animationComponents.Find(componentId);
case ComponentType::SCRIPT:
return scriptComponents.Find(componentId);
case ComponentType::PARTICLE:
return particleComponents.Find(componentId);
case ComponentType::TRAIL:
return trailComponents.Find(componentId);
case ComponentType::BILLBOARD:
return billboardComponents.Find(componentId);
case ComponentType::AUDIO_SOURCE:
return audioSourceComponents.Find(componentId);
case ComponentType::AUDIO_LISTENER:
return audioListenerComponents.Find(componentId);
case ComponentType::PROGRESS_BAR:
return progressbarsComponents.Find(componentId);
case ComponentType::SPHERE_COLLIDER:
return sphereColliderComponents.Find(componentId);
case ComponentType::BOX_COLLIDER:
return boxColliderComponents.Find(componentId);
case ComponentType::CAPSULE_COLLIDER:
return capsuleColliderComponents.Find(componentId);
case ComponentType::AGENT:
return agentComponents.Find(componentId);
case ComponentType::OBSTACLE:
return obstacleComponents.Find(componentId);
case ComponentType::FOG:
return fogComponents.Find(componentId);
case ComponentType::VIDEO:
return videoComponents.Find(componentId);
default:
LOG("Component of type %i hasn't been registered in Scene::GetComponentByTypeAndId.", (unsigned) type);
assert(false);
return nullptr;
}
}
Component* Scene::CreateComponentByTypeAndId(GameObject* owner, ComponentType type, UID componentId) {
switch (type) {
case ComponentType::TRANSFORM:
return transformComponents.Obtain(componentId, owner, componentId, owner->IsActive());
case ComponentType::MESH_RENDERER:
return meshRendererComponents.Obtain(componentId, owner, componentId, owner->IsActive());
case ComponentType::BOUNDING_BOX:
return boundingBoxComponents.Obtain(componentId, owner, componentId, owner->IsActive());
case ComponentType::CAMERA:
return cameraComponents.Obtain(componentId, owner, componentId, owner->IsActive());
case ComponentType::LIGHT:
return lightComponents.Obtain(componentId, owner, componentId, owner->IsActive());
case ComponentType::CANVAS:
return canvasComponents.Obtain(componentId, owner, componentId, owner->IsActive());
case ComponentType::CANVASRENDERER:
return canvasRendererComponents.Obtain(componentId, owner, componentId, owner->IsActive());
case ComponentType::IMAGE:
return imageComponents.Obtain(componentId, owner, componentId, owner->IsActive());
case ComponentType::TRANSFORM2D:
return transform2DComponents.Obtain(componentId, owner, componentId, owner->IsActive());
case ComponentType::BUTTON:
return buttonComponents.Obtain(componentId, owner, componentId, owner->IsActive());
case ComponentType::EVENT_SYSTEM:
return eventSystemComponents.Obtain(componentId, owner, componentId, owner->IsActive());
case ComponentType::BOUNDING_BOX_2D:
return boundingBox2DComponents.Obtain(componentId, owner, componentId, owner->IsActive());
case ComponentType::TOGGLE:
return toggleComponents.Obtain(componentId, owner, componentId, owner->IsActive());
case ComponentType::TEXT:
return textComponents.Obtain(componentId, owner, componentId, owner->IsActive());
case ComponentType::SELECTABLE:
return selectableComponents.Obtain(componentId, owner, componentId, owner->IsActive());
case ComponentType::SLIDER:
return sliderComponents.Obtain(componentId, owner, componentId, owner->IsActive());
case ComponentType::SKYBOX:
return skyboxComponents.Obtain(componentId, owner, componentId, owner->IsActive());
case ComponentType::ANIMATION:
return animationComponents.Obtain(componentId, owner, componentId, owner->IsActive());
case ComponentType::SCRIPT:
return scriptComponents.Obtain(componentId, owner, componentId, owner->IsActive());
case ComponentType::PARTICLE:
return particleComponents.Obtain(componentId, owner, componentId, owner->IsActive());
case ComponentType::TRAIL:
return trailComponents.Obtain(componentId, owner, componentId, owner->IsActive());
case ComponentType::BILLBOARD:
return billboardComponents.Obtain(componentId, owner, componentId, owner->IsActive());
case ComponentType::AUDIO_SOURCE:
return audioSourceComponents.Obtain(componentId, owner, componentId, owner->IsActive());
case ComponentType::AUDIO_LISTENER:
return audioListenerComponents.Obtain(componentId, owner, componentId, owner->IsActive());
case ComponentType::PROGRESS_BAR:
return progressbarsComponents.Obtain(componentId, owner, componentId, owner->IsActive());
case ComponentType::SPHERE_COLLIDER:
return sphereColliderComponents.Obtain(componentId, owner, componentId, owner->IsActive());
case ComponentType::BOX_COLLIDER:
return boxColliderComponents.Obtain(componentId, owner, componentId, owner->IsActive());
case ComponentType::CAPSULE_COLLIDER:
return capsuleColliderComponents.Obtain(componentId, owner, componentId, owner->IsActive());
case ComponentType::AGENT:
return agentComponents.Obtain(componentId, owner, componentId, owner->IsActive());
case ComponentType::OBSTACLE:
return obstacleComponents.Obtain(componentId, owner, componentId, owner->IsActive());
case ComponentType::FOG:
return fogComponents.Obtain(componentId, owner, componentId, owner->IsActive());
case ComponentType::VIDEO:
return videoComponents.Obtain(componentId, owner, componentId, owner->IsActive());
default:
LOG("Component of type %i hasn't been registered in Scene::CreateComponentByTypeAndId.", (unsigned) type);
assert(false);
return nullptr;
}
}
void Scene::RemoveComponentByTypeAndId(ComponentType type, UID componentId) {
switch (type) {
case ComponentType::TRANSFORM:
transformComponents.Release(componentId);
break;
case ComponentType::MESH_RENDERER:
meshRendererComponents.Release(componentId);
break;
case ComponentType::BOUNDING_BOX:
boundingBoxComponents.Release(componentId);
break;
case ComponentType::CAMERA:
cameraComponents.Release(componentId);
break;
case ComponentType::LIGHT:
lightComponents.Release(componentId);
break;
case ComponentType::CANVAS:
canvasComponents.Release(componentId);
break;
case ComponentType::CANVASRENDERER:
canvasRendererComponents.Release(componentId);
break;
case ComponentType::IMAGE:
imageComponents.Release(componentId);
break;
case ComponentType::TRANSFORM2D:
transform2DComponents.Release(componentId);
break;
case ComponentType::BUTTON:
buttonComponents.Release(componentId);
break;
case ComponentType::EVENT_SYSTEM:
eventSystemComponents.Release(componentId);
break;
case ComponentType::BOUNDING_BOX_2D:
boundingBox2DComponents.Release(componentId);
break;
case ComponentType::TOGGLE:
toggleComponents.Release(componentId);
break;
case ComponentType::TEXT:
textComponents.Release(componentId);
break;
case ComponentType::SELECTABLE:
selectableComponents.Release(componentId);
break;
case ComponentType::SLIDER:
sliderComponents.Release(componentId);
break;
case ComponentType::SKYBOX:
skyboxComponents.Release(componentId);
break;
case ComponentType::ANIMATION:
animationComponents.Release(componentId);
break;
case ComponentType::SCRIPT:
scriptComponents.Release(componentId);
break;
case ComponentType::PARTICLE:
particleComponents.Release(componentId);
break;
case ComponentType::TRAIL:
trailComponents.Release(componentId);
break;
case ComponentType::BILLBOARD:
billboardComponents.Release(componentId);
break;
case ComponentType::AUDIO_SOURCE:
audioSourceComponents.Release(componentId);
break;
case ComponentType::AUDIO_LISTENER:
audioListenerComponents.Release(componentId);
break;
case ComponentType::PROGRESS_BAR:
progressbarsComponents.Release(componentId);
break;
case ComponentType::SPHERE_COLLIDER:
if (App->time->IsGameRunning()) App->physics->RemoveSphereRigidbody(sphereColliderComponents.Find(componentId));
sphereColliderComponents.Release(componentId);
break;
case ComponentType::BOX_COLLIDER:
if (App->time->IsGameRunning()) App->physics->RemoveBoxRigidbody(boxColliderComponents.Find(componentId));
boxColliderComponents.Release(componentId);
break;
case ComponentType::CAPSULE_COLLIDER:
if (App->time->IsGameRunning()) App->physics->RemoveCapsuleRigidbody(capsuleColliderComponents.Find(componentId));
capsuleColliderComponents.Release(componentId);
break;
case ComponentType::AGENT:
agentComponents.Release(componentId);
break;
case ComponentType::OBSTACLE:
obstacleComponents.Release(componentId);
break;
case ComponentType::FOG:
fogComponents.Release(componentId);
break;
case ComponentType::VIDEO:
videoComponents.Release(componentId);
break;
default:
LOG("Component of type %i hasn't been registered in Scene::RemoveComponentByTypeAndId.", (unsigned) type);
assert(false);
break;
}
}
int Scene::GetTotalTriangles() const {
int triangles = 0;
for (const ComponentMeshRenderer& meshComponent : meshRendererComponents) {
ResourceMesh* mesh = App->resources->GetResource<ResourceMesh>(meshComponent.GetMesh());
if (mesh != nullptr) {
triangles += mesh->indices.size() / 3;
}
}
return triangles;
}
std::vector<float> Scene::GetVertices() {
std::vector<float> result;
for (ComponentMeshRenderer& meshRenderer : meshRendererComponents) {
ResourceMesh* mesh = App->resources->GetResource<ResourceMesh>(meshRenderer.GetMesh());
ComponentTransform* transform = meshRenderer.GetOwner().GetComponent<ComponentTransform>();
if (mesh != nullptr && transform->GetOwner().IsStatic()) {
for (const ResourceMesh::Vertex& vertex : mesh->vertices) {
float4 transformedVertex = transform->GetGlobalMatrix() * float4(vertex.position, 1.0f);
result.push_back(transformedVertex.x);
result.push_back(transformedVertex.y);
result.push_back(transformedVertex.z);
}
}
}
return result;
}
std::vector<int> Scene::GetTriangles() {
int triangles = 0;
std::vector<int> maxVertMesh;
maxVertMesh.push_back(0);
for (ComponentMeshRenderer& meshRenderer : meshRendererComponents) {
ResourceMesh* mesh = App->resources->GetResource<ResourceMesh>(meshRenderer.GetMesh());
if (mesh != nullptr && meshRenderer.GetOwner().IsStatic()) {
triangles += mesh->indices.size() / 3;
maxVertMesh.push_back(mesh->vertices.size());
}
}
std::vector<int> result(triangles * 3);
int currentGlobalTri = 0;
int vertOverload = 0;
int i = 0;
for (ComponentMeshRenderer& meshRenderer : meshRendererComponents) {
ResourceMesh* mesh = App->resources->GetResource<ResourceMesh>(meshRenderer.GetMesh());
if (mesh != nullptr && meshRenderer.GetOwner().IsStatic()) {
vertOverload += maxVertMesh[i];
for (unsigned j = 0; j < mesh->indices.size(); j += 3) {
result[currentGlobalTri] = mesh->indices[j] + vertOverload;
result[currentGlobalTri + 1] = mesh->indices[j + 1] + vertOverload;
result[currentGlobalTri + 2] = mesh->indices[j + 2] + vertOverload;
currentGlobalTri += 3;
}
i++;
}
}
return result;
}
std::vector<float> Scene::GetNormals() {
std::vector<float> result;
for (ComponentMeshRenderer& meshRenderer : meshRendererComponents) {
ResourceMesh* mesh = App->resources->GetResource<ResourceMesh>(meshRenderer.GetMesh());
ComponentTransform* transform = meshRenderer.GetOwner().GetComponent<ComponentTransform>();
if (mesh != nullptr && transform->GetOwner().IsStatic()) {
for (const ResourceMesh::Vertex& vertex : mesh->vertices) {
float4 transformedVertex = transform->GetGlobalMatrix() * float4(vertex.normal, 1.0f);
result.push_back(transformedVertex.x);
result.push_back(transformedVertex.y);
result.push_back(transformedVertex.z);
}
}
}
return result;
}
const std::vector<GameObject*>& Scene::GetStaticShadowCasters() const {
return staticShadowCasters;
}
const std::vector<GameObject*>& Scene::GetDynamicShadowCasters() const {
return dynamicShadowCasters;
}
const std::vector<GameObject*>& Scene::GetMainEntitiesShadowCasters() const {
return mainEntitiesShadowCasters;
}
bool Scene::InsideFrustumPlanes(const FrustumPlanes& planes, const GameObject* go) {
ComponentBoundingBox* boundingBox = go->GetComponent<ComponentBoundingBox>();
if (boundingBox && planes.CheckIfInsideFrustumPlanes(boundingBox->GetWorldAABB(), boundingBox->GetWorldOBB())) {
return true;
}
return false;
}
std::vector<GameObject*> Scene::GetCulledMeshes(const FrustumPlanes& planes, const int mask) {
std::vector<GameObject*> meshes;
for (ComponentMeshRenderer componentMR : meshRendererComponents) {
GameObject* go = &componentMR.GetOwner();
Mask& maskGo = go->GetMask();
if ((maskGo.bitMask & mask) != 0) {
if (InsideFrustumPlanes(planes, go)) {
meshes.push_back(go);
}
}
}
return meshes;
}
std::vector<GameObject*> Scene::GetStaticCulledShadowCasters(const FrustumPlanes& planes) {
std::vector<GameObject*> meshes;
for (GameObject* go : staticShadowCasters) {
if (InsideFrustumPlanes(planes, go)) {
meshes.push_back(go);
}
}
return meshes;
}
std::vector<GameObject*> Scene::GetDynamicCulledShadowCasters(const FrustumPlanes& planes) {
std::vector<GameObject*> meshes;
for (GameObject* go : dynamicShadowCasters) {
if (InsideFrustumPlanes(planes, go)) {
meshes.push_back(go);
}
}
return meshes;
}
std::vector<GameObject*> Scene::GetMainEntitiesCulledShadowCasters(const FrustumPlanes& planes) {
std::vector<GameObject*> meshes;
for (GameObject* go : mainEntitiesShadowCasters) {
if (InsideFrustumPlanes(planes, go)) {
meshes.push_back(go);
}
}
return meshes;
}
void Scene::RemoveStaticShadowCaster(const GameObject* go) {
auto it = std::find(staticShadowCasters.begin(), staticShadowCasters.end(), go);
if (it == staticShadowCasters.end()) return;
staticShadowCasters.erase(it);
App->renderer->lightFrustumStatic.Invalidate();
}
void Scene::AddStaticShadowCaster(GameObject* go) {
auto it = std::find(staticShadowCasters.begin(), staticShadowCasters.end(), go);
if (it != staticShadowCasters.end()) return;
staticShadowCasters.push_back(go);
App->renderer->lightFrustumStatic.Invalidate();
}
void Scene::RemoveDynamicShadowCaster(const GameObject* go) {
auto it = std::find(dynamicShadowCasters.begin(), dynamicShadowCasters.end(), go);
if (it == dynamicShadowCasters.end()) return;
dynamicShadowCasters.erase(it);
App->renderer->lightFrustumDynamic.Invalidate();
}
void Scene::AddDynamicShadowCaster(GameObject* go) {
auto it = std::find(dynamicShadowCasters.begin(), dynamicShadowCasters.end(), go);
if (it != dynamicShadowCasters.end()) return;
dynamicShadowCasters.push_back(go);
App->renderer->lightFrustumDynamic.Invalidate();
}
void Scene::RemoveMainEntityShadowCaster(const GameObject* go) {
auto it = std::find(mainEntitiesShadowCasters.begin(), mainEntitiesShadowCasters.end(), go);
if (it == mainEntitiesShadowCasters.end()) return;
mainEntitiesShadowCasters.erase(it);
App->renderer->lightFrustumMainEntities.Invalidate();
}
void Scene::AddMainEntityShadowCaster(GameObject* go) {
auto it = std::find(mainEntitiesShadowCasters.begin(), mainEntitiesShadowCasters.end(), go);
if (it != mainEntitiesShadowCasters.end()) return;
mainEntitiesShadowCasters.push_back(go);
App->renderer->lightFrustumMainEntities.Invalidate();
}
void Scene::SetCursor(UID cursor) {
if (cursorId != 0) {
App->resources->DecreaseReferenceCount(cursorId);
}
cursorId = cursor;
if (cursor != 0) {
App->resources->IncreaseReferenceCount(cursor);
}
App->window->SetCursor(cursorId, widthCursor, heightCursor);
#if GAME
App->window->ActivateCursor(true);
#endif
}
UID Scene::GetCursor() {
return cursorId;
}
void Scene::SetCursorWidth(int width) {
widthCursor = width;
}
int Scene::GetCursorWidth() {
return widthCursor;
}
void Scene::SetCursorHeight(int height) {
heightCursor = height;
}
int Scene::GetCursorHeight() {
return heightCursor;
}
| 33.214092
| 136
| 0.777945
|
TBD-org
|
435552d931ccffb65e45704f1b5909b4cb708ba0
| 1,606
|
cpp
|
C++
|
modules/argument_game/grid_controller_base.cpp
|
Niluk93/ArgumentGame
|
e934399578d3aa0852faed3175b8675439632c9e
|
[
"CC-BY-3.0",
"Apache-2.0",
"MIT"
] | 1
|
2020-03-08T21:31:15.000Z
|
2020-03-08T21:31:15.000Z
|
modules/argument_game/grid_controller_base.cpp
|
Niluk93/ArgumentGame
|
e934399578d3aa0852faed3175b8675439632c9e
|
[
"CC-BY-3.0",
"Apache-2.0",
"MIT"
] | null | null | null |
modules/argument_game/grid_controller_base.cpp
|
Niluk93/ArgumentGame
|
e934399578d3aa0852faed3175b8675439632c9e
|
[
"CC-BY-3.0",
"Apache-2.0",
"MIT"
] | null | null | null |
#include "grid_controller_base.h"
#include "grid_state.h"
#include "game_grid.h"
#include <stdexcept>
GridControllerBase::GridControllerBase()
: bAcceptingInput(true)
{
}
void GridControllerBase::_bind_methods()
{
ClassDB::bind_method(D_METHOD("init", "owner"), &GridControllerBase::init);
ClassDB::bind_method(D_METHOD("process_tileHover", "oldTileIndex", "newTileIndex"), &GridControllerBase::process_tileHover);
ClassDB::bind_method(D_METHOD("process_tileSelected", "tileIndex"), &GridControllerBase::process_tileSelected);
ClassDB::bind_method(D_METHOD("process_gridStateChanged", "bNext"), &GridControllerBase::process_gridStateChanged);
ClassDB::bind_method(D_METHOD("toggle_acceptingInput", "bAcceptingInput"), &GridControllerBase::toggleAcceptingInput);
}
void GridControllerBase::init(Variant owner)
{
OwningGrid = owner;
GridStateRef.instance();
GridStateRef->set_GridRef(owner);
}
void GridControllerBase::process_tileHoverImpl(int oldTileIndex, int newTileIndex)
{
throw std::logic_error("The method or operation is not implemented.");
}
void GridControllerBase::process_tileSelectedImpl(int tileIndex)
{
throw std::logic_error("The method or operation is not implemented.");
}
void GridControllerBase::process_gridStateChangedImpl(bool bNext)
{
throw std::logic_error("The method or operation is not implemented.");
}
void GridControllerBase::toggleAcceptingInput(bool toggleTo)
{
GridStateRef->set_GridRef(OwningGrid);
bAcceptingInput = toggleTo;
}
GridTextures GridControllerBase::get_GridStateAtNode(int nodeIndex)
{
return GridStateRef->get_NodeState(nodeIndex);
}
| 30.301887
| 125
| 0.800125
|
Niluk93
|
43569ad39815f1f8b9c0661f1e4a85149010644c
| 1,761
|
cpp
|
C++
|
2019/online/0908/test.cpp
|
tusikalanse/acm-icpc
|
20150f42752b85e286d812e716bb32ae1fa3db70
|
[
"MIT"
] | 2
|
2021-06-09T12:27:07.000Z
|
2021-06-11T12:02:03.000Z
|
2019/online/0908/test.cpp
|
tusikalanse/acm-icpc
|
20150f42752b85e286d812e716bb32ae1fa3db70
|
[
"MIT"
] | 1
|
2021-09-08T12:00:05.000Z
|
2021-09-08T14:52:30.000Z
|
2019/online/0908/test.cpp
|
tusikalanse/acm-icpc
|
20150f42752b85e286d812e716bb32ae1fa3db70
|
[
"MIT"
] | null | null | null |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e6+10;
ll m,n,k;
ll f[maxn];
int main()
{
//freopen("in.txt","r",stdin);
int t;
cin>>t;
int T=0;
while(t--)
{
T++;
cin>>n>>m>>k;
cout<<"Case #"<<T<<": ";
if(m<=k){//直接递推
ll tp=(n-m+1);
f[1] = (k-1) % tp; //编号从0开始
for(int i=2;i<=m;++i) f[i] = (f[i-1]+k)%(++tp);
cout<<f[m]+1<<endl;
}
else{
if(k==1) cout<<m<<endl;
else{
ll tp = n-m+1;
ll ans = (k-1) % tp; //编号从0开始
ll now = 1;
while(1){
if((tp-ans)%(k-1)==0){
ll x = (tp-ans)/(k-1) -1 ;
x = min(x,m-now);
ans += x*k;
now += x;
tp += x;
if(now==m) break;
ans =(ans + k) % (tp+1);
now +=1;
tp +=1;
if(now==m) break;
assert(now <=m);
}
else{
ll x = (tp-ans)/(k-1);
x = min(x,m-now);
ans += x*k;
now += x;
tp +=x;
if(now==m) break;
ans =(ans + k) % (tp+1);
now +=1;
tp +=1;
if(now==m) break;
assert(now <=m);
}
}
cout<<ans+1<<endl;
}
}
}
return 0;
}
| 26.681818
| 59
| 0.252697
|
tusikalanse
|
4357a69dd104e211a12495be7e01f51c27fcab19
| 4,512
|
cpp
|
C++
|
orca/gporca/libnaucrates/src/operators/CDXLColDescr.cpp
|
vitessedata/gpdb.4.3.99.x
|
9462aad5df1bf120a2a87456b1f9574712227da4
|
[
"PostgreSQL",
"Apache-2.0"
] | 3
|
2017-12-10T16:41:21.000Z
|
2020-07-08T12:59:12.000Z
|
orca/gporca/libnaucrates/src/operators/CDXLColDescr.cpp
|
vitessedata/gpdb.4.3.99.x
|
9462aad5df1bf120a2a87456b1f9574712227da4
|
[
"PostgreSQL",
"Apache-2.0"
] | null | null | null |
orca/gporca/libnaucrates/src/operators/CDXLColDescr.cpp
|
vitessedata/gpdb.4.3.99.x
|
9462aad5df1bf120a2a87456b1f9574712227da4
|
[
"PostgreSQL",
"Apache-2.0"
] | 4
|
2017-12-10T16:41:35.000Z
|
2020-11-28T12:20:30.000Z
|
//---------------------------------------------------------------------------
// Greenplum Database
// Copyright (C) 2010 Greenplum, Inc.
//
// @filename:
// CDXLColDescr.cpp
//
// @doc:
// Implementation of DXL column descriptors
//
// @owner:
//
//
// @test:
//
//
//---------------------------------------------------------------------------
#include "gpos/string/CWStringDynamic.h"
#include "naucrates/dxl/operators/CDXLColDescr.h"
#include "naucrates/dxl/xml/CXMLSerializer.h"
#include "naucrates/md/CMDIdGPDB.h"
using namespace gpos;
using namespace gpdxl;
using namespace gpmd;
//---------------------------------------------------------------------------
// @function:
// CDXLColDescr::CDXLColDescr
//
// @doc:
// Ctor
//
//---------------------------------------------------------------------------
CDXLColDescr::CDXLColDescr
(
IMemoryPool *pmp,
CMDName *pmdname,
ULONG ulId,
INT iAttno,
IMDId *pmdidType,
BOOL fDropped,
ULONG ulWidth
)
:
m_pmp(pmp),
m_pmdname(pmdname),
m_ulId(ulId),
m_iAttno(iAttno),
m_pmdidType(pmdidType),
m_fDropped(fDropped),
m_ulWidth(ulWidth)
{
GPOS_ASSERT_IMP(m_fDropped, 0 == m_pmdname->Pstr()->UlLength());
}
//---------------------------------------------------------------------------
// @function:
// CDXLColDescr::~CDXLColDescr
//
// @doc:
// Dtor
//
//---------------------------------------------------------------------------
CDXLColDescr::~CDXLColDescr()
{
m_pmdidType->Release();
GPOS_DELETE(m_pmdname);
}
//---------------------------------------------------------------------------
// @function:
// CDXLColDescr::Pmdname
//
// @doc:
// Returns the column name
//
//---------------------------------------------------------------------------
const CMDName *
CDXLColDescr::Pmdname() const
{
return m_pmdname;
}
//---------------------------------------------------------------------------
// @function:
// CDXLColDescr::UlID
//
// @doc:
// Returns the column Id
//
//---------------------------------------------------------------------------
ULONG
CDXLColDescr::UlID() const
{
return m_ulId;
}
//---------------------------------------------------------------------------
// @function:
// CDXLColDescr::IAttno
//
// @doc:
// Returns the column attribute number in GPDB
//
//---------------------------------------------------------------------------
INT
CDXLColDescr::IAttno() const
{
return m_iAttno;
}
//---------------------------------------------------------------------------
// @function:
// CDXLColDescr::PmdidType
//
// @doc:
// Returns the type id for this column
//
//---------------------------------------------------------------------------
IMDId *
CDXLColDescr::PmdidType() const
{
return m_pmdidType;
}
//---------------------------------------------------------------------------
// @function:
// CDXLColDescr::FDropped
//
// @doc:
// Is the column dropped from the relation
//
//---------------------------------------------------------------------------
BOOL
CDXLColDescr::FDropped() const
{
return m_fDropped;
}
//---------------------------------------------------------------------------
// @function:
// CDXLColDescr::UlWidth
//
// @doc:
// Returns the width of the column
//
//---------------------------------------------------------------------------
ULONG
CDXLColDescr::UlWidth() const
{
return m_ulWidth;
}
//---------------------------------------------------------------------------
// @function:
// CDXLColDescr::SerializeToDXL
//
// @doc:
// Serializes the column descriptor into DXL format
//
//---------------------------------------------------------------------------
void
CDXLColDescr::SerializeToDXL
(
CXMLSerializer *pxmlser
)
const
{
const CWStringConst *pstrTokenColDescr = CDXLTokens::PstrToken(EdxltokenColDescr);
pxmlser->OpenElement(CDXLTokens::PstrToken(EdxltokenNamespacePrefix), pstrTokenColDescr);
pxmlser->AddAttribute(CDXLTokens::PstrToken(EdxltokenColId), m_ulId);
pxmlser->AddAttribute(CDXLTokens::PstrToken(EdxltokenAttno), m_iAttno);
pxmlser->AddAttribute(CDXLTokens::PstrToken(EdxltokenColName), m_pmdname->Pstr());
m_pmdidType->Serialize(pxmlser, CDXLTokens::PstrToken(EdxltokenTypeId));
if (m_fDropped)
{
pxmlser->AddAttribute(CDXLTokens::PstrToken(EdxltokenColDropped), m_fDropped);
}
if (ULONG_MAX != m_ulWidth)
{
pxmlser->AddAttribute(CDXLTokens::PstrToken(EdxltokenColWidth), m_ulWidth);
}
pxmlser->CloseElement(CDXLTokens::PstrToken(EdxltokenNamespacePrefix), pstrTokenColDescr);
GPOS_CHECK_ABORT;
}
// EOF
| 22.903553
| 91
| 0.466312
|
vitessedata
|
435c03d986c90d3c7ee9bef3f3f8ac3677cc4a46
| 2,828
|
cc
|
C++
|
chromeos/components/local_search_service/search_utils_unittest.cc
|
zealoussnow/chromium
|
fd8a8914ca0183f0add65ae55f04e287543c7d4a
|
[
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 14,668
|
2015-01-01T01:57:10.000Z
|
2022-03-31T23:33:32.000Z
|
chromeos/components/local_search_service/search_utils_unittest.cc
|
zealoussnow/chromium
|
fd8a8914ca0183f0add65ae55f04e287543c7d4a
|
[
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 86
|
2015-10-21T13:02:42.000Z
|
2022-03-14T07:50:50.000Z
|
chromeos/components/local_search_service/search_utils_unittest.cc
|
zealoussnow/chromium
|
fd8a8914ca0183f0add65ae55f04e287543c7d4a
|
[
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 5,941
|
2015-01-02T11:32:21.000Z
|
2022-03-31T16:35:46.000Z
|
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chromeos/components/local_search_service/search_utils.h"
#include <algorithm>
#include "base/strings/utf_string_conversions.h"
#include "chromeos/components/local_search_service/test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace chromeos {
namespace local_search_service {
TEST(SearchUtilsTest, PrefixMatch) {
// Query is a prefix of text, score is the ratio.
EXPECT_NEAR(ExactPrefixMatchScore(u"musi", u"music"), 0.8, 0.001);
// Text is a prefix of query, score is 0.
EXPECT_EQ(ExactPrefixMatchScore(u"music", u"musi"), 0);
// Case matters.
EXPECT_EQ(ExactPrefixMatchScore(u"musi", u"Music"), 0);
// Query isn't a prefix.
EXPECT_EQ(ExactPrefixMatchScore(u"wide", u"wifi"), 0);
// Text is empty.
EXPECT_EQ(ExactPrefixMatchScore(u"music", u""), 0);
// Query is empty.
EXPECT_EQ(ExactPrefixMatchScore(u"", u"abc"), 0);
}
TEST(SearchUtilsTest, BlockMatch) {
EXPECT_NEAR(BlockMatchScore(u"wifi", u"wi-fi"), 0.804, 0.001);
// Case matters.
EXPECT_NEAR(BlockMatchScore(u"wifi", u"Wi-Fi"), 0.402, 0.001);
}
TEST(SearchUtilsTest, RelevanceCoefficient) {
// Relevant because prefix requirement is met.
EXPECT_GT(RelevanceCoefficient(u"wifi", u"wi-fi", 0 /* prefix_threshold */,
0.99 /* block_threshold */),
0);
// Relevant because prefix requirement is met.
EXPECT_GT(RelevanceCoefficient(u"musi", u"music", 0.8 /* prefix_threshold */,
0.999 /* block_threshold */),
0);
// Relevant because block match requirement is met.
EXPECT_GT(RelevanceCoefficient(u"wifi", u"wi-fi", 0.2 /* prefix_threshold */,
0.001 /* block_threshold */),
0);
// Neither prefix nor block match requirement is met.
EXPECT_EQ(RelevanceCoefficient(u"wifi", u"wi-fi", 0.2 /* prefix_threshold */,
0.99 /* block_threshold */),
0);
// Return the higher score if both requirements are met.
EXPECT_NEAR(RelevanceCoefficient(u"wifi", u"wi-fi", 0 /* prefix_threshold */,
0 /* block_threshold */),
std::max(BlockMatchScore(u"wifi", u"wi-fi"),
ExactPrefixMatchScore(u"wifi", u"wi-fi")),
0.001);
EXPECT_NEAR(RelevanceCoefficient(u"musi", u"music", 0 /* prefix_threshold */,
0 /* block_threshold */),
std::max(BlockMatchScore(u"musi", u"music"),
ExactPrefixMatchScore(u"musi", u"music")),
0.001);
}
} // namespace local_search_service
} // namespace chromeos
| 35.797468
| 79
| 0.626945
|
zealoussnow
|
435c090fd8939dd970935de9450fce645ecbb7ce
| 1,227
|
cc
|
C++
|
lib/common/idioms.cc
|
clementval/f18
|
b17ab7f7bda573d33d6ca554ef1e46144148cf57
|
[
"Apache-2.0"
] | null | null | null |
lib/common/idioms.cc
|
clementval/f18
|
b17ab7f7bda573d33d6ca554ef1e46144148cf57
|
[
"Apache-2.0"
] | null | null | null |
lib/common/idioms.cc
|
clementval/f18
|
b17ab7f7bda573d33d6ca554ef1e46144148cf57
|
[
"Apache-2.0"
] | null | null | null |
//===-- lib/common/idioms.cc ----------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//----------------------------------------------------------------------------//
#include "idioms.h"
#include <cstdarg>
#include <cstdio>
#include <cstdlib>
namespace Fortran::common {
[[noreturn]] void die(const char *msg, ...) {
va_list ap;
va_start(ap, msg);
std::fputs("\nfatal internal error: ", stderr);
std::vfprintf(stderr, msg, ap);
va_end(ap);
fputc('\n', stderr);
std::abort();
}
// Convert the int index of an enumerator to a string.
// enumNames is a list of the names, separated by commas with optional spaces.
// This is intended for use from the expansion of ENUM_CLASS.
std::string EnumIndexToString(int index, const char *enumNames) {
const char *p{enumNames};
for (; index > 0; --index, ++p) {
for (; *p && *p != ','; ++p) {
}
}
for (; *p == ' '; ++p) {
}
CHECK(*p != '\0');
const char *q = p;
for (; *q && *q != ' ' && *q != ','; ++q) {
}
return std::string(p, q - p);
}
}
| 27.886364
| 80
| 0.546047
|
clementval
|
435c0c4257ecd93178b461ba61793dd9386e4bbd
| 6,031
|
cc
|
C++
|
chromium/chrome/browser/password_manager/save_password_infobar_delegate.cc
|
wedataintelligence/vivaldi-source
|
22a46f2c969f6a0b7ca239a05575d1ea2738768c
|
[
"BSD-3-Clause"
] | null | null | null |
chromium/chrome/browser/password_manager/save_password_infobar_delegate.cc
|
wedataintelligence/vivaldi-source
|
22a46f2c969f6a0b7ca239a05575d1ea2738768c
|
[
"BSD-3-Clause"
] | null | null | null |
chromium/chrome/browser/password_manager/save_password_infobar_delegate.cc
|
wedataintelligence/vivaldi-source
|
22a46f2c969f6a0b7ca239a05575d1ea2738768c
|
[
"BSD-3-Clause"
] | null | null | null |
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/password_manager/save_password_infobar_delegate.h"
#include <utility>
#include "base/metrics/histogram.h"
#include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/ui/passwords/manage_passwords_view_utils.h"
#include "chrome/grit/chromium_strings.h"
#include "chrome/grit/generated_resources.h"
#include "components/browser_sync/browser/profile_sync_service.h"
#include "components/infobars/core/infobar.h"
#include "components/password_manager/core/browser/password_bubble_experiment.h"
#include "components/password_manager/core/browser/password_manager_client.h"
#include "content/public/browser/web_contents.h"
#include "grit/theme_resources.h"
#include "ui/base/l10n/l10n_util.h"
// static
void SavePasswordInfoBarDelegate::Create(
content::WebContents* web_contents,
scoped_ptr<password_manager::PasswordFormManager> form_to_save,
const std::string& uma_histogram_suffix) {
Profile* profile =
Profile::FromBrowserContext(web_contents->GetBrowserContext());
sync_driver::SyncService* sync_service =
ProfileSyncServiceFactory::GetForProfile(profile);
bool is_smartlock_branding_enabled =
password_bubble_experiment::IsSmartLockBrandingEnabled(sync_service);
bool should_show_first_run_experience =
password_bubble_experiment::ShouldShowSavePromptFirstRunExperience(
sync_service, profile->GetPrefs());
InfoBarService::FromWebContents(web_contents)
->AddInfoBar(CreateSavePasswordInfoBar(
make_scoped_ptr(new SavePasswordInfoBarDelegate(
web_contents, std::move(form_to_save), uma_histogram_suffix,
is_smartlock_branding_enabled,
should_show_first_run_experience))));
}
SavePasswordInfoBarDelegate::~SavePasswordInfoBarDelegate() {
UMA_HISTOGRAM_ENUMERATION("PasswordManager.InfoBarResponse",
infobar_response_,
password_manager::metrics_util::NUM_RESPONSE_TYPES);
password_manager::metrics_util::LogUIDismissalReason(infobar_response_);
// The shortest period for which the prompt needs to live, so that we don't
// consider it killed prematurely, as might happen, e.g., if a pre-rendered
// page gets swapped in (and the current WebContents is destroyed).
const base::TimeDelta kMinimumPromptDisplayTime =
base::TimeDelta::FromSeconds(1);
if (!uma_histogram_suffix_.empty()) {
password_manager::metrics_util::LogUMAHistogramEnumeration(
"PasswordManager.SavePasswordPromptResponse_" + uma_histogram_suffix_,
infobar_response_,
password_manager::metrics_util::NUM_RESPONSE_TYPES);
password_manager::metrics_util::LogUMAHistogramBoolean(
"PasswordManager.SavePasswordPromptDisappearedQuickly_" +
uma_histogram_suffix_,
timer_.Elapsed() < kMinimumPromptDisplayTime);
}
if (should_show_first_run_experience_) {
Profile* profile =
Profile::FromBrowserContext(web_contents_->GetBrowserContext());
password_bubble_experiment::RecordSavePromptFirstRunExperienceWasShown(
profile->GetPrefs());
}
}
SavePasswordInfoBarDelegate::SavePasswordInfoBarDelegate(
content::WebContents* web_contents,
scoped_ptr<password_manager::PasswordFormManager> form_to_save,
const std::string& uma_histogram_suffix,
bool is_smartlock_branding_enabled,
bool should_show_first_run_experience)
: PasswordManagerInfoBarDelegate(),
form_to_save_(std::move(form_to_save)),
infobar_response_(password_manager::metrics_util::NO_RESPONSE),
uma_histogram_suffix_(uma_histogram_suffix),
should_show_first_run_experience_(should_show_first_run_experience),
web_contents_(web_contents) {
if (!uma_histogram_suffix_.empty()) {
password_manager::metrics_util::LogUMAHistogramBoolean(
"PasswordManager.SavePasswordPromptDisplayed_" + uma_histogram_suffix_,
true);
}
base::string16 message;
gfx::Range message_link_range = gfx::Range();
PasswordTittleType type =
form_to_save_->pending_credentials().federation_url.is_empty()
? PasswordTittleType::SAVE_PASSWORD
: PasswordTittleType::UPDATE_PASSWORD;
GetSavePasswordDialogTitleTextAndLinkRange(
web_contents->GetVisibleURL(), form_to_save_->observed_form().origin,
is_smartlock_branding_enabled, type,
&message, &message_link_range);
SetMessage(message);
SetMessageLinkRange(message_link_range);
}
base::string16 SavePasswordInfoBarDelegate::GetFirstRunExperienceMessage() {
return should_show_first_run_experience_
? l10n_util::GetStringUTF16(
IDS_PASSWORD_MANAGER_SAVE_PROMPT_FIRST_RUN_EXPERIENCE)
: base::string16();
}
infobars::InfoBarDelegate::InfoBarIdentifier
SavePasswordInfoBarDelegate::GetIdentifier() const {
return SAVE_PASSWORD_INFOBAR_DELEGATE;
}
void SavePasswordInfoBarDelegate::InfoBarDismissed() {
DCHECK(form_to_save_.get());
infobar_response_ = password_manager::metrics_util::INFOBAR_DISMISSED;
}
base::string16 SavePasswordInfoBarDelegate::GetButtonLabel(
InfoBarButton button) const {
return l10n_util::GetStringUTF16((button == BUTTON_OK)
? IDS_PASSWORD_MANAGER_SAVE_BUTTON
: IDS_PASSWORD_MANAGER_BLACKLIST_BUTTON);
}
bool SavePasswordInfoBarDelegate::Accept() {
DCHECK(form_to_save_.get());
form_to_save_->Save();
infobar_response_ = password_manager::metrics_util::REMEMBER_PASSWORD;
return true;
}
bool SavePasswordInfoBarDelegate::Cancel() {
DCHECK(form_to_save_.get());
form_to_save_->PermanentlyBlacklist();
infobar_response_ = password_manager::metrics_util::NEVER_REMEMBER_PASSWORD;
return true;
}
| 41.593103
| 80
| 0.765213
|
wedataintelligence
|
435df21ddd9ee3e897aae0f2896d3766695c88d1
| 12,938
|
cpp
|
C++
|
tests/unique_handle.cpp
|
DNKpp/Simple-Utility
|
db2d6cb1cc3849704f18272f8ce2d2bc05ad06a7
|
[
"BSL-1.0"
] | null | null | null |
tests/unique_handle.cpp
|
DNKpp/Simple-Utility
|
db2d6cb1cc3849704f18272f8ce2d2bc05ad06a7
|
[
"BSL-1.0"
] | 8
|
2021-12-30T22:07:39.000Z
|
2022-02-04T21:13:53.000Z
|
tests/unique_handle.cpp
|
DNKpp/Simple-Utility
|
db2d6cb1cc3849704f18272f8ce2d2bc05ad06a7
|
[
"BSL-1.0"
] | 1
|
2020-08-19T13:02:58.000Z
|
2020-08-19T13:02:58.000Z
|
// Copyright Dominic Koepke 2019 - 2022.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// https://www.boost.org/LICENSE_1_0.txt)
#include <catch2/catch.hpp>
#include "helper.hpp"
#include "Simple-Utility/unique_handle.hpp"
using namespace sl;
namespace
{
struct value_t
{
int a{};
int z{};
constexpr value_t(int a)
: a{ a }
{
}
constexpr value_t(int a, int z)
: a{ a },
z{ z }
{
}
constexpr value_t(value_t&&) noexcept = default;
constexpr value_t& operator =(value_t&&) noexcept = default;
constexpr auto operator <=>(const value_t&) const = default;
};
struct delete_action_mock
{
int* invoke_counter{};
constexpr void operator ()(auto&) noexcept
{
if (invoke_counter)
++(*invoke_counter);
}
};
using test_handle = unique_handle<int, delete_action_mock>;
}
TEST_CASE("unique_handle should be default constructible.", "[unique_handle]")
{
STATIC_REQUIRE(std::default_initializable<test_handle>);
}
TEST_CASE("unique_handle should neither be copy constructible nor assignable.", "[unique_handle]")
{
STATIC_REQUIRE(!std::copy_constructible<test_handle>);
STATIC_REQUIRE(!std::assignable_from<test_handle&, const test_handle&>);
}
TEST_CASE("default constructed unique_handle should not contain a value.", "[unique_handle]")
{
constexpr test_handle handle{};
STATIC_REQUIRE(!handle.is_valid());
STATIC_REQUIRE(!handle);
}
TEST_CASE("unique_handle should be explicitly null constructible by nullhandle.", "[unique_handle]")
{
constexpr test_handle handle{ nullhandle };
STATIC_REQUIRE(!handle.is_valid());
STATIC_REQUIRE(!handle);
}
TEST_CASE("unique_handle should be empty constructible by nullhandle and deleteAction.", "[unique_handle]")
{
constexpr bool result = []
{
int testValue = 1337;
const test_handle handle{ nullhandle, delete_action_mock{ &testValue } };
return !handle && *handle.delete_action().invoke_counter == 1337;
}();
REQUIRE(result);
}
TEST_CASE("unique_handle should be assignable by nullhandle.", "[unique_handle]")
{
SL_UNIQUE_HANDLE_FULL_CONSTEXPR
const test_handle handle = []
{
// ReSharper disable once CppInitializedValueIsAlwaysRewritten
test_handle temp{};
temp = nullhandle;
return temp;
}();
REQUIRE(!handle.is_valid());
REQUIRE(!handle);
}
TEST_CASE("unique_handle should be empty constructible by deleteAction.", "[unique_handle]")
{
constexpr bool result = []
{
int testValue = 1337;
const test_handle handle{ delete_action_mock{ &testValue } };
return !handle && *handle.delete_action().invoke_counter == 1337;
}();
REQUIRE(result);
}
TEST_CASE("unique_handle should be constructible by value.", "[unique_handle]")
{
constexpr test_handle handle{ 42 };
STATIC_REQUIRE(handle.is_valid());
STATIC_REQUIRE(handle);
}
TEST_CASE("unique_handle should be constructible by value and deleteAction.", "[unique_handle]")
{
constexpr bool result = []
{
int testValue = 1337;
const test_handle handle{ 42, delete_action_mock{ &testValue } };
return *handle == 42 && *handle.delete_action().invoke_counter == 1337;
}();
REQUIRE(result);
}
TEST_CASE("unique_handle should be assignable by value.", "[unique_handle]")
{
SL_UNIQUE_HANDLE_FULL_CONSTEXPR
const test_handle handle = []
{
// ReSharper disable once CppInitializedValueIsAlwaysRewritten
test_handle temp{};
temp = 42;
return temp;
}();
REQUIRE(handle.is_valid());
REQUIRE(handle);
}
TEST_CASE
(
"unique_handle should automatically deduct its template arguments when constructed by value and deleteAction.",
"[unique_handle]"
)
{
constexpr unique_handle handle{ 42, delete_action_mock{} };
STATIC_REQUIRE(std::same_as<int, decltype(handle)::value_type>);
STATIC_REQUIRE(std::same_as<delete_action_mock, decltype(handle)::delete_action_type>);
}
TEST_CASE("unique_handle should automatically deduct its template arguments when constructed by value.", "[unique_handle]")
{
constexpr unique_handle handle{ 42 };
STATIC_REQUIRE(std::same_as<decltype(handle)::value_type, int>);
STATIC_REQUIRE(std::same_as<decltype(handle)::delete_action_type, default_delete_action>);
}
TEST_CASE("unique_handle should be explicitly in-place construct value when std::in_place token is used.", "[unique_handle]")
{
constexpr unique_handle<value_t> handle{ std::in_place, 42, 1337 };
STATIC_REQUIRE(handle->a == 42);
STATIC_REQUIRE(handle->z == 1337);
}
TEST_CASE
(
"unique_handle should be explicitly in-place construct value and deleteAction when std::in_place token is used.",
"[unique_handle]"
)
{
constexpr bool result = []
{
int testValue = 1337;
const unique_handle<value_t, delete_action_mock> handle{ std::in_place, delete_action_mock{ &testValue }, 42, -1 };
return handle->a == 42
&& handle->z == -1
&& *handle.delete_action().invoke_counter == 1337;
}();
REQUIRE(result);
}
TEST_CASE("unique_handle::emplace constructs value in place.", "[unique_handle]")
{
SL_UNIQUE_HANDLE_FULL_CONSTEXPR
const bool result = []
{
unique_handle<value_t> handle{};
handle.emplace(1337, 42);
return handle->a == 1337 && handle->z == 42;
}();
REQUIRE(result);
}
#pragma warning(disable: 26444)
TEMPLATE_TEST_CASE_SIG
(
"delete action on assignment must only be invoked if unique_handle holds a value.",
"[unique_handle]",
((class TInit, class TAssign, bool VExpected), TInit, TAssign, VExpected),
(int, int, true),
(int, nullhandle_t, true),
(nullhandle_t, int, false),
(nullhandle_t, nullhandle_t, false)
)
#pragma warning(disable: 26444)
{
SL_UNIQUE_HANDLE_FULL_CONSTEXPR
const bool result = []
{
int counter{};
test_handle temp{ TInit{}, delete_action_mock{ .invoke_counter = &counter } };
temp = TAssign{};
return counter == 1;
}();
REQUIRE(result == VExpected);
}
TEST_CASE("unique_handle should be move constructible and invalidate the source.", "[unique_handle]")
{
SL_UNIQUE_HANDLE_FULL_CONSTEXPR
const bool result = []
{
test_handle source{ 42 };
const test_handle target{ std::move(source) };
return !source.is_valid() && target.is_valid();
}();
REQUIRE(result);
}
TEST_CASE("unique_handle should be move constructible and receive the value of other.", "[unique_handle]")
{
SL_UNIQUE_HANDLE_FULL_CONSTEXPR
const bool result = []
{
// ReSharper disable once CppInitializedValueIsAlwaysRewritten
test_handle source{ 42 };
const test_handle target{ std::move(source) };
return target.raw() == 42;
}();
REQUIRE(result);
}
TEST_CASE("unique_handle should be move assignable and invalidate the source.", "[unique_handle]")
{
SL_UNIQUE_HANDLE_FULL_CONSTEXPR
const bool result = []
{
test_handle source{ 42 };
// ReSharper disable once CppInitializedValueIsAlwaysRewritten
test_handle target{ nullhandle };
target = std::move(source);
return !source.is_valid() && target.is_valid();
}();
REQUIRE(result);
}
TEST_CASE("unique_handle should be move assignable and receive the value of other.", "[unique_handle]")
{
SL_UNIQUE_HANDLE_FULL_CONSTEXPR
const bool result = []
{
test_handle source{ 1337 };
// ReSharper disable once CppInitializedValueIsAlwaysRewritten
test_handle target{ nullhandle };
target = std::move(source);
return target.raw() == 1337;
}();
REQUIRE(result);
}
TEST_CASE("moving unique_handle with itself should change nothing.", "[unique_handle]")
{
SL_UNIQUE_HANDLE_FULL_CONSTEXPR
const bool result = []
{
test_handle handle{ 1337 };
handle = std::move(handle);
return handle.is_valid() && *handle == 1337;
}();
REQUIRE(result);
}
TEST_CASE("swapping unique_handle with itself should change nothing.", "[unique_handle]")
{
SL_UNIQUE_HANDLE_FULL_CONSTEXPR
const bool result = []
{
test_handle handle{ 1337 };
handle.swap(handle);
return handle.is_valid() && *handle == 1337;
}();
REQUIRE(result);
}
TEST_CASE("unique_handle should be swapable.", "[unique_handle]")
{
SL_UNIQUE_HANDLE_FULL_CONSTEXPR
const bool result = []
{
test_handle lhs{ 1337 };
test_handle rhs{ 42 };
lhs.swap(rhs);
return *lhs == 42 && *rhs == 1337;
}();
REQUIRE(result);
}
TEST_CASE("unique_handle::raw should expose a const reference of its value.", "[unique_handle]")
{
constexpr bool result = []
{
const test_handle handle{ 1337 };
const int& ref{ handle.raw() };
return ref == 1337;
}();
STATIC_REQUIRE(result);
}
TEST_CASE("unique_handle::raw should throw bad_handle_access if no value is hold.", "[unique_handle]")
{
constexpr test_handle handle{};
REQUIRE_THROWS_AS(handle.raw(), bad_handle_access);
}
TEST_CASE("unique_handle's operator * should expose a const reference of its value.", "[unique_handle]")
{
constexpr bool result = []
{
const test_handle handle{ 42 };
const int& ref{ *handle };
return ref == 42;
}();
REQUIRE(result);
}
TEMPLATE_TEST_CASE
(
"unique_handle's operator -> overload should expose a pointer to its value.",
"[unique_handle]",
test_handle,
const test_handle
)
{
constexpr bool result = []
{
TestType handle{ 1337 };
auto* ptr = handle.operator ->();
return *ptr == 1337;
}();
STATIC_REQUIRE(result);
}
TEST_CASE("unique_handle::reset should reset to a nullhandle.", "[unique_handle]")
{
SL_UNIQUE_HANDLE_FULL_CONSTEXPR
const test_handle handle = []
{
test_handle temp{ 42 };
temp.reset();
return temp;
}();
REQUIRE(!handle);
}
TEST_CASE("resetting a handle without value should do nothing.", "[unique_handle]")
{
REQUIRE_NOTHROW
(
[]
{
test_handle temp{ nullhandle };
temp.reset();
}()
);
}
#pragma warning(disable: 26444)
TEMPLATE_TEST_CASE_SIG
(
"delete action on reset must only be invoked if unique_handle holds a value.",
"[unique_handle]",
((class TInit, bool VExpected), TInit, VExpected),
(int, true),
(nullhandle_t, false)
)
#pragma warning(disable: 26444)
{
SL_UNIQUE_HANDLE_FULL_CONSTEXPR
const bool result = []
{
int counter{};
test_handle temp{ TInit{}, delete_action_mock{ .invoke_counter = &counter } };
temp.reset();
return counter == 1;
}();
REQUIRE(result == VExpected);
}
TEST_CASE("unique_handle::delete_action should return a reference to the used deleter action object.", "[unique_handle]")
{
constexpr bool result = []
{
test_handle temp{ 42 };
return &temp.delete_action() == &std::as_const(temp).delete_action();
}();
STATIC_REQUIRE(result);
}
#pragma warning(disable: 26444)
TEMPLATE_TEST_CASE_SIG
(
"delete action on destruction must only be invoked if unique_handle holds a value.",
"[unique_handle]",
((class TInit, bool VExpected), TInit, VExpected),
(int, true),
(nullhandle_t, false)
)
#pragma warning(disable: 26444)
{
constexpr bool result = []
{
int counter{};
{
const test_handle temp{ TInit{}, delete_action_mock{ .invoke_counter = &counter } };
}
return counter == 1;
}();
REQUIRE(result == VExpected);
}
TEST_CASE("unique_handle should be three-way-comparable with unqiue_handle of same type.", "[unique_handle]")
{
STATIC_REQUIRE((test_handle{} <=> test_handle{}) == std::strong_ordering::equal);
STATIC_REQUIRE((test_handle{} <=> test_handle{ 42 }) == std::strong_ordering::less);
STATIC_REQUIRE((test_handle{42 } <=> test_handle{}) == std::strong_ordering::greater);
STATIC_REQUIRE((test_handle{42 } <=> test_handle{1337}) == std::strong_ordering::less);
}
TEST_CASE("unique_handle should be three-way-comparable with nullhandle.", "[unique_handle]")
{
STATIC_REQUIRE((nullhandle <=> test_handle{ 42 }) == std::strong_ordering::less);
STATIC_REQUIRE((nullhandle <=> test_handle{}) == std::strong_ordering::equal);
STATIC_REQUIRE((test_handle{ 42 } <=> nullhandle) == std::strong_ordering::greater);
STATIC_REQUIRE((test_handle{} <=> nullhandle) == std::strong_ordering::equal);
}
TEST_CASE("unique_handle should be three-way-comparable with value type.", "[unique_handle]")
{
STATIC_REQUIRE((42 <=> test_handle{ 1337 }) == std::strong_ordering::less);
STATIC_REQUIRE((1337 <=> test_handle{ 42 }) == std::strong_ordering::greater);
STATIC_REQUIRE((test_handle{ 1337 } <=> 42 ) == std::strong_ordering::greater);
STATIC_REQUIRE((test_handle{ 42 } <=> 1337) == std::strong_ordering::less);
STATIC_REQUIRE((1337 <=> test_handle{}) == std::strong_ordering::greater);
STATIC_REQUIRE((test_handle{} <=> 1337) == std::strong_ordering::less);
STATIC_REQUIRE((42 <=> test_handle{ 42 }) == std::strong_ordering::equal);
STATIC_REQUIRE((test_handle{ 42 } <=> 42) == std::strong_ordering::equal);
}
TEST_CASE("unique_handle should be equality-comparable with specific types.", "[unique_handle]")
{
STATIC_REQUIRE(1337 != test_handle{});
STATIC_REQUIRE(1337 == test_handle{ 1337 });
STATIC_REQUIRE(test_handle{ 1337 } != test_handle{});
STATIC_REQUIRE(test_handle{ 1337 } != test_handle{ 42 });
STATIC_REQUIRE(test_handle{ 1337 } == test_handle{ 1337 });
STATIC_REQUIRE(nullhandle == test_handle{});
STATIC_REQUIRE(nullhandle != test_handle{ 42 });
}
| 25.269531
| 125
| 0.715257
|
DNKpp
|
4361339ed90cacbac792e72fa8a6080377be5d1e
| 7,840
|
cpp
|
C++
|
libs/extensions/CCArmature/CCBone.cpp
|
qq2588258/floweers
|
c7f117f29dee21473821b89ff9b18058f7ebdadf
|
[
"MIT"
] | 17
|
2015-01-09T07:34:32.000Z
|
2021-06-25T02:50:03.000Z
|
libs/extensions/CCArmature/CCBone.cpp
|
qq2588258/floweers
|
c7f117f29dee21473821b89ff9b18058f7ebdadf
|
[
"MIT"
] | null | null | null |
libs/extensions/CCArmature/CCBone.cpp
|
qq2588258/floweers
|
c7f117f29dee21473821b89ff9b18058f7ebdadf
|
[
"MIT"
] | 4
|
2015-01-24T02:48:46.000Z
|
2020-07-02T06:29:06.000Z
|
/****************************************************************************
Copyright (c) 2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "CCBone.h"
#include "CCArmature.h"
#include "utils/CCUtilMath.h"
#include "utils/CCArmatureDataManager.h"
#include "utils/CCTransformHelp.h"
#include "display/CCDisplayManager.h"
namespace cocos2d { namespace extension { namespace armature {
Bone *Bone::create()
{
Bone *pBone = new Bone();
if (pBone && pBone->init())
{
pBone->autorelease();
return pBone;
}
CC_SAFE_DELETE(pBone);
return NULL;
}
Bone *Bone::create(const char *name)
{
Bone *pBone = new Bone();
if (pBone && pBone->init(name))
{
pBone->autorelease();
return pBone;
}
CC_SAFE_DELETE(pBone);
return NULL;
}
Bone::Bone()
{
_tweenData = NULL;
_parent = NULL;
_armature = NULL;
_childArmature = NULL;
_boneData = NULL;
_tween = NULL;
_tween = NULL;
_children = NULL;
_displayManager = NULL;
_ignoreMovementBoneData = false;
_worldTransform = AffineTransformMake(1, 0, 0, 1, 0, 0);
_transformDirty = true;
}
Bone::~Bone(void)
{
CC_SAFE_DELETE(_tweenData);
CC_SAFE_DELETE(_children);
CC_SAFE_DELETE(_tween);
CC_SAFE_DELETE(_displayManager);
if(_boneData)
{
_boneData->release();
}
CC_SAFE_RELEASE(_childArmature);
}
bool Bone::init()
{
return Bone::init(NULL);
}
bool Bone::init(const char *name)
{
bool bRet = false;
do
{
if(NULL != name)
{
_name = name;
}
CC_SAFE_DELETE(_tweenData);
_tweenData = new FrameData();
CC_SAFE_DELETE(_tween);
_tween = new Tween();
_tween->init(this);
CC_SAFE_DELETE(_displayManager);
_displayManager = new DisplayManager();
_displayManager->init(this);
bRet = true;
}
while (0);
return bRet;
}
void Bone::setBoneData(BoneData *boneData)
{
CCASSERT(NULL != boneData, "_boneData must not be NULL");
_boneData = boneData;
_boneData->retain();
_name = _boneData->name;
_ZOrder = _boneData->zOrder;
_displayManager->initDisplayList(boneData);
}
BoneData *Bone::getBoneData()
{
return _boneData;
}
void Bone::setArmature(Armature *armature)
{
_armature = armature;
_tween->setAnimation(_armature->getAnimation());
}
Armature *Bone::getArmature()
{
return _armature;
}
void Bone::update(float delta)
{
if (_parent)
_transformDirty = _transformDirty || _parent->isTransformDirty();
if (_transformDirty)
{
float cosX = cos(_tweenData->skewX);
float cosY = cos(_tweenData->skewY);
float sinX = sin(_tweenData->skewX);
float sinY = sin(_tweenData->skewY);
_worldTransform.a = _tweenData->scaleX * cosY;
_worldTransform.b = _tweenData->scaleX * sinY;
_worldTransform.c = _tweenData->scaleY * sinX;
_worldTransform.d = _tweenData->scaleY * cosX;
_worldTransform.tx = _tweenData->x;
_worldTransform.ty = _tweenData->y;
_worldTransform = AffineTransformConcat(getNodeToParentTransform(), _worldTransform);
if(_parent)
{
_worldTransform = AffineTransformConcat(_worldTransform, _parent->_worldTransform);
}
}
DisplayFactory::updateDisplay(this, _displayManager->getCurrentDecorativeDisplay(), delta, _transformDirty);
Object *object = NULL;
CCARRAY_FOREACH(_children, object)
{
Bone *childBone = static_cast<Bone *>(object);
childBone->update(delta);
}
_transformDirty = false;
}
void Bone::updateDisplayedColor(const Color3B &parentColor)
{
NodeRGBA::updateDisplayedColor(parentColor);
updateColor();
}
void Bone::updateDisplayedOpacity(GLubyte parentOpacity)
{
NodeRGBA::updateDisplayedOpacity(parentOpacity);
updateColor();
}
void Bone::updateColor()
{
Node *display = _displayManager->getDisplayRenderNode();
RGBAProtocol *protocol = dynamic_cast<RGBAProtocol *>(display);
if(protocol != NULL)
{
protocol->setColor(Color3B(_displayedColor.r * _tweenData->r / 255, _displayedColor.g * _tweenData->g / 255, _displayedColor.b * _tweenData->b / 255));
protocol->setOpacity(_displayedOpacity * _tweenData->a / 255);
}
}
void Bone::addChildBone(Bone *child)
{
CCASSERT( NULL != child, "Argument must be non-nil");
CCASSERT( NULL == child->_parent, "child already added. It can't be added again");
if(!_children)
{
childrenAlloc();
}
if (_children->getIndexOfObject(child) == UINT_MAX)
{
_children->addObject(child);
child->setParentBone(this);
}
}
void Bone::removeChildBone(Bone *bone, bool recursion)
{
if ( _children->getIndexOfObject(bone) != UINT_MAX )
{
if(recursion)
{
Array *_ccbones = bone->_children;
Object *_object = NULL;
CCARRAY_FOREACH(_ccbones, _object)
{
Bone *_ccBone = static_cast<Bone *>(_object);
bone->removeChildBone(_ccBone, recursion);
}
}
bone->setParentBone(NULL);
bone->getDisplayManager()->setCurrentDecorativeDisplay(NULL);
_children->removeObject(bone);
}
}
void Bone::removeFromParent(bool recursion)
{
if (NULL != _parent)
{
_parent->removeChildBone(this, recursion);
}
}
void Bone::setParentBone(Bone *parent)
{
_parent = parent;
}
Bone *Bone::getParentBone()
{
return _parent;
}
void Bone::childrenAlloc(void)
{
CC_SAFE_DELETE(_children);
_children = Array::createWithCapacity(4);
_children->retain();
}
void Bone::setChildArmature(Armature *armature)
{
if (_childArmature != armature)
{
CC_SAFE_RETAIN(armature);
CC_SAFE_RELEASE(_childArmature);
_childArmature = armature;
}
}
Armature *Bone::getChildArmature()
{
return _childArmature;
}
Array *Bone::getChildren()
{
return _children;
}
Tween *Bone::getTween()
{
return _tween;
}
void Bone::setZOrder(int zOrder)
{
if (_ZOrder != zOrder)
Node::setZOrder(zOrder);
}
void Bone::setTransformDirty(bool dirty)
{
_transformDirty = dirty;
}
bool Bone::isTransformDirty()
{
return _transformDirty;
}
AffineTransform Bone::nodeToArmatureTransform()
{
return _worldTransform;
}
void Bone::addDisplay(DisplayData *_displayData, int _index)
{
_displayManager->addDisplay(_displayData, _index);
}
void Bone::changeDisplayByIndex(int _index, bool _force)
{
_displayManager->changeDisplayByIndex(_index, _force);
}
}}} // namespace cocos2d { namespace extension { namespace armature {
| 22.65896
| 159
| 0.653954
|
qq2588258
|
cb196e35fc623b3aa0f1ca9511afa22f3352f8c7
| 750
|
cpp
|
C++
|
lib/Target/AVR/TargetInfo/AVRTargetInfo.cpp
|
kkeita/llvm_autofdo
|
9ecd435b55a3e58e1e3f71d478ff02c57840a900
|
[
"Apache-2.0"
] | 34
|
2019-05-29T03:15:48.000Z
|
2022-03-24T03:14:58.000Z
|
lib/Target/AVR/TargetInfo/AVRTargetInfo.cpp
|
kkeita/llvm_autofdo
|
9ecd435b55a3e58e1e3f71d478ff02c57840a900
|
[
"Apache-2.0"
] | 1
|
2020-05-21T11:44:22.000Z
|
2020-05-21T11:44:22.000Z
|
lib/Target/AVR/TargetInfo/AVRTargetInfo.cpp
|
kkeita/llvm_autofdo
|
9ecd435b55a3e58e1e3f71d478ff02c57840a900
|
[
"Apache-2.0"
] | 4
|
2019-12-16T18:49:42.000Z
|
2021-10-11T18:41:54.000Z
|
//===-- AVRTargetInfo.cpp - AVR Target Implementation ---------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "llvm/IR/Module.h"
#include "llvm/Support/TargetRegistry.h"
namespace llvm {
Target &getTheAVRTarget() {
static Target TheAVRTarget;
return TheAVRTarget;
}
}
extern "C" void LLVMInitializeAVRTargetInfo() {
llvm::RegisterTarget<llvm::Triple::avr> X(llvm::getTheAVRTarget(), "avr",
"Atmel AVR Microcontroller", "AVR");
}
| 32.608696
| 80
| 0.586667
|
kkeita
|
cb1b4f33bb1124eb17374dc1faa6e4ab516899b5
| 5,802
|
cpp
|
C++
|
examples/cpp/source/decision_tree/dt_reg_dense_batch.cpp
|
KalyanovD/daal
|
b354b68f83a213102bca6e03d7a11f55ab751f92
|
[
"Apache-2.0"
] | null | null | null |
examples/cpp/source/decision_tree/dt_reg_dense_batch.cpp
|
KalyanovD/daal
|
b354b68f83a213102bca6e03d7a11f55ab751f92
|
[
"Apache-2.0"
] | null | null | null |
examples/cpp/source/decision_tree/dt_reg_dense_batch.cpp
|
KalyanovD/daal
|
b354b68f83a213102bca6e03d7a11f55ab751f92
|
[
"Apache-2.0"
] | null | null | null |
/* file: dt_reg_dense_batch.cpp */
/*******************************************************************************
* Copyright 2014-2019 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
/*
! Content:
! C++ example of Decision tree regression in the batch processing mode.
!******************************************************************************/
/**
* <a name="DAAL-EXAMPLE-CPP-DT_REG_DENSE_BATCH"></a>
* \example dt_reg_dense_batch.cpp
*/
#include "daal.h"
#include "service.h"
#include <cstdio>
using namespace std;
using namespace daal;
using namespace daal::algorithms;
/* Input data set parameters */
string trainDatasetFileName = "../data/batch/decision_tree_train.csv";
string pruneDatasetFileName = "../data/batch/decision_tree_prune.csv";
string testDatasetFileName = "../data/batch/decision_tree_test.csv";
const size_t nFeatures = 5; /* Number of features in training and testing data sets */
decision_tree::regression::training::ResultPtr trainingResult;
decision_tree::regression::prediction::ResultPtr predictionResult;
NumericTablePtr testGroundTruth;
void trainModel();
void testModel();
void printResults();
int main(int argc, char * argv[])
{
checkArguments(argc, argv, 2, &trainDatasetFileName, &testDatasetFileName);
trainModel();
testModel();
printResults();
return 0;
}
void trainModel()
{
/* Initialize FileDataSource<CSVFeatureManager> to retrieve the input data from a .csv file */
FileDataSource<CSVFeatureManager> trainDataSource(trainDatasetFileName, DataSource::notAllocateNumericTable, DataSource::doDictionaryFromContext);
/* Create Numeric Tables for training data and dependent variables */
NumericTablePtr trainData(new HomogenNumericTable<>(nFeatures, 0, NumericTable::notAllocate));
NumericTablePtr trainGroundTruth(new HomogenNumericTable<>(1, 0, NumericTable::notAllocate));
NumericTablePtr mergedData(new MergedNumericTable(trainData, trainGroundTruth));
/* Retrieve the data from the input file */
trainDataSource.loadDataBlock(mergedData.get());
/* Initialize FileDataSource<CSVFeatureManager> to retrieve the pruning input data from a .csv file */
FileDataSource<CSVFeatureManager> pruneDataSource(pruneDatasetFileName, DataSource::notAllocateNumericTable, DataSource::doDictionaryFromContext);
/* Create Numeric Tables for pruning data and dependent variables */
NumericTablePtr pruneData(new HomogenNumericTable<>(nFeatures, 0, NumericTable::notAllocate));
NumericTablePtr pruneGroundTruth(new HomogenNumericTable<>(1, 0, NumericTable::notAllocate));
NumericTablePtr pruneMergedData(new MergedNumericTable(pruneData, pruneGroundTruth));
/* Retrieve the data from the pruning input file */
pruneDataSource.loadDataBlock(pruneMergedData.get());
/* Create an algorithm object to train the Decision tree model */
decision_tree::regression::training::Batch<> algorithm;
/* Pass the training data set, dependent variables, and pruning dataset with dependent variables to the algorithm */
algorithm.input.set(decision_tree::regression::training::data, trainData);
algorithm.input.set(decision_tree::regression::training::dependentVariables, trainGroundTruth);
algorithm.input.set(decision_tree::regression::training::dataForPruning, pruneData);
algorithm.input.set(decision_tree::regression::training::dependentVariablesForPruning, pruneGroundTruth);
/* Train the Decision tree model */
algorithm.compute();
/* Retrieve the results of the training algorithm */
trainingResult = algorithm.getResult();
}
void testModel()
{
/* Initialize FileDataSource<CSVFeatureManager> to retrieve the test data from a .csv file */
FileDataSource<CSVFeatureManager> testDataSource(testDatasetFileName, DataSource::notAllocateNumericTable, DataSource::doDictionaryFromContext);
/* Create Numeric Tables for testing data and dependent variables */
NumericTablePtr testData(new HomogenNumericTable<>(nFeatures, 0, NumericTable::notAllocate));
testGroundTruth = NumericTablePtr(new HomogenNumericTable<>(1, 0, NumericTable::notAllocate));
NumericTablePtr mergedData(new MergedNumericTable(testData, testGroundTruth));
/* Retrieve the data from input file */
testDataSource.loadDataBlock(mergedData.get());
/* Create algorithm objects for Decision tree prediction with the default method */
decision_tree::regression::prediction::Batch<> algorithm;
/* Pass the testing data set and trained model to the algorithm */
algorithm.input.set(decision_tree::regression::prediction::data, testData);
algorithm.input.set(decision_tree::regression::prediction::model, trainingResult->get(decision_tree::regression::training::model));
/* Compute prediction results */
algorithm.compute();
/* Retrieve algorithm results */
predictionResult = algorithm.getResult();
}
void printResults()
{
printNumericTables<float, float>(testGroundTruth, predictionResult->get(decision_tree::regression::prediction::prediction), "Ground truth",
"Regression results", "Decision tree regression results (first 20 observations):", 20);
}
| 43.298507
| 150
| 0.729231
|
KalyanovD
|
cb1d93a8dcc65301589afdd43ea7004cd3627cd9
| 22,224
|
cc
|
C++
|
services/network/web_transport.cc
|
chromium/chromium
|
df46e572c3449a4b108d6e02fbe4f6d24cf98381
|
[
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 14,668
|
2015-01-01T01:57:10.000Z
|
2022-03-31T23:33:32.000Z
|
services/network/web_transport.cc
|
chromium/chromium
|
df46e572c3449a4b108d6e02fbe4f6d24cf98381
|
[
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 86
|
2015-10-21T13:02:42.000Z
|
2022-03-14T07:50:50.000Z
|
services/network/web_transport.cc
|
chromium/chromium
|
df46e572c3449a4b108d6e02fbe4f6d24cf98381
|
[
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 5,941
|
2015-01-02T11:32:21.000Z
|
2022-03-31T16:35:46.000Z
|
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "services/network/web_transport.h"
#include "base/auto_reset.h"
#include "base/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/notreached.h"
#include "base/strings/string_util.h"
#include "base/threading/sequenced_task_runner_handle.h"
#include "base/time/time.h"
#include "net/base/io_buffer.h"
#include "net/quic/platform/impl/quic_mem_slice_impl.h"
#include "net/third_party/quiche/src/quic/core/quic_session.h"
#include "net/third_party/quiche/src/quic/core/quic_time.h"
#include "net/third_party/quiche/src/quic/core/quic_types.h"
#include "net/third_party/quiche/src/quic/platform/api/quic_mem_slice.h"
#include "services/network/network_context.h"
#include "services/network/public/mojom/web_transport.mojom.h"
namespace network {
namespace {
net::WebTransportParameters CreateParameters(
const std::vector<mojom::WebTransportCertificateFingerprintPtr>&
fingerprints) {
net::WebTransportParameters params;
params.enable_quic_transport = false;
params.enable_web_transport_http3 = true;
for (const auto& fingerprint : fingerprints) {
params.server_certificate_fingerprints.push_back(
quic::CertificateFingerprint{.algorithm = fingerprint->algorithm,
.fingerprint = fingerprint->fingerprint});
}
return params;
}
} // namespace
class WebTransport::Stream final {
public:
class StreamVisitor final : public quic::WebTransportStreamVisitor {
public:
explicit StreamVisitor(Stream* stream)
: stream_(stream->weak_factory_.GetWeakPtr()) {}
~StreamVisitor() override {
if (stream_) {
if (stream_->incoming_) {
stream_->writable_watcher_.Cancel();
stream_->writable_.reset();
stream_->transport_->client_->OnIncomingStreamClosed(
stream_->id_,
/*fin_received=*/false);
stream_->incoming_ = nullptr;
}
if (stream_->outgoing_) {
stream_->readable_watcher_.Cancel();
stream_->readable_.reset();
stream_->outgoing_ = nullptr;
}
stream_->MayDisposeLater();
}
}
// Visitor implementation:
void OnCanRead() override {
base::SequencedTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(&Stream::Receive, stream_));
}
void OnCanWrite() override {
base::SequencedTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce(&Stream::Send, stream_));
}
void OnResetStreamReceived(quic::WebTransportStreamError error) override {
if (auto* stream = stream_.get()) {
stream->OnResetStreamReceived(error);
}
}
void OnStopSendingReceived(quic::WebTransportStreamError error) override {
if (auto* stream = stream_.get()) {
stream->OnStopSendingReceived(error);
}
}
void OnWriteSideInDataRecvdState() override {
if (auto* stream = stream_.get()) {
stream->OnWriteSideInDataRecvdState();
}
}
private:
const base::WeakPtr<Stream> stream_;
};
// Bidirectional
Stream(WebTransport* transport,
quic::WebTransportStream* stream,
mojo::ScopedDataPipeConsumerHandle readable,
mojo::ScopedDataPipeProducerHandle writable)
: transport_(transport),
id_(stream->GetStreamId()),
outgoing_(stream),
incoming_(stream),
readable_(std::move(readable)),
writable_(std::move(writable)),
readable_watcher_(FROM_HERE, ArmingPolicy::MANUAL),
writable_watcher_(FROM_HERE, ArmingPolicy::MANUAL) {
DCHECK(outgoing_);
DCHECK(incoming_);
DCHECK(readable_);
DCHECK(writable_);
Init();
}
// Unidirectional: outgoing
Stream(WebTransport* transport,
quic::WebTransportStream* outgoing,
mojo::ScopedDataPipeConsumerHandle readable)
: transport_(transport),
id_(outgoing->GetStreamId()),
outgoing_(outgoing),
readable_(std::move(readable)),
readable_watcher_(FROM_HERE, ArmingPolicy::MANUAL),
writable_watcher_(FROM_HERE, ArmingPolicy::MANUAL) {
DCHECK(outgoing_);
DCHECK(readable_);
Init();
}
// Unidirectional: incoming
Stream(WebTransport* transport,
quic::WebTransportStream* incoming,
mojo::ScopedDataPipeProducerHandle writable)
: transport_(transport),
id_(incoming->GetStreamId()),
incoming_(incoming),
writable_(std::move(writable)),
readable_watcher_(FROM_HERE, ArmingPolicy::MANUAL),
writable_watcher_(FROM_HERE, ArmingPolicy::MANUAL) {
DCHECK(incoming_);
DCHECK(writable_);
Init();
}
void NotifyFinFromClient() {
has_received_fin_from_client_ = true;
MaySendFin();
}
void Abort(uint8_t code) {
if (!outgoing_) {
return;
}
outgoing_->ResetWithUserCode(code);
outgoing_ = nullptr;
readable_watcher_.Cancel();
readable_.reset();
MayDisposeLater();
}
void StopSending(uint8_t code) {
if (!incoming_) {
return;
}
incoming_->SendStopSending(code);
incoming_ = nullptr;
writable_watcher_.Cancel();
writable_.reset();
MayDisposeLater();
}
~Stream() {
auto* stream = incoming_ ? incoming_.get() : outgoing_.get();
if (!stream) {
return;
}
stream->MaybeResetDueToStreamObjectGone();
}
private:
using ArmingPolicy = mojo::SimpleWatcher::ArmingPolicy;
void Init() {
if (outgoing_) {
DCHECK(readable_);
outgoing_->SetVisitor(std::make_unique<StreamVisitor>(this));
readable_watcher_.Watch(
readable_.get(),
MOJO_HANDLE_SIGNAL_NEW_DATA_READABLE | MOJO_HANDLE_SIGNAL_PEER_CLOSED,
MOJO_TRIGGER_CONDITION_SIGNALS_SATISFIED,
base::BindRepeating(&Stream::OnReadable, base::Unretained(this)));
readable_watcher_.ArmOrNotify();
}
if (incoming_) {
DCHECK(writable_);
if (incoming_ != outgoing_) {
incoming_->SetVisitor(std::make_unique<StreamVisitor>(this));
}
writable_watcher_.Watch(
writable_.get(), MOJO_HANDLE_SIGNAL_WRITABLE,
MOJO_TRIGGER_CONDITION_SIGNALS_SATISFIED,
base::BindRepeating(&Stream::OnWritable, base::Unretained(this)));
writable_watcher_.ArmOrNotify();
}
}
void OnReadable(MojoResult result, const mojo::HandleSignalsState& state) {
DCHECK_EQ(result, MOJO_RESULT_OK);
Send();
}
void Send() {
MaySendFin();
while (outgoing_ && outgoing_->CanWrite()) {
const void* data = nullptr;
uint32_t available = 0;
MojoResult result = readable_->BeginReadData(
&data, &available, MOJO_BEGIN_READ_DATA_FLAG_NONE);
if (result == MOJO_RESULT_SHOULD_WAIT) {
readable_watcher_.Arm();
return;
}
if (result == MOJO_RESULT_FAILED_PRECONDITION) {
has_seen_end_of_pipe_for_readable_ = true;
MaySendFin();
return;
}
DCHECK_EQ(result, MOJO_RESULT_OK);
bool send_result = outgoing_->Write(
absl::string_view(reinterpret_cast<const char*>(data), available));
if (!send_result) {
// TODO(yhirano): Handle this failure.
readable_->EndReadData(0);
return;
}
readable_->EndReadData(available);
}
}
void OnWritable(MojoResult result, const mojo::HandleSignalsState& state) {
DCHECK_EQ(result, MOJO_RESULT_OK);
Receive();
}
void MaySendFin() {
if (!outgoing_) {
return;
}
if (!has_seen_end_of_pipe_for_readable_ || !has_received_fin_from_client_) {
return;
}
if (outgoing_->SendFin()) {
// We don't reset `outgoing_` as we want to wait for the ACK signal.
readable_watcher_.Cancel();
readable_.reset();
}
// Otherwise, retry in Send().
}
void Receive() {
while (incoming_) {
quic::WebTransportStream::ReadResult read_result;
if (incoming_->ReadableBytes() > 0) {
void* buffer = nullptr;
uint32_t available = 0;
MojoResult result = writable_->BeginWriteData(
&buffer, &available, MOJO_BEGIN_WRITE_DATA_FLAG_NONE);
if (result == MOJO_RESULT_SHOULD_WAIT) {
writable_watcher_.Arm();
return;
}
if (result == MOJO_RESULT_FAILED_PRECONDITION) {
// The client doesn't want further data.
writable_watcher_.Cancel();
writable_.reset();
incoming_ = nullptr;
MayDisposeLater();
return;
}
DCHECK_EQ(result, MOJO_RESULT_OK);
read_result =
incoming_->Read(reinterpret_cast<char*>(buffer), available);
writable_->EndWriteData(read_result.bytes_read);
} else {
// Even if ReadableBytes() == 0, we may need to read the FIN at the end
// of the stream.
read_result = incoming_->Read(nullptr, 0);
if (!read_result.fin) {
return;
}
}
if (read_result.fin) {
transport_->client_->OnIncomingStreamClosed(id_, /*fin_received=*/true);
writable_watcher_.Cancel();
writable_.reset();
incoming_ = nullptr;
MayDisposeLater();
return;
}
}
}
void OnResetStreamReceived(quic::WebTransportStreamError error) {
if (transport_->client_) {
transport_->client_->OnReceivedResetStream(id_, error);
}
incoming_ = nullptr;
writable_watcher_.Cancel();
writable_.reset();
MayDisposeLater();
}
void OnStopSendingReceived(quic::WebTransportStreamError error) {
if (transport_->client_) {
transport_->client_->OnReceivedStopSending(id_, error);
}
outgoing_ = nullptr;
readable_watcher_.Cancel();
readable_.reset();
MayDisposeLater();
}
void OnWriteSideInDataRecvdState() {
if (transport_->client_) {
transport_->client_->OnOutgoingStreamClosed(id_);
}
outgoing_ = nullptr;
readable_watcher_.Cancel();
readable_.reset();
MayDisposeLater();
}
void Dispose() {
transport_->streams_.erase(id_);
// Deletes |this|.
}
void MayDisposeLater() {
if (outgoing_ || incoming_) {
return;
}
base::SequencedTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::BindOnce(&Stream::Dispose, weak_factory_.GetWeakPtr()));
}
const raw_ptr<WebTransport> transport_; // outlives |this|.
const uint32_t id_;
// |outgoing_| and |incoming_| point to the same stream when this is a
// bidirectional stream. They are owned by |transport_| (via
// quic::QuicSession), and the properties will be null-set when the streams
// are gone (via StreamVisitor).
raw_ptr<quic::WebTransportStream> outgoing_ = nullptr;
raw_ptr<quic::WebTransportStream> incoming_ = nullptr;
mojo::ScopedDataPipeConsumerHandle readable_; // for |outgoing|
mojo::ScopedDataPipeProducerHandle writable_; // for |incoming|
mojo::SimpleWatcher readable_watcher_;
mojo::SimpleWatcher writable_watcher_;
bool has_seen_end_of_pipe_for_readable_ = false;
bool has_received_fin_from_client_ = false;
// This must be the last member.
base::WeakPtrFactory<Stream> weak_factory_{this};
};
WebTransport::WebTransport(
const GURL& url,
const url::Origin& origin,
const net::NetworkIsolationKey& key,
const std::vector<mojom::WebTransportCertificateFingerprintPtr>&
fingerprints,
NetworkContext* context,
mojo::PendingRemote<mojom::WebTransportHandshakeClient> handshake_client)
: transport_(net::CreateWebTransportClient(url,
origin,
this,
key,
context->url_request_context(),
CreateParameters(fingerprints))),
context_(context),
receiver_(this),
handshake_client_(std::move(handshake_client)) {
handshake_client_.set_disconnect_handler(
base::BindOnce(&WebTransport::Dispose, base::Unretained(this)));
transport_->Connect();
}
WebTransport::~WebTransport() = default;
void WebTransport::SendDatagram(base::span<const uint8_t> data,
base::OnceCallback<void(bool)> callback) {
DCHECK(!torn_down_);
datagram_callbacks_.emplace(std::move(callback));
auto buffer = base::MakeRefCounted<net::IOBuffer>(data.size());
memcpy(buffer->data(), data.data(), data.size());
quic::QuicMemSlice slice(
quic::QuicMemSliceImpl(std::move(buffer), data.size()));
transport_->session()->SendOrQueueDatagram(std::move(slice));
}
void WebTransport::CreateStream(
mojo::ScopedDataPipeConsumerHandle readable,
mojo::ScopedDataPipeProducerHandle writable,
base::OnceCallback<void(bool, uint32_t)> callback) {
// |readable| is non-nullable, |writable| is nullable.
DCHECK(readable);
if (handshake_client_) {
// Invalid request.
std::move(callback).Run(false, 0);
return;
}
quic::WebTransportSession* const session = transport_->session();
if (writable) {
// Bidirectional
if (!session->CanOpenNextOutgoingBidirectionalStream()) {
// TODO(crbug.com/104236): Instead of rejecting the creation request, we
// should wait in this case.
std::move(callback).Run(false, 0);
return;
}
quic::WebTransportStream* const stream =
session->OpenOutgoingBidirectionalStream();
DCHECK(stream);
streams_.insert(std::make_pair(
stream->GetStreamId(),
std::make_unique<Stream>(this, stream, std::move(readable),
std::move(writable))));
std::move(callback).Run(true, stream->GetStreamId());
return;
}
// Unidirectional
if (!session->CanOpenNextOutgoingUnidirectionalStream()) {
// TODO(crbug.com/104236): Instead of rejecting the creation request, we
// should wait in this case.
std::move(callback).Run(false, 0);
return;
}
quic::WebTransportStream* const stream =
session->OpenOutgoingUnidirectionalStream();
DCHECK(stream);
streams_.insert(std::make_pair(
stream->GetStreamId(),
std::make_unique<Stream>(this, stream, std::move(readable))));
std::move(callback).Run(true, stream->GetStreamId());
}
void WebTransport::AcceptBidirectionalStream(
BidirectionalStreamAcceptanceCallback acceptance) {
bidirectional_stream_acceptances_.push(std::move(acceptance));
OnIncomingBidirectionalStreamAvailable();
}
void WebTransport::AcceptUnidirectionalStream(
UnidirectionalStreamAcceptanceCallback acceptance) {
unidirectional_stream_acceptances_.push(std::move(acceptance));
OnIncomingUnidirectionalStreamAvailable();
}
void WebTransport::SendFin(uint32_t stream) {
auto it = streams_.find(stream);
if (it == streams_.end()) {
return;
}
it->second->NotifyFinFromClient();
}
void WebTransport::AbortStream(uint32_t stream, uint8_t code) {
auto it = streams_.find(stream);
if (it == streams_.end()) {
return;
}
it->second->Abort(code);
}
void WebTransport::StopSending(uint32_t stream, uint8_t code) {
auto it = streams_.find(stream);
if (it == streams_.end()) {
return;
}
it->second->StopSending(code);
}
void WebTransport::SetOutgoingDatagramExpirationDuration(
base::TimeDelta duration) {
if (torn_down_) {
return;
}
transport_->session()->SetDatagramMaxTimeInQueue(
quic::QuicTime::Delta::FromMicroseconds(duration.InMicroseconds()));
}
void WebTransport::Close(mojom::WebTransportCloseInfoPtr close_info) {
if (torn_down_) {
return;
}
closing_ = true;
receiver_.reset();
handshake_client_.reset();
client_.reset();
absl::optional<net::WebTransportCloseInfo> close_info_to_pass;
if (close_info) {
close_info_to_pass =
absl::make_optional<net::WebTransportCloseInfo>(close_info->code, "");
// As described at
// https://w3c.github.io/webtransport/#dom-webtransport-close,
// the size of the reason string must not exceed 1024.
constexpr size_t kMaxSize = 1024;
if (close_info->reason.size() > kMaxSize) {
base::TruncateUTF8ToByteSize(close_info->reason, kMaxSize,
&close_info_to_pass->reason);
} else {
close_info_to_pass->reason = std::move(close_info->reason);
}
}
transport_->Close(close_info_to_pass);
}
void WebTransport::OnConnected(
scoped_refptr<net::HttpResponseHeaders> response_headers) {
if (torn_down_) {
return;
}
DCHECK(handshake_client_);
handshake_client_->OnConnectionEstablished(
receiver_.BindNewPipeAndPassRemote(),
client_.BindNewPipeAndPassReceiver(), std::move(response_headers));
handshake_client_.reset();
// We set the disconnect handler for `receiver_`, not `client_`, in order
// to make the closing sequence consistent: The client calls Close() and
// then resets the mojo endpoints.
receiver_.set_disconnect_handler(
base::BindOnce(&WebTransport::Dispose, base::Unretained(this)));
}
void WebTransport::OnConnectionFailed(const net::WebTransportError& error) {
if (torn_down_) {
return;
}
DCHECK(handshake_client_);
// Here we assume that the error is not going to handed to the
// initiator renderer.
handshake_client_->OnHandshakeFailed(error);
TearDown();
}
void WebTransport::OnClosed(
const absl::optional<net::WebTransportCloseInfo>& close_info) {
if (torn_down_) {
return;
}
DCHECK(!handshake_client_);
if (closing_) {
closing_ = false;
} else {
mojom::WebTransportCloseInfoPtr close_info_to_pass;
if (close_info) {
close_info_to_pass = mojom::WebTransportCloseInfo::New(
close_info->code, close_info->reason);
}
client_->OnClosed(std::move(close_info_to_pass));
}
TearDown();
}
void WebTransport::OnError(const net::WebTransportError& error) {
if (torn_down_) {
return;
}
if (closing_) {
closing_ = false;
}
DCHECK(!handshake_client_);
TearDown();
}
void WebTransport::OnIncomingBidirectionalStreamAvailable() {
DCHECK(!handshake_client_);
DCHECK(client_);
while (!bidirectional_stream_acceptances_.empty()) {
quic::WebTransportStream* const stream =
transport_->session()->AcceptIncomingBidirectionalStream();
if (!stream) {
return;
}
auto acceptance = std::move(bidirectional_stream_acceptances_.front());
bidirectional_stream_acceptances_.pop();
mojo::ScopedDataPipeConsumerHandle readable_for_outgoing;
mojo::ScopedDataPipeProducerHandle writable_for_outgoing;
mojo::ScopedDataPipeConsumerHandle readable_for_incoming;
mojo::ScopedDataPipeProducerHandle writable_for_incoming;
const MojoCreateDataPipeOptions options = {
sizeof(options), MOJO_CREATE_DATA_PIPE_FLAG_NONE, 1, 256 * 1024};
if (mojo::CreateDataPipe(&options, writable_for_outgoing,
readable_for_outgoing) != MOJO_RESULT_OK) {
stream->ResetDueToInternalError();
// TODO(yhirano): Error the entire connection.
return;
}
if (mojo::CreateDataPipe(&options, writable_for_incoming,
readable_for_incoming) != MOJO_RESULT_OK) {
stream->ResetDueToInternalError();
// TODO(yhirano): Error the entire connection.
return;
}
streams_.insert(std::make_pair(
stream->GetStreamId(),
std::make_unique<Stream>(this, stream, std::move(readable_for_outgoing),
std::move(writable_for_incoming))));
std::move(acceptance)
.Run(stream->GetStreamId(), std::move(readable_for_incoming),
std::move(writable_for_outgoing));
}
}
void WebTransport::OnIncomingUnidirectionalStreamAvailable() {
DCHECK(!handshake_client_);
DCHECK(client_);
while (!unidirectional_stream_acceptances_.empty()) {
quic::WebTransportStream* const stream =
transport_->session()->AcceptIncomingUnidirectionalStream();
if (!stream) {
return;
}
auto acceptance = std::move(unidirectional_stream_acceptances_.front());
unidirectional_stream_acceptances_.pop();
mojo::ScopedDataPipeConsumerHandle readable_for_incoming;
mojo::ScopedDataPipeProducerHandle writable_for_incoming;
const MojoCreateDataPipeOptions options = {
sizeof(options), MOJO_CREATE_DATA_PIPE_FLAG_NONE, 1, 256 * 1024};
if (mojo::CreateDataPipe(&options, writable_for_incoming,
readable_for_incoming) != MOJO_RESULT_OK) {
stream->ResetDueToInternalError();
// TODO(yhirano): Error the entire connection.
return;
}
streams_.insert(
std::make_pair(stream->GetStreamId(),
std::make_unique<Stream>(
this, stream, std::move(writable_for_incoming))));
std::move(acceptance)
.Run(stream->GetStreamId(), std::move(readable_for_incoming));
}
}
void WebTransport::OnDatagramReceived(base::StringPiece datagram) {
if (torn_down_) {
return;
}
client_->OnDatagramReceived(base::make_span(
reinterpret_cast<const uint8_t*>(datagram.data()), datagram.size()));
}
void WebTransport::OnCanCreateNewOutgoingBidirectionalStream() {
// TODO(yhirano): Implement this.
}
void WebTransport::OnCanCreateNewOutgoingUnidirectionalStream() {
// TODO(yhirano): Implement this.
}
void WebTransport::OnDatagramProcessed(
absl::optional<quic::MessageStatus> status) {
DCHECK(!datagram_callbacks_.empty());
std::move(datagram_callbacks_.front())
.Run(status == quic::MESSAGE_STATUS_SUCCESS);
datagram_callbacks_.pop();
}
void WebTransport::TearDown() {
torn_down_ = true;
receiver_.reset();
handshake_client_.reset();
client_.reset();
base::SequencedTaskRunnerHandle::Get()->PostTask(
FROM_HERE,
base::BindOnce(&WebTransport::Dispose, weak_factory_.GetWeakPtr()));
}
void WebTransport::Dispose() {
receiver_.reset();
context_->Remove(this);
// |this| is deleted.
}
} // namespace network
| 30.319236
| 80
| 0.669726
|
chromium
|
cb1ecaceb1f1cbd84409850879b41f210ceaf3a1
| 487
|
hpp
|
C++
|
include/render/Triangle.hpp
|
nsentout/project-lambda-client
|
3b6f84e90ebf1319bbbfd6649b1e9e94b96f1469
|
[
"MIT"
] | null | null | null |
include/render/Triangle.hpp
|
nsentout/project-lambda-client
|
3b6f84e90ebf1319bbbfd6649b1e9e94b96f1469
|
[
"MIT"
] | null | null | null |
include/render/Triangle.hpp
|
nsentout/project-lambda-client
|
3b6f84e90ebf1319bbbfd6649b1e9e94b96f1469
|
[
"MIT"
] | null | null | null |
#ifndef TRIANGLE_HPP
#define TRIANGLE_HPP
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include "GameObject.hpp"
#include "Position.h"
#include "Color.h"
//TODO: manage width and color
class Triangle : public GameObject
{
public:
Triangle();
void init() override;
void draw() const override;
void erase() const override;
void moveX(unsigned int movement) override;
void moveY(unsigned int movement) override;
void setXY(int x, int y) override;
};
#endif
| 18.730769
| 47
| 0.704312
|
nsentout
|
cb1ef2b1565387a58e53630a76e8cbac8b92347c
| 12,997
|
cpp
|
C++
|
src/openms/source/ANALYSIS/TARGETED/TargetedExperiment.cpp
|
mrurik/OpenMS
|
3bf48247423dc28a7df7b12b72fbc7751965c321
|
[
"Zlib",
"Apache-2.0"
] | null | null | null |
src/openms/source/ANALYSIS/TARGETED/TargetedExperiment.cpp
|
mrurik/OpenMS
|
3bf48247423dc28a7df7b12b72fbc7751965c321
|
[
"Zlib",
"Apache-2.0"
] | null | null | null |
src/openms/source/ANALYSIS/TARGETED/TargetedExperiment.cpp
|
mrurik/OpenMS
|
3bf48247423dc28a7df7b12b72fbc7751965c321
|
[
"Zlib",
"Apache-2.0"
] | null | null | null |
// --------------------------------------------------------------------------
// OpenMS -- Open-Source Mass Spectrometry
// --------------------------------------------------------------------------
// Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
// ETH Zurich, and Freie Universitaet Berlin 2002-2016.
//
// This software is released under a three-clause BSD license:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of any author or any participating institution
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
// For a full list of authors, refer to the file AUTHORS.
// --------------------------------------------------------------------------
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
// INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// --------------------------------------------------------------------------
// $Maintainer: Hannes Roest $
// $Authors: Andreas Bertsch $
// --------------------------------------------------------------------------
#include <OpenMS/ANALYSIS/TARGETED/TargetedExperiment.h>
#include <algorithm>
namespace OpenMS
{
TargetedExperiment::TargetedExperiment()
{
}
TargetedExperiment::TargetedExperiment(const TargetedExperiment & rhs) :
cvs_(rhs.cvs_),
contacts_(rhs.contacts_),
publications_(rhs.publications_),
instruments_(rhs.instruments_),
targets_(rhs.targets_),
software_(rhs.software_),
proteins_(rhs.proteins_),
compounds_(rhs.compounds_),
peptides_(rhs.peptides_),
transitions_(rhs.transitions_),
include_targets_(rhs.include_targets_),
exclude_targets_(rhs.exclude_targets_),
source_files_(rhs.source_files_),
protein_reference_map_dirty_(true),
peptide_reference_map_dirty_(true)
{
}
TargetedExperiment::~TargetedExperiment()
{
}
TargetedExperiment & TargetedExperiment::operator=(const TargetedExperiment & rhs)
{
if (&rhs != this)
{
cvs_ = rhs.cvs_;
contacts_ = rhs.contacts_;
publications_ = rhs.publications_;
instruments_ = rhs.instruments_;
targets_ = rhs.targets_;
software_ = rhs.software_;
proteins_ = rhs.proteins_;
compounds_ = rhs.compounds_;
peptides_ = rhs.peptides_;
transitions_ = rhs.transitions_;
include_targets_ = rhs.include_targets_;
exclude_targets_ = rhs.exclude_targets_;
source_files_ = rhs.source_files_;
protein_reference_map_dirty_ = true;
peptide_reference_map_dirty_ = true;
}
return *this;
}
TargetedExperiment TargetedExperiment::operator+(const TargetedExperiment & rhs) const
{
TargetedExperiment tmp(*this);
tmp += rhs;
return tmp;
}
TargetedExperiment & TargetedExperiment::operator+=(const TargetedExperiment & rhs)
{
protein_reference_map_dirty_ = true;
peptide_reference_map_dirty_ = true;
// merge these:
cvs_.insert(cvs_.end(), rhs.cvs_.begin(), rhs.cvs_.end());
contacts_.insert(contacts_.end(), rhs.contacts_.begin(), rhs.contacts_.end());
publications_.insert(publications_.end(), rhs.publications_.begin(), rhs.publications_.end());
instruments_.insert(instruments_.end(), rhs.instruments_.begin(), rhs.instruments_.end());
software_.insert(software_.end(), rhs.software_.begin(), rhs.software_.end());
proteins_.insert(proteins_.end(), rhs.proteins_.begin(), rhs.proteins_.end());
compounds_.insert(compounds_.end(), rhs.compounds_.begin(), rhs.compounds_.end());
peptides_.insert(peptides_.end(), rhs.peptides_.begin(), rhs.peptides_.end());
transitions_.insert(transitions_.end(), rhs.transitions_.begin(), rhs.transitions_.end());
include_targets_.insert(include_targets_.end(), rhs.include_targets_.begin(), rhs.include_targets_.end());
exclude_targets_.insert(exclude_targets_.end(), rhs.exclude_targets_.begin(), rhs.exclude_targets_.end());
source_files_.insert(source_files_.end(), rhs.source_files_.begin(), rhs.source_files_.end());
for (Map<String, std::vector<CVTerm> >::const_iterator targ_it = rhs.targets_.getCVTerms().begin(); targ_it != rhs.targets_.getCVTerms().end(); ++targ_it)
{
for (std::vector<CVTerm>::const_iterator term_it = targ_it->second.begin(); term_it != targ_it->second.end(); ++term_it)
{
targets_.addCVTerm(*term_it);
}
}
// todo: check for double entries
// transitions, peptides, proteins
return *this;
}
bool TargetedExperiment::operator==(const TargetedExperiment & rhs) const
{
return cvs_ == rhs.cvs_ &&
contacts_ == rhs.contacts_ &&
publications_ == rhs.publications_ &&
instruments_ == rhs.instruments_ &&
targets_ == rhs.targets_ &&
software_ == rhs.software_ &&
proteins_ == rhs.proteins_ &&
compounds_ == rhs.compounds_ &&
peptides_ == rhs.peptides_ &&
transitions_ == rhs.transitions_ &&
include_targets_ == rhs.include_targets_ &&
exclude_targets_ == rhs.exclude_targets_ &&
source_files_ == rhs.source_files_;
}
bool TargetedExperiment::operator!=(const TargetedExperiment & rhs) const
{
return !(operator==(rhs));
}
void TargetedExperiment::clear(bool clear_meta_data)
{
transitions_.clear();
if (clear_meta_data)
{
cvs_.clear();
contacts_.clear();
publications_.clear();
instruments_.clear();
targets_ = CVTermList();
software_.clear();
proteins_.clear();
compounds_.clear();
peptides_.clear();
include_targets_.clear();
exclude_targets_.clear();
source_files_.clear();
protein_reference_map_.clear();
peptide_reference_map_.clear();
protein_reference_map_dirty_ = true;
peptide_reference_map_dirty_ = true;
}
}
void TargetedExperiment::setCVs(const std::vector<CV> & cvs)
{
cvs_ = cvs;
}
const std::vector<TargetedExperiment::CV> & TargetedExperiment::getCVs() const
{
return cvs_;
}
void TargetedExperiment::addCV(const CV & cv)
{
cvs_.push_back(cv);
}
void TargetedExperiment::setContacts(const std::vector<Contact> & contacts)
{
contacts_ = contacts;
}
const std::vector<TargetedExperiment::Contact> & TargetedExperiment::getContacts() const
{
return contacts_;
}
void TargetedExperiment::addContact(const Contact & contact)
{
contacts_.push_back(contact);
}
void TargetedExperiment::setPublications(const std::vector<Publication> & publications)
{
publications_ = publications;
}
const std::vector<TargetedExperiment::Publication> & TargetedExperiment::getPublications() const
{
return publications_;
}
void TargetedExperiment::addPublication(const Publication & publication)
{
publications_.push_back(publication);
}
void TargetedExperiment::setTargetCVTerms(const CVTermList & cv_terms)
{
targets_ = cv_terms;
}
const CVTermList & TargetedExperiment::getTargetCVTerms() const
{
return targets_;
}
void TargetedExperiment::addTargetCVTerm(const CVTerm & cv_term)
{
targets_.addCVTerm(cv_term);
}
void TargetedExperiment::setTargetMetaValue(const String & name, const DataValue & value)
{
targets_.setMetaValue(name, value);
}
void TargetedExperiment::setInstruments(const std::vector<Instrument> & instruments)
{
instruments_ = instruments;
}
const std::vector<TargetedExperiment::Instrument> & TargetedExperiment::getInstruments() const
{
return instruments_;
}
void TargetedExperiment::addInstrument(const Instrument & instrument)
{
instruments_.push_back(instrument);
}
void TargetedExperiment::setSoftware(const std::vector<Software> & software)
{
software_ = software;
}
const std::vector<Software> & TargetedExperiment::getSoftware() const
{
return software_;
}
void TargetedExperiment::addSoftware(const Software & software)
{
software_.push_back(software);
}
void TargetedExperiment::setProteins(const std::vector<Protein> & proteins)
{
protein_reference_map_dirty_ = true;
proteins_ = proteins;
}
const std::vector<TargetedExperiment::Protein> & TargetedExperiment::getProteins() const
{
return proteins_;
}
const TargetedExperiment::Protein & TargetedExperiment::getProteinByRef(const String & ref)
{
if (protein_reference_map_dirty_)
{
createProteinReferenceMap_();
}
return *(protein_reference_map_[ref]);
}
void TargetedExperiment::addProtein(const Protein & protein)
{
protein_reference_map_dirty_ = true;
proteins_.push_back(protein);
}
void TargetedExperiment::setCompounds(const std::vector<Compound> & compounds)
{
compounds_ = compounds;
}
const std::vector<TargetedExperiment::Compound> & TargetedExperiment::getCompounds() const
{
return compounds_;
}
void TargetedExperiment::addCompound(const Compound & rhs)
{
compounds_.push_back(rhs);
}
void TargetedExperiment::setPeptides(const std::vector<Peptide> & peptides)
{
peptide_reference_map_dirty_ = true;
peptides_ = peptides;
}
const std::vector<TargetedExperiment::Peptide> & TargetedExperiment::getPeptides() const
{
return peptides_;
}
const TargetedExperiment::Peptide & TargetedExperiment::getPeptideByRef(const String & ref)
{
if (peptide_reference_map_dirty_)
{
createPeptideReferenceMap_();
}
return *(peptide_reference_map_[ref]);
}
void TargetedExperiment::addPeptide(const Peptide & rhs)
{
peptide_reference_map_dirty_ = true;
peptides_.push_back(rhs);
}
void TargetedExperiment::setTransitions(const std::vector<ReactionMonitoringTransition> & transitions)
{
transitions_ = transitions;
}
const std::vector<ReactionMonitoringTransition> & TargetedExperiment::getTransitions() const
{
return transitions_;
}
void TargetedExperiment::addTransition(const ReactionMonitoringTransition & transition)
{
transitions_.push_back(transition);
}
void TargetedExperiment::setIncludeTargets(const std::vector<IncludeExcludeTarget> & targets)
{
include_targets_ = targets;
}
const std::vector<IncludeExcludeTarget> & TargetedExperiment::getIncludeTargets() const
{
return include_targets_;
}
void TargetedExperiment::addIncludeTarget(const IncludeExcludeTarget & target)
{
include_targets_.push_back(target);
}
void TargetedExperiment::setExcludeTargets(const std::vector<IncludeExcludeTarget> & targets)
{
exclude_targets_ = targets;
}
const std::vector<IncludeExcludeTarget> & TargetedExperiment::getExcludeTargets() const
{
return exclude_targets_;
}
void TargetedExperiment::addExcludeTarget(const IncludeExcludeTarget & target)
{
exclude_targets_.push_back(target);
}
void TargetedExperiment::setSourceFiles(const std::vector<SourceFile> & source_files)
{
source_files_ = source_files;
}
const std::vector<SourceFile> & TargetedExperiment::getSourceFiles() const
{
return source_files_;
}
void TargetedExperiment::addSourceFile(const SourceFile & source_file)
{
source_files_.push_back(source_file);
}
void TargetedExperiment::sortTransitionsByProductMZ()
{
std::sort(transitions_.begin(), transitions_.end(), ReactionMonitoringTransition::ProductMZLess());
}
void TargetedExperiment::createProteinReferenceMap_()
{
for (Size i = 0; i < getProteins().size(); i++)
{
protein_reference_map_[getProteins()[i].id] = &getProteins()[i];
}
protein_reference_map_dirty_ = false;
}
void TargetedExperiment::createPeptideReferenceMap_()
{
for (Size i = 0; i < getPeptides().size(); i++)
{
peptide_reference_map_[getPeptides()[i].id] = &getPeptides()[i];
}
peptide_reference_map_dirty_ = false;
}
} // namespace OpenMS
| 30.50939
| 158
| 0.689467
|
mrurik
|
cb21d43e0e262a3c11d8f08fa85b552829f7afd6
| 46,255
|
cpp
|
C++
|
libredex/DexClass.cpp
|
rybalkinsd/redex
|
950917ff252eb62ad64b9c7ab1f7322b9e0c4bd6
|
[
"MIT"
] | null | null | null |
libredex/DexClass.cpp
|
rybalkinsd/redex
|
950917ff252eb62ad64b9c7ab1f7322b9e0c4bd6
|
[
"MIT"
] | null | null | null |
libredex/DexClass.cpp
|
rybalkinsd/redex
|
950917ff252eb62ad64b9c7ab1f7322b9e0c4bd6
|
[
"MIT"
] | null | null | null |
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "DexClass.h"
#include "Debug.h"
#include "DexAccess.h"
#include "DexDebugInstruction.h"
#include "DexDefs.h"
#include "DexMemberRefs.h"
#include "DexOutput.h"
#include "DexUtil.h"
#include "DuplicateClasses.h"
#include "IRCode.h"
#include "IRInstruction.h"
#include "StringBuilder.h"
#include "Util.h"
#include "Walkers.h"
#include "Warning.h"
#include <algorithm>
#include <boost/functional/hash.hpp>
#include <boost/optional.hpp>
#include <memory>
#include <mutex>
#include <unordered_map>
uint32_t DexString::length() const {
if (is_simple()) {
return size();
}
return length_of_utf8_string(c_str());
}
int32_t DexString::java_hashcode() const {
return java_hashcode_of_utf8_string(c_str());
}
int DexTypeList::encode(DexOutputIdx* dodx, uint32_t* output) const {
uint16_t* typep = (uint16_t*)(output + 1);
*output = (uint32_t)m_list.size();
for (auto const& type : m_list) {
*typep++ = dodx->typeidx(type);
}
return (int)(((uint8_t*)typep) - (uint8_t*)output);
}
DexField* DexFieldRef::make_concrete(DexAccessFlags access_flags,
DexEncodedValue* v) {
// FIXME assert if already concrete
auto that = static_cast<DexField*>(this);
that->m_access = access_flags;
that->m_concrete = true;
if (is_static(access_flags)) {
that->set_value(v);
} else {
always_assert(v == nullptr);
}
return that;
}
DexFieldRef* DexField::get_field(const std::string& full_descriptor) {
auto fdt = dex_member_refs::parse_field(full_descriptor);
auto cls = DexType::get_type(fdt.cls.c_str());
auto name = DexString::get_string(fdt.name);
auto type = DexType::get_type(fdt.type.c_str());
return DexField::get_field(cls, name, type);
}
DexFieldRef* DexField::make_field(const std::string& full_descriptor) {
auto fdt = dex_member_refs::parse_field(full_descriptor);
auto cls = DexType::make_type(fdt.cls.c_str());
auto name = DexString::make_string(fdt.name);
auto type = DexType::make_type(fdt.type.c_str());
return DexField::make_field(cls, name, type);
}
DexDebugEntry::DexDebugEntry(DexDebugEntry&& that)
: type(that.type), addr(that.addr) {
switch (type) {
case DexDebugEntryType::Position:
new (&pos) std::unique_ptr<DexPosition>(std::move(that.pos));
break;
case DexDebugEntryType::Instruction:
new (&insn) std::unique_ptr<DexDebugInstruction>(std::move(that.insn));
break;
}
}
DexDebugEntry::~DexDebugEntry() {
switch (type) {
case DexDebugEntryType::Position:
pos.~unique_ptr<DexPosition>();
break;
case DexDebugEntryType::Instruction:
insn.~unique_ptr<DexDebugInstruction>();
break;
}
}
/*
* Evaluate the debug opcodes to figure out their absolute addresses and line
* numbers.
*/
static std::vector<DexDebugEntry> eval_debug_instructions(
DexDebugItem* dbg,
std::vector<std::unique_ptr<DexDebugInstruction>>& insns,
uint32_t absolute_line) {
std::vector<DexDebugEntry> entries;
uint32_t pc = 0;
for (auto& opcode : insns) {
auto op = opcode->opcode();
switch (op) {
case DBG_ADVANCE_LINE: {
absolute_line += opcode->value();
continue;
}
case DBG_END_LOCAL:
case DBG_RESTART_LOCAL:
case DBG_START_LOCAL:
case DBG_START_LOCAL_EXTENDED:
case DBG_SET_FILE:
case DBG_END_SEQUENCE:
case DBG_SET_PROLOGUE_END:
case DBG_SET_EPILOGUE_BEGIN: {
entries.emplace_back(pc, std::move(opcode));
break;
}
case DBG_ADVANCE_PC: {
pc += opcode->uvalue();
continue;
}
default: {
uint8_t adjustment = op - DBG_FIRST_SPECIAL;
absolute_line += DBG_LINE_BASE + (adjustment % DBG_LINE_RANGE);
pc += adjustment / DBG_LINE_RANGE;
entries.emplace_back(pc, std::make_unique<DexPosition>(absolute_line));
break;
}
}
}
return entries;
}
DexDebugItem::DexDebugItem(DexIdx* idx, uint32_t offset)
: m_source_checksum(idx->get_checksum()), m_source_offset(offset) {
const uint8_t* encdata = idx->get_uleb_data(offset);
const uint8_t* base_encdata = encdata;
uint32_t line_start = read_uleb128(&encdata);
uint32_t paramcount = read_uleb128(&encdata);
while (paramcount--) {
// We intentionally drop the parameter string name here because we don't
// have a convenient representation of it, and our internal tooling doesn't
// use this info anyway.
// We emit matching number of nulls as method arguments at the end.
decode_noindexable_string(idx, encdata);
}
std::vector<std::unique_ptr<DexDebugInstruction>> insns;
DexDebugInstruction* dbgp;
while ((dbgp = DexDebugInstruction::make_instruction(idx, &encdata)) !=
nullptr) {
insns.emplace_back(dbgp);
}
m_dbg_entries = eval_debug_instructions(this, insns, line_start);
m_on_disk_size = encdata - base_encdata;
}
uint32_t DexDebugItem::get_line_start() const {
for (auto& entry : m_dbg_entries) {
switch (entry.type) {
case DexDebugEntryType::Position: {
return entry.pos->line;
default:
break;
}
}
}
return 0;
}
DexDebugItem::DexDebugItem(const DexDebugItem& that) {
std::unordered_map<DexPosition*, DexPosition*> pos_map;
for (auto& entry : that.m_dbg_entries) {
switch (entry.type) {
case DexDebugEntryType::Position: {
auto pos = std::make_unique<DexPosition>(*entry.pos);
pos_map[entry.pos.get()] = pos.get();
pos->parent = pos_map[pos->parent];
m_dbg_entries.emplace_back(entry.addr, std::move(pos));
break;
}
case DexDebugEntryType::Instruction:
m_dbg_entries.emplace_back(entry.addr, entry.insn->clone());
break;
}
}
}
std::unique_ptr<DexDebugItem> DexDebugItem::get_dex_debug(DexIdx* idx,
uint32_t offset) {
if (offset == 0) return nullptr;
return std::unique_ptr<DexDebugItem>(new DexDebugItem(idx, offset));
}
/*
* Convert DexDebugEntries into debug opcodes.
*/
std::vector<std::unique_ptr<DexDebugInstruction>> generate_debug_instructions(
DexDebugItem* debugitem,
PositionMapper* pos_mapper,
uint32_t* line_start,
std::vector<DebugLineItem>* line_info) {
std::vector<std::unique_ptr<DexDebugInstruction>> dbgops;
uint32_t prev_addr = 0;
boost::optional<uint32_t> prev_line;
auto& entries = debugitem->get_entries();
for (auto it = entries.begin(); it != entries.end(); ++it) {
// find all entries that belong to the same address, and group them by type
auto addr = it->addr;
std::vector<DexPosition*> positions;
std::vector<DexDebugInstruction*> insns;
for (; it != entries.end() && it->addr == addr; ++it) {
switch (it->type) {
case DexDebugEntryType::Position:
if (it->pos->file != nullptr) {
positions.push_back(it->pos.get());
}
break;
case DexDebugEntryType::Instruction:
insns.push_back(it->insn.get());
break;
}
}
--it;
auto addr_delta = addr - prev_addr;
prev_addr = addr;
for (auto pos : positions) {
pos_mapper->register_position(pos);
}
// only emit the last position entry for a given address
if (!positions.empty()) {
auto line = pos_mapper->position_to_line(positions.back());
line_info->emplace_back(DebugLineItem(it->addr, line));
int32_t line_delta;
if (prev_line) {
line_delta = line - *prev_line;
} else {
*line_start = line;
line_delta = 0;
}
prev_line = line;
if (line_delta < DBG_LINE_BASE ||
line_delta >= (DBG_LINE_RANGE + DBG_LINE_BASE)) {
dbgops.emplace_back(
new DexDebugInstruction(DBG_ADVANCE_LINE, line_delta));
line_delta = 0;
}
auto special = (line_delta - DBG_LINE_BASE) +
(addr_delta * DBG_LINE_RANGE) + DBG_FIRST_SPECIAL;
if (special & ~0xff) {
dbgops.emplace_back(
new DexDebugInstruction(DBG_ADVANCE_PC, uint32_t(addr_delta)));
special = line_delta - DBG_LINE_BASE + DBG_FIRST_SPECIAL;
}
dbgops.emplace_back(
new DexDebugInstruction(static_cast<DexDebugItemOpcode>(special)));
line_delta = 0;
addr_delta = 0;
}
for (auto insn : insns) {
if (addr_delta != 0) {
dbgops.emplace_back(
new DexDebugInstruction(DBG_ADVANCE_PC, addr_delta));
addr_delta = 0;
}
dbgops.emplace_back(insn->clone());
}
}
return dbgops;
}
int DexDebugItem::encode(
DexOutputIdx* dodx,
uint8_t* output,
uint32_t line_start,
uint32_t num_params,
const std::vector<std::unique_ptr<DexDebugInstruction>>& dbgops) {
uint8_t* encdata = output;
encdata = write_uleb128(encdata, line_start);
encdata = write_uleb128(encdata, num_params);
for (uint32_t i = 0; i < num_params; ++i) {
encdata = write_uleb128p1(encdata, DEX_NO_INDEX);
continue;
}
for (auto& dbgop : dbgops) {
dbgop->encode(dodx, encdata);
}
encdata = write_uleb128(encdata, DBG_END_SEQUENCE);
return (int)(encdata - output);
}
void DexDebugItem::bind_positions(DexMethod* method, DexString* file) {
auto* method_str = DexString::make_string(show(method));
for (auto& entry : m_dbg_entries) {
switch (entry.type) {
case DexDebugEntryType::Position:
entry.pos->bind(method_str, file);
break;
case DexDebugEntryType::Instruction:
break;
}
}
}
void DexDebugItem::gather_types(std::vector<DexType*>& ltype) const {
for (auto& entry : m_dbg_entries) {
entry.gather_types(ltype);
}
}
void DexDebugItem::gather_strings(std::vector<DexString*>& lstring) const {
for (auto& entry : m_dbg_entries) {
entry.gather_strings(lstring);
}
}
DexCode::DexCode(const DexCode& that)
: m_registers_size(that.m_registers_size),
m_ins_size(that.m_ins_size),
m_outs_size(that.m_outs_size),
m_insns(std::make_unique<std::vector<DexInstruction*>>()) {
for (auto& insn : *that.m_insns) {
m_insns->emplace_back(insn->clone());
}
for (auto& try_ : that.m_tries) {
m_tries.emplace_back(new DexTryItem(*try_));
}
if (that.m_dbg) {
m_dbg.reset(new DexDebugItem(*that.m_dbg));
}
}
std::unique_ptr<DexCode> DexCode::get_dex_code(DexIdx* idx, uint32_t offset) {
if (offset == 0) return std::unique_ptr<DexCode>();
const dex_code_item* code = (const dex_code_item*)idx->get_uint_data(offset);
std::unique_ptr<DexCode> dc(new DexCode());
dc->m_registers_size = code->registers_size;
dc->m_ins_size = code->ins_size;
dc->m_outs_size = code->outs_size;
dc->m_insns.reset(new std::vector<DexInstruction*>());
const uint16_t* cdata = (const uint16_t*)(code + 1);
uint32_t tries = code->tries_size;
if (code->insns_size) {
const uint16_t* end = cdata + code->insns_size;
while (cdata < end) {
DexInstruction* dop = DexInstruction::make_instruction(idx, &cdata);
always_assert_log(dop != nullptr,
"Failed to parse method at offset 0x%08x", offset);
dc->m_insns->push_back(dop);
}
/*
* Padding, see dex-spec.
* Per my memory, there are dex-files where the padding is
* implemented not according to spec. Just FYI in case
* something weird happens in the future.
*/
if (code->insns_size & 1 && tries) cdata++;
}
if (tries) {
const dex_tries_item* dti = (const dex_tries_item*)cdata;
const uint8_t* handlers = (const uint8_t*)(dti + tries);
for (uint32_t i = 0; i < tries; i++) {
DexTryItem* dextry = new DexTryItem(dti[i].start_addr, dti[i].insn_count);
const uint8_t* handler = handlers + dti[i].handler_off;
int32_t count = read_sleb128(&handler);
bool has_catchall = false;
if (count <= 0) {
count = -count;
has_catchall = true;
}
while (count--) {
uint32_t tidx = read_uleb128(&handler);
uint32_t hoff = read_uleb128(&handler);
DexType* dt = idx->get_typeidx(tidx);
dextry->m_catches.push_back(std::make_pair(dt, hoff));
}
if (has_catchall) {
auto hoff = read_uleb128(&handler);
dextry->m_catches.push_back(std::make_pair(nullptr, hoff));
}
dc->m_tries.emplace_back(dextry);
}
}
dc->m_dbg = DexDebugItem::get_dex_debug(idx, code->debug_info_off);
return dc;
}
int DexCode::encode(DexOutputIdx* dodx, uint32_t* output) {
dex_code_item* code = (dex_code_item*)output;
code->registers_size = m_registers_size;
code->ins_size = m_ins_size;
code->outs_size = m_outs_size;
code->tries_size = 0;
/* Debug info is added later */
code->debug_info_off = 0;
uint16_t* insns = (uint16_t*)(code + 1);
for (auto const& opc : get_instructions()) {
opc->encode(dodx, insns);
}
code->insns_size = (uint32_t)(insns - ((uint16_t*)(code + 1)));
if (m_tries.size() == 0)
return ((code->insns_size * sizeof(uint16_t)) + sizeof(dex_code_item));
/*
* Now the tries..., obscenely messy encoding :(
* Pad tries to uint32_t
*/
if (code->insns_size & 1) insns++;
int tries = code->tries_size = m_tries.size();
dex_tries_item* dti = (dex_tries_item*)insns;
uint8_t* handler_base = (uint8_t*)(dti + tries);
uint8_t* hemit = handler_base;
std::unordered_set<DexCatches, boost::hash<DexCatches>> catches_set;
for (auto& dextry : m_tries) {
catches_set.insert(dextry->m_catches);
}
hemit = write_uleb128(hemit, catches_set.size());
int tryno = 0;
std::unordered_map<DexCatches, uint32_t, boost::hash<DexCatches>> catches_map;
for (auto it = m_tries.begin(); it != m_tries.end(); ++it, ++tryno) {
auto& dextry = *it;
always_assert(dextry->m_start_addr < code->insns_size);
dti[tryno].start_addr = dextry->m_start_addr;
always_assert(dextry->m_start_addr + dextry->m_insn_count <=
code->insns_size);
dti[tryno].insn_count = dextry->m_insn_count;
if (catches_map.find(dextry->m_catches) == catches_map.end()) {
catches_map[dextry->m_catches] = hemit - handler_base;
size_t catchcount = dextry->m_catches.size();
bool has_catchall = dextry->m_catches.back().first == nullptr;
if (has_catchall) {
// -1 because the catch-all address is last (without an address)
catchcount = -(catchcount - 1);
}
hemit = write_sleb128(hemit, (int32_t)catchcount);
for (auto const& cit : dextry->m_catches) {
auto type = cit.first;
auto catch_addr = cit.second;
if (type != nullptr) {
// Assumption: The only catch-all is at the end of the list
hemit = write_uleb128(hemit, dodx->typeidx(type));
}
always_assert(catch_addr < code->insns_size);
hemit = write_uleb128(hemit, catch_addr);
}
}
dti[tryno].handler_off = catches_map.at(dextry->m_catches);
}
return (int)(hemit - ((uint8_t*)output));
}
DexMethod::DexMethod(DexType* type, DexString* name, DexProto* proto)
: DexMethodRef(type, name, proto) {
m_virtual = false;
m_anno = nullptr;
m_dex_code = nullptr;
m_code = nullptr;
m_access = static_cast<DexAccessFlags>(0);
}
DexMethod::~DexMethod() = default;
std::string DexMethod::get_simple_deobfuscated_name() const {
auto full_name = get_deobfuscated_name();
if (full_name.empty()) {
// This comes up for redex-created methods.
return std::string(c_str());
}
auto dot_pos = full_name.find(".");
auto colon_pos = full_name.find(":");
if (dot_pos == std::string::npos || colon_pos == std::string::npos) {
return full_name;
}
return full_name.substr(dot_pos + 1, colon_pos - dot_pos - 1);
}
// Why? get_deobfuscated_name and show_deobfuscated are not enough. deobfuscated
// names could be empty, e.g., when Redex-created methods. So we need a better
// job. And proto and type are still obfuscated in some cases. We also implement
// show_deobfuscated for DexProto.
namespace {
std::string build_fully_deobfuscated_name(const DexMethod* m) {
string_builders::StaticStringBuilder<5> b;
DexClass* cls = type_class(m->get_class());
if (cls == nullptr) {
// Well, just for safety.
b << "<null>";
} else {
b << std::string(cls->get_deobfuscated_name().empty()
? cls->get_name()->str()
: cls->get_deobfuscated_name());
}
b << "." << m->get_simple_deobfuscated_name() << ":"
<< show_deobfuscated(m->get_proto());
return b.str();
}
} // namespace
std::string DexMethod::get_fully_deobfuscated_name() const {
if (get_deobfuscated_name() == show(this)) {
return get_deobfuscated_name();
}
return build_fully_deobfuscated_name(this);
}
void DexMethod::set_code(std::unique_ptr<IRCode> code) {
m_code = std::move(code);
}
void DexMethod::balloon() {
redex_assert(m_code == nullptr);
m_code = std::make_unique<IRCode>(this);
m_dex_code.reset();
}
void DexMethod::sync() {
redex_assert(m_dex_code == nullptr);
m_dex_code = m_code->sync(this);
m_code.reset();
}
size_t hash_value(const DexMethodSpec& r) {
size_t seed = boost::hash<DexType*>()(r.cls);
boost::hash_combine(seed, r.name);
boost::hash_combine(seed, r.proto);
return seed;
}
DexMethod* DexMethod::make_method_from(DexMethod* that,
DexType* target_cls,
DexString* name) {
auto m = static_cast<DexMethod*>(
DexMethod::make_method(target_cls, name, that->get_proto()));
redex_assert(m != that);
if (that->m_anno) {
m->m_anno = new DexAnnotationSet(*that->m_anno);
}
m->set_code(std::make_unique<IRCode>(*that->get_code()));
m->m_access = that->m_access;
m->m_concrete = that->m_concrete;
m->m_virtual = that->m_virtual;
m->m_external = that->m_external;
for (auto& pair : that->m_param_anno) {
// note: DexAnnotation's copy ctor only does a shallow copy
m->m_param_anno.emplace(pair.first, new DexAnnotationSet(*pair.second));
}
return m;
}
DexMethodRef* DexMethod::get_method(const std::string& full_descriptor) {
auto mdt = dex_member_refs::parse_method(full_descriptor);
auto cls = DexType::get_type(mdt.cls.c_str());
auto name = DexString::get_string(mdt.name);
std::deque<DexType*> args;
for (auto& arg_str : mdt.args) {
args.push_back(DexType::get_type(arg_str.c_str()));
}
auto dtl = DexTypeList::get_type_list(std::move(args));
auto rtype = DexType::get_type(mdt.rtype.c_str());
return DexMethod::get_method(cls, name, DexProto::get_proto(rtype, dtl));
}
DexMethodRef* DexMethod::make_method(const std::string& full_descriptor) {
auto mdt = dex_member_refs::parse_method(full_descriptor);
auto cls = DexType::make_type(mdt.cls.c_str());
auto name = DexString::make_string(mdt.name);
std::deque<DexType*> args;
for (auto& arg_str : mdt.args) {
args.push_back(DexType::make_type(arg_str.c_str()));
}
auto dtl = DexTypeList::make_type_list(std::move(args));
auto rtype = DexType::make_type(mdt.rtype.c_str());
return DexMethod::make_method(cls, name, DexProto::make_proto(rtype, dtl));
}
DexMethodRef* DexMethod::make_method(
const std::string& class_type,
const std::string& name,
std::initializer_list<std::string> arg_types,
const std::string& return_type) {
std::deque<DexType*> dex_types;
for (const std::string& type_str : arg_types) {
dex_types.push_back(DexType::make_type(type_str.c_str()));
}
return DexMethod::make_method(
DexType::make_type(class_type.c_str()),
DexString::make_string(name),
DexProto::make_proto(DexType::make_type(return_type.c_str()),
DexTypeList::make_type_list(std::move(dex_types))));
}
void DexClass::set_deobfuscated_name(const std::string& name) {
// If the class has an old deobfuscated_name which is not equal to
// `show(self)`, erase the name mapping from the global type map.
if (!m_deobfuscated_name.empty()) {
auto old_name = DexString::make_string(m_deobfuscated_name);
if (old_name != m_self->get_name()) {
g_redex->remove_type_name(old_name);
}
}
m_deobfuscated_name = name;
auto new_name = DexString::make_string(m_deobfuscated_name);
if (new_name == m_self->get_name()) {
return;
}
auto existing_type = g_redex->get_type(new_name);
if (existing_type != nullptr) {
fprintf(stderr,
"Unable to alias type '%s' to deobfuscated name '%s' because type "
"'%s' already exists.\n",
m_self->c_str(),
new_name->c_str(),
existing_type->c_str());
return;
}
g_redex->alias_type_name(m_self, new_name);
}
void DexClass::remove_method(const DexMethod* m) {
auto& meths = m->is_virtual() ? m_vmethods : m_dmethods;
auto it = std::find(meths.begin(), meths.end(), m);
DEBUG_ONLY bool erased = false;
if (it != meths.end()) {
erased = true;
meths.erase(it);
}
redex_assert(erased);
}
void DexMethod::become_virtual() {
redex_assert(!m_virtual);
auto cls = type_class(m_spec.cls);
redex_assert(!cls->is_external());
cls->remove_method(this);
m_virtual = true;
auto& vmethods = cls->get_vmethods();
insert_sorted(vmethods, this, compare_dexmethods);
}
DexMethod* DexMethodRef::make_concrete(DexAccessFlags access,
std::unique_ptr<DexCode> dc,
bool is_virtual) {
auto that = static_cast<DexMethod*>(this);
that->m_access = access;
that->m_dex_code = std::move(dc);
that->m_concrete = true;
that->m_virtual = is_virtual;
return that;
}
DexMethod* DexMethodRef::make_concrete(DexAccessFlags access,
std::unique_ptr<IRCode> dc,
bool is_virtual) {
auto that = static_cast<DexMethod*>(this);
that->m_access = access;
that->m_code = std::move(dc);
that->m_concrete = true;
that->m_virtual = is_virtual;
return that;
}
DexMethod* DexMethodRef::make_concrete(DexAccessFlags access, bool is_virtual) {
return make_concrete(access, std::unique_ptr<IRCode>(nullptr), is_virtual);
}
void DexMethod::make_non_concrete() {
m_access = static_cast<DexAccessFlags>(0);
m_concrete = false;
m_code.reset();
m_virtual = false;
m_param_anno.clear();
}
/*
* See class_data_item in Dex spec.
*/
void DexClass::load_class_data_item(DexIdx* idx,
uint32_t cdi_off,
DexEncodedValueArray* svalues) {
if (cdi_off == 0) return;
const uint8_t* encd = idx->get_uleb_data(cdi_off);
uint32_t sfield_count = read_uleb128(&encd);
uint32_t ifield_count = read_uleb128(&encd);
uint32_t dmethod_count = read_uleb128(&encd);
uint32_t vmethod_count = read_uleb128(&encd);
uint32_t ndex = 0;
for (uint32_t i = 0; i < sfield_count; i++) {
ndex += read_uleb128(&encd);
auto access_flags = (DexAccessFlags)read_uleb128(&encd);
DexField* df = static_cast<DexField*>(idx->get_fieldidx(ndex));
DexEncodedValue* ev = nullptr;
if (svalues != nullptr) {
ev = svalues->pop_next();
}
df->make_concrete(access_flags, ev);
m_sfields.push_back(df);
}
ndex = 0;
for (uint32_t i = 0; i < ifield_count; i++) {
ndex += read_uleb128(&encd);
auto access_flags = (DexAccessFlags)read_uleb128(&encd);
DexField* df = static_cast<DexField*>(idx->get_fieldidx(ndex));
df->make_concrete(access_flags);
m_ifields.push_back(df);
}
std::unordered_set<DexMethod*> method_pointer_cache;
ndex = 0;
for (uint32_t i = 0; i < dmethod_count; i++) {
ndex += read_uleb128(&encd);
auto access_flags = (DexAccessFlags)read_uleb128(&encd);
uint32_t code_off = read_uleb128(&encd);
// Find method in method index, returns same pointer for same method.
DexMethod* dm = static_cast<DexMethod*>(idx->get_methodidx(ndex));
std::unique_ptr<DexCode> dc = DexCode::get_dex_code(idx, code_off);
if (dc && dc->get_debug_item()) {
dc->get_debug_item()->bind_positions(dm, m_source_file);
}
dm->make_concrete(access_flags, std::move(dc), false);
assert_or_throw(
method_pointer_cache.count(dm) == 0, RedexError::DUPLICATE_METHODS,
"Found duplicate methods in the same class.", {{"method", SHOW(dm)}});
method_pointer_cache.insert(dm);
m_dmethods.push_back(dm);
}
ndex = 0;
for (uint32_t i = 0; i < vmethod_count; i++) {
ndex += read_uleb128(&encd);
auto access_flags = (DexAccessFlags)read_uleb128(&encd);
uint32_t code_off = read_uleb128(&encd);
// Find method in method index, returns same pointer for same method.
DexMethod* dm = static_cast<DexMethod*>(idx->get_methodidx(ndex));
auto dc = DexCode::get_dex_code(idx, code_off);
if (dc && dc->get_debug_item()) {
dc->get_debug_item()->bind_positions(dm, m_source_file);
}
dm->make_concrete(access_flags, std::move(dc), true);
assert_or_throw(
method_pointer_cache.count(dm) == 0, RedexError::DUPLICATE_METHODS,
"Found duplicate methods in the same class.", {{"method", SHOW(dm)}});
method_pointer_cache.insert(dm);
m_vmethods.push_back(dm);
}
}
std::unique_ptr<IRCode> DexMethod::release_code() { return std::move(m_code); }
void DexClass::add_method(DexMethod* m) {
always_assert_log(m->is_concrete() || m->is_external(),
"Method %s must be concrete",
SHOW(m));
always_assert(m->get_class() == get_type());
if (m->is_virtual()) {
insert_sorted(m_vmethods, m, compare_dexmethods);
} else {
insert_sorted(m_dmethods, m, compare_dexmethods);
}
}
void DexClass::add_field(DexField* f) {
always_assert_log(f->is_concrete() || f->is_external(),
"Field %s must be concrete",
SHOW(f));
always_assert(f->get_class() == get_type());
bool is_static = f->get_access() & DexAccessFlags::ACC_STATIC;
if (is_static) {
insert_sorted(m_sfields, f, compare_dexfields);
} else {
insert_sorted(m_ifields, f, compare_dexfields);
}
}
void DexClass::remove_field(const DexField* f) {
bool is_static = f->get_access() & DexAccessFlags::ACC_STATIC;
auto& fields = is_static ? m_sfields : m_ifields;
DEBUG_ONLY bool erase = false;
auto it = std::find(fields.begin(), fields.end(), f);
if (it != fields.end()) {
erase = true;
fields.erase(it);
}
redex_assert(erase);
}
void DexClass::sort_fields() {
auto& sfields = this->get_sfields();
auto& ifields = this->get_ifields();
std::sort(sfields.begin(), sfields.end(), compare_dexfields);
std::sort(ifields.begin(), ifields.end(), compare_dexfields);
}
void DexClass::sort_methods() {
auto& vmeths = this->get_vmethods();
auto& dmeths = this->get_dmethods();
std::sort(vmeths.begin(), vmeths.end(), compare_dexmethods);
std::sort(dmeths.begin(), dmeths.end(), compare_dexmethods);
}
DexField* DexClass::find_field(const char* name,
const DexType* field_type) const {
for (const auto f : m_ifields) {
if (std::strcmp(f->c_str(), name) == 0 && f->get_type() == field_type) {
return f;
}
}
return nullptr;
}
bool DexClass::has_class_data() const {
return !m_vmethods.empty() || !m_dmethods.empty() || !m_ifields.empty() ||
!m_sfields.empty();
}
int DexClass::encode(DexOutputIdx* dodx,
dexcode_to_offset& dco,
uint8_t* output) {
if (m_sfields.size() == 0 && m_ifields.size() == 0 &&
m_dmethods.size() == 0 && m_vmethods.size() == 0) {
opt_warn(PURE_ABSTRACT_CLASS,
"'%s' super '%s' flags 0x%08x\n",
m_self->get_name()->c_str(),
m_super_class->get_name()->c_str(),
m_access_flags);
}
sort_fields();
sort_methods();
uint8_t* encdata = output;
encdata = write_uleb128(encdata, (uint32_t)m_sfields.size());
encdata = write_uleb128(encdata, (uint32_t)m_ifields.size());
encdata = write_uleb128(encdata, (uint32_t)m_dmethods.size());
encdata = write_uleb128(encdata, (uint32_t)m_vmethods.size());
uint32_t idxbase;
idxbase = 0;
for (auto const& f : m_sfields) {
uint32_t idx = dodx->fieldidx(f);
encdata = write_uleb128(encdata, idx - idxbase);
idxbase = idx;
encdata = write_uleb128(encdata, f->get_access());
}
idxbase = 0;
for (auto const& f : m_ifields) {
uint32_t idx = dodx->fieldidx(f);
encdata = write_uleb128(encdata, idx - idxbase);
idxbase = idx;
encdata = write_uleb128(encdata, f->get_access());
}
idxbase = 0;
for (auto const& m : m_dmethods) {
uint32_t idx = dodx->methodidx(m);
always_assert_log(!m->is_virtual(),
"Virtual method in dmethod."
"\nOffending type: %s"
"\nOffending method: %s",
SHOW(this),
SHOW(m));
redex_assert(!m->is_virtual());
encdata = write_uleb128(encdata, idx - idxbase);
idxbase = idx;
encdata = write_uleb128(encdata, m->get_access());
uint32_t code_off = 0;
if (m->get_dex_code() != nullptr && dco.count(m->get_dex_code())) {
code_off = dco[m->get_dex_code()];
}
encdata = write_uleb128(encdata, code_off);
}
idxbase = 0;
for (auto const& m : m_vmethods) {
uint32_t idx = dodx->methodidx(m);
always_assert_log(m->is_virtual(),
"Direct method in vmethod."
"\nOffending type: %s"
"\nOffending method: %s",
SHOW(this),
SHOW(m));
redex_assert(m->is_virtual());
encdata = write_uleb128(encdata, idx - idxbase);
idxbase = idx;
encdata = write_uleb128(encdata, m->get_access());
uint32_t code_off = 0;
if (m->get_dex_code() != nullptr && dco.count(m->get_dex_code())) {
code_off = dco[m->get_dex_code()];
}
encdata = write_uleb128(encdata, code_off);
}
return (int)(encdata - output);
}
void DexClass::load_class_annotations(DexIdx* idx, uint32_t anno_off) {
if (anno_off == 0) return;
const dex_annotations_directory_item* annodir =
(const dex_annotations_directory_item*)idx->get_uint_data(anno_off);
m_anno =
DexAnnotationSet::get_annotation_set(idx, annodir->class_annotations_off);
const uint32_t* annodata = (uint32_t*)(annodir + 1);
for (uint32_t i = 0; i < annodir->fields_size; i++) {
uint32_t fidx = *annodata++;
uint32_t off = *annodata++;
DexField* field = static_cast<DexField*>(idx->get_fieldidx(fidx));
DexAnnotationSet* aset = DexAnnotationSet::get_annotation_set(idx, off);
field->attach_annotation_set(aset);
}
for (uint32_t i = 0; i < annodir->methods_size; i++) {
uint32_t midx = *annodata++;
uint32_t off = *annodata++;
DexMethod* method = static_cast<DexMethod*>(idx->get_methodidx(midx));
DexAnnotationSet* aset = DexAnnotationSet::get_annotation_set(idx, off);
method->attach_annotation_set(aset);
}
for (uint32_t i = 0; i < annodir->parameters_size; i++) {
uint32_t midx = *annodata++;
uint32_t xrefoff = *annodata++;
if (xrefoff != 0) {
DexMethod* method = static_cast<DexMethod*>(idx->get_methodidx(midx));
const uint32_t* annoxref = idx->get_uint_data(xrefoff);
uint32_t count = *annoxref++;
for (uint32_t j = 0; j < count; j++) {
uint32_t off = annoxref[j];
DexAnnotationSet* aset = DexAnnotationSet::get_annotation_set(idx, off);
if (aset != nullptr) {
method->attach_param_annotation_set(j, aset);
redex_assert(method->get_param_anno());
}
}
}
}
}
static DexEncodedValueArray* load_static_values(DexIdx* idx, uint32_t sv_off) {
if (sv_off == 0) return nullptr;
const uint8_t* encd = idx->get_uleb_data(sv_off);
return get_encoded_value_array(idx, encd);
}
DexEncodedValueArray* DexClass::get_static_values() {
bool has_static_values = false;
auto aev = std::make_unique<std::deque<DexEncodedValue*>>();
for (auto it = m_sfields.rbegin(); it != m_sfields.rend(); ++it) {
auto const& f = *it;
DexEncodedValue* ev = f->get_static_value();
if (!ev->is_zero() || has_static_values) {
has_static_values = true;
aev->push_front(ev);
}
}
if (!has_static_values) return nullptr;
return new DexEncodedValueArray(aev.release(), true);
}
DexAnnotationDirectory* DexClass::get_annotation_directory() {
/* First scan to see what types of annotations to scan for if any.
*/
std::unique_ptr<DexFieldAnnotations> fanno = nullptr;
std::unique_ptr<DexMethodAnnotations> manno = nullptr;
std::unique_ptr<DexMethodParamAnnotations> mpanno = nullptr;
for (auto const& f : m_sfields) {
if (f->get_anno_set()) {
if (fanno == nullptr) {
fanno = std::make_unique<DexFieldAnnotations>();
}
fanno->push_back(std::make_pair(f, f->get_anno_set()));
}
}
for (auto const& f : m_ifields) {
if (f->get_anno_set()) {
if (fanno == nullptr) {
fanno = std::make_unique<DexFieldAnnotations>();
}
fanno->push_back(std::make_pair(f, f->get_anno_set()));
}
}
for (auto const& m : m_dmethods) {
if (m->get_anno_set()) {
if (manno == nullptr) {
manno = std::make_unique<DexMethodAnnotations>();
}
manno->push_back(std::make_pair(m, m->get_anno_set()));
}
if (m->get_param_anno()) {
if (mpanno == nullptr) {
mpanno = std::make_unique<DexMethodParamAnnotations>();
}
mpanno->push_back(std::make_pair(m, m->get_param_anno()));
}
}
for (auto const& m : m_vmethods) {
if (m->get_anno_set()) {
if (manno == nullptr) {
manno = std::make_unique<DexMethodAnnotations>();
}
manno->push_back(std::make_pair(m, m->get_anno_set()));
}
if (m->get_param_anno()) {
if (mpanno == nullptr) {
mpanno = std::make_unique<DexMethodParamAnnotations>();
}
mpanno->push_back(std::make_pair(m, m->get_param_anno()));
}
}
if (m_anno || fanno || manno || mpanno) {
return new DexAnnotationDirectory(m_anno, std::move(fanno),
std::move(manno), std::move(mpanno));
}
return nullptr;
}
DexClass* DexClass::create(DexIdx* idx,
const dex_class_def* cdef,
const std::string& location) {
DexClass* cls = new DexClass(idx, cdef, location);
if (g_redex->class_already_loaded(cls)) {
// FIXME: This isn't deterministic. We're keeping whichever class we loaded
// first, which may not always be from the same dex (if we load them in
// parallel, for example).
delete cls;
return nullptr;
}
cls->load_class_annotations(idx, cdef->annotations_off);
auto deva = std::unique_ptr<DexEncodedValueArray>(
load_static_values(idx, cdef->static_values_off));
cls->load_class_data_item(idx, cdef->class_data_offset, deva.get());
g_redex->publish_class(cls);
return cls;
}
DexClass::DexClass(DexIdx* idx,
const dex_class_def* cdef,
const std::string& location)
: m_access_flags((DexAccessFlags)cdef->access_flags),
m_super_class(idx->get_typeidx(cdef->super_idx)),
m_self(idx->get_typeidx(cdef->typeidx)),
m_interfaces(idx->get_type_list(cdef->interfaces_off)),
m_source_file(idx->get_nullable_stringidx(cdef->source_file_idx)),
m_anno(nullptr),
m_external(false),
m_perf_sensitive(false),
m_location(location) {
}
void DexTypeList::gather_types(std::vector<DexType*>& ltype) const {
for (auto const& type : m_list) {
ltype.push_back(type);
}
}
static DexString* make_shorty(const DexType* rtype, const DexTypeList* args) {
std::string s;
s.push_back(type::type_shorty(rtype));
if (args != nullptr) {
for (auto arg : args->get_type_list()) {
s.push_back(type::type_shorty(arg));
}
}
return DexString::make_string(s);
}
DexProto* DexProto::make_proto(const DexType* rtype, const DexTypeList* args) {
auto shorty = make_shorty(rtype, args);
return DexProto::make_proto(rtype, args, shorty);
}
void DexProto::gather_types(std::vector<DexType*>& ltype) const {
if (m_args) {
m_args->gather_types(ltype);
}
if (m_rtype) {
ltype.push_back(m_rtype);
}
}
void DexProto::gather_strings(std::vector<DexString*>& lstring) const {
if (m_shorty) {
lstring.push_back(m_shorty);
}
}
void DexClass::gather_types(std::vector<DexType*>& ltype) const {
for (auto const& m : m_dmethods) {
m->gather_types(ltype);
}
for (auto const& m : m_vmethods) {
m->gather_types(ltype);
}
for (auto const& f : m_sfields) {
f->gather_types_shallow(ltype);
f->gather_types(ltype);
}
for (auto const& f : m_ifields) {
f->gather_types_shallow(ltype);
f->gather_types(ltype);
}
ltype.push_back(m_super_class);
ltype.push_back(m_self);
if (m_interfaces) m_interfaces->gather_types(ltype);
if (m_anno) m_anno->gather_types(ltype);
}
void DexClass::gather_strings(std::vector<DexString*>& lstring,
bool exclude_loads) const {
for (auto const& m : m_dmethods) {
m->gather_strings(lstring, exclude_loads);
}
for (auto const& m : m_vmethods) {
m->gather_strings(lstring, exclude_loads);
}
for (auto const& f : m_sfields) {
f->gather_strings(lstring);
}
for (auto const& f : m_ifields) {
f->gather_strings(lstring);
}
if (m_source_file) lstring.push_back(m_source_file);
if (m_anno) m_anno->gather_strings(lstring);
}
void DexClass::gather_fields(std::vector<DexFieldRef*>& lfield) const {
for (auto const& m : m_dmethods) {
m->gather_fields(lfield);
}
for (auto const& m : m_vmethods) {
m->gather_fields(lfield);
}
for (auto const& f : m_sfields) {
lfield.push_back(f);
f->gather_fields(lfield);
}
for (auto const& f : m_ifields) {
lfield.push_back(f);
f->gather_fields(lfield);
}
if (m_anno) m_anno->gather_fields(lfield);
}
void DexClass::gather_methods(std::vector<DexMethodRef*>& lmethod) const {
for (auto const& m : m_dmethods) {
lmethod.push_back(m);
m->gather_methods(lmethod);
}
for (auto const& m : m_vmethods) {
lmethod.push_back(m);
m->gather_methods(lmethod);
}
for (auto const& f : m_sfields) {
f->gather_methods(lmethod);
}
for (auto const& f : m_ifields) {
f->gather_methods(lmethod);
}
if (m_anno) m_anno->gather_methods(lmethod);
}
const DexField* DexFieldRef::as_def() const {
if (is_def()) {
return static_cast<const DexField*>(this);
} else {
return nullptr;
}
}
DexField* DexFieldRef::as_def() {
if (is_def()) {
return static_cast<DexField*>(this);
} else {
return nullptr;
}
}
// Find methods and fields from a class using its obfuscated name.
DexField* DexClass::find_field_from_simple_deobfuscated_name(
const std::string& field_name) {
for (DexField* f : get_sfields()) {
if (f->get_simple_deobfuscated_name() == field_name) {
return f;
}
}
for (DexField* f : get_ifields()) {
if (f->get_simple_deobfuscated_name() == field_name) {
return f;
}
}
return nullptr;
}
DexMethod* DexClass::find_method_from_simple_deobfuscated_name(
const std::string& method_name) {
for (DexMethod* m : get_dmethods()) {
if (m->get_simple_deobfuscated_name() == method_name) {
return m;
}
}
for (DexMethod* m : get_vmethods()) {
if (m->get_simple_deobfuscated_name() == method_name) {
return m;
}
}
return nullptr;
}
void DexFieldRef::gather_types_shallow(std::vector<DexType*>& ltype) const {
ltype.push_back(m_spec.cls);
ltype.push_back(m_spec.type);
}
void DexFieldRef::gather_strings_shallow(
std::vector<DexString*>& lstring) const {
lstring.push_back(m_spec.name);
}
void DexField::gather_types(std::vector<DexType*>& ltype) const {
if (m_value) m_value->gather_types(ltype);
if (m_anno) m_anno->gather_types(ltype);
}
void DexField::gather_strings(std::vector<DexString*>& lstring) const {
if (m_value) m_value->gather_strings(lstring);
if (m_anno) m_anno->gather_strings(lstring);
}
void DexField::gather_fields(std::vector<DexFieldRef*>& lfield) const {
if (m_value) m_value->gather_fields(lfield);
if (m_anno) m_anno->gather_fields(lfield);
}
void DexField::gather_methods(std::vector<DexMethodRef*>& lmethod) const {
if (m_value) m_value->gather_methods(lmethod);
if (m_anno) m_anno->gather_methods(lmethod);
}
void DexMethod::gather_types(std::vector<DexType*>& ltype) const {
gather_types_shallow(ltype); // Handle DexMethodRef parts.
if (m_code) m_code->gather_types(ltype);
if (m_anno) m_anno->gather_types(ltype);
auto param_anno = get_param_anno();
if (param_anno) {
for (auto pair : *param_anno) {
auto anno_set = pair.second;
anno_set->gather_types(ltype);
}
}
}
void DexMethod::gather_strings(std::vector<DexString*>& lstring,
bool exclude_loads) const {
// We handle m_name and proto in the first-layer gather.
if (m_code && !exclude_loads) m_code->gather_strings(lstring);
if (m_anno) m_anno->gather_strings(lstring);
auto param_anno = get_param_anno();
if (param_anno) {
for (auto pair : *param_anno) {
auto anno_set = pair.second;
anno_set->gather_strings(lstring);
}
}
}
void DexMethod::gather_fields(std::vector<DexFieldRef*>& lfield) const {
if (m_code) m_code->gather_fields(lfield);
if (m_anno) m_anno->gather_fields(lfield);
auto param_anno = get_param_anno();
if (param_anno) {
for (auto pair : *param_anno) {
auto anno_set = pair.second;
anno_set->gather_fields(lfield);
}
}
}
void DexMethod::gather_methods(std::vector<DexMethodRef*>& lmethod) const {
if (m_code) m_code->gather_methods(lmethod);
if (m_anno) m_anno->gather_methods(lmethod);
auto param_anno = get_param_anno();
if (param_anno) {
for (auto pair : *param_anno) {
auto anno_set = pair.second;
anno_set->gather_methods(lmethod);
}
}
}
const DexMethod* DexMethodRef::as_def() const {
if (is_def()) {
return static_cast<const DexMethod*>(this);
} else {
return nullptr;
}
}
DexMethod* DexMethodRef::as_def() {
if (is_def()) {
return static_cast<DexMethod*>(this);
} else {
return nullptr;
}
}
void DexMethodRef::gather_types_shallow(std::vector<DexType*>& ltype) const {
ltype.push_back(m_spec.cls);
m_spec.proto->gather_types(ltype);
}
void DexMethodRef::gather_strings_shallow(
std::vector<DexString*>& lstring) const {
lstring.push_back(m_spec.name);
m_spec.proto->gather_strings(lstring);
}
uint32_t DexCode::size() const {
uint32_t size = 0;
for (auto const& opc : get_instructions()) {
if (!dex_opcode::is_fopcode(opc->opcode())) {
size += opc->size();
}
}
return size;
}
DexProto* DexType::get_non_overlapping_proto(DexString* method_name,
DexProto* orig_proto) {
auto methodref_in_context =
DexMethod::get_method(this, method_name, orig_proto);
if (!methodref_in_context) {
return orig_proto;
}
std::deque<DexType*> new_arg_list;
const auto& type_list = orig_proto->get_args()->get_type_list();
auto rtype = orig_proto->get_rtype();
for (auto t : type_list) {
new_arg_list.push_back(t);
}
new_arg_list.push_back(type::_int());
DexTypeList* new_args = DexTypeList::make_type_list(std::move(new_arg_list));
DexProto* new_proto = DexProto::make_proto(rtype, new_args);
methodref_in_context = DexMethod::get_method(this, method_name, new_proto);
while (methodref_in_context) {
new_arg_list.push_back(type::_int());
new_args = DexTypeList::make_type_list(std::move(new_arg_list));
new_proto = DexProto::make_proto(rtype, new_args);
methodref_in_context = DexMethod::get_method(this, method_name, new_proto);
}
return new_proto;
}
void DexMethod::add_load_params(size_t num_add_loads) {
IRCode* code = this->get_code();
always_assert_log(code, "Method don't have IRCode\n");
auto callee_params = code->get_param_instructions();
size_t added_params = 0;
while (added_params < num_add_loads) {
++added_params;
auto temp = code->allocate_temp();
IRInstruction* new_param_load = new IRInstruction(IOPCODE_LOAD_PARAM);
new_param_load->set_dest(temp);
code->insert_before(callee_params.end(), new_param_load);
}
}
void IRInstruction::gather_types(std::vector<DexType*>& ltype) const {
switch (opcode::ref(opcode())) {
case opcode::Ref::None:
case opcode::Ref::String:
case opcode::Ref::Literal:
case opcode::Ref::Data:
break;
case opcode::Ref::Type:
ltype.push_back(m_type);
break;
case opcode::Ref::Field:
m_field->gather_types_shallow(ltype);
break;
case opcode::Ref::Method:
m_method->gather_types_shallow(ltype);
break;
}
}
void gather_components(std::vector<DexString*>& lstring,
std::vector<DexType*>& ltype,
std::vector<DexFieldRef*>& lfield,
std::vector<DexMethodRef*>& lmethod,
const DexClasses& classes,
bool exclude_loads) {
// Gather references reachable from each class.
for (auto const& cls : classes) {
cls->gather_strings(lstring, exclude_loads);
cls->gather_types(ltype);
cls->gather_fields(lfield);
cls->gather_methods(lmethod);
}
// Remove duplicates to speed up the later loops.
sort_unique(lstring);
sort_unique(ltype);
// Gather types and strings needed for field and method refs.
sort_unique(lmethod);
for (auto meth : lmethod) {
meth->gather_types_shallow(ltype);
meth->gather_strings_shallow(lstring);
}
sort_unique(lfield);
for (auto field : lfield) {
field->gather_types_shallow(ltype);
field->gather_strings_shallow(lstring);
}
// Gather strings needed for each type.
sort_unique(ltype);
for (auto type : ltype) {
if (type) lstring.push_back(type->get_name());
}
sort_unique(lstring);
}
| 31.966137
| 80
| 0.657983
|
rybalkinsd
|
cb24210c3b97751caff9776316f1a805f119e4c3
| 15,911
|
cc
|
C++
|
content/browser/web_contents/web_contents_drag_win.cc
|
nagineni/chromium-crosswalk
|
5725642f1c67d0f97e8613ec1c3e8107ab53fdf8
|
[
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null |
content/browser/web_contents/web_contents_drag_win.cc
|
nagineni/chromium-crosswalk
|
5725642f1c67d0f97e8613ec1c3e8107ab53fdf8
|
[
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null |
content/browser/web_contents/web_contents_drag_win.cc
|
nagineni/chromium-crosswalk
|
5725642f1c67d0f97e8613ec1c3e8107ab53fdf8
|
[
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null |
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/browser/web_contents/web_contents_drag_win.h"
#include <windows.h>
#include <string>
#include "base/bind.h"
#include "base/file_util.h"
#include "base/files/file_path.h"
#include "base/message_loop/message_loop.h"
#include "base/pickle.h"
#include "base/strings/utf_string_conversions.h"
#include "base/threading/platform_thread.h"
#include "base/threading/thread.h"
#include "content/browser/download/drag_download_file.h"
#include "content/browser/download/drag_download_util.h"
#include "content/browser/web_contents/web_drag_dest_win.h"
#include "content/browser/web_contents/web_drag_source_win.h"
#include "content/browser/web_contents/web_drag_utils_win.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_view.h"
#include "content/public/browser/web_drag_dest_delegate.h"
#include "content/public/common/drop_data.h"
#include "net/base/net_util.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/clipboard/clipboard.h"
#include "ui/base/clipboard/custom_data_helper.h"
#include "ui/base/dragdrop/drag_utils.h"
#include "ui/base/layout.h"
#include "ui/base/win/scoped_ole_initializer.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/screen.h"
#include "ui/gfx/size.h"
using WebKit::WebDragOperationsMask;
using WebKit::WebDragOperationCopy;
using WebKit::WebDragOperationLink;
using WebKit::WebDragOperationMove;
namespace content {
namespace {
bool run_do_drag_drop = true;
HHOOK msg_hook = NULL;
DWORD drag_out_thread_id = 0;
bool mouse_up_received = false;
LRESULT CALLBACK MsgFilterProc(int code, WPARAM wparam, LPARAM lparam) {
if (code == base::MessagePumpForUI::kMessageFilterCode &&
!mouse_up_received) {
MSG* msg = reinterpret_cast<MSG*>(lparam);
// We do not care about WM_SYSKEYDOWN and WM_SYSKEYUP because when ALT key
// is pressed down on drag-and-drop, it means to create a link.
if (msg->message == WM_MOUSEMOVE || msg->message == WM_LBUTTONUP ||
msg->message == WM_KEYDOWN || msg->message == WM_KEYUP) {
// Forward the message from the UI thread to the drag-and-drop thread.
PostThreadMessage(drag_out_thread_id,
msg->message,
msg->wParam,
msg->lParam);
// If the left button is up, we do not need to forward the message any
// more.
if (msg->message == WM_LBUTTONUP || !(GetKeyState(VK_LBUTTON) & 0x8000))
mouse_up_received = true;
return TRUE;
}
}
return CallNextHookEx(msg_hook, code, wparam, lparam);
}
void EnableBackgroundDraggingSupport(DWORD thread_id) {
// Install a hook procedure to monitor the messages so that we can forward
// the appropriate ones to the background thread.
drag_out_thread_id = thread_id;
mouse_up_received = false;
DCHECK(!msg_hook);
msg_hook = SetWindowsHookEx(WH_MSGFILTER,
MsgFilterProc,
NULL,
GetCurrentThreadId());
// Attach the input state of the background thread to the UI thread so that
// SetCursor can work from the background thread.
AttachThreadInput(drag_out_thread_id, GetCurrentThreadId(), TRUE);
}
void DisableBackgroundDraggingSupport() {
DCHECK(msg_hook);
AttachThreadInput(drag_out_thread_id, GetCurrentThreadId(), FALSE);
UnhookWindowsHookEx(msg_hook);
msg_hook = NULL;
}
bool IsBackgroundDraggingSupportEnabled() {
return msg_hook != NULL;
}
} // namespace
class DragDropThread : public base::Thread {
public:
explicit DragDropThread(WebContentsDragWin* drag_handler)
: Thread("Chrome_DragDropThread"),
drag_handler_(drag_handler) {
}
virtual ~DragDropThread() {
Stop();
}
protected:
// base::Thread implementations:
virtual void Init() {
ole_initializer_.reset(new ui::ScopedOleInitializer());
}
virtual void CleanUp() {
ole_initializer_.reset();
}
private:
scoped_ptr<ui::ScopedOleInitializer> ole_initializer_;
// Hold a reference count to WebContentsDragWin to make sure that it is always
// alive in the thread lifetime.
scoped_refptr<WebContentsDragWin> drag_handler_;
DISALLOW_COPY_AND_ASSIGN(DragDropThread);
};
WebContentsDragWin::WebContentsDragWin(
gfx::NativeWindow source_window,
WebContents* web_contents,
WebDragDest* drag_dest,
const base::Callback<void()>& drag_end_callback)
: drag_drop_thread_id_(0),
source_window_(source_window),
web_contents_(web_contents),
drag_dest_(drag_dest),
drag_ended_(false),
drag_end_callback_(drag_end_callback) {
}
WebContentsDragWin::~WebContentsDragWin() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(!drag_drop_thread_.get());
}
void WebContentsDragWin::StartDragging(const DropData& drop_data,
WebDragOperationsMask ops,
const gfx::ImageSkia& image,
const gfx::Vector2d& image_offset) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
drag_source_ = new WebDragSource(source_window_, web_contents_);
const GURL& page_url = web_contents_->GetLastCommittedURL();
const std::string& page_encoding = web_contents_->GetEncoding();
// If it is not drag-out, do the drag-and-drop in the current UI thread.
if (drop_data.download_metadata.empty()) {
if (DoDragging(drop_data, ops, page_url, page_encoding,
image, image_offset))
EndDragging();
return;
}
// Start a background thread to do the drag-and-drop.
DCHECK(!drag_drop_thread_.get());
drag_drop_thread_.reset(new DragDropThread(this));
base::Thread::Options options;
options.message_loop_type = base::MessageLoop::TYPE_UI;
if (drag_drop_thread_->StartWithOptions(options)) {
drag_drop_thread_->message_loop()->PostTask(
FROM_HERE,
base::Bind(&WebContentsDragWin::StartBackgroundDragging, this,
drop_data, ops, page_url, page_encoding,
image, image_offset));
}
EnableBackgroundDraggingSupport(drag_drop_thread_->thread_id());
}
void WebContentsDragWin::StartBackgroundDragging(
const DropData& drop_data,
WebDragOperationsMask ops,
const GURL& page_url,
const std::string& page_encoding,
const gfx::ImageSkia& image,
const gfx::Vector2d& image_offset) {
drag_drop_thread_id_ = base::PlatformThread::CurrentId();
if (DoDragging(drop_data, ops, page_url, page_encoding,
image, image_offset)) {
BrowserThread::PostTask(
BrowserThread::UI,
FROM_HERE,
base::Bind(&WebContentsDragWin::EndDragging, this));
} else {
// When DoDragging returns false, the contents view window is gone and thus
// WebContentsViewWin instance becomes invalid though WebContentsDragWin
// instance is still alive because the task holds a reference count to it.
// We should not do more than the following cleanup items:
// 1) Remove the background dragging support. This is safe since it does not
// access the instance at all.
// 2) Stop the background thread. This is done in OnDataObjectDisposed.
// Only drag_drop_thread_ member is accessed.
BrowserThread::PostTask(
BrowserThread::UI,
FROM_HERE,
base::Bind(&DisableBackgroundDraggingSupport));
}
}
void WebContentsDragWin::PrepareDragForDownload(
const DropData& drop_data,
ui::OSExchangeData* data,
const GURL& page_url,
const std::string& page_encoding) {
// Parse the download metadata.
string16 mime_type;
base::FilePath file_name;
GURL download_url;
if (!ParseDownloadMetadata(drop_data.download_metadata,
&mime_type,
&file_name,
&download_url))
return;
// Generate the file name based on both mime type and proposed file name.
std::string default_name =
GetContentClient()->browser()->GetDefaultDownloadName();
base::FilePath generated_download_file_name =
net::GenerateFileName(download_url,
std::string(),
std::string(),
UTF16ToUTF8(file_name.value()),
UTF16ToUTF8(mime_type),
default_name);
base::FilePath temp_dir_path;
if (!file_util::CreateNewTempDirectory(
FILE_PATH_LITERAL("chrome_drag"), &temp_dir_path))
return;
base::FilePath download_path =
temp_dir_path.Append(generated_download_file_name);
// We cannot know when the target application will be done using the temporary
// file, so schedule it to be deleted after rebooting.
base::DeleteFileAfterReboot(download_path);
base::DeleteFileAfterReboot(temp_dir_path);
// Provide the data as file (CF_HDROP). A temporary download file with the
// Zone.Identifier ADS (Alternate Data Stream) attached will be created.
scoped_refptr<DragDownloadFile> download_file =
new DragDownloadFile(
download_path,
scoped_ptr<net::FileStream>(),
download_url,
Referrer(page_url, drop_data.referrer_policy),
page_encoding,
web_contents_);
ui::OSExchangeData::DownloadFileInfo file_download(base::FilePath(),
download_file.get());
data->SetDownloadFileInfo(file_download);
// Enable asynchronous operation.
ui::OSExchangeDataProviderWin::GetIAsyncOperation(*data)->SetAsyncMode(TRUE);
}
void WebContentsDragWin::PrepareDragForFileContents(
const DropData& drop_data, ui::OSExchangeData* data) {
static const int kMaxFilenameLength = 255; // FAT and NTFS
base::FilePath file_name(drop_data.file_description_filename);
// Images without ALT text will only have a file extension so we need to
// synthesize one from the provided extension and URL.
if (file_name.BaseName().RemoveExtension().empty()) {
const string16 extension = file_name.Extension();
// Retrieve the name from the URL.
file_name = base::FilePath(
net::GetSuggestedFilename(drop_data.url, "", "", "", "", ""));
if (file_name.value().size() + extension.size() > kMaxFilenameLength) {
file_name = base::FilePath(file_name.value().substr(
0, kMaxFilenameLength - extension.size()));
}
file_name = file_name.ReplaceExtension(extension);
}
data->SetFileContents(file_name, drop_data.file_contents);
}
void WebContentsDragWin::PrepareDragForUrl(const DropData& drop_data,
ui::OSExchangeData* data) {
if (drag_dest_->delegate() &&
drag_dest_->delegate()->AddDragData(drop_data, data)) {
return;
}
data->SetURL(drop_data.url, drop_data.url_title);
}
bool WebContentsDragWin::DoDragging(const DropData& drop_data,
WebDragOperationsMask ops,
const GURL& page_url,
const std::string& page_encoding,
const gfx::ImageSkia& image,
const gfx::Vector2d& image_offset) {
ui::OSExchangeData data;
if (!drop_data.download_metadata.empty()) {
PrepareDragForDownload(drop_data, &data, page_url, page_encoding);
// Set the observer.
ui::OSExchangeDataProviderWin::GetDataObjectImpl(data)->set_observer(this);
}
// We set the file contents before the URL because the URL also sets file
// contents (to a .URL shortcut). We want to prefer file content data over
// a shortcut so we add it first.
if (!drop_data.file_contents.empty())
PrepareDragForFileContents(drop_data, &data);
if (!drop_data.html.string().empty())
data.SetHtml(drop_data.html.string(), drop_data.html_base_url);
// We set the text contents before the URL because the URL also sets text
// content.
if (!drop_data.text.string().empty())
data.SetString(drop_data.text.string());
if (drop_data.url.is_valid())
PrepareDragForUrl(drop_data, &data);
if (!drop_data.custom_data.empty()) {
Pickle pickle;
ui::WriteCustomDataToPickle(drop_data.custom_data, &pickle);
data.SetPickledData(ui::Clipboard::GetWebCustomDataFormatType(), pickle);
}
// Set drag image.
if (!image.isNull()) {
drag_utils::SetDragImageOnDataObject(image,
gfx::Size(image.width(), image.height()), image_offset, &data);
}
// Use a local variable to keep track of the contents view window handle.
// It might not be safe to access the instance after DoDragDrop returns
// because the window could be disposed in the nested message loop.
HWND native_window = web_contents_->GetView()->GetNativeView();
// We need to enable recursive tasks on the message loop so we can get
// updates while in the system DoDragDrop loop.
DWORD effect = DROPEFFECT_NONE;
if (run_do_drag_drop) {
// Keep a reference count such that |drag_source_| will not get deleted
// if the contents view window is gone in the nested message loop invoked
// from DoDragDrop.
scoped_refptr<WebDragSource> retain_source(drag_source_);
retain_source->set_data(&data);
data.SetInDragLoop(true);
base::MessageLoop::ScopedNestableTaskAllower allow(
base::MessageLoop::current());
DoDragDrop(ui::OSExchangeDataProviderWin::GetIDataObject(data),
drag_source_,
WebDragOpMaskToWinDragOpMask(ops),
&effect);
retain_source->set_data(NULL);
}
// Bail out immediately if the contents view window is gone.
if (!IsWindow(native_window))
return false;
// Normally, the drop and dragend events get dispatched in the system
// DoDragDrop message loop so it'd be too late to set the effect to send back
// to the renderer here. However, we use PostTask to delay the execution of
// WebDragSource::OnDragSourceDrop, which means that the delayed dragend
// callback to the renderer doesn't run until this has been set to the correct
// value.
drag_source_->set_effect(effect);
return true;
}
void WebContentsDragWin::EndDragging() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (drag_ended_)
return;
drag_ended_ = true;
if (IsBackgroundDraggingSupportEnabled())
DisableBackgroundDraggingSupport();
drag_end_callback_.Run();
}
void WebContentsDragWin::CancelDrag() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
drag_source_->CancelDrag();
}
void WebContentsDragWin::CloseThread() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
drag_drop_thread_.reset();
}
void WebContentsDragWin::OnWaitForData() {
DCHECK(drag_drop_thread_id_ == base::PlatformThread::CurrentId());
// When the left button is release and we start to wait for the data, end
// the dragging before DoDragDrop returns. This makes the page leave the drag
// mode so that it can start to process the normal input events.
BrowserThread::PostTask(
BrowserThread::UI,
FROM_HERE,
base::Bind(&WebContentsDragWin::EndDragging, this));
}
void WebContentsDragWin::OnDataObjectDisposed() {
DCHECK(drag_drop_thread_id_ == base::PlatformThread::CurrentId());
// The drag-and-drop thread is only closed after OLE is done with
// DataObjectImpl.
BrowserThread::PostTask(
BrowserThread::UI,
FROM_HERE,
base::Bind(&WebContentsDragWin::CloseThread, this));
}
// static
void WebContentsDragWin::DisableDragDropForTesting() {
run_do_drag_drop = false;
}
} // namespace content
| 35.835586
| 80
| 0.696625
|
nagineni
|
cb253a9543f4b930da580dd83756499311e85f33
| 1,931
|
cpp
|
C++
|
strands_movebase/src/subsample_cloud.cpp
|
nilsbore/strands_movebase
|
1fd7a289eb2f66f4656f625a88724edaadd4b613
|
[
"MIT"
] | null | null | null |
strands_movebase/src/subsample_cloud.cpp
|
nilsbore/strands_movebase
|
1fd7a289eb2f66f4656f625a88724edaadd4b613
|
[
"MIT"
] | null | null | null |
strands_movebase/src/subsample_cloud.cpp
|
nilsbore/strands_movebase
|
1fd7a289eb2f66f4656f625a88724edaadd4b613
|
[
"MIT"
] | null | null | null |
#include <ros/ros.h>
#include <sensor_msgs/PointCloud2.h>
#include <pcl_ros/point_cloud.h>
#include <pcl/point_types.h>
#include <pcl/filters/voxel_grid.h>
#include <pcl/filters/statistical_outlier_removal.h>
#include <boost/thread/thread.hpp>
#include "strands_movebase/noise_approximate_voxel_grid.h"
ros::Publisher pub;
void callback(const sensor_msgs::PointCloud2::ConstPtr& msg)
{
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud(new pcl::PointCloud<pcl::PointXYZ>());
pcl::fromROSMsg(*msg, *cloud);
pcl::PointCloud<pcl::PointXYZ> voxel_cloud;
noise_approximate_voxel_grid sor(5, 20); // a bit faster than nvg, not as accurate
sor.setInputCloud(cloud);
sor.setLeafSize(0.05f, 0.05f, 0.05f);
sor.filter(voxel_cloud);
/*pcl::StatisticalOutlierRemoval<pcl::PointXYZ> sor; // another possibility, slow
sor.setInputCloud(new_cloud);
sor.setMeanK(20);
sor.setStddevMulThresh(1.0);
sor.filter(voxel_cloud);*/
sensor_msgs::PointCloud2 msg_cloud;
pcl::toROSMsg(voxel_cloud, msg_cloud);
msg_cloud.header = msg->header;
pub.publish(msg_cloud);
}
int main(int argc, char** argv)
{
ros::init(argc, argv, "subsample_cloud");
ros::NodeHandle n;
// topic of input cloud
if (!n.hasParam("/subsample_cloud/input")) {
ROS_ERROR("Could not find parameter input.");
return -1;
}
std::string input;
n.getParam("/subsample_cloud/input", input);
// topic of output cloud
if (!n.hasParam("/subsample_cloud/output")) {
ROS_ERROR("Could not find parameter output.");
return -1;
}
std::string output;
n.getParam("/subsample_cloud/output", output);
ros::Subscriber sub = n.subscribe(input, 1, callback);
pub = n.advertise<sensor_msgs::PointCloud2>(output, 1);
ros::Rate rate(5); // updating at 5 hz, slightly faster than move_base
while (n.ok()) {
rate.sleep();
ros::spinOnce();
}
return 0;
}
| 28.397059
| 86
| 0.684619
|
nilsbore
|
cb2704acf1688c0dd55810183741f63121b92191
| 196,624
|
cpp
|
C++
|
HTML_Lectures/Virtualization_Lecture/vbox/src/VBox/Devices/Audio/DevHDA.cpp
|
roughk/CSCI-49XX-OpenSource
|
74268cbca8bcda3023b2350d046e2dca2853a3ef
|
[
"BSD-2-Clause",
"CC-BY-4.0"
] | null | null | null |
HTML_Lectures/Virtualization_Lecture/vbox/src/VBox/Devices/Audio/DevHDA.cpp
|
roughk/CSCI-49XX-OpenSource
|
74268cbca8bcda3023b2350d046e2dca2853a3ef
|
[
"BSD-2-Clause",
"CC-BY-4.0"
] | null | null | null |
HTML_Lectures/Virtualization_Lecture/vbox/src/VBox/Devices/Audio/DevHDA.cpp
|
roughk/CSCI-49XX-OpenSource
|
74268cbca8bcda3023b2350d046e2dca2853a3ef
|
[
"BSD-2-Clause",
"CC-BY-4.0"
] | null | null | null |
/* $Id: DevHDA.cpp 73466 2018-08-03 09:41:27Z vboxsync $ */
/** @file
* DevHDA.cpp - VBox Intel HD Audio Controller.
*
* Implemented against the specifications found in "High Definition Audio
* Specification", Revision 1.0a June 17, 2010, and "Intel I/O Controller
* HUB 6 (ICH6) Family, Datasheet", document number 301473-002.
*/
/*
* Copyright (C) 2006-2018 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* you can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
/*********************************************************************************************************************************
* Header Files *
*********************************************************************************************************************************/
#define LOG_GROUP LOG_GROUP_DEV_HDA
#include <VBox/log.h>
#include <VBox/vmm/pdmdev.h>
#include <VBox/vmm/pdmaudioifs.h>
#include <VBox/version.h>
#include <VBox/AssertGuest.h>
#include <iprt/assert.h>
#include <iprt/asm.h>
#include <iprt/asm-math.h>
#include <iprt/file.h>
#include <iprt/list.h>
#ifdef IN_RING3
# include <iprt/mem.h>
# include <iprt/semaphore.h>
# include <iprt/string.h>
# include <iprt/uuid.h>
#endif
#include "VBoxDD.h"
#include "AudioMixBuffer.h"
#include "AudioMixer.h"
#include "DevHDA.h"
#include "DevHDACommon.h"
#include "HDACodec.h"
#include "HDAStream.h"
# if defined(VBOX_WITH_HDA_AUDIO_INTERLEAVING_STREAMS_SUPPORT) || defined(VBOX_WITH_AUDIO_HDA_51_SURROUND)
# include "HDAStreamChannel.h"
# endif
#include "HDAStreamMap.h"
#include "HDAStreamPeriod.h"
#include "DrvAudio.h"
/*********************************************************************************************************************************
* Defined Constants And Macros *
*********************************************************************************************************************************/
//#define HDA_AS_PCI_EXPRESS
/* Installs a DMA access handler (via PGM callback) to monitor
* HDA's DMA operations, that is, writing / reading audio stream data.
*
* !!! Note: Certain guests are *that* timing sensitive that when enabling !!!
* !!! such a handler will mess up audio completely (e.g. Windows 7). !!! */
//#define HDA_USE_DMA_ACCESS_HANDLER
#ifdef HDA_USE_DMA_ACCESS_HANDLER
# include <VBox/vmm/pgm.h>
#endif
/* Uses the DMA access handler to read the written DMA audio (output) data.
* Only valid if HDA_USE_DMA_ACCESS_HANDLER is set.
*
* Also see the note / warning for HDA_USE_DMA_ACCESS_HANDLER. */
//# define HDA_USE_DMA_ACCESS_HANDLER_WRITING
/* Useful to debug the device' timing. */
//#define HDA_DEBUG_TIMING
/* To debug silence coming from the guest in form of audio gaps.
* Very crude implementation for now. */
//#define HDA_DEBUG_SILENCE
#if defined(VBOX_WITH_HP_HDA)
/* HP Pavilion dv4t-1300 */
# define HDA_PCI_VENDOR_ID 0x103c
# define HDA_PCI_DEVICE_ID 0x30f7
#elif defined(VBOX_WITH_INTEL_HDA)
/* Intel HDA controller */
# define HDA_PCI_VENDOR_ID 0x8086
# define HDA_PCI_DEVICE_ID 0x2668
#elif defined(VBOX_WITH_NVIDIA_HDA)
/* nVidia HDA controller */
# define HDA_PCI_VENDOR_ID 0x10de
# define HDA_PCI_DEVICE_ID 0x0ac0
#else
# error "Please specify your HDA device vendor/device IDs"
#endif
/* Make sure that interleaving streams support is enabled if the 5.1 surround code is being used. */
#if defined (VBOX_WITH_AUDIO_HDA_51_SURROUND) && !defined(VBOX_WITH_HDA_AUDIO_INTERLEAVING_STREAMS_SUPPORT)
# define VBOX_WITH_HDA_AUDIO_INTERLEAVING_STREAMS_SUPPORT
#endif
/**
* Acquires the HDA lock.
*/
#define DEVHDA_LOCK(a_pThis) \
do { \
int rcLock = PDMCritSectEnter(&(a_pThis)->CritSect, VERR_IGNORED); \
AssertRC(rcLock); \
} while (0)
/**
* Acquires the HDA lock or returns.
*/
# define DEVHDA_LOCK_RETURN(a_pThis, a_rcBusy) \
do { \
int rcLock = PDMCritSectEnter(&(a_pThis)->CritSect, a_rcBusy); \
if (rcLock != VINF_SUCCESS) \
{ \
AssertRC(rcLock); \
return rcLock; \
} \
} while (0)
/**
* Acquires the HDA lock or returns.
*/
# define DEVHDA_LOCK_RETURN_VOID(a_pThis) \
do { \
int rcLock = PDMCritSectEnter(&(a_pThis)->CritSect, VERR_IGNORED); \
if (rcLock != VINF_SUCCESS) \
{ \
AssertRC(rcLock); \
return; \
} \
} while (0)
/**
* Releases the HDA lock.
*/
#define DEVHDA_UNLOCK(a_pThis) \
do { PDMCritSectLeave(&(a_pThis)->CritSect); } while (0)
/**
* Acquires the TM lock and HDA lock, returns on failure.
*/
#define DEVHDA_LOCK_BOTH_RETURN_VOID(a_pThis, a_SD) \
do { \
int rcLock = TMTimerLock((a_pThis)->pTimer[a_SD], VERR_IGNORED); \
if (rcLock != VINF_SUCCESS) \
{ \
AssertRC(rcLock); \
return; \
} \
rcLock = PDMCritSectEnter(&(a_pThis)->CritSect, VERR_IGNORED); \
if (rcLock != VINF_SUCCESS) \
{ \
AssertRC(rcLock); \
TMTimerUnlock((a_pThis)->pTimer[a_SD]); \
return; \
} \
} while (0)
/**
* Acquires the TM lock and HDA lock, returns on failure.
*/
#define DEVHDA_LOCK_BOTH_RETURN(a_pThis, a_SD, a_rcBusy) \
do { \
int rcLock = TMTimerLock((a_pThis)->pTimer[a_SD], (a_rcBusy)); \
if (rcLock != VINF_SUCCESS) \
return rcLock; \
rcLock = PDMCritSectEnter(&(a_pThis)->CritSect, (a_rcBusy)); \
if (rcLock != VINF_SUCCESS) \
{ \
AssertRC(rcLock); \
TMTimerUnlock((a_pThis)->pTimer[a_SD]); \
return rcLock; \
} \
} while (0)
/**
* Releases the HDA lock and TM lock.
*/
#define DEVHDA_UNLOCK_BOTH(a_pThis, a_SD) \
do { \
PDMCritSectLeave(&(a_pThis)->CritSect); \
TMTimerUnlock((a_pThis)->pTimer[a_SD]); \
} while (0)
/*********************************************************************************************************************************
* Structures and Typedefs *
*********************************************************************************************************************************/
/**
* Structure defining a (host backend) driver stream.
* Each driver has its own instances of audio mixer streams, which then
* can go into the same (or even different) audio mixer sinks.
*/
typedef struct HDADRIVERSTREAM
{
union
{
/** Desired playback destination (for an output stream). */
PDMAUDIOPLAYBACKDEST Dest;
/** Desired recording source (for an input stream). */
PDMAUDIORECSOURCE Source;
} DestSource;
uint8_t Padding1[4];
/** Associated mixer handle. */
R3PTRTYPE(PAUDMIXSTREAM) pMixStrm;
} HDADRIVERSTREAM, *PHDADRIVERSTREAM;
#ifdef HDA_USE_DMA_ACCESS_HANDLER
/**
* Struct for keeping an HDA DMA access handler context.
*/
typedef struct HDADMAACCESSHANDLER
{
/** Node for storing this handler in our list in HDASTREAMSTATE. */
RTLISTNODER3 Node;
/** Pointer to stream to which this access handler is assigned to. */
R3PTRTYPE(PHDASTREAM) pStream;
/** Access handler type handle. */
PGMPHYSHANDLERTYPE hAccessHandlerType;
/** First address this handler uses. */
RTGCPHYS GCPhysFirst;
/** Last address this handler uses. */
RTGCPHYS GCPhysLast;
/** Actual BDLE address to handle. */
RTGCPHYS BDLEAddr;
/** Actual BDLE buffer size to handle. */
RTGCPHYS BDLESize;
/** Whether the access handler has been registered or not. */
bool fRegistered;
uint8_t Padding[3];
} HDADMAACCESSHANDLER, *PHDADMAACCESSHANDLER;
#endif
/**
* Struct for maintaining a host backend driver.
* This driver must be associated to one, and only one,
* HDA codec. The HDA controller does the actual multiplexing
* of HDA codec data to various host backend drivers then.
*
* This HDA device uses a timer in order to synchronize all
* read/write accesses across all attached LUNs / backends.
*/
typedef struct HDADRIVER
{
/** Node for storing this driver in our device driver list of HDASTATE. */
RTLISTNODER3 Node;
/** Pointer to HDA controller (state). */
R3PTRTYPE(PHDASTATE) pHDAState;
/** Driver flags. */
PDMAUDIODRVFLAGS fFlags;
uint8_t u32Padding0[2];
/** LUN to which this driver has been assigned. */
uint8_t uLUN;
/** Whether this driver is in an attached state or not. */
bool fAttached;
/** Pointer to attached driver base interface. */
R3PTRTYPE(PPDMIBASE) pDrvBase;
/** Audio connector interface to the underlying host backend. */
R3PTRTYPE(PPDMIAUDIOCONNECTOR) pConnector;
/** Mixer stream for line input. */
HDADRIVERSTREAM LineIn;
#ifdef VBOX_WITH_AUDIO_HDA_MIC_IN
/** Mixer stream for mic input. */
HDADRIVERSTREAM MicIn;
#endif
/** Mixer stream for front output. */
HDADRIVERSTREAM Front;
#ifdef VBOX_WITH_AUDIO_HDA_51_SURROUND
/** Mixer stream for center/LFE output. */
HDADRIVERSTREAM CenterLFE;
/** Mixer stream for rear output. */
HDADRIVERSTREAM Rear;
#endif
} HDADRIVER;
/*********************************************************************************************************************************
* Internal Functions *
*********************************************************************************************************************************/
#ifndef VBOX_DEVICE_STRUCT_TESTCASE
#ifdef IN_RING3
static void hdaR3GCTLReset(PHDASTATE pThis);
#endif
/** @name Register read/write stubs.
* @{
*/
static int hdaRegReadUnimpl(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value);
static int hdaRegWriteUnimpl(PHDASTATE pThis, uint32_t iReg, uint32_t pu32Value);
/** @} */
/** @name Global register set read/write functions.
* @{
*/
static int hdaRegWriteGCTL(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value);
static int hdaRegReadLPIB(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value);
static int hdaRegReadWALCLK(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value);
static int hdaRegWriteCORBWP(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value);
static int hdaRegWriteCORBRP(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value);
static int hdaRegWriteCORBCTL(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value);
static int hdaRegWriteCORBSIZE(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value);
static int hdaRegWriteCORBSTS(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value);
static int hdaRegWriteRINTCNT(PHDASTATE pThis, uint32_t iReg, uint32_t pu32Value);
static int hdaRegWriteRIRBWP(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value);
static int hdaRegWriteRIRBSTS(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value);
static int hdaRegWriteSTATESTS(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value);
static int hdaRegWriteIRS(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value);
static int hdaRegReadIRS(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value);
static int hdaRegWriteBase(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value);
/** @} */
/** @name {IOB}SDn write functions.
* @{
*/
static int hdaRegWriteSDCBL(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value);
static int hdaRegWriteSDCTL(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value);
static int hdaRegWriteSDSTS(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value);
static int hdaRegWriteSDLVI(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value);
static int hdaRegWriteSDFIFOW(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value);
static int hdaRegWriteSDFIFOS(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value);
static int hdaRegWriteSDFMT(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value);
static int hdaRegWriteSDBDPL(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value);
static int hdaRegWriteSDBDPU(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value);
/** @} */
/** @name Generic register read/write functions.
* @{
*/
static int hdaRegReadU32(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value);
static int hdaRegWriteU32(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value);
static int hdaRegReadU24(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value);
#ifdef IN_RING3
static int hdaRegWriteU24(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value);
#endif
static int hdaRegReadU16(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value);
static int hdaRegWriteU16(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value);
static int hdaRegReadU8(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value);
static int hdaRegWriteU8(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value);
/** @} */
/** @name HDA device functions.
* @{
*/
#ifdef IN_RING3
static int hdaR3AddStream(PHDASTATE pThis, PPDMAUDIOSTREAMCFG pCfg);
static int hdaR3RemoveStream(PHDASTATE pThis, PPDMAUDIOSTREAMCFG pCfg);
static int hdaR3UpdateStream(PHDASTATE pThis, PPDMAUDIOSTREAMCFG pCfg);
# ifdef HDA_USE_DMA_ACCESS_HANDLER
static DECLCALLBACK(VBOXSTRICTRC) hdaR3DMAAccessHandler(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, void *pvPhys,
void *pvBuf, size_t cbBuf,
PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser);
# endif
#endif /* IN_RING3 */
/** @} */
/*********************************************************************************************************************************
* Global Variables *
*********************************************************************************************************************************/
/** No register description (RD) flags defined. */
#define HDA_RD_FLAG_NONE 0
/** Writes to SD are allowed while RUN bit is set. */
#define HDA_RD_FLAG_SD_WRITE_RUN RT_BIT(0)
/** Emits a single audio stream register set (e.g. OSD0) at a specified offset. */
#define HDA_REG_MAP_STRM(offset, name) \
/* offset size read mask write mask flags read callback write callback index + abbrev description */ \
/* ------- ------- ---------- ---------- ------------------------- -------------- ----------------- ----------------------------- ----------- */ \
/* Offset 0x80 (SD0) */ \
{ offset, 0x00003, 0x00FF001F, 0x00F0001F, HDA_RD_FLAG_SD_WRITE_RUN, hdaRegReadU24 , hdaRegWriteSDCTL , HDA_REG_IDX_STRM(name, CTL) , #name " Stream Descriptor Control" }, \
/* Offset 0x83 (SD0) */ \
{ offset + 0x3, 0x00001, 0x0000003C, 0x0000001C, HDA_RD_FLAG_SD_WRITE_RUN, hdaRegReadU8 , hdaRegWriteSDSTS , HDA_REG_IDX_STRM(name, STS) , #name " Status" }, \
/* Offset 0x84 (SD0) */ \
{ offset + 0x4, 0x00004, 0xFFFFFFFF, 0x00000000, HDA_RD_FLAG_NONE, hdaRegReadLPIB, hdaRegWriteU32 , HDA_REG_IDX_STRM(name, LPIB) , #name " Link Position In Buffer" }, \
/* Offset 0x88 (SD0) */ \
{ offset + 0x8, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, HDA_RD_FLAG_NONE, hdaRegReadU32 , hdaRegWriteSDCBL , HDA_REG_IDX_STRM(name, CBL) , #name " Cyclic Buffer Length" }, \
/* Offset 0x8C (SD0) */ \
{ offset + 0xC, 0x00002, 0x0000FFFF, 0x0000FFFF, HDA_RD_FLAG_NONE, hdaRegReadU16 , hdaRegWriteSDLVI , HDA_REG_IDX_STRM(name, LVI) , #name " Last Valid Index" }, \
/* Reserved: FIFO Watermark. ** @todo Document this! */ \
{ offset + 0xE, 0x00002, 0x00000007, 0x00000007, HDA_RD_FLAG_NONE, hdaRegReadU16 , hdaRegWriteSDFIFOW, HDA_REG_IDX_STRM(name, FIFOW), #name " FIFO Watermark" }, \
/* Offset 0x90 (SD0) */ \
{ offset + 0x10, 0x00002, 0x000000FF, 0x000000FF, HDA_RD_FLAG_NONE, hdaRegReadU16 , hdaRegWriteSDFIFOS, HDA_REG_IDX_STRM(name, FIFOS), #name " FIFO Size" }, \
/* Offset 0x92 (SD0) */ \
{ offset + 0x12, 0x00002, 0x00007F7F, 0x00007F7F, HDA_RD_FLAG_NONE, hdaRegReadU16 , hdaRegWriteSDFMT , HDA_REG_IDX_STRM(name, FMT) , #name " Stream Format" }, \
/* Reserved: 0x94 - 0x98. */ \
/* Offset 0x98 (SD0) */ \
{ offset + 0x18, 0x00004, 0xFFFFFF80, 0xFFFFFF80, HDA_RD_FLAG_NONE, hdaRegReadU32 , hdaRegWriteSDBDPL , HDA_REG_IDX_STRM(name, BDPL) , #name " Buffer Descriptor List Pointer-Lower Base Address" }, \
/* Offset 0x9C (SD0) */ \
{ offset + 0x1C, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, HDA_RD_FLAG_NONE, hdaRegReadU32 , hdaRegWriteSDBDPU , HDA_REG_IDX_STRM(name, BDPU) , #name " Buffer Descriptor List Pointer-Upper Base Address" }
/** Defines a single audio stream register set (e.g. OSD0). */
#define HDA_REG_MAP_DEF_STREAM(index, name) \
HDA_REG_MAP_STRM(HDA_REG_DESC_SD0_BASE + (index * 32 /* 0x20 */), name)
/* See 302349 p 6.2. */
const HDAREGDESC g_aHdaRegMap[HDA_NUM_REGS] =
{
/* offset size read mask write mask flags read callback write callback index + abbrev */
/*------- ------- ---------- ---------- ----------------- ---------------- ------------------- ------------------------ */
{ 0x00000, 0x00002, 0x0000FFFB, 0x00000000, HDA_RD_FLAG_NONE, hdaRegReadU16 , hdaRegWriteUnimpl , HDA_REG_IDX(GCAP) }, /* Global Capabilities */
{ 0x00002, 0x00001, 0x000000FF, 0x00000000, HDA_RD_FLAG_NONE, hdaRegReadU8 , hdaRegWriteUnimpl , HDA_REG_IDX(VMIN) }, /* Minor Version */
{ 0x00003, 0x00001, 0x000000FF, 0x00000000, HDA_RD_FLAG_NONE, hdaRegReadU8 , hdaRegWriteUnimpl , HDA_REG_IDX(VMAJ) }, /* Major Version */
{ 0x00004, 0x00002, 0x0000FFFF, 0x00000000, HDA_RD_FLAG_NONE, hdaRegReadU16 , hdaRegWriteU16 , HDA_REG_IDX(OUTPAY) }, /* Output Payload Capabilities */
{ 0x00006, 0x00002, 0x0000FFFF, 0x00000000, HDA_RD_FLAG_NONE, hdaRegReadU16 , hdaRegWriteUnimpl , HDA_REG_IDX(INPAY) }, /* Input Payload Capabilities */
{ 0x00008, 0x00004, 0x00000103, 0x00000103, HDA_RD_FLAG_NONE, hdaRegReadU32 , hdaRegWriteGCTL , HDA_REG_IDX(GCTL) }, /* Global Control */
{ 0x0000c, 0x00002, 0x00007FFF, 0x00007FFF, HDA_RD_FLAG_NONE, hdaRegReadU16 , hdaRegWriteU16 , HDA_REG_IDX(WAKEEN) }, /* Wake Enable */
{ 0x0000e, 0x00002, 0x00000007, 0x00000007, HDA_RD_FLAG_NONE, hdaRegReadU8 , hdaRegWriteSTATESTS, HDA_REG_IDX(STATESTS) }, /* State Change Status */
{ 0x00010, 0x00002, 0xFFFFFFFF, 0x00000000, HDA_RD_FLAG_NONE, hdaRegReadUnimpl, hdaRegWriteUnimpl , HDA_REG_IDX(GSTS) }, /* Global Status */
{ 0x00018, 0x00002, 0x0000FFFF, 0x00000000, HDA_RD_FLAG_NONE, hdaRegReadU16 , hdaRegWriteU16 , HDA_REG_IDX(OUTSTRMPAY) }, /* Output Stream Payload Capability */
{ 0x0001A, 0x00002, 0x0000FFFF, 0x00000000, HDA_RD_FLAG_NONE, hdaRegReadU16 , hdaRegWriteUnimpl , HDA_REG_IDX(INSTRMPAY) }, /* Input Stream Payload Capability */
{ 0x00020, 0x00004, 0xC00000FF, 0xC00000FF, HDA_RD_FLAG_NONE, hdaRegReadU32 , hdaRegWriteU32 , HDA_REG_IDX(INTCTL) }, /* Interrupt Control */
{ 0x00024, 0x00004, 0xC00000FF, 0x00000000, HDA_RD_FLAG_NONE, hdaRegReadU32 , hdaRegWriteUnimpl , HDA_REG_IDX(INTSTS) }, /* Interrupt Status */
{ 0x00030, 0x00004, 0xFFFFFFFF, 0x00000000, HDA_RD_FLAG_NONE, hdaRegReadWALCLK, hdaRegWriteUnimpl , HDA_REG_IDX_NOMEM(WALCLK) }, /* Wall Clock Counter */
{ 0x00034, 0x00004, 0x000000FF, 0x000000FF, HDA_RD_FLAG_NONE, hdaRegReadU32 , hdaRegWriteU32 , HDA_REG_IDX(SSYNC) }, /* Stream Synchronization */
{ 0x00040, 0x00004, 0xFFFFFF80, 0xFFFFFF80, HDA_RD_FLAG_NONE, hdaRegReadU32 , hdaRegWriteBase , HDA_REG_IDX(CORBLBASE) }, /* CORB Lower Base Address */
{ 0x00044, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, HDA_RD_FLAG_NONE, hdaRegReadU32 , hdaRegWriteBase , HDA_REG_IDX(CORBUBASE) }, /* CORB Upper Base Address */
{ 0x00048, 0x00002, 0x000000FF, 0x000000FF, HDA_RD_FLAG_NONE, hdaRegReadU16 , hdaRegWriteCORBWP , HDA_REG_IDX(CORBWP) }, /* CORB Write Pointer */
{ 0x0004A, 0x00002, 0x000080FF, 0x00008000, HDA_RD_FLAG_NONE, hdaRegReadU16 , hdaRegWriteCORBRP , HDA_REG_IDX(CORBRP) }, /* CORB Read Pointer */
{ 0x0004C, 0x00001, 0x00000003, 0x00000003, HDA_RD_FLAG_NONE, hdaRegReadU8 , hdaRegWriteCORBCTL , HDA_REG_IDX(CORBCTL) }, /* CORB Control */
{ 0x0004D, 0x00001, 0x00000001, 0x00000001, HDA_RD_FLAG_NONE, hdaRegReadU8 , hdaRegWriteCORBSTS , HDA_REG_IDX(CORBSTS) }, /* CORB Status */
{ 0x0004E, 0x00001, 0x000000F3, 0x00000003, HDA_RD_FLAG_NONE, hdaRegReadU8 , hdaRegWriteCORBSIZE, HDA_REG_IDX(CORBSIZE) }, /* CORB Size */
{ 0x00050, 0x00004, 0xFFFFFF80, 0xFFFFFF80, HDA_RD_FLAG_NONE, hdaRegReadU32 , hdaRegWriteBase , HDA_REG_IDX(RIRBLBASE) }, /* RIRB Lower Base Address */
{ 0x00054, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, HDA_RD_FLAG_NONE, hdaRegReadU32 , hdaRegWriteBase , HDA_REG_IDX(RIRBUBASE) }, /* RIRB Upper Base Address */
{ 0x00058, 0x00002, 0x000000FF, 0x00008000, HDA_RD_FLAG_NONE, hdaRegReadU8 , hdaRegWriteRIRBWP , HDA_REG_IDX(RIRBWP) }, /* RIRB Write Pointer */
{ 0x0005A, 0x00002, 0x000000FF, 0x000000FF, HDA_RD_FLAG_NONE, hdaRegReadU16 , hdaRegWriteRINTCNT , HDA_REG_IDX(RINTCNT) }, /* Response Interrupt Count */
{ 0x0005C, 0x00001, 0x00000007, 0x00000007, HDA_RD_FLAG_NONE, hdaRegReadU8 , hdaRegWriteU8 , HDA_REG_IDX(RIRBCTL) }, /* RIRB Control */
{ 0x0005D, 0x00001, 0x00000005, 0x00000005, HDA_RD_FLAG_NONE, hdaRegReadU8 , hdaRegWriteRIRBSTS , HDA_REG_IDX(RIRBSTS) }, /* RIRB Status */
{ 0x0005E, 0x00001, 0x000000F3, 0x00000000, HDA_RD_FLAG_NONE, hdaRegReadU8 , hdaRegWriteUnimpl , HDA_REG_IDX(RIRBSIZE) }, /* RIRB Size */
{ 0x00060, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, HDA_RD_FLAG_NONE, hdaRegReadU32 , hdaRegWriteU32 , HDA_REG_IDX(IC) }, /* Immediate Command */
{ 0x00064, 0x00004, 0x00000000, 0xFFFFFFFF, HDA_RD_FLAG_NONE, hdaRegReadU32 , hdaRegWriteUnimpl , HDA_REG_IDX(IR) }, /* Immediate Response */
{ 0x00068, 0x00002, 0x00000002, 0x00000002, HDA_RD_FLAG_NONE, hdaRegReadIRS , hdaRegWriteIRS , HDA_REG_IDX(IRS) }, /* Immediate Command Status */
{ 0x00070, 0x00004, 0xFFFFFFFF, 0xFFFFFF81, HDA_RD_FLAG_NONE, hdaRegReadU32 , hdaRegWriteBase , HDA_REG_IDX(DPLBASE) }, /* DMA Position Lower Base */
{ 0x00074, 0x00004, 0xFFFFFFFF, 0xFFFFFFFF, HDA_RD_FLAG_NONE, hdaRegReadU32 , hdaRegWriteBase , HDA_REG_IDX(DPUBASE) }, /* DMA Position Upper Base */
/* 4 Serial Data In (SDI). */
HDA_REG_MAP_DEF_STREAM(0, SD0),
HDA_REG_MAP_DEF_STREAM(1, SD1),
HDA_REG_MAP_DEF_STREAM(2, SD2),
HDA_REG_MAP_DEF_STREAM(3, SD3),
/* 4 Serial Data Out (SDO). */
HDA_REG_MAP_DEF_STREAM(4, SD4),
HDA_REG_MAP_DEF_STREAM(5, SD5),
HDA_REG_MAP_DEF_STREAM(6, SD6),
HDA_REG_MAP_DEF_STREAM(7, SD7)
};
const HDAREGALIAS g_aHdaRegAliases[] =
{
{ 0x2084, HDA_REG_SD0LPIB },
{ 0x20a4, HDA_REG_SD1LPIB },
{ 0x20c4, HDA_REG_SD2LPIB },
{ 0x20e4, HDA_REG_SD3LPIB },
{ 0x2104, HDA_REG_SD4LPIB },
{ 0x2124, HDA_REG_SD5LPIB },
{ 0x2144, HDA_REG_SD6LPIB },
{ 0x2164, HDA_REG_SD7LPIB }
};
#ifdef IN_RING3
/** HDABDLEDESC field descriptors for the v7 saved state. */
static SSMFIELD const g_aSSMBDLEDescFields7[] =
{
SSMFIELD_ENTRY(HDABDLEDESC, u64BufAdr),
SSMFIELD_ENTRY(HDABDLEDESC, u32BufSize),
SSMFIELD_ENTRY(HDABDLEDESC, fFlags),
SSMFIELD_ENTRY_TERM()
};
/** HDABDLESTATE field descriptors for the v6+ saved state. */
static SSMFIELD const g_aSSMBDLEStateFields6[] =
{
SSMFIELD_ENTRY(HDABDLESTATE, u32BDLIndex),
SSMFIELD_ENTRY(HDABDLESTATE, cbBelowFIFOW),
SSMFIELD_ENTRY_OLD(FIFO, HDA_FIFO_MAX), /* Deprecated; now is handled in the stream's circular buffer. */
SSMFIELD_ENTRY(HDABDLESTATE, u32BufOff),
SSMFIELD_ENTRY_TERM()
};
/** HDABDLESTATE field descriptors for the v7 saved state. */
static SSMFIELD const g_aSSMBDLEStateFields7[] =
{
SSMFIELD_ENTRY(HDABDLESTATE, u32BDLIndex),
SSMFIELD_ENTRY(HDABDLESTATE, cbBelowFIFOW),
SSMFIELD_ENTRY(HDABDLESTATE, u32BufOff),
SSMFIELD_ENTRY_TERM()
};
/** HDASTREAMSTATE field descriptors for the v6 saved state. */
static SSMFIELD const g_aSSMStreamStateFields6[] =
{
SSMFIELD_ENTRY_OLD(cBDLE, sizeof(uint16_t)), /* Deprecated. */
SSMFIELD_ENTRY(HDASTREAMSTATE, uCurBDLE),
SSMFIELD_ENTRY_OLD(fStop, 1), /* Deprecated; see SSMR3PutBool(). */
SSMFIELD_ENTRY_OLD(fRunning, 1), /* Deprecated; using the HDA_SDCTL_RUN bit is sufficient. */
SSMFIELD_ENTRY(HDASTREAMSTATE, fInReset),
SSMFIELD_ENTRY_TERM()
};
/** HDASTREAMSTATE field descriptors for the v7 saved state. */
static SSMFIELD const g_aSSMStreamStateFields7[] =
{
SSMFIELD_ENTRY(HDASTREAMSTATE, uCurBDLE),
SSMFIELD_ENTRY(HDASTREAMSTATE, fInReset),
SSMFIELD_ENTRY(HDASTREAMSTATE, tsTransferNext),
SSMFIELD_ENTRY_TERM()
};
/** HDASTREAMPERIOD field descriptors for the v7 saved state. */
static SSMFIELD const g_aSSMStreamPeriodFields7[] =
{
SSMFIELD_ENTRY(HDASTREAMPERIOD, u64StartWalClk),
SSMFIELD_ENTRY(HDASTREAMPERIOD, u64ElapsedWalClk),
SSMFIELD_ENTRY(HDASTREAMPERIOD, framesTransferred),
SSMFIELD_ENTRY(HDASTREAMPERIOD, cIntPending),
SSMFIELD_ENTRY_TERM()
};
/**
* 32-bit size indexed masks, i.e. g_afMasks[2 bytes] = 0xffff.
*/
static uint32_t const g_afMasks[5] =
{
UINT32_C(0), UINT32_C(0x000000ff), UINT32_C(0x0000ffff), UINT32_C(0x00ffffff), UINT32_C(0xffffffff)
};
#endif /* IN_RING3 */
/**
* Retrieves the number of bytes of a FIFOW register.
*
* @return Number of bytes of a given FIFOW register.
*/
DECLINLINE(uint8_t) hdaSDFIFOWToBytes(uint32_t u32RegFIFOW)
{
uint32_t cb;
switch (u32RegFIFOW)
{
case HDA_SDFIFOW_8B: cb = 8; break;
case HDA_SDFIFOW_16B: cb = 16; break;
case HDA_SDFIFOW_32B: cb = 32; break;
default: cb = 0; break;
}
Assert(RT_IS_POWER_OF_TWO(cb));
return cb;
}
#ifdef IN_RING3
/**
* Reschedules pending interrupts for all audio streams which have complete
* audio periods but did not have the chance to issue their (pending) interrupts yet.
*
* @param pThis The HDA device state.
*/
static void hdaR3ReschedulePendingInterrupts(PHDASTATE pThis)
{
bool fInterrupt = false;
for (uint8_t i = 0; i < HDA_MAX_STREAMS; ++i)
{
PHDASTREAM pStream = hdaGetStreamFromSD(pThis, i);
if (!pStream)
continue;
if ( hdaR3StreamPeriodIsComplete (&pStream->State.Period)
&& hdaR3StreamPeriodNeedsInterrupt(&pStream->State.Period)
&& hdaR3WalClkSet(pThis, hdaR3StreamPeriodGetAbsElapsedWalClk(&pStream->State.Period), false /* fForce */))
{
fInterrupt = true;
break;
}
}
LogFunc(("fInterrupt=%RTbool\n", fInterrupt));
# ifndef LOG_ENABLED
hdaProcessInterrupt(pThis);
# else
hdaProcessInterrupt(pThis, __FUNCTION__);
# endif
}
#endif /* IN_RING3 */
/**
* Looks up a register at the exact offset given by @a offReg.
*
* @returns Register index on success, -1 if not found.
* @param offReg The register offset.
*/
static int hdaRegLookup(uint32_t offReg)
{
/*
* Aliases.
*/
if (offReg >= g_aHdaRegAliases[0].offReg)
{
for (unsigned i = 0; i < RT_ELEMENTS(g_aHdaRegAliases); i++)
if (offReg == g_aHdaRegAliases[i].offReg)
return g_aHdaRegAliases[i].idxAlias;
Assert(g_aHdaRegMap[RT_ELEMENTS(g_aHdaRegMap) - 1].offset < offReg);
return -1;
}
/*
* Binary search the
*/
int idxEnd = RT_ELEMENTS(g_aHdaRegMap);
int idxLow = 0;
for (;;)
{
int idxMiddle = idxLow + (idxEnd - idxLow) / 2;
if (offReg < g_aHdaRegMap[idxMiddle].offset)
{
if (idxLow == idxMiddle)
break;
idxEnd = idxMiddle;
}
else if (offReg > g_aHdaRegMap[idxMiddle].offset)
{
idxLow = idxMiddle + 1;
if (idxLow >= idxEnd)
break;
}
else
return idxMiddle;
}
#ifdef RT_STRICT
for (unsigned i = 0; i < RT_ELEMENTS(g_aHdaRegMap); i++)
Assert(g_aHdaRegMap[i].offset != offReg);
#endif
return -1;
}
#ifdef IN_RING3
/**
* Looks up a register covering the offset given by @a offReg.
*
* @returns Register index on success, -1 if not found.
* @param offReg The register offset.
*/
static int hdaR3RegLookupWithin(uint32_t offReg)
{
/*
* Aliases.
*/
if (offReg >= g_aHdaRegAliases[0].offReg)
{
for (unsigned i = 0; i < RT_ELEMENTS(g_aHdaRegAliases); i++)
{
uint32_t off = offReg - g_aHdaRegAliases[i].offReg;
if (off < 4 && off < g_aHdaRegMap[g_aHdaRegAliases[i].idxAlias].size)
return g_aHdaRegAliases[i].idxAlias;
}
Assert(g_aHdaRegMap[RT_ELEMENTS(g_aHdaRegMap) - 1].offset < offReg);
return -1;
}
/*
* Binary search the register map.
*/
int idxEnd = RT_ELEMENTS(g_aHdaRegMap);
int idxLow = 0;
for (;;)
{
int idxMiddle = idxLow + (idxEnd - idxLow) / 2;
if (offReg < g_aHdaRegMap[idxMiddle].offset)
{
if (idxLow == idxMiddle)
break;
idxEnd = idxMiddle;
}
else if (offReg >= g_aHdaRegMap[idxMiddle].offset + g_aHdaRegMap[idxMiddle].size)
{
idxLow = idxMiddle + 1;
if (idxLow >= idxEnd)
break;
}
else
return idxMiddle;
}
# ifdef RT_STRICT
for (unsigned i = 0; i < RT_ELEMENTS(g_aHdaRegMap); i++)
Assert(offReg - g_aHdaRegMap[i].offset >= g_aHdaRegMap[i].size);
# endif
return -1;
}
/**
* Synchronizes the CORB / RIRB buffers between internal <-> device state.
*
* @returns IPRT status code.
* @param pThis HDA state.
* @param fLocal Specify true to synchronize HDA state's CORB buffer with the device state,
* or false to synchronize the device state's RIRB buffer with the HDA state.
*
* @todo r=andy Break this up into two functions?
*/
static int hdaR3CmdSync(PHDASTATE pThis, bool fLocal)
{
int rc = VINF_SUCCESS;
if (fLocal)
{
if (pThis->u64CORBBase)
{
AssertPtr(pThis->pu32CorbBuf);
Assert(pThis->cbCorbBuf);
/** @todo r=bird: An explanation is required why PDMDevHlpPhysRead is used with
* the CORB and PDMDevHlpPCIPhysWrite with RIRB below. There are
* similar unexplained inconsistencies in DevHDACommon.cpp. */
rc = PDMDevHlpPhysRead(pThis->CTX_SUFF(pDevIns), pThis->u64CORBBase, pThis->pu32CorbBuf, pThis->cbCorbBuf);
Log(("hdaR3CmdSync/CORB: read %RGp LB %#x (%Rrc)\n", pThis->u64CORBBase, pThis->cbCorbBuf, rc));
AssertRCReturn(rc, rc);
}
}
else
{
if (pThis->u64RIRBBase)
{
AssertPtr(pThis->pu64RirbBuf);
Assert(pThis->cbRirbBuf);
rc = PDMDevHlpPCIPhysWrite(pThis->CTX_SUFF(pDevIns), pThis->u64RIRBBase, pThis->pu64RirbBuf, pThis->cbRirbBuf);
Log(("hdaR3CmdSync/RIRB: phys read %RGp LB %#x (%Rrc)\n", pThis->u64RIRBBase, pThis->pu64RirbBuf, rc));
AssertRCReturn(rc, rc);
}
}
# ifdef DEBUG_CMD_BUFFER
LogFunc(("fLocal=%RTbool\n", fLocal));
uint8_t i = 0;
do
{
LogFunc(("CORB%02x: ", i));
uint8_t j = 0;
do
{
const char *pszPrefix;
if ((i + j) == HDA_REG(pThis, CORBRP))
pszPrefix = "[R]";
else if ((i + j) == HDA_REG(pThis, CORBWP))
pszPrefix = "[W]";
else
pszPrefix = " "; /* three spaces */
Log((" %s%08x", pszPrefix, pThis->pu32CorbBuf[i + j]));
j++;
} while (j < 8);
Log(("\n"));
i += 8;
} while(i != 0);
do
{
LogFunc(("RIRB%02x: ", i));
uint8_t j = 0;
do
{
const char *prefix;
if ((i + j) == HDA_REG(pThis, RIRBWP))
prefix = "[W]";
else
prefix = " ";
Log((" %s%016lx", prefix, pThis->pu64RirbBuf[i + j]));
} while (++j < 8);
Log(("\n"));
i += 8;
} while (i != 0);
# endif
return rc;
}
/**
* Processes the next CORB buffer command in the queue.
*
* This will invoke the HDA codec verb dispatcher.
*
* @returns IPRT status code.
* @param pThis HDA state.
*/
static int hdaR3CORBCmdProcess(PHDASTATE pThis)
{
uint8_t corbRp = HDA_REG(pThis, CORBRP);
uint8_t corbWp = HDA_REG(pThis, CORBWP);
uint8_t rirbWp = HDA_REG(pThis, RIRBWP);
Log3Func(("CORB(RP:%x, WP:%x) RIRBWP:%x\n", corbRp, corbWp, rirbWp));
if (!(HDA_REG(pThis, CORBCTL) & HDA_CORBCTL_DMA))
{
LogFunc(("CORB DMA not active, skipping\n"));
return VINF_SUCCESS;
}
Assert(pThis->cbCorbBuf);
int rc = hdaR3CmdSync(pThis, true /* Sync from guest */);
AssertRCReturn(rc, rc);
uint16_t cIntCnt = HDA_REG(pThis, RINTCNT) & 0xff;
if (!cIntCnt) /* 0 means 256 interrupts. */
cIntCnt = HDA_MAX_RINTCNT;
Log3Func(("START CORB(RP:%x, WP:%x) RIRBWP:%x, RINTCNT:%RU8/%RU8\n",
corbRp, corbWp, rirbWp, pThis->u16RespIntCnt, cIntCnt));
while (corbRp != corbWp)
{
corbRp = (corbRp + 1) % (pThis->cbCorbBuf / HDA_CORB_ELEMENT_SIZE); /* Advance +1 as the first command(s) are at CORBWP + 1. */
uint32_t uCmd = pThis->pu32CorbBuf[corbRp];
uint64_t uResp = 0;
rc = pThis->pCodec->pfnLookup(pThis->pCodec, HDA_CODEC_CMD(uCmd, 0 /* Codec index */), &uResp);
if (RT_FAILURE(rc))
LogFunc(("Codec lookup failed with rc=%Rrc\n", rc));
Log3Func(("Codec verb %08x -> response %016lx\n", uCmd, uResp));
if ( (uResp & CODEC_RESPONSE_UNSOLICITED)
&& !(HDA_REG(pThis, GCTL) & HDA_GCTL_UNSOL))
{
LogFunc(("Unexpected unsolicited response.\n"));
HDA_REG(pThis, CORBRP) = corbRp;
/** @todo r=andy No CORB/RIRB syncing to guest required in that case? */
return rc;
}
rirbWp = (rirbWp + 1) % HDA_RIRB_SIZE;
pThis->pu64RirbBuf[rirbWp] = uResp;
pThis->u16RespIntCnt++;
bool fSendInterrupt = false;
if (pThis->u16RespIntCnt == cIntCnt) /* Response interrupt count reached? */
{
pThis->u16RespIntCnt = 0; /* Reset internal interrupt response counter. */
Log3Func(("Response interrupt count reached (%RU16)\n", pThis->u16RespIntCnt));
fSendInterrupt = true;
}
else if (corbRp == corbWp) /* Did we reach the end of the current command buffer? */
{
Log3Func(("Command buffer empty\n"));
fSendInterrupt = true;
}
if (fSendInterrupt)
{
if (HDA_REG(pThis, RIRBCTL) & HDA_RIRBCTL_RINTCTL) /* Response Interrupt Control (RINTCTL) enabled? */
{
HDA_REG(pThis, RIRBSTS) |= HDA_RIRBSTS_RINTFL;
# ifndef LOG_ENABLED
rc = hdaProcessInterrupt(pThis);
# else
rc = hdaProcessInterrupt(pThis, __FUNCTION__);
# endif
}
}
}
Log3Func(("END CORB(RP:%x, WP:%x) RIRBWP:%x, RINTCNT:%RU8/%RU8\n",
corbRp, corbWp, rirbWp, pThis->u16RespIntCnt, cIntCnt));
HDA_REG(pThis, CORBRP) = corbRp;
HDA_REG(pThis, RIRBWP) = rirbWp;
rc = hdaR3CmdSync(pThis, false /* Sync to guest */);
AssertRCReturn(rc, rc);
if (RT_FAILURE(rc))
AssertRCReturn(rc, rc);
return rc;
}
#endif /* IN_RING3 */
/* Register access handlers. */
static int hdaRegReadUnimpl(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value)
{
RT_NOREF_PV(pThis); RT_NOREF_PV(iReg);
*pu32Value = 0;
return VINF_SUCCESS;
}
static int hdaRegWriteUnimpl(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
{
RT_NOREF_PV(pThis); RT_NOREF_PV(iReg); RT_NOREF_PV(u32Value);
return VINF_SUCCESS;
}
/* U8 */
static int hdaRegReadU8(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value)
{
Assert(((pThis->au32Regs[g_aHdaRegMap[iReg].mem_idx] & g_aHdaRegMap[iReg].readable) & 0xffffff00) == 0);
return hdaRegReadU32(pThis, iReg, pu32Value);
}
static int hdaRegWriteU8(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
{
Assert((u32Value & 0xffffff00) == 0);
return hdaRegWriteU32(pThis, iReg, u32Value);
}
/* U16 */
static int hdaRegReadU16(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value)
{
Assert(((pThis->au32Regs[g_aHdaRegMap[iReg].mem_idx] & g_aHdaRegMap[iReg].readable) & 0xffff0000) == 0);
return hdaRegReadU32(pThis, iReg, pu32Value);
}
static int hdaRegWriteU16(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
{
Assert((u32Value & 0xffff0000) == 0);
return hdaRegWriteU32(pThis, iReg, u32Value);
}
/* U24 */
static int hdaRegReadU24(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value)
{
Assert(((pThis->au32Regs[g_aHdaRegMap[iReg].mem_idx] & g_aHdaRegMap[iReg].readable) & 0xff000000) == 0);
return hdaRegReadU32(pThis, iReg, pu32Value);
}
#ifdef IN_RING3
static int hdaRegWriteU24(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
{
Assert((u32Value & 0xff000000) == 0);
return hdaRegWriteU32(pThis, iReg, u32Value);
}
#endif
/* U32 */
static int hdaRegReadU32(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value)
{
uint32_t iRegMem = g_aHdaRegMap[iReg].mem_idx;
DEVHDA_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_READ);
*pu32Value = pThis->au32Regs[iRegMem] & g_aHdaRegMap[iReg].readable;
DEVHDA_UNLOCK(pThis);
return VINF_SUCCESS;
}
static int hdaRegWriteU32(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
{
uint32_t iRegMem = g_aHdaRegMap[iReg].mem_idx;
DEVHDA_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_WRITE);
pThis->au32Regs[iRegMem] = (u32Value & g_aHdaRegMap[iReg].writable)
| (pThis->au32Regs[iRegMem] & ~g_aHdaRegMap[iReg].writable);
DEVHDA_UNLOCK(pThis);
return VINF_SUCCESS;
}
static int hdaRegWriteGCTL(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
{
RT_NOREF_PV(iReg);
#ifdef IN_RING3
DEVHDA_LOCK(pThis);
#else
if (!(u32Value & HDA_GCTL_CRST))
return VINF_IOM_R3_MMIO_WRITE;
DEVHDA_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_WRITE);
#endif
if (u32Value & HDA_GCTL_CRST)
{
/* Set the CRST bit to indicate that we're leaving reset mode. */
HDA_REG(pThis, GCTL) |= HDA_GCTL_CRST;
LogFunc(("Guest leaving HDA reset\n"));
}
else
{
#ifdef IN_RING3
/* Enter reset state. */
LogFunc(("Guest entering HDA reset with DMA(RIRB:%s, CORB:%s)\n",
HDA_REG(pThis, CORBCTL) & HDA_CORBCTL_DMA ? "on" : "off",
HDA_REG(pThis, RIRBCTL) & HDA_RIRBCTL_RDMAEN ? "on" : "off"));
/* Clear the CRST bit to indicate that we're in reset state. */
HDA_REG(pThis, GCTL) &= ~HDA_GCTL_CRST;
hdaR3GCTLReset(pThis);
#else
AssertFailedReturnStmt(DEVHDA_UNLOCK(pThis), VINF_IOM_R3_MMIO_WRITE);
#endif
}
if (u32Value & HDA_GCTL_FCNTRL)
{
/* Flush: GSTS:1 set, see 6.2.6. */
HDA_REG(pThis, GSTS) |= HDA_GSTS_FSTS; /* Set the flush status. */
/* DPLBASE and DPUBASE should be initialized with initial value (see 6.2.6). */
}
DEVHDA_UNLOCK(pThis);
return VINF_SUCCESS;
}
static int hdaRegWriteSTATESTS(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
{
DEVHDA_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_WRITE);
uint32_t v = HDA_REG_IND(pThis, iReg);
uint32_t nv = u32Value & HDA_STATESTS_SCSF_MASK;
HDA_REG(pThis, STATESTS) &= ~(v & nv); /* Write of 1 clears corresponding bit. */
DEVHDA_UNLOCK(pThis);
return VINF_SUCCESS;
}
static int hdaRegReadLPIB(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value)
{
DEVHDA_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_READ);
const uint8_t uSD = HDA_SD_NUM_FROM_REG(pThis, LPIB, iReg);
uint32_t u32LPIB = HDA_STREAM_REG(pThis, LPIB, uSD);
#ifdef LOG_ENABLED
const uint32_t u32CBL = HDA_STREAM_REG(pThis, CBL, uSD);
LogFlowFunc(("[SD%RU8] LPIB=%RU32, CBL=%RU32\n", uSD, u32LPIB, u32CBL));
#endif
*pu32Value = u32LPIB;
DEVHDA_UNLOCK(pThis);
return VINF_SUCCESS;
}
#ifdef IN_RING3
/**
* Returns the current maximum value the wall clock counter can be set to.
* This maximum value depends on all currently handled HDA streams and their own current timing.
*
* @return Current maximum value the wall clock counter can be set to.
* @param pThis HDA state.
*
* @remark Does not actually set the wall clock counter.
*/
static uint64_t hdaR3WalClkGetMax(PHDASTATE pThis)
{
const uint64_t u64WalClkCur = ASMAtomicReadU64(&pThis->u64WalClk);
const uint64_t u64FrontAbsWalClk = pThis->SinkFront.pStream
? hdaR3StreamPeriodGetAbsElapsedWalClk(&pThis->SinkFront.pStream->State.Period) : 0;
# ifdef VBOX_WITH_AUDIO_HDA_51_SURROUND
# error "Implement me!"
# endif
const uint64_t u64LineInAbsWalClk = pThis->SinkLineIn.pStream
? hdaR3StreamPeriodGetAbsElapsedWalClk(&pThis->SinkLineIn.pStream->State.Period) : 0;
# ifdef VBOX_WITH_HDA_MIC_IN
const uint64_t u64MicInAbsWalClk = pThis->SinkMicIn.pStream
? hdaR3StreamPeriodGetAbsElapsedWalClk(&pThis->SinkMicIn.pStream->State.Period) : 0;
# endif
uint64_t u64WalClkNew = RT_MAX(u64WalClkCur, u64FrontAbsWalClk);
# ifdef VBOX_WITH_AUDIO_HDA_51_SURROUND
# error "Implement me!"
# endif
u64WalClkNew = RT_MAX(u64WalClkNew, u64LineInAbsWalClk);
# ifdef VBOX_WITH_HDA_MIC_IN
u64WalClkNew = RT_MAX(u64WalClkNew, u64MicInAbsWalClk);
# endif
Log3Func(("%RU64 -> Front=%RU64, LineIn=%RU64 -> %RU64\n",
u64WalClkCur, u64FrontAbsWalClk, u64LineInAbsWalClk, u64WalClkNew));
return u64WalClkNew;
}
#endif /* IN_RING3 */
static int hdaRegReadWALCLK(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value)
{
#ifdef IN_RING3
RT_NOREF(iReg);
DEVHDA_LOCK(pThis);
*pu32Value = RT_LO_U32(ASMAtomicReadU64(&pThis->u64WalClk));
Log3Func(("%RU32 (max @ %RU64)\n",*pu32Value, hdaR3WalClkGetMax(pThis)));
DEVHDA_UNLOCK(pThis);
return VINF_SUCCESS;
#else
RT_NOREF(pThis, iReg, pu32Value);
return VINF_IOM_R3_MMIO_READ;
#endif
}
static int hdaRegWriteCORBRP(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
{
RT_NOREF(iReg);
DEVHDA_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_WRITE);
if (u32Value & HDA_CORBRP_RST)
{
/* Do a CORB reset. */
if (pThis->cbCorbBuf)
{
#ifdef IN_RING3
Assert(pThis->pu32CorbBuf);
RT_BZERO((void *)pThis->pu32CorbBuf, pThis->cbCorbBuf);
#else
DEVHDA_UNLOCK(pThis);
return VINF_IOM_R3_MMIO_WRITE;
#endif
}
LogRel2(("HDA: CORB reset\n"));
HDA_REG(pThis, CORBRP) = HDA_CORBRP_RST; /* Clears the pointer. */
}
else
HDA_REG(pThis, CORBRP) &= ~HDA_CORBRP_RST; /* Only CORBRP_RST bit is writable. */
DEVHDA_UNLOCK(pThis);
return VINF_SUCCESS;
}
static int hdaRegWriteCORBCTL(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
{
#ifdef IN_RING3
DEVHDA_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_WRITE);
int rc = hdaRegWriteU8(pThis, iReg, u32Value);
AssertRC(rc);
if (HDA_REG(pThis, CORBCTL) & HDA_CORBCTL_DMA) /* Start DMA engine. */
{
rc = hdaR3CORBCmdProcess(pThis);
}
else
LogFunc(("CORB DMA not running, skipping\n"));
DEVHDA_UNLOCK(pThis);
return rc;
#else
RT_NOREF(pThis, iReg, u32Value);
return VINF_IOM_R3_MMIO_WRITE;
#endif
}
static int hdaRegWriteCORBSIZE(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
{
#ifdef IN_RING3
RT_NOREF(iReg);
DEVHDA_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_WRITE);
if (HDA_REG(pThis, CORBCTL) & HDA_CORBCTL_DMA) /* Ignore request if CORB DMA engine is (still) running. */
{
LogFunc(("CORB DMA is (still) running, skipping\n"));
DEVHDA_UNLOCK(pThis);
return VINF_SUCCESS;
}
u32Value = (u32Value & HDA_CORBSIZE_SZ);
uint16_t cEntries = HDA_CORB_SIZE; /* Set default. */
switch (u32Value)
{
case 0: /* 8 byte; 2 entries. */
cEntries = 2;
break;
case 1: /* 64 byte; 16 entries. */
cEntries = 16;
break;
case 2: /* 1 KB; 256 entries. */
/* Use default size. */
break;
default:
LogRel(("HDA: Guest tried to set an invalid CORB size (0x%x), keeping default\n", u32Value));
u32Value = 2;
/* Use default size. */
break;
}
uint32_t cbCorbBuf = cEntries * HDA_CORB_ELEMENT_SIZE;
Assert(cbCorbBuf <= HDA_CORB_SIZE * HDA_CORB_ELEMENT_SIZE); /* Paranoia. */
if (cbCorbBuf != pThis->cbCorbBuf)
{
RT_BZERO(pThis->pu32CorbBuf, HDA_CORB_SIZE * HDA_CORB_ELEMENT_SIZE); /* Clear CORB when setting a new size. */
pThis->cbCorbBuf = cbCorbBuf;
}
LogFunc(("CORB buffer size is now %RU32 bytes (%u entries)\n", pThis->cbCorbBuf, pThis->cbCorbBuf / HDA_CORB_ELEMENT_SIZE));
HDA_REG(pThis, CORBSIZE) = u32Value;
DEVHDA_UNLOCK(pThis);
return VINF_SUCCESS;
#else
RT_NOREF(pThis, iReg, u32Value);
return VINF_IOM_R3_MMIO_WRITE;
#endif
}
static int hdaRegWriteCORBSTS(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
{
RT_NOREF_PV(iReg);
DEVHDA_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_WRITE);
uint32_t v = HDA_REG(pThis, CORBSTS);
HDA_REG(pThis, CORBSTS) &= ~(v & u32Value);
DEVHDA_UNLOCK(pThis);
return VINF_SUCCESS;
}
static int hdaRegWriteCORBWP(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
{
#ifdef IN_RING3
DEVHDA_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_WRITE);
int rc = hdaRegWriteU16(pThis, iReg, u32Value);
AssertRCSuccess(rc);
rc = hdaR3CORBCmdProcess(pThis);
DEVHDA_UNLOCK(pThis);
return rc;
#else
RT_NOREF(pThis, iReg, u32Value);
return VINF_IOM_R3_MMIO_WRITE;
#endif
}
static int hdaRegWriteSDCBL(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
{
DEVHDA_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_WRITE);
PHDASTREAM pStream = hdaGetStreamFromSD(pThis, HDA_SD_NUM_FROM_REG(pThis, CBL, iReg));
if (pStream)
{
pStream->u32CBL = u32Value;
LogFlowFunc(("[SD%RU8] CBL=%RU32\n", pStream->u8SD, u32Value));
}
else
LogFunc(("[SD%RU8] Warning: Changing SDCBL on non-attached stream (0x%x)\n",
HDA_SD_NUM_FROM_REG(pThis, CTL, iReg), u32Value));
int rc = hdaRegWriteU32(pThis, iReg, u32Value);
AssertRCSuccess(rc);
DEVHDA_UNLOCK(pThis);
return rc;
}
static int hdaRegWriteSDCTL(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
{
#ifdef IN_RING3
/* Get the stream descriptor. */
const uint8_t uSD = HDA_SD_NUM_FROM_REG(pThis, CTL, iReg);
DEVHDA_LOCK_BOTH_RETURN(pThis, uSD, VINF_IOM_R3_MMIO_WRITE);
/*
* Some guests write too much (that is, 32-bit with the top 8 bit being junk)
* instead of 24-bit required for SDCTL. So just mask this here to be safe.
*/
u32Value &= 0x00ffffff;
bool fRun = RT_BOOL(u32Value & HDA_SDCTL_RUN);
bool fInRun = RT_BOOL(HDA_REG_IND(pThis, iReg) & HDA_SDCTL_RUN);
bool fReset = RT_BOOL(u32Value & HDA_SDCTL_SRST);
bool fInReset = RT_BOOL(HDA_REG_IND(pThis, iReg) & HDA_SDCTL_SRST);
LogFunc(("[SD%RU8] fRun=%RTbool, fInRun=%RTbool, fReset=%RTbool, fInReset=%RTbool, %R[sdctl]\n",
uSD, fRun, fInRun, fReset, fInReset, u32Value));
/*
* Extract the stream tag the guest wants to use for this specific
* stream descriptor (SDn). This only can happen if the stream is in a non-running
* state, so we're doing the lookup and assignment here.
*
* So depending on the guest OS, SD3 can use stream tag 4, for example.
*/
uint8_t uTag = (u32Value >> HDA_SDCTL_NUM_SHIFT) & HDA_SDCTL_NUM_MASK;
if (uTag > HDA_MAX_TAGS)
{
LogFunc(("[SD%RU8] Warning: Invalid stream tag %RU8 specified!\n", uSD, uTag));
int rc = hdaRegWriteU24(pThis, iReg, u32Value);
DEVHDA_UNLOCK_BOTH(pThis, uSD);
return rc;
}
PHDATAG pTag = &pThis->aTags[uTag];
AssertPtr(pTag);
LogFunc(("[SD%RU8] Using stream tag=%RU8\n", uSD, uTag));
/* Assign new values. */
pTag->uTag = uTag;
pTag->pStream = hdaGetStreamFromSD(pThis, uSD);
PHDASTREAM pStream = pTag->pStream;
AssertPtr(pStream);
if (fInReset)
{
Assert(!fReset);
Assert(!fInRun && !fRun);
/* Exit reset state. */
ASMAtomicXchgBool(&pStream->State.fInReset, false);
/* Report that we're done resetting this stream by clearing SRST. */
HDA_STREAM_REG(pThis, CTL, uSD) &= ~HDA_SDCTL_SRST;
LogFunc(("[SD%RU8] Reset exit\n", uSD));
}
else if (fReset)
{
/* ICH6 datasheet 18.2.33 says that RUN bit should be cleared before initiation of reset. */
Assert(!fInRun && !fRun);
LogFunc(("[SD%RU8] Reset enter\n", uSD));
hdaR3StreamLock(pStream);
# ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
hdaR3StreamAsyncIOLock(pStream);
hdaR3StreamAsyncIOEnable(pStream, false /* fEnable */);
# endif
/* Make sure to remove the run bit before doing the actual stream reset. */
HDA_STREAM_REG(pThis, CTL, uSD) &= ~HDA_SDCTL_RUN;
hdaR3StreamReset(pThis, pStream, pStream->u8SD);
# ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
hdaR3StreamAsyncIOUnlock(pStream);
# endif
hdaR3StreamUnlock(pStream);
}
else
{
/*
* We enter here to change DMA states only.
*/
if (fInRun != fRun)
{
Assert(!fReset && !fInReset);
LogFunc(("[SD%RU8] State changed (fRun=%RTbool)\n", uSD, fRun));
hdaR3StreamLock(pStream);
int rc2;
# ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
if (fRun)
rc2 = hdaR3StreamAsyncIOCreate(pStream);
hdaR3StreamAsyncIOLock(pStream);
# endif
if (fRun)
{
# ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
hdaR3StreamAsyncIOEnable(pStream, fRun /* fEnable */);
# endif
/* (Re-)initialize the stream with current values. */
rc2 = hdaR3StreamInit(pStream, pStream->u8SD);
AssertRC(rc2);
/* Remove the old stream from the device setup. */
hdaR3RemoveStream(pThis, &pStream->State.Cfg);
/* Add the stream to the device setup. */
rc2 = hdaR3AddStream(pThis, &pStream->State.Cfg);
AssertRC(rc2);
}
/* Enable/disable the stream. */
rc2 = hdaR3StreamEnable(pStream, fRun /* fEnable */);
AssertRC(rc2);
if (fRun)
{
/* Keep track of running streams. */
pThis->cStreamsActive++;
/* (Re-)init the stream's period. */
hdaR3StreamPeriodInit(&pStream->State.Period,
pStream->u8SD, pStream->u16LVI, pStream->u32CBL, &pStream->State.Cfg);
/* Begin a new period for this stream. */
rc2 = hdaR3StreamPeriodBegin(&pStream->State.Period, hdaWalClkGetCurrent(pThis)/* Use current wall clock time */);
AssertRC(rc2);
rc2 = hdaR3TimerSet(pThis, pStream, TMTimerGet(pThis->pTimer[pStream->u8SD]) + pStream->State.cTransferTicks, false /* fForce */);
AssertRC(rc2);
}
else
{
/* Keep track of running streams. */
Assert(pThis->cStreamsActive);
if (pThis->cStreamsActive)
pThis->cStreamsActive--;
/* Make sure to (re-)schedule outstanding (delayed) interrupts. */
hdaR3ReschedulePendingInterrupts(pThis);
/* Reset the period. */
hdaR3StreamPeriodReset(&pStream->State.Period);
}
# ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
hdaR3StreamAsyncIOUnlock(pStream);
# endif
/* Make sure to leave the lock before (eventually) starting the timer. */
hdaR3StreamUnlock(pStream);
}
}
int rc2 = hdaRegWriteU24(pThis, iReg, u32Value);
AssertRC(rc2);
DEVHDA_UNLOCK_BOTH(pThis, uSD);
return VINF_SUCCESS; /* Always return success to the MMIO handler. */
#else /* !IN_RING3 */
RT_NOREF_PV(pThis); RT_NOREF_PV(iReg); RT_NOREF_PV(u32Value);
return VINF_IOM_R3_MMIO_WRITE;
#endif /* IN_RING3 */
}
static int hdaRegWriteSDSTS(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
{
#ifdef IN_RING3
const uint8_t uSD = HDA_SD_NUM_FROM_REG(pThis, STS, iReg);
DEVHDA_LOCK_BOTH_RETURN(pThis, uSD, VINF_IOM_R3_MMIO_WRITE);
PHDASTREAM pStream = hdaGetStreamFromSD(pThis, uSD);
if (!pStream)
{
AssertMsgFailed(("[SD%RU8] Warning: Writing SDSTS on non-attached stream (0x%x)\n",
HDA_SD_NUM_FROM_REG(pThis, STS, iReg), u32Value));
int rc = hdaRegWriteU16(pThis, iReg, u32Value);
DEVHDA_UNLOCK_BOTH(pThis, uSD);
return rc;
}
hdaR3StreamLock(pStream);
uint32_t v = HDA_REG_IND(pThis, iReg);
/* Clear (zero) FIFOE, DESE and BCIS bits when writing 1 to it (6.2.33). */
HDA_REG_IND(pThis, iReg) &= ~(u32Value & v);
/* Some guests tend to write SDnSTS even if the stream is not running.
* So make sure to check if the RUN bit is set first. */
const bool fRunning = pStream->State.fRunning;
Log3Func(("[SD%RU8] fRunning=%RTbool %R[sdsts]\n", pStream->u8SD, fRunning, v));
PHDASTREAMPERIOD pPeriod = &pStream->State.Period;
if (hdaR3StreamPeriodLock(pPeriod))
{
const bool fNeedsInterrupt = hdaR3StreamPeriodNeedsInterrupt(pPeriod);
if (fNeedsInterrupt)
hdaR3StreamPeriodReleaseInterrupt(pPeriod);
if (hdaR3StreamPeriodIsComplete(pPeriod))
{
/* Make sure to try to update the WALCLK register if a period is complete.
* Use the maximum WALCLK value all (active) streams agree to. */
const uint64_t uWalClkMax = hdaR3WalClkGetMax(pThis);
if (uWalClkMax > hdaWalClkGetCurrent(pThis))
hdaR3WalClkSet(pThis, uWalClkMax, false /* fForce */);
hdaR3StreamPeriodEnd(pPeriod);
if (fRunning)
hdaR3StreamPeriodBegin(pPeriod, hdaWalClkGetCurrent(pThis) /* Use current wall clock time */);
}
hdaR3StreamPeriodUnlock(pPeriod); /* Unlock before processing interrupt. */
}
# ifndef LOG_ENABLED
hdaProcessInterrupt(pThis);
# else
hdaProcessInterrupt(pThis, __FUNCTION__);
# endif
const uint64_t tsNow = TMTimerGet(pThis->pTimer[uSD]);
Assert(tsNow >= pStream->State.tsTransferLast);
const uint64_t cTicksElapsed = tsNow - pStream->State.tsTransferLast;
# ifdef LOG_ENABLED
const uint64_t cTicksTransferred = pStream->State.cbTransferProcessed * pStream->State.cTicksPerByte;
# endif
uint64_t cTicksToNext = pStream->State.cTransferTicks;
if (cTicksToNext) /* Only do any calculations if the stream currently is set up for transfers. */
{
Log3Func(("[SD%RU8] cTicksElapsed=%RU64, cTicksTransferred=%RU64, cTicksToNext=%RU64\n",
pStream->u8SD, cTicksElapsed, cTicksTransferred, cTicksToNext));
Log3Func(("[SD%RU8] cbTransferProcessed=%RU32, cbTransferChunk=%RU32, cbTransferSize=%RU32\n",
pStream->u8SD, pStream->State.cbTransferProcessed, pStream->State.cbTransferChunk, pStream->State.cbTransferSize));
if (cTicksElapsed <= cTicksToNext)
{
cTicksToNext = cTicksToNext - cTicksElapsed;
}
else /* Catch up. */
{
Log3Func(("[SD%RU8] Warning: Lagging behind (%RU64 ticks elapsed, maximum allowed is %RU64)\n",
pStream->u8SD, cTicksElapsed, cTicksToNext));
LogRelMax2(64, ("HDA: Stream #%RU8 interrupt lagging behind (expected %uus, got %uus), trying to catch up ...\n",
pStream->u8SD,
(TMTimerGetFreq(pThis->pTimer[pStream->u8SD]) / pThis->u16TimerHz) / 1000,(tsNow - pStream->State.tsTransferLast) / 1000));
cTicksToNext = 0;
}
Log3Func(("[SD%RU8] -> cTicksToNext=%RU64\n", pStream->u8SD, cTicksToNext));
/* Reset processed data counter. */
pStream->State.cbTransferProcessed = 0;
pStream->State.tsTransferNext = tsNow + cTicksToNext;
/* Only re-arm the timer if there were pending transfer interrupts left
* -- it could happen that we land in here if a guest writes to SDnSTS
* unconditionally. */
if (pStream->State.cTransferPendingInterrupts)
{
pStream->State.cTransferPendingInterrupts--;
/* Re-arm the timer. */
LogFunc(("Timer set SD%RU8\n", pStream->u8SD));
hdaR3TimerSet(pThis, pStream, tsNow + cTicksToNext, false /* fForce */);
}
}
hdaR3StreamUnlock(pStream);
DEVHDA_UNLOCK_BOTH(pThis, uSD);
return VINF_SUCCESS;
#else /* IN_RING3 */
RT_NOREF(pThis, iReg, u32Value);
return VINF_IOM_R3_MMIO_WRITE;
#endif /* !IN_RING3 */
}
static int hdaRegWriteSDLVI(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
{
DEVHDA_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_WRITE);
if (HDA_REG_IND(pThis, iReg) == u32Value) /* Value already set? */
{ /* nothing to do */ }
else
{
uint8_t uSD = HDA_SD_NUM_FROM_REG(pThis, LVI, iReg);
PHDASTREAM pStream = hdaGetStreamFromSD(pThis, uSD);
if (pStream)
{
/** @todo Validate LVI. */
pStream->u16LVI = u32Value;
LogFunc(("[SD%RU8] Updating LVI to %RU16\n", uSD, pStream->u16LVI));
#ifdef HDA_USE_DMA_ACCESS_HANDLER
if (hdaGetDirFromSD(uSD) == PDMAUDIODIR_OUT)
{
/* Try registering the DMA handlers.
* As we can't be sure in which order LVI + BDL base are set, try registering in both routines. */
if (hdaR3StreamRegisterDMAHandlers(pThis, pStream))
LogFunc(("[SD%RU8] DMA logging enabled\n", pStream->u8SD));
}
#endif
}
else
AssertMsgFailed(("[SD%RU8] Warning: Changing SDLVI on non-attached stream (0x%x)\n", uSD, u32Value));
int rc2 = hdaRegWriteU16(pThis, iReg, u32Value);
AssertRC(rc2);
}
DEVHDA_UNLOCK(pThis);
return VINF_SUCCESS; /* Always return success to the MMIO handler. */
}
static int hdaRegWriteSDFIFOW(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
{
DEVHDA_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_WRITE);
uint8_t uSD = HDA_SD_NUM_FROM_REG(pThis, FIFOW, iReg);
if (hdaGetDirFromSD(uSD) != PDMAUDIODIR_IN) /* FIFOW for input streams only. */
{
#ifndef IN_RING0
LogRel(("HDA: Warning: Guest tried to write read-only FIFOW to output stream #%RU8, ignoring\n", uSD));
DEVHDA_UNLOCK(pThis);
return VINF_SUCCESS;
#else
DEVHDA_UNLOCK(pThis);
return VINF_IOM_R3_MMIO_WRITE;
#endif
}
PHDASTREAM pStream = hdaGetStreamFromSD(pThis, HDA_SD_NUM_FROM_REG(pThis, FIFOW, iReg));
if (!pStream)
{
AssertMsgFailed(("[SD%RU8] Warning: Changing FIFOW on non-attached stream (0x%x)\n", uSD, u32Value));
int rc = hdaRegWriteU16(pThis, iReg, u32Value);
DEVHDA_UNLOCK(pThis);
return rc;
}
uint32_t u32FIFOW = 0;
switch (u32Value)
{
case HDA_SDFIFOW_8B:
case HDA_SDFIFOW_16B:
case HDA_SDFIFOW_32B:
u32FIFOW = u32Value;
break;
default:
ASSERT_GUEST_LOGREL_MSG_FAILED(("Guest tried write unsupported FIFOW (0x%x) to stream #%RU8, defaulting to 32 bytes\n",
u32Value, uSD));
u32FIFOW = HDA_SDFIFOW_32B;
break;
}
if (u32FIFOW)
{
pStream->u16FIFOW = hdaSDFIFOWToBytes(u32FIFOW);
LogFunc(("[SD%RU8] Updating FIFOW to %RU32 bytes\n", uSD, pStream->u16FIFOW));
int rc2 = hdaRegWriteU16(pThis, iReg, u32FIFOW);
AssertRC(rc2);
}
DEVHDA_UNLOCK(pThis);
return VINF_SUCCESS; /* Always return success to the MMIO handler. */
}
/**
* @note This method could be called for changing value on Output Streams only (ICH6 datasheet 18.2.39).
*/
static int hdaRegWriteSDFIFOS(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
{
DEVHDA_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_WRITE);
uint8_t uSD = HDA_SD_NUM_FROM_REG(pThis, FIFOS, iReg);
if (hdaGetDirFromSD(uSD) != PDMAUDIODIR_OUT) /* FIFOS for output streams only. */
{
LogRel(("HDA: Warning: Guest tried to write read-only FIFOS to input stream #%RU8, ignoring\n", uSD));
DEVHDA_UNLOCK(pThis);
return VINF_SUCCESS;
}
PHDASTREAM pStream = hdaGetStreamFromSD(pThis, uSD);
if (!pStream)
{
AssertMsgFailed(("[SD%RU8] Warning: Changing FIFOS on non-attached stream (0x%x)\n", uSD, u32Value));
int rc = hdaRegWriteU16(pThis, iReg, u32Value);
DEVHDA_UNLOCK(pThis);
return rc;
}
uint32_t u32FIFOS = 0;
switch(u32Value)
{
case HDA_SDOFIFO_16B:
case HDA_SDOFIFO_32B:
case HDA_SDOFIFO_64B:
case HDA_SDOFIFO_128B:
case HDA_SDOFIFO_192B:
case HDA_SDOFIFO_256B:
u32FIFOS = u32Value;
break;
default:
ASSERT_GUEST_LOGREL_MSG_FAILED(("Guest tried write unsupported FIFOS (0x%x) to stream #%RU8, defaulting to 192 bytes\n",
u32Value, uSD));
u32FIFOS = HDA_SDOFIFO_192B;
break;
}
if (u32FIFOS)
{
pStream->u16FIFOS = u32FIFOS + 1;
LogFunc(("[SD%RU8] Updating FIFOS to %RU32 bytes\n", uSD, pStream->u16FIFOS));
int rc2 = hdaRegWriteU16(pThis, iReg, u32FIFOS);
AssertRC(rc2);
}
DEVHDA_UNLOCK(pThis);
return VINF_SUCCESS; /* Always return success to the MMIO handler. */
}
#ifdef IN_RING3
/**
* Adds an audio output stream to the device setup using the given configuration.
*
* @returns IPRT status code.
* @param pThis Device state.
* @param pCfg Stream configuration to use for adding a stream.
*/
static int hdaR3AddStreamOut(PHDASTATE pThis, PPDMAUDIOSTREAMCFG pCfg)
{
AssertPtrReturn(pThis, VERR_INVALID_POINTER);
AssertPtrReturn(pCfg, VERR_INVALID_POINTER);
AssertReturn(pCfg->enmDir == PDMAUDIODIR_OUT, VERR_INVALID_PARAMETER);
LogFlowFunc(("Stream=%s\n", pCfg->szName));
int rc = VINF_SUCCESS;
bool fUseFront = true; /* Always use front out by default. */
# ifdef VBOX_WITH_AUDIO_HDA_51_SURROUND
bool fUseRear;
bool fUseCenter;
bool fUseLFE;
fUseRear = fUseCenter = fUseLFE = false;
/*
* Use commonly used setups for speaker configurations.
*/
/** @todo Make the following configurable through mixer API and/or CFGM? */
switch (pCfg->Props.cChannels)
{
case 3: /* 2.1: Front (Stereo) + LFE. */
{
fUseLFE = true;
break;
}
case 4: /* Quadrophonic: Front (Stereo) + Rear (Stereo). */
{
fUseRear = true;
break;
}
case 5: /* 4.1: Front (Stereo) + Rear (Stereo) + LFE. */
{
fUseRear = true;
fUseLFE = true;
break;
}
case 6: /* 5.1: Front (Stereo) + Rear (Stereo) + Center/LFE. */
{
fUseRear = true;
fUseCenter = true;
fUseLFE = true;
break;
}
default: /* Unknown; fall back to 2 front channels (stereo). */
{
rc = VERR_NOT_SUPPORTED;
break;
}
}
# else /* !VBOX_WITH_AUDIO_HDA_51_SURROUND */
/* Only support mono or stereo channels. */
if ( pCfg->Props.cChannels != 1 /* Mono */
&& pCfg->Props.cChannels != 2 /* Stereo */)
{
rc = VERR_NOT_SUPPORTED;
}
# endif /* !VBOX_WITH_AUDIO_HDA_51_SURROUND */
if (rc == VERR_NOT_SUPPORTED)
{
LogRel2(("HDA: Warning: Unsupported channel count (%RU8), falling back to stereo channels (2)\n", pCfg->Props.cChannels));
/* Fall back to 2 channels (see below in fUseFront block). */
rc = VINF_SUCCESS;
}
do
{
if (RT_FAILURE(rc))
break;
if (fUseFront)
{
RTStrPrintf(pCfg->szName, RT_ELEMENTS(pCfg->szName), "Front");
pCfg->DestSource.Dest = PDMAUDIOPLAYBACKDEST_FRONT;
pCfg->enmLayout = PDMAUDIOSTREAMLAYOUT_NON_INTERLEAVED;
pCfg->Props.cChannels = 2;
pCfg->Props.cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pCfg->Props.cBits, pCfg->Props.cChannels);
rc = hdaCodecAddStream(pThis->pCodec, PDMAUDIOMIXERCTL_FRONT, pCfg);
}
# ifdef VBOX_WITH_AUDIO_HDA_51_SURROUND
if ( RT_SUCCESS(rc)
&& (fUseCenter || fUseLFE))
{
RTStrPrintf(pCfg->szName, RT_ELEMENTS(pCfg->szName), "Center/LFE");
pCfg->DestSource.Dest = PDMAUDIOPLAYBACKDEST_CENTER_LFE;
pCfg->enmLayout = PDMAUDIOSTREAMLAYOUT_NON_INTERLEAVED;
pCfg->Props.cChannels = (fUseCenter && fUseLFE) ? 2 : 1;
pCfg->Props.cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pCfg->Props.cBits, pCfg->Props.cChannels);
rc = hdaCodecAddStream(pThis->pCodec, PDMAUDIOMIXERCTL_CENTER_LFE, pCfg);
}
if ( RT_SUCCESS(rc)
&& fUseRear)
{
RTStrPrintf(pCfg->szName, RT_ELEMENTS(pCfg->szName), "Rear");
pCfg->DestSource.Dest = PDMAUDIOPLAYBACKDEST_REAR;
pCfg->enmLayout = PDMAUDIOSTREAMLAYOUT_NON_INTERLEAVED;
pCfg->Props.cChannels = 2;
pCfg->Props.cShift = PDMAUDIOPCMPROPS_MAKE_SHIFT_PARMS(pCfg->Props.cBits, pCfg->Props.cChannels);
rc = hdaCodecAddStream(pThis->pCodec, PDMAUDIOMIXERCTL_REAR, pCfg);
}
# endif /* VBOX_WITH_AUDIO_HDA_51_SURROUND */
} while (0);
LogFlowFuncLeaveRC(rc);
return rc;
}
/**
* Adds an audio input stream to the device setup using the given configuration.
*
* @returns IPRT status code.
* @param pThis Device state.
* @param pCfg Stream configuration to use for adding a stream.
*/
static int hdaR3AddStreamIn(PHDASTATE pThis, PPDMAUDIOSTREAMCFG pCfg)
{
AssertPtrReturn(pThis, VERR_INVALID_POINTER);
AssertPtrReturn(pCfg, VERR_INVALID_POINTER);
AssertReturn(pCfg->enmDir == PDMAUDIODIR_IN, VERR_INVALID_PARAMETER);
LogFlowFunc(("Stream=%s, Source=%ld\n", pCfg->szName, pCfg->DestSource.Source));
int rc;
switch (pCfg->DestSource.Source)
{
case PDMAUDIORECSOURCE_LINE:
{
rc = hdaCodecAddStream(pThis->pCodec, PDMAUDIOMIXERCTL_LINE_IN, pCfg);
break;
}
# ifdef VBOX_WITH_AUDIO_HDA_MIC_IN
case PDMAUDIORECSOURCE_MIC:
{
rc = hdaCodecAddStream(pThis->pCodec, PDMAUDIOMIXERCTL_MIC_IN, pCfg);
break;
}
# endif
default:
rc = VERR_NOT_SUPPORTED;
break;
}
LogFlowFuncLeaveRC(rc);
return rc;
}
/**
* Adds an audio stream to the device setup using the given configuration.
*
* @returns IPRT status code.
* @param pThis Device state.
* @param pCfg Stream configuration to use for adding a stream.
*/
static int hdaR3AddStream(PHDASTATE pThis, PPDMAUDIOSTREAMCFG pCfg)
{
AssertPtrReturn(pThis, VERR_INVALID_POINTER);
AssertPtrReturn(pCfg, VERR_INVALID_POINTER);
int rc;
LogFlowFuncEnter();
switch (pCfg->enmDir)
{
case PDMAUDIODIR_OUT:
rc = hdaR3AddStreamOut(pThis, pCfg);
break;
case PDMAUDIODIR_IN:
rc = hdaR3AddStreamIn(pThis, pCfg);
break;
default:
rc = VERR_NOT_SUPPORTED;
AssertFailed();
break;
}
LogFlowFunc(("Returning %Rrc\n", rc));
return rc;
}
/**
* Removes an audio stream from the device setup using the given configuration.
*
* @returns IPRT status code.
* @param pThis Device state.
* @param pCfg Stream configuration to use for removing a stream.
*/
static int hdaR3RemoveStream(PHDASTATE pThis, PPDMAUDIOSTREAMCFG pCfg)
{
AssertPtrReturn(pThis, VERR_INVALID_POINTER);
AssertPtrReturn(pCfg, VERR_INVALID_POINTER);
int rc = VINF_SUCCESS;
PDMAUDIOMIXERCTL enmMixerCtl = PDMAUDIOMIXERCTL_UNKNOWN;
switch (pCfg->enmDir)
{
case PDMAUDIODIR_IN:
{
LogFlowFunc(("Stream=%s, Source=%ld\n", pCfg->szName, pCfg->DestSource.Source));
switch (pCfg->DestSource.Source)
{
case PDMAUDIORECSOURCE_LINE: enmMixerCtl = PDMAUDIOMIXERCTL_LINE_IN; break;
# ifdef VBOX_WITH_AUDIO_HDA_MIC_IN
case PDMAUDIORECSOURCE_MIC: enmMixerCtl = PDMAUDIOMIXERCTL_MIC_IN; break;
# endif
default:
rc = VERR_NOT_SUPPORTED;
break;
}
break;
}
case PDMAUDIODIR_OUT:
{
LogFlowFunc(("Stream=%s, Source=%ld\n", pCfg->szName, pCfg->DestSource.Dest));
switch (pCfg->DestSource.Dest)
{
case PDMAUDIOPLAYBACKDEST_FRONT: enmMixerCtl = PDMAUDIOMIXERCTL_FRONT; break;
# ifdef VBOX_WITH_AUDIO_HDA_51_SURROUND
case PDMAUDIOPLAYBACKDEST_CENTER_LFE: enmMixerCtl = PDMAUDIOMIXERCTL_CENTER_LFE; break;
case PDMAUDIOPLAYBACKDEST_REAR: enmMixerCtl = PDMAUDIOMIXERCTL_REAR; break;
# endif
default:
rc = VERR_NOT_SUPPORTED;
break;
}
break;
}
default:
rc = VERR_NOT_SUPPORTED;
break;
}
if (RT_SUCCESS(rc))
rc = hdaCodecRemoveStream(pThis->pCodec, enmMixerCtl);
LogFlowFuncLeaveRC(rc);
return rc;
}
/**
* Updates an audio device stream with the given configuration.
*
* @returns IPRT status code.
* @param pThis HDA state.
* @param pCfg Stream configuration to apply.
*/
static int hdaR3UpdateStream(PHDASTATE pThis, PPDMAUDIOSTREAMCFG pCfg)
{
/* Remove the old stream from the device setup. */
hdaR3RemoveStream(pThis, pCfg);
/* Add the stream to the device setup. */
return hdaR3AddStream(pThis, pCfg);
}
#endif /* IN_RING3 */
static int hdaRegWriteSDFMT(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
{
DEVHDA_LOCK(pThis);
# ifdef LOG_ENABLED
if (!hdaGetStreamFromSD(pThis, HDA_SD_NUM_FROM_REG(pThis, FMT, iReg)))
LogFunc(("[SD%RU8] Warning: Changing SDFMT on non-attached stream (0x%x)\n",
HDA_SD_NUM_FROM_REG(pThis, FMT, iReg), u32Value));
# endif
/* Write the wanted stream format into the register in any case.
*
* This is important for e.g. MacOS guests, as those try to initialize streams which are not reported
* by the device emulation (wants 4 channels, only have 2 channels at the moment).
*
* When ignoring those (invalid) formats, this leads to MacOS thinking that the device is malfunctioning
* and therefore disabling the device completely. */
int rc = hdaRegWriteU16(pThis, iReg, u32Value);
AssertRC(rc);
DEVHDA_UNLOCK(pThis);
return VINF_SUCCESS; /* Never return failure. */
}
/* Note: Will be called for both, BDPL and BDPU, registers. */
DECLINLINE(int) hdaRegWriteSDBDPX(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value, uint8_t uSD)
{
#ifdef IN_RING3
DEVHDA_LOCK(pThis);
int rc2 = hdaRegWriteU32(pThis, iReg, u32Value);
AssertRC(rc2);
PHDASTREAM pStream = hdaGetStreamFromSD(pThis, uSD);
if (!pStream)
{
DEVHDA_UNLOCK(pThis);
return VINF_SUCCESS;
}
/* Update BDL base. */
pStream->u64BDLBase = RT_MAKE_U64(HDA_STREAM_REG(pThis, BDPL, uSD),
HDA_STREAM_REG(pThis, BDPU, uSD));
# ifdef HDA_USE_DMA_ACCESS_HANDLER
if (hdaGetDirFromSD(uSD) == PDMAUDIODIR_OUT)
{
/* Try registering the DMA handlers.
* As we can't be sure in which order LVI + BDL base are set, try registering in both routines. */
if (hdaR3StreamRegisterDMAHandlers(pThis, pStream))
LogFunc(("[SD%RU8] DMA logging enabled\n", pStream->u8SD));
}
# endif
LogFlowFunc(("[SD%RU8] BDLBase=0x%x\n", pStream->u8SD, pStream->u64BDLBase));
DEVHDA_UNLOCK(pThis);
return VINF_SUCCESS; /* Always return success to the MMIO handler. */
#else /* !IN_RING3 */
RT_NOREF_PV(pThis); RT_NOREF_PV(iReg); RT_NOREF_PV(u32Value); RT_NOREF_PV(uSD);
return VINF_IOM_R3_MMIO_WRITE;
#endif /* IN_RING3 */
}
static int hdaRegWriteSDBDPL(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
{
return hdaRegWriteSDBDPX(pThis, iReg, u32Value, HDA_SD_NUM_FROM_REG(pThis, BDPL, iReg));
}
static int hdaRegWriteSDBDPU(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
{
return hdaRegWriteSDBDPX(pThis, iReg, u32Value, HDA_SD_NUM_FROM_REG(pThis, BDPU, iReg));
}
static int hdaRegReadIRS(PHDASTATE pThis, uint32_t iReg, uint32_t *pu32Value)
{
DEVHDA_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_READ);
/* regarding 3.4.3 we should mark IRS as busy in case CORB is active */
if ( HDA_REG(pThis, CORBWP) != HDA_REG(pThis, CORBRP)
|| (HDA_REG(pThis, CORBCTL) & HDA_CORBCTL_DMA))
{
HDA_REG(pThis, IRS) = HDA_IRS_ICB; /* busy */
}
int rc = hdaRegReadU32(pThis, iReg, pu32Value);
DEVHDA_UNLOCK(pThis);
return rc;
}
static int hdaRegWriteIRS(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
{
RT_NOREF_PV(iReg);
DEVHDA_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_WRITE);
/*
* If the guest set the ICB bit of IRS register, HDA should process the verb in IC register,
* write the response to IR register, and set the IRV (valid in case of success) bit of IRS register.
*/
if ( (u32Value & HDA_IRS_ICB)
&& !(HDA_REG(pThis, IRS) & HDA_IRS_ICB))
{
#ifdef IN_RING3
uint32_t uCmd = HDA_REG(pThis, IC);
if (HDA_REG(pThis, CORBWP) != HDA_REG(pThis, CORBRP))
{
DEVHDA_UNLOCK(pThis);
/*
* 3.4.3: Defines behavior of immediate Command status register.
*/
LogRel(("HDA: Guest attempted process immediate verb (%x) with active CORB\n", uCmd));
return VINF_SUCCESS;
}
HDA_REG(pThis, IRS) = HDA_IRS_ICB; /* busy */
uint64_t uResp;
int rc2 = pThis->pCodec->pfnLookup(pThis->pCodec,
HDA_CODEC_CMD(uCmd, 0 /* LUN */), &uResp);
if (RT_FAILURE(rc2))
LogFunc(("Codec lookup failed with rc2=%Rrc\n", rc2));
HDA_REG(pThis, IR) = (uint32_t)uResp; /** @todo r=andy Do we need a 64-bit response? */
HDA_REG(pThis, IRS) = HDA_IRS_IRV; /* result is ready */
/** @todo r=michaln We just set the IRS value, why are we clearing unset bits? */
HDA_REG(pThis, IRS) &= ~HDA_IRS_ICB; /* busy is clear */
DEVHDA_UNLOCK(pThis);
return VINF_SUCCESS;
#else /* !IN_RING3 */
DEVHDA_UNLOCK(pThis);
return VINF_IOM_R3_MMIO_WRITE;
#endif /* !IN_RING3 */
}
/*
* Once the guest read the response, it should clear the IRV bit of the IRS register.
*/
HDA_REG(pThis, IRS) &= ~(u32Value & HDA_IRS_IRV);
DEVHDA_UNLOCK(pThis);
return VINF_SUCCESS;
}
static int hdaRegWriteRIRBWP(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
{
RT_NOREF(iReg);
DEVHDA_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_WRITE);
if (HDA_REG(pThis, CORBCTL) & HDA_CORBCTL_DMA) /* Ignore request if CORB DMA engine is (still) running. */
{
LogFunc(("CORB DMA (still) running, skipping\n"));
DEVHDA_UNLOCK(pThis);
return VINF_SUCCESS;
}
if (u32Value & HDA_RIRBWP_RST)
{
/* Do a RIRB reset. */
if (pThis->cbRirbBuf)
{
Assert(pThis->pu64RirbBuf);
RT_BZERO((void *)pThis->pu64RirbBuf, pThis->cbRirbBuf);
}
LogRel2(("HDA: RIRB reset\n"));
HDA_REG(pThis, RIRBWP) = 0;
}
/* The remaining bits are O, see 6.2.22. */
DEVHDA_UNLOCK(pThis);
return VINF_SUCCESS;
}
static int hdaRegWriteRINTCNT(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
{
DEVHDA_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_WRITE);
if (HDA_REG(pThis, CORBCTL) & HDA_CORBCTL_DMA) /* Ignore request if CORB DMA engine is (still) running. */
{
LogFunc(("CORB DMA is (still) running, skipping\n"));
DEVHDA_UNLOCK(pThis);
return VINF_SUCCESS;
}
int rc = hdaRegWriteU16(pThis, iReg, u32Value);
AssertRC(rc);
LogFunc(("Response interrupt count is now %RU8\n", HDA_REG(pThis, RINTCNT) & 0xFF));
DEVHDA_UNLOCK(pThis);
return rc;
}
static int hdaRegWriteBase(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
{
uint32_t iRegMem = g_aHdaRegMap[iReg].mem_idx;
DEVHDA_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_WRITE);
int rc = hdaRegWriteU32(pThis, iReg, u32Value);
AssertRCSuccess(rc);
switch (iReg)
{
case HDA_REG_CORBLBASE:
pThis->u64CORBBase &= UINT64_C(0xFFFFFFFF00000000);
pThis->u64CORBBase |= pThis->au32Regs[iRegMem];
break;
case HDA_REG_CORBUBASE:
pThis->u64CORBBase &= UINT64_C(0x00000000FFFFFFFF);
pThis->u64CORBBase |= ((uint64_t)pThis->au32Regs[iRegMem] << 32);
break;
case HDA_REG_RIRBLBASE:
pThis->u64RIRBBase &= UINT64_C(0xFFFFFFFF00000000);
pThis->u64RIRBBase |= pThis->au32Regs[iRegMem];
break;
case HDA_REG_RIRBUBASE:
pThis->u64RIRBBase &= UINT64_C(0x00000000FFFFFFFF);
pThis->u64RIRBBase |= ((uint64_t)pThis->au32Regs[iRegMem] << 32);
break;
case HDA_REG_DPLBASE:
{
pThis->u64DPBase = pThis->au32Regs[iRegMem] & DPBASE_ADDR_MASK;
Assert(pThis->u64DPBase % 128 == 0); /* Must be 128-byte aligned. */
/* Also make sure to handle the DMA position enable bit. */
pThis->fDMAPosition = pThis->au32Regs[iRegMem] & RT_BIT_32(0);
LogRel(("HDA: %s DMA position buffer\n", pThis->fDMAPosition ? "Enabled" : "Disabled"));
break;
}
case HDA_REG_DPUBASE:
pThis->u64DPBase = RT_MAKE_U64(RT_LO_U32(pThis->u64DPBase) & DPBASE_ADDR_MASK, pThis->au32Regs[iRegMem]);
break;
default:
AssertMsgFailed(("Invalid index\n"));
break;
}
LogFunc(("CORB base:%llx RIRB base: %llx DP base: %llx\n",
pThis->u64CORBBase, pThis->u64RIRBBase, pThis->u64DPBase));
DEVHDA_UNLOCK(pThis);
return rc;
}
static int hdaRegWriteRIRBSTS(PHDASTATE pThis, uint32_t iReg, uint32_t u32Value)
{
RT_NOREF_PV(iReg);
DEVHDA_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_WRITE);
uint8_t v = HDA_REG(pThis, RIRBSTS);
HDA_REG(pThis, RIRBSTS) &= ~(v & u32Value);
#ifndef LOG_ENABLED
int rc = hdaProcessInterrupt(pThis);
#else
int rc = hdaProcessInterrupt(pThis, __FUNCTION__);
#endif
DEVHDA_UNLOCK(pThis);
return rc;
}
#ifdef IN_RING3
/**
* Retrieves a corresponding sink for a given mixer control.
* Returns NULL if no sink is found.
*
* @return PHDAMIXERSINK
* @param pThis HDA state.
* @param enmMixerCtl Mixer control to get the corresponding sink for.
*/
static PHDAMIXERSINK hdaR3MixerControlToSink(PHDASTATE pThis, PDMAUDIOMIXERCTL enmMixerCtl)
{
PHDAMIXERSINK pSink;
switch (enmMixerCtl)
{
case PDMAUDIOMIXERCTL_VOLUME_MASTER:
/* Fall through is intentional. */
case PDMAUDIOMIXERCTL_FRONT:
pSink = &pThis->SinkFront;
break;
# ifdef VBOX_WITH_AUDIO_HDA_51_SURROUND
case PDMAUDIOMIXERCTL_CENTER_LFE:
pSink = &pThis->SinkCenterLFE;
break;
case PDMAUDIOMIXERCTL_REAR:
pSink = &pThis->SinkRear;
break;
# endif
case PDMAUDIOMIXERCTL_LINE_IN:
pSink = &pThis->SinkLineIn;
break;
# ifdef VBOX_WITH_AUDIO_HDA_MIC_IN
case PDMAUDIOMIXERCTL_MIC_IN:
pSink = &pThis->SinkMicIn;
break;
# endif
default:
pSink = NULL;
AssertMsgFailed(("Unhandled mixer control\n"));
break;
}
return pSink;
}
/**
* Adds a driver stream to a specific mixer sink.
*
* @returns IPRT status code (ignored by caller).
* @param pThis HDA state.
* @param pMixSink Audio mixer sink to add audio streams to.
* @param pCfg Audio stream configuration to use for the audio streams to add.
* @param pDrv Driver stream to add.
*/
static int hdaR3MixerAddDrvStream(PHDASTATE pThis, PAUDMIXSINK pMixSink, PPDMAUDIOSTREAMCFG pCfg, PHDADRIVER pDrv)
{
AssertPtrReturn(pThis, VERR_INVALID_POINTER);
AssertPtrReturn(pMixSink, VERR_INVALID_POINTER);
AssertPtrReturn(pCfg, VERR_INVALID_POINTER);
LogFunc(("Sink=%s, Stream=%s\n", pMixSink->pszName, pCfg->szName));
PPDMAUDIOSTREAMCFG pStreamCfg = DrvAudioHlpStreamCfgDup(pCfg);
if (!pStreamCfg)
return VERR_NO_MEMORY;
LogFunc(("[LUN#%RU8] %s\n", pDrv->uLUN, pStreamCfg->szName));
int rc = VINF_SUCCESS;
PHDADRIVERSTREAM pDrvStream = NULL;
if (pStreamCfg->enmDir == PDMAUDIODIR_IN)
{
LogFunc(("enmRecSource=%d\n", pStreamCfg->DestSource.Source));
switch (pStreamCfg->DestSource.Source)
{
case PDMAUDIORECSOURCE_LINE:
pDrvStream = &pDrv->LineIn;
break;
# ifdef VBOX_WITH_AUDIO_HDA_MIC_IN
case PDMAUDIORECSOURCE_MIC:
pDrvStream = &pDrv->MicIn;
break;
# endif
default:
rc = VERR_NOT_SUPPORTED;
break;
}
}
else if (pStreamCfg->enmDir == PDMAUDIODIR_OUT)
{
LogFunc(("enmPlaybackDest=%d\n", pStreamCfg->DestSource.Dest));
switch (pStreamCfg->DestSource.Dest)
{
case PDMAUDIOPLAYBACKDEST_FRONT:
pDrvStream = &pDrv->Front;
break;
# ifdef VBOX_WITH_AUDIO_HDA_51_SURROUND
case PDMAUDIOPLAYBACKDEST_CENTER_LFE:
pDrvStream = &pDrv->CenterLFE;
break;
case PDMAUDIOPLAYBACKDEST_REAR:
pDrvStream = &pDrv->Rear;
break;
# endif
default:
rc = VERR_NOT_SUPPORTED;
break;
}
}
else
rc = VERR_NOT_SUPPORTED;
if (RT_SUCCESS(rc))
{
AssertPtr(pDrvStream);
AssertMsg(pDrvStream->pMixStrm == NULL, ("[LUN#%RU8] Driver stream already present when it must not\n", pDrv->uLUN));
PAUDMIXSTREAM pMixStrm;
rc = AudioMixerSinkCreateStream(pMixSink, pDrv->pConnector, pStreamCfg, 0 /* fFlags */, &pMixStrm);
LogFlowFunc(("LUN#%RU8: Created stream \"%s\" for sink, rc=%Rrc\n", pDrv->uLUN, pStreamCfg->szName, rc));
if (RT_SUCCESS(rc))
{
rc = AudioMixerSinkAddStream(pMixSink, pMixStrm);
LogFlowFunc(("LUN#%RU8: Added stream \"%s\" to sink, rc=%Rrc\n", pDrv->uLUN, pStreamCfg->szName, rc));
if (RT_SUCCESS(rc))
{
/* If this is an input stream, always set the latest (added) stream
* as the recording source.
* @todo Make the recording source dynamic (CFGM?). */
if (pStreamCfg->enmDir == PDMAUDIODIR_IN)
{
PDMAUDIOBACKENDCFG Cfg;
rc = pDrv->pConnector->pfnGetConfig(pDrv->pConnector, &Cfg);
if ( RT_SUCCESS(rc)
&& Cfg.cMaxStreamsIn) /* At least one input source available? */
{
rc = AudioMixerSinkSetRecordingSource(pMixSink, pMixStrm);
LogFlowFunc(("LUN#%RU8: Recording source is now '%s', rc=%Rrc\n", pDrv->uLUN, pStreamCfg->szName, rc));
LogRel2(("HDA: Set recording source to '%s'\n", pStreamCfg->szName));
}
else if (RT_FAILURE(rc))
LogFunc(("LUN#%RU8: Unable to retrieve backend configuratio for '%s', rc=%Rrc\n",
pDrv->uLUN, pStreamCfg->szName, rc));
}
}
}
if (RT_SUCCESS(rc))
pDrvStream->pMixStrm = pMixStrm;
}
RTMemFree(pStreamCfg);
LogFlowFuncLeaveRC(rc);
return rc;
}
/**
* Adds all current driver streams to a specific mixer sink.
*
* @returns IPRT status code.
* @param pThis HDA state.
* @param pMixSink Audio mixer sink to add stream to.
* @param pCfg Audio stream configuration to use for the audio streams to add.
*/
static int hdaR3MixerAddDrvStreams(PHDASTATE pThis, PAUDMIXSINK pMixSink, PPDMAUDIOSTREAMCFG pCfg)
{
AssertPtrReturn(pThis, VERR_INVALID_POINTER);
AssertPtrReturn(pMixSink, VERR_INVALID_POINTER);
AssertPtrReturn(pCfg, VERR_INVALID_POINTER);
LogFunc(("Sink=%s, Stream=%s\n", pMixSink->pszName, pCfg->szName));
if (!DrvAudioHlpStreamCfgIsValid(pCfg))
return VERR_INVALID_PARAMETER;
int rc = AudioMixerSinkSetFormat(pMixSink, &pCfg->Props);
if (RT_FAILURE(rc))
return rc;
PHDADRIVER pDrv;
RTListForEach(&pThis->lstDrv, pDrv, HDADRIVER, Node)
{
int rc2 = hdaR3MixerAddDrvStream(pThis, pMixSink, pCfg, pDrv);
if (RT_FAILURE(rc2))
LogFunc(("Attaching stream failed with %Rrc\n", rc2));
/* Do not pass failure to rc here, as there might be drivers which aren't
* configured / ready yet. */
}
return rc;
}
/**
* @interface_method_impl{HDACODEC,pfnCbMixerAddStream}
*
* Adds a new audio stream to a specific mixer control.
*
* Depending on the mixer control the stream then gets assigned to one of the internal
* mixer sinks, which in turn then handle the mixing of all connected streams to that sink.
*
* @return IPRT status code.
* @param pThis HDA state.
* @param enmMixerCtl Mixer control to assign new stream to.
* @param pCfg Stream configuration for the new stream.
*/
static DECLCALLBACK(int) hdaR3MixerAddStream(PHDASTATE pThis, PDMAUDIOMIXERCTL enmMixerCtl, PPDMAUDIOSTREAMCFG pCfg)
{
AssertPtrReturn(pThis, VERR_INVALID_POINTER);
AssertPtrReturn(pCfg, VERR_INVALID_POINTER);
int rc;
PHDAMIXERSINK pSink = hdaR3MixerControlToSink(pThis, enmMixerCtl);
if (pSink)
{
rc = hdaR3MixerAddDrvStreams(pThis, pSink->pMixSink, pCfg);
AssertPtr(pSink->pMixSink);
LogFlowFunc(("Sink=%s, Mixer control=%s\n", pSink->pMixSink->pszName, DrvAudioHlpAudMixerCtlToStr(enmMixerCtl)));
}
else
rc = VERR_NOT_FOUND;
LogFlowFuncLeaveRC(rc);
return rc;
}
/**
* @interface_method_impl{HDACODEC,pfnCbMixerRemoveStream}
*
* Removes a specified mixer control from the HDA's mixer.
*
* @return IPRT status code.
* @param pThis HDA state.
* @param enmMixerCtl Mixer control to remove.
*
* @remarks Can be called as a callback by the HDA codec.
*/
static DECLCALLBACK(int) hdaR3MixerRemoveStream(PHDASTATE pThis, PDMAUDIOMIXERCTL enmMixerCtl)
{
AssertPtrReturn(pThis, VERR_INVALID_POINTER);
int rc;
PHDAMIXERSINK pSink = hdaR3MixerControlToSink(pThis, enmMixerCtl);
if (pSink)
{
PHDADRIVER pDrv;
RTListForEach(&pThis->lstDrv, pDrv, HDADRIVER, Node)
{
PAUDMIXSTREAM pMixStream = NULL;
switch (enmMixerCtl)
{
/*
* Input.
*/
case PDMAUDIOMIXERCTL_LINE_IN:
pMixStream = pDrv->LineIn.pMixStrm;
pDrv->LineIn.pMixStrm = NULL;
break;
# ifdef VBOX_WITH_AUDIO_HDA_MIC_IN
case PDMAUDIOMIXERCTL_MIC_IN:
pMixStream = pDrv->MicIn.pMixStrm;
pDrv->MicIn.pMixStrm = NULL;
break;
# endif
/*
* Output.
*/
case PDMAUDIOMIXERCTL_FRONT:
pMixStream = pDrv->Front.pMixStrm;
pDrv->Front.pMixStrm = NULL;
break;
# ifdef VBOX_WITH_AUDIO_HDA_51_SURROUND
case PDMAUDIOMIXERCTL_CENTER_LFE:
pMixStream = pDrv->CenterLFE.pMixStrm;
pDrv->CenterLFE.pMixStrm = NULL;
break;
case PDMAUDIOMIXERCTL_REAR:
pMixStream = pDrv->Rear.pMixStrm;
pDrv->Rear.pMixStrm = NULL;
break;
# endif
default:
AssertMsgFailed(("Mixer control %d not implemented\n", enmMixerCtl));
break;
}
if (pMixStream)
{
AudioMixerSinkRemoveStream(pSink->pMixSink, pMixStream);
AudioMixerStreamDestroy(pMixStream);
pMixStream = NULL;
}
}
AudioMixerSinkRemoveAllStreams(pSink->pMixSink);
rc = VINF_SUCCESS;
}
else
rc = VERR_NOT_FOUND;
LogFunc(("Mixer control=%s, rc=%Rrc\n", DrvAudioHlpAudMixerCtlToStr(enmMixerCtl), rc));
return rc;
}
/**
* @interface_method_impl{HDACODEC,pfnCbMixerControl}
*
* Controls an input / output converter widget, that is, which converter is connected
* to which stream (and channel).
*
* @returns IPRT status code.
* @param pThis HDA State.
* @param enmMixerCtl Mixer control to set SD stream number and channel for.
* @param uSD SD stream number (number + 1) to set. Set to 0 for unassign.
* @param uChannel Channel to set. Only valid if a valid SD stream number is specified.
*
* @remarks Can be called as a callback by the HDA codec.
*/
static DECLCALLBACK(int) hdaR3MixerControl(PHDASTATE pThis, PDMAUDIOMIXERCTL enmMixerCtl, uint8_t uSD, uint8_t uChannel)
{
LogFunc(("enmMixerCtl=%s, uSD=%RU8, uChannel=%RU8\n", DrvAudioHlpAudMixerCtlToStr(enmMixerCtl), uSD, uChannel));
if (uSD == 0) /* Stream number 0 is reserved. */
{
Log2Func(("Invalid SDn (%RU8) number for mixer control '%s', ignoring\n", uSD, DrvAudioHlpAudMixerCtlToStr(enmMixerCtl)));
return VINF_SUCCESS;
}
/* uChannel is optional. */
/* SDn0 starts as 1. */
Assert(uSD);
uSD--;
# ifndef VBOX_WITH_AUDIO_HDA_MIC_IN
/* Only SDI0 (Line-In) is supported. */
if ( hdaGetDirFromSD(uSD) == PDMAUDIODIR_IN
&& uSD >= 1)
{
LogRel2(("HDA: Dedicated Mic-In support not imlpemented / built-in (stream #%RU8), using Line-In (stream #0) instead\n", uSD));
uSD = 0;
}
# endif
int rc = VINF_SUCCESS;
PHDAMIXERSINK pSink = hdaR3MixerControlToSink(pThis, enmMixerCtl);
if (pSink)
{
AssertPtr(pSink->pMixSink);
/* If this an output stream, determine the correct SD#. */
if ( (uSD < HDA_MAX_SDI)
&& AudioMixerSinkGetDir(pSink->pMixSink) == AUDMIXSINKDIR_OUTPUT)
{
uSD += HDA_MAX_SDI;
}
/* Detach the existing stream from the sink. */
if ( pSink->pStream
&& ( pSink->pStream->u8SD != uSD
|| pSink->pStream->u8Channel != uChannel)
)
{
LogFunc(("Sink '%s' was assigned to stream #%RU8 (channel %RU8) before\n",
pSink->pMixSink->pszName, pSink->pStream->u8SD, pSink->pStream->u8Channel));
hdaR3StreamLock(pSink->pStream);
/* Only disable the stream if the stream descriptor # has changed. */
if (pSink->pStream->u8SD != uSD)
hdaR3StreamEnable(pSink->pStream, false);
pSink->pStream->pMixSink = NULL;
hdaR3StreamUnlock(pSink->pStream);
pSink->pStream = NULL;
}
Assert(uSD < HDA_MAX_STREAMS);
/* Attach the new stream to the sink.
* Enabling the stream will be done by the gust via a separate SDnCTL call then. */
if (pSink->pStream == NULL)
{
LogRel2(("HDA: Setting sink '%s' to stream #%RU8 (channel %RU8), mixer control=%s\n",
pSink->pMixSink->pszName, uSD, uChannel, DrvAudioHlpAudMixerCtlToStr(enmMixerCtl)));
PHDASTREAM pStream = hdaGetStreamFromSD(pThis, uSD);
if (pStream)
{
hdaR3StreamLock(pStream);
pSink->pStream = pStream;
pStream->u8Channel = uChannel;
pStream->pMixSink = pSink;
hdaR3StreamUnlock(pStream);
rc = VINF_SUCCESS;
}
else
rc = VERR_NOT_IMPLEMENTED;
}
}
else
rc = VERR_NOT_FOUND;
if (RT_FAILURE(rc))
LogRel(("HDA: Converter control for stream #%RU8 (channel %RU8) / mixer control '%s' failed with %Rrc, skipping\n",
uSD, uChannel, DrvAudioHlpAudMixerCtlToStr(enmMixerCtl), rc));
LogFlowFuncLeaveRC(rc);
return rc;
}
/**
* @interface_method_impl{HDACODEC,pfnCbMixerSetVolume}
*
* Sets the volume of a specified mixer control.
*
* @return IPRT status code.
* @param pThis HDA State.
* @param enmMixerCtl Mixer control to set volume for.
* @param pVol Pointer to volume data to set.
*
* @remarks Can be called as a callback by the HDA codec.
*/
static DECLCALLBACK(int) hdaR3MixerSetVolume(PHDASTATE pThis, PDMAUDIOMIXERCTL enmMixerCtl, PPDMAUDIOVOLUME pVol)
{
int rc;
PHDAMIXERSINK pSink = hdaR3MixerControlToSink(pThis, enmMixerCtl);
if ( pSink
&& pSink->pMixSink)
{
LogRel2(("HDA: Setting volume for mixer sink '%s' to %RU8/%RU8 (%s)\n",
pSink->pMixSink->pszName, pVol->uLeft, pVol->uRight, pVol->fMuted ? "Muted" : "Unmuted"));
/* Set the volume.
* We assume that the codec already converted it to the correct range. */
rc = AudioMixerSinkSetVolume(pSink->pMixSink, pVol);
}
else
rc = VERR_NOT_FOUND;
LogFlowFuncLeaveRC(rc);
return rc;
}
/**
* Main routine for the stream's timer.
*
* @param pDevIns Device instance.
* @param pTimer Timer this callback was called for.
* @param pvUser Pointer to associated HDASTREAM.
*/
static DECLCALLBACK(void) hdaR3Timer(PPDMDEVINS pDevIns, PTMTIMER pTimer, void *pvUser)
{
RT_NOREF(pDevIns, pTimer);
PHDASTREAM pStream = (PHDASTREAM)pvUser;
AssertPtr(pStream);
PHDASTATE pThis = pStream->pHDAState;
DEVHDA_LOCK_BOTH_RETURN_VOID(pStream->pHDAState, pStream->u8SD);
hdaR3StreamUpdate(pStream, true /* fInTimer */);
/* Flag indicating whether to kick the timer again for a
* new data processing round. */
const bool fSinkActive = AudioMixerSinkIsActive(pStream->pMixSink->pMixSink);
if (fSinkActive)
{
const bool fTimerScheduled = hdaR3StreamTransferIsScheduled(pStream);
Log3Func(("fSinksActive=%RTbool, fTimerScheduled=%RTbool\n", fSinkActive, fTimerScheduled));
if (!fTimerScheduled)
hdaR3TimerSet(pThis, pStream,
TMTimerGet(pThis->pTimer[pStream->u8SD])
+ TMTimerGetFreq(pThis->pTimer[pStream->u8SD]) / pStream->pHDAState->u16TimerHz,
true /* fForce */);
}
else
Log3Func(("fSinksActive=%RTbool\n", fSinkActive));
DEVHDA_UNLOCK_BOTH(pThis, pStream->u8SD);
}
# ifdef HDA_USE_DMA_ACCESS_HANDLER
/**
* HC access handler for the FIFO.
*
* @returns VINF_SUCCESS if the handler have carried out the operation.
* @returns VINF_PGM_HANDLER_DO_DEFAULT if the caller should carry out the access operation.
* @param pVM VM Handle.
* @param pVCpu The cross context CPU structure for the calling EMT.
* @param GCPhys The physical address the guest is writing to.
* @param pvPhys The HC mapping of that address.
* @param pvBuf What the guest is reading/writing.
* @param cbBuf How much it's reading/writing.
* @param enmAccessType The access type.
* @param enmOrigin Who is making the access.
* @param pvUser User argument.
*/
static DECLCALLBACK(VBOXSTRICTRC) hdaR3DMAAccessHandler(PVM pVM, PVMCPU pVCpu, RTGCPHYS GCPhys, void *pvPhys,
void *pvBuf, size_t cbBuf,
PGMACCESSTYPE enmAccessType, PGMACCESSORIGIN enmOrigin, void *pvUser)
{
RT_NOREF(pVM, pVCpu, pvPhys, pvBuf, enmOrigin);
PHDADMAACCESSHANDLER pHandler = (PHDADMAACCESSHANDLER)pvUser;
AssertPtr(pHandler);
PHDASTREAM pStream = pHandler->pStream;
AssertPtr(pStream);
Assert(GCPhys >= pHandler->GCPhysFirst);
Assert(GCPhys <= pHandler->GCPhysLast);
Assert(enmAccessType == PGMACCESSTYPE_WRITE);
/* Not within BDLE range? Bail out. */
if ( (GCPhys < pHandler->BDLEAddr)
|| (GCPhys + cbBuf > pHandler->BDLEAddr + pHandler->BDLESize))
{
return VINF_PGM_HANDLER_DO_DEFAULT;
}
switch(enmAccessType)
{
case PGMACCESSTYPE_WRITE:
{
# ifdef DEBUG
PHDASTREAMDBGINFO pStreamDbg = &pStream->Dbg;
const uint64_t tsNowNs = RTTimeNanoTS();
const uint32_t tsElapsedMs = (tsNowNs - pStreamDbg->tsWriteSlotBegin) / 1000 / 1000;
uint64_t cWritesHz = ASMAtomicReadU64(&pStreamDbg->cWritesHz);
uint64_t cbWrittenHz = ASMAtomicReadU64(&pStreamDbg->cbWrittenHz);
if (tsElapsedMs >= (1000 / HDA_TIMER_HZ_DEFAULT))
{
LogFunc(("[SD%RU8] %RU32ms elapsed, cbWritten=%RU64, cWritten=%RU64 -- %RU32 bytes on average per time slot (%zums)\n",
pStream->u8SD, tsElapsedMs, cbWrittenHz, cWritesHz,
ASMDivU64ByU32RetU32(cbWrittenHz, cWritesHz ? cWritesHz : 1), 1000 / HDA_TIMER_HZ_DEFAULT));
pStreamDbg->tsWriteSlotBegin = tsNowNs;
cWritesHz = 0;
cbWrittenHz = 0;
}
cWritesHz += 1;
cbWrittenHz += cbBuf;
ASMAtomicIncU64(&pStreamDbg->cWritesTotal);
ASMAtomicAddU64(&pStreamDbg->cbWrittenTotal, cbBuf);
ASMAtomicWriteU64(&pStreamDbg->cWritesHz, cWritesHz);
ASMAtomicWriteU64(&pStreamDbg->cbWrittenHz, cbWrittenHz);
LogFunc(("[SD%RU8] Writing %3zu @ 0x%x (off %zu)\n",
pStream->u8SD, cbBuf, GCPhys, GCPhys - pHandler->BDLEAddr));
LogFunc(("[SD%RU8] cWrites=%RU64, cbWritten=%RU64 -> %RU32 bytes on average\n",
pStream->u8SD, pStreamDbg->cWritesTotal, pStreamDbg->cbWrittenTotal,
ASMDivU64ByU32RetU32(pStreamDbg->cbWrittenTotal, pStreamDbg->cWritesTotal)));
# endif
if (pThis->fDebugEnabled)
{
RTFILE fh;
RTFileOpen(&fh, VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH "hdaDMAAccessWrite.pcm",
RTFILE_O_OPEN_CREATE | RTFILE_O_APPEND | RTFILE_O_WRITE | RTFILE_O_DENY_NONE);
RTFileWrite(fh, pvBuf, cbBuf, NULL);
RTFileClose(fh);
}
# ifdef HDA_USE_DMA_ACCESS_HANDLER_WRITING
PRTCIRCBUF pCircBuf = pStream->State.pCircBuf;
AssertPtr(pCircBuf);
uint8_t *pbBuf = (uint8_t *)pvBuf;
while (cbBuf)
{
/* Make sure we only copy as much as the stream's FIFO can hold (SDFIFOS, 18.2.39). */
void *pvChunk;
size_t cbChunk;
RTCircBufAcquireWriteBlock(pCircBuf, cbBuf, &pvChunk, &cbChunk);
if (cbChunk)
{
memcpy(pvChunk, pbBuf, cbChunk);
pbBuf += cbChunk;
Assert(cbBuf >= cbChunk);
cbBuf -= cbChunk;
}
else
{
//AssertMsg(RTCircBufFree(pCircBuf), ("No more space but still %zu bytes to write\n", cbBuf));
break;
}
LogFunc(("[SD%RU8] cbChunk=%zu\n", pStream->u8SD, cbChunk));
RTCircBufReleaseWriteBlock(pCircBuf, cbChunk);
}
# endif /* HDA_USE_DMA_ACCESS_HANDLER_WRITING */
break;
}
default:
AssertMsgFailed(("Access type not implemented\n"));
break;
}
return VINF_PGM_HANDLER_DO_DEFAULT;
}
# endif /* HDA_USE_DMA_ACCESS_HANDLER */
/**
* Soft reset of the device triggered via GCTL.
*
* @param pThis HDA state.
*
*/
static void hdaR3GCTLReset(PHDASTATE pThis)
{
LogFlowFuncEnter();
pThis->cStreamsActive = 0;
HDA_REG(pThis, GCAP) = HDA_MAKE_GCAP(HDA_MAX_SDO, HDA_MAX_SDI, 0, 0, 1); /* see 6.2.1 */
HDA_REG(pThis, VMIN) = 0x00; /* see 6.2.2 */
HDA_REG(pThis, VMAJ) = 0x01; /* see 6.2.3 */
HDA_REG(pThis, OUTPAY) = 0x003C; /* see 6.2.4 */
HDA_REG(pThis, INPAY) = 0x001D; /* see 6.2.5 */
HDA_REG(pThis, CORBSIZE) = 0x42; /* Up to 256 CORB entries see 6.2.1 */
HDA_REG(pThis, RIRBSIZE) = 0x42; /* Up to 256 RIRB entries see 6.2.1 */
HDA_REG(pThis, CORBRP) = 0x0;
HDA_REG(pThis, CORBWP) = 0x0;
HDA_REG(pThis, RIRBWP) = 0x0;
/* Some guests (like Haiku) don't set RINTCNT explicitly but expect an interrupt after each
* RIRB response -- so initialize RINTCNT to 1 by default. */
HDA_REG(pThis, RINTCNT) = 0x1;
/*
* Stop any audio currently playing and/or recording.
*/
pThis->SinkFront.pStream = NULL;
if (pThis->SinkFront.pMixSink)
AudioMixerSinkReset(pThis->SinkFront.pMixSink);
# ifdef VBOX_WITH_AUDIO_HDA_MIC_IN
pThis->SinkMicIn.pStream = NULL;
if (pThis->SinkMicIn.pMixSink)
AudioMixerSinkReset(pThis->SinkMicIn.pMixSink);
# endif
pThis->SinkLineIn.pStream = NULL;
if (pThis->SinkLineIn.pMixSink)
AudioMixerSinkReset(pThis->SinkLineIn.pMixSink);
# ifdef VBOX_WITH_AUDIO_HDA_51_SURROUND
pThis->SinkCenterLFE = NULL;
if (pThis->SinkCenterLFE.pMixSink)
AudioMixerSinkReset(pThis->SinkCenterLFE.pMixSink);
pThis->SinkRear.pStream = NULL;
if (pThis->SinkRear.pMixSink)
AudioMixerSinkReset(pThis->SinkRear.pMixSink);
# endif
/*
* Reset the codec.
*/
if ( pThis->pCodec
&& pThis->pCodec->pfnReset)
{
pThis->pCodec->pfnReset(pThis->pCodec);
}
/*
* Set some sensible defaults for which HDA sinks
* are connected to which stream number.
*
* We use SD0 for input and SD4 for output by default.
* These stream numbers can be changed by the guest dynamically lateron.
*/
# ifdef VBOX_WITH_AUDIO_HDA_MIC_IN
hdaR3MixerControl(pThis, PDMAUDIOMIXERCTL_MIC_IN , 1 /* SD0 */, 0 /* Channel */);
# endif
hdaR3MixerControl(pThis, PDMAUDIOMIXERCTL_LINE_IN , 1 /* SD0 */, 0 /* Channel */);
hdaR3MixerControl(pThis, PDMAUDIOMIXERCTL_FRONT , 5 /* SD4 */, 0 /* Channel */);
# ifdef VBOX_WITH_AUDIO_HDA_51_SURROUND
hdaR3MixerControl(pThis, PDMAUDIOMIXERCTL_CENTER_LFE, 5 /* SD4 */, 0 /* Channel */);
hdaR3MixerControl(pThis, PDMAUDIOMIXERCTL_REAR , 5 /* SD4 */, 0 /* Channel */);
# endif
/* Reset CORB. */
pThis->cbCorbBuf = HDA_CORB_SIZE * HDA_CORB_ELEMENT_SIZE;
RT_BZERO(pThis->pu32CorbBuf, pThis->cbCorbBuf);
/* Reset RIRB. */
pThis->cbRirbBuf = HDA_RIRB_SIZE * HDA_RIRB_ELEMENT_SIZE;
RT_BZERO(pThis->pu64RirbBuf, pThis->cbRirbBuf);
/* Clear our internal response interrupt counter. */
pThis->u16RespIntCnt = 0;
for (uint8_t uSD = 0; uSD < HDA_MAX_STREAMS; ++uSD)
{
int rc2 = hdaR3StreamEnable(&pThis->aStreams[uSD], false /* fEnable */);
if (RT_SUCCESS(rc2))
{
/* Remove the RUN bit from SDnCTL in case the stream was in a running state before. */
HDA_STREAM_REG(pThis, CTL, uSD) &= ~HDA_SDCTL_RUN;
hdaR3StreamReset(pThis, &pThis->aStreams[uSD], uSD);
}
}
/* Clear stream tags <-> objects mapping table. */
RT_ZERO(pThis->aTags);
/* Emulation of codec "wake up" (HDA spec 5.5.1 and 6.5). */
HDA_REG(pThis, STATESTS) = 0x1;
LogFlowFuncLeave();
LogRel(("HDA: Reset\n"));
}
#endif /* IN_RING3 */
/* MMIO callbacks */
/**
* @callback_method_impl{FNIOMMMIOREAD, Looks up and calls the appropriate handler.}
*
* @note During implementation, we discovered so-called "forgotten" or "hole"
* registers whose description is not listed in the RPM, datasheet, or
* spec.
*/
PDMBOTHCBDECL(int) hdaMMIORead(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void *pv, unsigned cb)
{
PHDASTATE pThis = PDMINS_2_DATA(pDevIns, PHDASTATE);
int rc;
RT_NOREF_PV(pvUser);
Assert(pThis->uAlignmentCheckMagic == HDASTATE_ALIGNMENT_CHECK_MAGIC);
/*
* Look up and log.
*/
uint32_t offReg = GCPhysAddr - pThis->MMIOBaseAddr;
int idxRegDsc = hdaRegLookup(offReg); /* Register descriptor index. */
#ifdef LOG_ENABLED
unsigned const cbLog = cb;
uint32_t offRegLog = offReg;
#endif
Log3Func(("offReg=%#x cb=%#x\n", offReg, cb));
Assert(cb == 4); Assert((offReg & 3) == 0);
DEVHDA_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_READ);
if (!(HDA_REG(pThis, GCTL) & HDA_GCTL_CRST) && idxRegDsc != HDA_REG_GCTL)
LogFunc(("Access to registers except GCTL is blocked while reset\n"));
if (idxRegDsc == -1)
LogRel(("HDA: Invalid read access @0x%x (bytes=%u)\n", offReg, cb));
if (idxRegDsc != -1)
{
/* Leave lock before calling read function. */
DEVHDA_UNLOCK(pThis);
/* ASSUMES gapless DWORD at end of map. */
if (g_aHdaRegMap[idxRegDsc].size == 4)
{
/*
* Straight forward DWORD access.
*/
rc = g_aHdaRegMap[idxRegDsc].pfnRead(pThis, idxRegDsc, (uint32_t *)pv);
Log3Func(("\tRead %s => %x (%Rrc)\n", g_aHdaRegMap[idxRegDsc].abbrev, *(uint32_t *)pv, rc));
}
else
{
/*
* Multi register read (unless there are trailing gaps).
* ASSUMES that only DWORD reads have sideeffects.
*/
#ifdef IN_RING3
uint32_t u32Value = 0;
unsigned cbLeft = 4;
do
{
uint32_t const cbReg = g_aHdaRegMap[idxRegDsc].size;
uint32_t u32Tmp = 0;
rc = g_aHdaRegMap[idxRegDsc].pfnRead(pThis, idxRegDsc, &u32Tmp);
Log3Func(("\tRead %s[%db] => %x (%Rrc)*\n", g_aHdaRegMap[idxRegDsc].abbrev, cbReg, u32Tmp, rc));
if (rc != VINF_SUCCESS)
break;
u32Value |= (u32Tmp & g_afMasks[cbReg]) << ((4 - cbLeft) * 8);
cbLeft -= cbReg;
offReg += cbReg;
idxRegDsc++;
} while (cbLeft > 0 && g_aHdaRegMap[idxRegDsc].offset == offReg);
if (rc == VINF_SUCCESS)
*(uint32_t *)pv = u32Value;
else
Assert(!IOM_SUCCESS(rc));
#else /* !IN_RING3 */
/* Take the easy way out. */
rc = VINF_IOM_R3_MMIO_READ;
#endif /* !IN_RING3 */
}
}
else
{
DEVHDA_UNLOCK(pThis);
rc = VINF_IOM_MMIO_UNUSED_FF;
Log3Func(("\tHole at %x is accessed for read\n", offReg));
}
/*
* Log the outcome.
*/
#ifdef LOG_ENABLED
if (cbLog == 4)
Log3Func(("\tReturning @%#05x -> %#010x %Rrc\n", offRegLog, *(uint32_t *)pv, rc));
else if (cbLog == 2)
Log3Func(("\tReturning @%#05x -> %#06x %Rrc\n", offRegLog, *(uint16_t *)pv, rc));
else if (cbLog == 1)
Log3Func(("\tReturning @%#05x -> %#04x %Rrc\n", offRegLog, *(uint8_t *)pv, rc));
#endif
return rc;
}
DECLINLINE(int) hdaWriteReg(PHDASTATE pThis, int idxRegDsc, uint32_t u32Value, char const *pszLog)
{
DEVHDA_LOCK_RETURN(pThis, VINF_IOM_R3_MMIO_WRITE);
if (!(HDA_REG(pThis, GCTL) & HDA_GCTL_CRST) && idxRegDsc != HDA_REG_GCTL)
{
Log(("hdaWriteReg: Warning: Access to %s is blocked while controller is in reset mode\n", g_aHdaRegMap[idxRegDsc].abbrev));
LogRel2(("HDA: Warning: Access to register %s is blocked while controller is in reset mode\n",
g_aHdaRegMap[idxRegDsc].abbrev));
DEVHDA_UNLOCK(pThis);
return VINF_SUCCESS;
}
/*
* Handle RD (register description) flags.
*/
/* For SDI / SDO: Check if writes to those registers are allowed while SDCTL's RUN bit is set. */
if (idxRegDsc >= HDA_NUM_GENERAL_REGS)
{
const uint32_t uSDCTL = HDA_STREAM_REG(pThis, CTL, HDA_SD_NUM_FROM_REG(pThis, CTL, idxRegDsc));
/*
* Some OSes (like Win 10 AU) violate the spec by writing stuff to registers which are not supposed to be be touched
* while SDCTL's RUN bit is set. So just ignore those values.
*/
/* Is the RUN bit currently set? */
if ( RT_BOOL(uSDCTL & HDA_SDCTL_RUN)
/* Are writes to the register denied if RUN bit is set? */
&& !(g_aHdaRegMap[idxRegDsc].fFlags & HDA_RD_FLAG_SD_WRITE_RUN))
{
Log(("hdaWriteReg: Warning: Access to %s is blocked! %R[sdctl]\n", g_aHdaRegMap[idxRegDsc].abbrev, uSDCTL));
LogRel2(("HDA: Warning: Access to register %s is blocked while the stream's RUN bit is set\n",
g_aHdaRegMap[idxRegDsc].abbrev));
DEVHDA_UNLOCK(pThis);
return VINF_SUCCESS;
}
}
/* Leave the lock before calling write function. */
/** @todo r=bird: Why do we need to do that?? There is no
* explanation why this is necessary here...
*
* More or less all write functions retake the lock, so why not let
* those who need to drop the lock or take additional locks release
* it? See, releasing a lock you already got always runs the risk
* of someone else grabbing it and forcing you to wait, better to
* do the two-three things a write handle needs to do than enter
* and exit the lock all the time. */
DEVHDA_UNLOCK(pThis);
#ifdef LOG_ENABLED
uint32_t const idxRegMem = g_aHdaRegMap[idxRegDsc].mem_idx;
uint32_t const u32OldValue = pThis->au32Regs[idxRegMem];
#endif
int rc = g_aHdaRegMap[idxRegDsc].pfnWrite(pThis, idxRegDsc, u32Value);
Log3Func(("Written value %#x to %s[%d byte]; %x => %x%s, rc=%d\n", u32Value, g_aHdaRegMap[idxRegDsc].abbrev,
g_aHdaRegMap[idxRegDsc].size, u32OldValue, pThis->au32Regs[idxRegMem], pszLog, rc));
RT_NOREF(pszLog);
return rc;
}
/**
* @callback_method_impl{FNIOMMMIOWRITE, Looks up and calls the appropriate handler.}
*/
PDMBOTHCBDECL(int) hdaMMIOWrite(PPDMDEVINS pDevIns, void *pvUser, RTGCPHYS GCPhysAddr, void const *pv, unsigned cb)
{
PHDASTATE pThis = PDMINS_2_DATA(pDevIns, PHDASTATE);
int rc;
RT_NOREF_PV(pvUser);
Assert(pThis->uAlignmentCheckMagic == HDASTATE_ALIGNMENT_CHECK_MAGIC);
/*
* The behavior of accesses that aren't aligned on natural boundraries is
* undefined. Just reject them outright.
*/
/** @todo IOM could check this, it could also split the 8 byte accesses for us. */
Assert(cb == 1 || cb == 2 || cb == 4 || cb == 8);
if (GCPhysAddr & (cb - 1))
return PDMDevHlpDBGFStop(pDevIns, RT_SRC_POS, "misaligned write access: GCPhysAddr=%RGp cb=%u\n", GCPhysAddr, cb);
/*
* Look up and log the access.
*/
uint32_t offReg = GCPhysAddr - pThis->MMIOBaseAddr;
int idxRegDsc = hdaRegLookup(offReg);
#if defined(IN_RING3) || defined(LOG_ENABLED)
uint32_t idxRegMem = idxRegDsc != -1 ? g_aHdaRegMap[idxRegDsc].mem_idx : UINT32_MAX;
#endif
uint64_t u64Value;
if (cb == 4) u64Value = *(uint32_t const *)pv;
else if (cb == 2) u64Value = *(uint16_t const *)pv;
else if (cb == 1) u64Value = *(uint8_t const *)pv;
else if (cb == 8) u64Value = *(uint64_t const *)pv;
else
{
u64Value = 0; /* shut up gcc. */
AssertReleaseMsgFailed(("%u\n", cb));
}
#ifdef LOG_ENABLED
uint32_t const u32LogOldValue = idxRegDsc >= 0 ? pThis->au32Regs[idxRegMem] : UINT32_MAX;
if (idxRegDsc == -1)
Log3Func(("@%#05x u32=%#010x cb=%d\n", offReg, *(uint32_t const *)pv, cb));
else if (cb == 4)
Log3Func(("@%#05x u32=%#010x %s\n", offReg, *(uint32_t *)pv, g_aHdaRegMap[idxRegDsc].abbrev));
else if (cb == 2)
Log3Func(("@%#05x u16=%#06x (%#010x) %s\n", offReg, *(uint16_t *)pv, *(uint32_t *)pv, g_aHdaRegMap[idxRegDsc].abbrev));
else if (cb == 1)
Log3Func(("@%#05x u8=%#04x (%#010x) %s\n", offReg, *(uint8_t *)pv, *(uint32_t *)pv, g_aHdaRegMap[idxRegDsc].abbrev));
if (idxRegDsc >= 0 && g_aHdaRegMap[idxRegDsc].size != cb)
Log3Func(("\tsize=%RU32 != cb=%u!!\n", g_aHdaRegMap[idxRegDsc].size, cb));
#endif
/*
* Try for a direct hit first.
*/
if (idxRegDsc != -1 && g_aHdaRegMap[idxRegDsc].size == cb)
{
rc = hdaWriteReg(pThis, idxRegDsc, u64Value, "");
Log3Func(("\t%#x -> %#x\n", u32LogOldValue, idxRegMem != UINT32_MAX ? pThis->au32Regs[idxRegMem] : UINT32_MAX));
}
/*
* Partial or multiple register access, loop thru the requested memory.
*/
else
{
#ifdef IN_RING3
/*
* If it's an access beyond the start of the register, shift the input
* value and fill in missing bits. Natural alignment rules means we
* will only see 1 or 2 byte accesses of this kind, so no risk of
* shifting out input values.
*/
if (idxRegDsc == -1 && (idxRegDsc = hdaR3RegLookupWithin(offReg)) != -1)
{
uint32_t const cbBefore = offReg - g_aHdaRegMap[idxRegDsc].offset; Assert(cbBefore > 0 && cbBefore < 4);
offReg -= cbBefore;
idxRegMem = g_aHdaRegMap[idxRegDsc].mem_idx;
u64Value <<= cbBefore * 8;
u64Value |= pThis->au32Regs[idxRegMem] & g_afMasks[cbBefore];
Log3Func(("\tWithin register, supplied %u leading bits: %#llx -> %#llx ...\n",
cbBefore * 8, ~g_afMasks[cbBefore] & u64Value, u64Value));
}
/* Loop thru the write area, it may cover multiple registers. */
rc = VINF_SUCCESS;
for (;;)
{
uint32_t cbReg;
if (idxRegDsc != -1)
{
idxRegMem = g_aHdaRegMap[idxRegDsc].mem_idx;
cbReg = g_aHdaRegMap[idxRegDsc].size;
if (cb < cbReg)
{
u64Value |= pThis->au32Regs[idxRegMem] & g_afMasks[cbReg] & ~g_afMasks[cb];
Log3Func(("\tSupplying missing bits (%#x): %#llx -> %#llx ...\n",
g_afMasks[cbReg] & ~g_afMasks[cb], u64Value & g_afMasks[cb], u64Value));
}
# ifdef LOG_ENABLED
uint32_t uLogOldVal = pThis->au32Regs[idxRegMem];
# endif
rc = hdaWriteReg(pThis, idxRegDsc, u64Value, "*");
Log3Func(("\t%#x -> %#x\n", uLogOldVal, pThis->au32Regs[idxRegMem]));
}
else
{
LogRel(("HDA: Invalid write access @0x%x\n", offReg));
cbReg = 1;
}
if (rc != VINF_SUCCESS)
break;
if (cbReg >= cb)
break;
/* Advance. */
offReg += cbReg;
cb -= cbReg;
u64Value >>= cbReg * 8;
if (idxRegDsc == -1)
idxRegDsc = hdaRegLookup(offReg);
else
{
idxRegDsc++;
if ( (unsigned)idxRegDsc >= RT_ELEMENTS(g_aHdaRegMap)
|| g_aHdaRegMap[idxRegDsc].offset != offReg)
{
idxRegDsc = -1;
}
}
}
#else /* !IN_RING3 */
/* Take the simple way out. */
rc = VINF_IOM_R3_MMIO_WRITE;
#endif /* !IN_RING3 */
}
return rc;
}
/* PCI callback. */
#ifdef IN_RING3
/**
* @callback_method_impl{FNPCIIOREGIONMAP}
*/
static DECLCALLBACK(int) hdaR3PciIoRegionMap(PPDMDEVINS pDevIns, PPDMPCIDEV pPciDev, uint32_t iRegion,
RTGCPHYS GCPhysAddress, RTGCPHYS cb, PCIADDRESSSPACE enmType)
{
RT_NOREF(iRegion, enmType);
PHDASTATE pThis = RT_FROM_MEMBER(pPciDev, HDASTATE, PciDev);
/*
* 18.2 of the ICH6 datasheet defines the valid access widths as byte, word, and double word.
*
* Let IOM talk DWORDs when reading, saves a lot of complications. On
* writing though, we have to do it all ourselves because of sideeffects.
*/
Assert(enmType == PCI_ADDRESS_SPACE_MEM);
int rc = PDMDevHlpMMIORegister(pDevIns, GCPhysAddress, cb, NULL /*pvUser*/,
IOMMMIO_FLAGS_READ_DWORD
| IOMMMIO_FLAGS_WRITE_PASSTHRU,
hdaMMIOWrite, hdaMMIORead, "HDA");
if (RT_FAILURE(rc))
return rc;
if (pThis->fRZEnabled)
{
rc = PDMDevHlpMMIORegisterR0(pDevIns, GCPhysAddress, cb, NIL_RTR0PTR /*pvUser*/,
"hdaMMIOWrite", "hdaMMIORead");
if (RT_FAILURE(rc))
return rc;
rc = PDMDevHlpMMIORegisterRC(pDevIns, GCPhysAddress, cb, NIL_RTRCPTR /*pvUser*/,
"hdaMMIOWrite", "hdaMMIORead");
if (RT_FAILURE(rc))
return rc;
}
pThis->MMIOBaseAddr = GCPhysAddress;
return VINF_SUCCESS;
}
/* Saved state workers and callbacks. */
static int hdaR3SaveStream(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, PHDASTREAM pStream)
{
RT_NOREF(pDevIns);
#ifdef VBOX_STRICT
PHDASTATE pThis = PDMINS_2_DATA(pDevIns, PHDASTATE);
#endif
Log2Func(("[SD%RU8]\n", pStream->u8SD));
/* Save stream ID. */
int rc = SSMR3PutU8(pSSM, pStream->u8SD);
AssertRCReturn(rc, rc);
Assert(pStream->u8SD < HDA_MAX_STREAMS);
rc = SSMR3PutStructEx(pSSM, &pStream->State, sizeof(HDASTREAMSTATE), 0 /*fFlags*/, g_aSSMStreamStateFields7, NULL);
AssertRCReturn(rc, rc);
#ifdef VBOX_STRICT /* Sanity checks. */
uint64_t u64BaseDMA = RT_MAKE_U64(HDA_STREAM_REG(pThis, BDPL, pStream->u8SD),
HDA_STREAM_REG(pThis, BDPU, pStream->u8SD));
uint16_t u16LVI = HDA_STREAM_REG(pThis, LVI, pStream->u8SD);
uint32_t u32CBL = HDA_STREAM_REG(pThis, CBL, pStream->u8SD);
Assert(u64BaseDMA == pStream->u64BDLBase);
Assert(u16LVI == pStream->u16LVI);
Assert(u32CBL == pStream->u32CBL);
#endif
rc = SSMR3PutStructEx(pSSM, &pStream->State.BDLE.Desc, sizeof(HDABDLEDESC),
0 /*fFlags*/, g_aSSMBDLEDescFields7, NULL);
AssertRCReturn(rc, rc);
rc = SSMR3PutStructEx(pSSM, &pStream->State.BDLE.State, sizeof(HDABDLESTATE),
0 /*fFlags*/, g_aSSMBDLEStateFields7, NULL);
AssertRCReturn(rc, rc);
rc = SSMR3PutStructEx(pSSM, &pStream->State.Period, sizeof(HDASTREAMPERIOD),
0 /* fFlags */, g_aSSMStreamPeriodFields7, NULL);
AssertRCReturn(rc, rc);
#ifdef VBOX_STRICT /* Sanity checks. */
PHDABDLE pBDLE = &pStream->State.BDLE;
if (u64BaseDMA)
{
Assert(pStream->State.uCurBDLE <= u16LVI + 1);
HDABDLE curBDLE;
rc = hdaR3BDLEFetch(pThis, &curBDLE, u64BaseDMA, pStream->State.uCurBDLE);
AssertRC(rc);
Assert(curBDLE.Desc.u32BufSize == pBDLE->Desc.u32BufSize);
Assert(curBDLE.Desc.u64BufAdr == pBDLE->Desc.u64BufAdr);
Assert(curBDLE.Desc.fFlags == pBDLE->Desc.fFlags);
}
else
{
Assert(pBDLE->Desc.u64BufAdr == 0);
Assert(pBDLE->Desc.u32BufSize == 0);
}
#endif
uint32_t cbCircBufSize = 0;
uint32_t cbCircBufUsed = 0;
if (pStream->State.pCircBuf)
{
cbCircBufSize = (uint32_t)RTCircBufSize(pStream->State.pCircBuf);
cbCircBufUsed = (uint32_t)RTCircBufUsed(pStream->State.pCircBuf);
}
rc = SSMR3PutU32(pSSM, cbCircBufSize);
AssertRCReturn(rc, rc);
rc = SSMR3PutU32(pSSM, cbCircBufUsed);
AssertRCReturn(rc, rc);
if (cbCircBufUsed)
{
/*
* We now need to get the circular buffer's data without actually modifying
* the internal read / used offsets -- otherwise we would end up with broken audio
* data after saving the state.
*
* So get the current read offset and serialize the buffer data manually based on that.
*/
size_t cbCircBufOffRead = RTCircBufOffsetRead(pStream->State.pCircBuf);
void *pvBuf;
size_t cbBuf;
RTCircBufAcquireReadBlock(pStream->State.pCircBuf, cbCircBufUsed, &pvBuf, &cbBuf);
if (cbBuf)
{
size_t cbToRead = cbCircBufUsed;
size_t cbEnd = 0;
if (cbCircBufUsed > cbCircBufOffRead)
cbEnd = cbCircBufUsed - cbCircBufOffRead;
if (cbEnd) /* Save end of buffer first. */
{
rc = SSMR3PutMem(pSSM, (uint8_t *)pvBuf + cbCircBufSize - cbEnd /* End of buffer */, cbEnd);
AssertRCReturn(rc, rc);
Assert(cbToRead >= cbEnd);
cbToRead -= cbEnd;
}
if (cbToRead) /* Save remaining stuff at start of buffer (if any). */
{
rc = SSMR3PutMem(pSSM, (uint8_t *)pvBuf - cbCircBufUsed /* Start of buffer */, cbToRead);
AssertRCReturn(rc, rc);
}
}
RTCircBufReleaseReadBlock(pStream->State.pCircBuf, 0 /* Don't advance read pointer -- see comment above */);
}
Log2Func(("[SD%RU8] LPIB=%RU32, CBL=%RU32, LVI=%RU32\n",
pStream->u8SD,
HDA_STREAM_REG(pThis, LPIB, pStream->u8SD), HDA_STREAM_REG(pThis, CBL, pStream->u8SD), HDA_STREAM_REG(pThis, LVI, pStream->u8SD)));
#ifdef LOG_ENABLED
hdaR3BDLEDumpAll(pThis, pStream->u64BDLBase, pStream->u16LVI + 1);
#endif
return rc;
}
/**
* @callback_method_impl{FNSSMDEVSAVEEXEC}
*/
static DECLCALLBACK(int) hdaR3SaveExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM)
{
PHDASTATE pThis = PDMINS_2_DATA(pDevIns, PHDASTATE);
/* Save Codec nodes states. */
hdaCodecSaveState(pThis->pCodec, pSSM);
/* Save MMIO registers. */
SSMR3PutU32(pSSM, RT_ELEMENTS(pThis->au32Regs));
SSMR3PutMem(pSSM, pThis->au32Regs, sizeof(pThis->au32Regs));
/* Save controller-specifc internals. */
SSMR3PutU64(pSSM, pThis->u64WalClk);
SSMR3PutU8(pSSM, pThis->u8IRQL);
/* Save number of streams. */
SSMR3PutU32(pSSM, HDA_MAX_STREAMS);
/* Save stream states. */
for (uint8_t i = 0; i < HDA_MAX_STREAMS; i++)
{
int rc = hdaR3SaveStream(pDevIns, pSSM, &pThis->aStreams[i]);
AssertRCReturn(rc, rc);
}
return VINF_SUCCESS;
}
/**
* Does required post processing when loading a saved state.
*
* @param pThis Pointer to HDA state.
*/
static int hdaR3LoadExecPost(PHDASTATE pThis)
{
int rc = VINF_SUCCESS;
/*
* Enable all previously active streams.
*/
for (uint8_t i = 0; i < HDA_MAX_STREAMS; i++)
{
PHDASTREAM pStream = hdaGetStreamFromSD(pThis, i);
if (pStream)
{
int rc2;
bool fActive = RT_BOOL(HDA_STREAM_REG(pThis, CTL, i) & HDA_SDCTL_RUN);
if (fActive)
{
#ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
/* Make sure to also create the async I/O thread before actually enabling the stream. */
rc2 = hdaR3StreamAsyncIOCreate(pStream);
AssertRC(rc2);
/* ... and enabling it. */
hdaR3StreamAsyncIOEnable(pStream, true /* fEnable */);
#endif
/* Resume the stream's period. */
hdaR3StreamPeriodResume(&pStream->State.Period);
/* (Re-)enable the stream. */
rc2 = hdaR3StreamEnable(pStream, true /* fEnable */);
AssertRC(rc2);
/* Add the stream to the device setup. */
rc2 = hdaR3AddStream(pThis, &pStream->State.Cfg);
AssertRC(rc2);
#ifdef HDA_USE_DMA_ACCESS_HANDLER
/* (Re-)install the DMA handler. */
hdaR3StreamRegisterDMAHandlers(pThis, pStream);
#endif
if (hdaR3StreamTransferIsScheduled(pStream))
hdaR3TimerSet(pThis, pStream, hdaR3StreamTransferGetNext(pStream), true /* fForce */);
/* Also keep track of the currently active streams. */
pThis->cStreamsActive++;
}
}
}
LogFlowFuncLeaveRC(rc);
return rc;
}
/**
* Handles loading of all saved state versions older than the current one.
*
* @param pThis Pointer to HDA state.
* @param pSSM Pointer to SSM handle.
* @param uVersion Saved state version to load.
* @param uPass Loading stage to handle.
*/
static int hdaR3LoadExecLegacy(PHDASTATE pThis, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
{
RT_NOREF(uPass);
int rc = VINF_SUCCESS;
/*
* Load MMIO registers.
*/
uint32_t cRegs;
switch (uVersion)
{
case HDA_SSM_VERSION_1:
/* Starting with r71199, we would save 112 instead of 113
registers due to some code cleanups. This only affected trunk
builds in the 4.1 development period. */
cRegs = 113;
if (SSMR3HandleRevision(pSSM) >= 71199)
{
uint32_t uVer = SSMR3HandleVersion(pSSM);
if ( VBOX_FULL_VERSION_GET_MAJOR(uVer) == 4
&& VBOX_FULL_VERSION_GET_MINOR(uVer) == 0
&& VBOX_FULL_VERSION_GET_BUILD(uVer) >= 51)
cRegs = 112;
}
break;
case HDA_SSM_VERSION_2:
case HDA_SSM_VERSION_3:
cRegs = 112;
AssertCompile(RT_ELEMENTS(pThis->au32Regs) >= 112);
break;
/* Since version 4 we store the register count to stay flexible. */
case HDA_SSM_VERSION_4:
case HDA_SSM_VERSION_5:
case HDA_SSM_VERSION_6:
rc = SSMR3GetU32(pSSM, &cRegs); AssertRCReturn(rc, rc);
if (cRegs != RT_ELEMENTS(pThis->au32Regs))
LogRel(("HDA: SSM version cRegs is %RU32, expected %RU32\n", cRegs, RT_ELEMENTS(pThis->au32Regs)));
break;
default:
LogRel(("HDA: Warning: Unsupported / too new saved state version (%RU32)\n", uVersion));
return VERR_SSM_UNSUPPORTED_DATA_UNIT_VERSION;
}
if (cRegs >= RT_ELEMENTS(pThis->au32Regs))
{
SSMR3GetMem(pSSM, pThis->au32Regs, sizeof(pThis->au32Regs));
SSMR3Skip(pSSM, sizeof(uint32_t) * (cRegs - RT_ELEMENTS(pThis->au32Regs)));
}
else
SSMR3GetMem(pSSM, pThis->au32Regs, sizeof(uint32_t) * cRegs);
/* Make sure to update the base addresses first before initializing any streams down below. */
pThis->u64CORBBase = RT_MAKE_U64(HDA_REG(pThis, CORBLBASE), HDA_REG(pThis, CORBUBASE));
pThis->u64RIRBBase = RT_MAKE_U64(HDA_REG(pThis, RIRBLBASE), HDA_REG(pThis, RIRBUBASE));
pThis->u64DPBase = RT_MAKE_U64(HDA_REG(pThis, DPLBASE) & DPBASE_ADDR_MASK, HDA_REG(pThis, DPUBASE));
/* Also make sure to update the DMA position bit if this was enabled when saving the state. */
pThis->fDMAPosition = RT_BOOL(HDA_REG(pThis, DPLBASE) & RT_BIT_32(0));
/*
* Note: Saved states < v5 store LVI (u32BdleMaxCvi) for
* *every* BDLE state, whereas it only needs to be stored
* *once* for every stream. Most of the BDLE state we can
* get out of the registers anyway, so just ignore those values.
*
* Also, only the current BDLE was saved, regardless whether
* there were more than one (and there are at least two entries,
* according to the spec).
*/
#define HDA_SSM_LOAD_BDLE_STATE_PRE_V5(v, x) \
{ \
rc = SSMR3Skip(pSSM, sizeof(uint32_t)); /* Begin marker */ \
AssertRCReturn(rc, rc); \
rc = SSMR3GetU64(pSSM, &x.Desc.u64BufAdr); /* u64BdleCviAddr */ \
AssertRCReturn(rc, rc); \
rc = SSMR3Skip(pSSM, sizeof(uint32_t)); /* u32BdleMaxCvi */ \
AssertRCReturn(rc, rc); \
rc = SSMR3GetU32(pSSM, &x.State.u32BDLIndex); /* u32BdleCvi */ \
AssertRCReturn(rc, rc); \
rc = SSMR3GetU32(pSSM, &x.Desc.u32BufSize); /* u32BdleCviLen */ \
AssertRCReturn(rc, rc); \
rc = SSMR3GetU32(pSSM, &x.State.u32BufOff); /* u32BdleCviPos */ \
AssertRCReturn(rc, rc); \
bool fIOC; \
rc = SSMR3GetBool(pSSM, &fIOC); /* fBdleCviIoc */ \
AssertRCReturn(rc, rc); \
x.Desc.fFlags = fIOC ? HDA_BDLE_FLAG_IOC : 0; \
rc = SSMR3GetU32(pSSM, &x.State.cbBelowFIFOW); /* cbUnderFifoW */ \
AssertRCReturn(rc, rc); \
rc = SSMR3Skip(pSSM, sizeof(uint8_t) * 256); /* FIFO */ \
AssertRCReturn(rc, rc); \
rc = SSMR3Skip(pSSM, sizeof(uint32_t)); /* End marker */ \
AssertRCReturn(rc, rc); \
}
/*
* Load BDLEs (Buffer Descriptor List Entries) and DMA counters.
*/
switch (uVersion)
{
case HDA_SSM_VERSION_1:
case HDA_SSM_VERSION_2:
case HDA_SSM_VERSION_3:
case HDA_SSM_VERSION_4:
{
/* Only load the internal states.
* The rest will be initialized from the saved registers later. */
/* Note 1: Only the *current* BDLE for a stream was saved! */
/* Note 2: The stream's saving order is/was fixed, so don't touch! */
/* Output */
PHDASTREAM pStream = &pThis->aStreams[4];
rc = hdaR3StreamInit(pStream, 4 /* Stream descriptor, hardcoded */);
if (RT_FAILURE(rc))
break;
HDA_SSM_LOAD_BDLE_STATE_PRE_V5(uVersion, pStream->State.BDLE);
pStream->State.uCurBDLE = pStream->State.BDLE.State.u32BDLIndex;
/* Microphone-In */
pStream = &pThis->aStreams[2];
rc = hdaR3StreamInit(pStream, 2 /* Stream descriptor, hardcoded */);
if (RT_FAILURE(rc))
break;
HDA_SSM_LOAD_BDLE_STATE_PRE_V5(uVersion, pStream->State.BDLE);
pStream->State.uCurBDLE = pStream->State.BDLE.State.u32BDLIndex;
/* Line-In */
pStream = &pThis->aStreams[0];
rc = hdaR3StreamInit(pStream, 0 /* Stream descriptor, hardcoded */);
if (RT_FAILURE(rc))
break;
HDA_SSM_LOAD_BDLE_STATE_PRE_V5(uVersion, pStream->State.BDLE);
pStream->State.uCurBDLE = pStream->State.BDLE.State.u32BDLIndex;
break;
}
#undef HDA_SSM_LOAD_BDLE_STATE_PRE_V5
default: /* Since v5 we support flexible stream and BDLE counts. */
{
uint32_t cStreams;
rc = SSMR3GetU32(pSSM, &cStreams);
if (RT_FAILURE(rc))
break;
if (cStreams > HDA_MAX_STREAMS)
cStreams = HDA_MAX_STREAMS; /* Sanity. */
/* Load stream states. */
for (uint32_t i = 0; i < cStreams; i++)
{
uint8_t uStreamID;
rc = SSMR3GetU8(pSSM, &uStreamID);
if (RT_FAILURE(rc))
break;
PHDASTREAM pStream = hdaGetStreamFromSD(pThis, uStreamID);
HDASTREAM StreamDummy;
if (!pStream)
{
pStream = &StreamDummy;
LogRel2(("HDA: Warning: Stream ID=%RU32 not supported, skipping to load ...\n", uStreamID));
}
rc = hdaR3StreamInit(pStream, uStreamID);
if (RT_FAILURE(rc))
{
LogRel(("HDA: Stream #%RU32: Initialization of stream %RU8 failed, rc=%Rrc\n", i, uStreamID, rc));
break;
}
/*
* Load BDLEs (Buffer Descriptor List Entries) and DMA counters.
*/
if (uVersion == HDA_SSM_VERSION_5)
{
/* Get the current BDLE entry and skip the rest. */
uint16_t cBDLE;
rc = SSMR3Skip(pSSM, sizeof(uint32_t)); /* Begin marker */
AssertRC(rc);
rc = SSMR3GetU16(pSSM, &cBDLE); /* cBDLE */
AssertRC(rc);
rc = SSMR3GetU16(pSSM, &pStream->State.uCurBDLE); /* uCurBDLE */
AssertRC(rc);
rc = SSMR3Skip(pSSM, sizeof(uint32_t)); /* End marker */
AssertRC(rc);
uint32_t u32BDLEIndex;
for (uint16_t a = 0; a < cBDLE; a++)
{
rc = SSMR3Skip(pSSM, sizeof(uint32_t)); /* Begin marker */
AssertRC(rc);
rc = SSMR3GetU32(pSSM, &u32BDLEIndex); /* u32BDLIndex */
AssertRC(rc);
/* Does the current BDLE index match the current BDLE to process? */
if (u32BDLEIndex == pStream->State.uCurBDLE)
{
rc = SSMR3GetU32(pSSM, &pStream->State.BDLE.State.cbBelowFIFOW); /* cbBelowFIFOW */
AssertRC(rc);
rc = SSMR3Skip(pSSM, sizeof(uint8_t) * 256); /* FIFO, deprecated */
AssertRC(rc);
rc = SSMR3GetU32(pSSM, &pStream->State.BDLE.State.u32BufOff); /* u32BufOff */
AssertRC(rc);
rc = SSMR3Skip(pSSM, sizeof(uint32_t)); /* End marker */
AssertRC(rc);
}
else /* Skip not current BDLEs. */
{
rc = SSMR3Skip(pSSM, sizeof(uint32_t) /* cbBelowFIFOW */
+ sizeof(uint8_t) * 256 /* au8FIFO */
+ sizeof(uint32_t) /* u32BufOff */
+ sizeof(uint32_t)); /* End marker */
AssertRC(rc);
}
}
}
else
{
rc = SSMR3GetStructEx(pSSM, &pStream->State, sizeof(HDASTREAMSTATE),
0 /* fFlags */, g_aSSMStreamStateFields6, NULL);
if (RT_FAILURE(rc))
break;
/* Get HDABDLEDESC. */
uint32_t uMarker;
rc = SSMR3GetU32(pSSM, &uMarker); /* Begin marker. */
AssertRC(rc);
Assert(uMarker == UINT32_C(0x19200102) /* SSMR3STRUCT_BEGIN */);
rc = SSMR3GetU64(pSSM, &pStream->State.BDLE.Desc.u64BufAdr);
AssertRC(rc);
rc = SSMR3GetU32(pSSM, &pStream->State.BDLE.Desc.u32BufSize);
AssertRC(rc);
bool fFlags = false;
rc = SSMR3GetBool(pSSM, &fFlags); /* Saved states < v7 only stored the IOC as boolean flag. */
AssertRC(rc);
pStream->State.BDLE.Desc.fFlags = fFlags ? HDA_BDLE_FLAG_IOC : 0;
rc = SSMR3GetU32(pSSM, &uMarker); /* End marker. */
AssertRC(rc);
Assert(uMarker == UINT32_C(0x19920406) /* SSMR3STRUCT_END */);
rc = SSMR3GetStructEx(pSSM, &pStream->State.BDLE.State, sizeof(HDABDLESTATE),
0 /* fFlags */, g_aSSMBDLEStateFields6, NULL);
if (RT_FAILURE(rc))
break;
Log2Func(("[SD%RU8] LPIB=%RU32, CBL=%RU32, LVI=%RU32\n",
uStreamID,
HDA_STREAM_REG(pThis, LPIB, uStreamID), HDA_STREAM_REG(pThis, CBL, uStreamID), HDA_STREAM_REG(pThis, LVI, uStreamID)));
#ifdef LOG_ENABLED
hdaR3BDLEDumpAll(pThis, pStream->u64BDLBase, pStream->u16LVI + 1);
#endif
}
} /* for cStreams */
break;
} /* default */
}
return rc;
}
/**
* @callback_method_impl{FNSSMDEVLOADEXEC}
*/
static DECLCALLBACK(int) hdaR3LoadExec(PPDMDEVINS pDevIns, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass)
{
PHDASTATE pThis = PDMINS_2_DATA(pDevIns, PHDASTATE);
Assert(uPass == SSM_PASS_FINAL); NOREF(uPass);
LogRel2(("hdaR3LoadExec: uVersion=%RU32, uPass=0x%x\n", uVersion, uPass));
/*
* Load Codec nodes states.
*/
int rc = hdaCodecLoadState(pThis->pCodec, pSSM, uVersion);
if (RT_FAILURE(rc))
{
LogRel(("HDA: Failed loading codec state (version %RU32, pass 0x%x), rc=%Rrc\n", uVersion, uPass, rc));
return rc;
}
if (uVersion < HDA_SSM_VERSION) /* Handle older saved states? */
{
rc = hdaR3LoadExecLegacy(pThis, pSSM, uVersion, uPass);
if (RT_SUCCESS(rc))
rc = hdaR3LoadExecPost(pThis);
return rc;
}
/*
* Load MMIO registers.
*/
uint32_t cRegs;
rc = SSMR3GetU32(pSSM, &cRegs); AssertRCReturn(rc, rc);
if (cRegs != RT_ELEMENTS(pThis->au32Regs))
LogRel(("HDA: SSM version cRegs is %RU32, expected %RU32\n", cRegs, RT_ELEMENTS(pThis->au32Regs)));
if (cRegs >= RT_ELEMENTS(pThis->au32Regs))
{
SSMR3GetMem(pSSM, pThis->au32Regs, sizeof(pThis->au32Regs));
SSMR3Skip(pSSM, sizeof(uint32_t) * (cRegs - RT_ELEMENTS(pThis->au32Regs)));
}
else
SSMR3GetMem(pSSM, pThis->au32Regs, sizeof(uint32_t) * cRegs);
/* Make sure to update the base addresses first before initializing any streams down below. */
pThis->u64CORBBase = RT_MAKE_U64(HDA_REG(pThis, CORBLBASE), HDA_REG(pThis, CORBUBASE));
pThis->u64RIRBBase = RT_MAKE_U64(HDA_REG(pThis, RIRBLBASE), HDA_REG(pThis, RIRBUBASE));
pThis->u64DPBase = RT_MAKE_U64(HDA_REG(pThis, DPLBASE) & DPBASE_ADDR_MASK, HDA_REG(pThis, DPUBASE));
/* Also make sure to update the DMA position bit if this was enabled when saving the state. */
pThis->fDMAPosition = RT_BOOL(HDA_REG(pThis, DPLBASE) & RT_BIT_32(0));
/*
* Load controller-specifc internals.
* Don't annoy other team mates (forgot this for state v7).
*/
if ( SSMR3HandleRevision(pSSM) >= 116273
|| SSMR3HandleVersion(pSSM) >= VBOX_FULL_VERSION_MAKE(5, 2, 0))
{
rc = SSMR3GetU64(pSSM, &pThis->u64WalClk);
AssertRC(rc);
rc = SSMR3GetU8(pSSM, &pThis->u8IRQL);
AssertRC(rc);
}
/*
* Load streams.
*/
uint32_t cStreams;
rc = SSMR3GetU32(pSSM, &cStreams);
AssertRC(rc);
if (cStreams > HDA_MAX_STREAMS)
cStreams = HDA_MAX_STREAMS; /* Sanity. */
Log2Func(("cStreams=%RU32\n", cStreams));
/* Load stream states. */
for (uint32_t i = 0; i < cStreams; i++)
{
uint8_t uStreamID;
rc = SSMR3GetU8(pSSM, &uStreamID);
AssertRC(rc);
PHDASTREAM pStream = hdaGetStreamFromSD(pThis, uStreamID);
HDASTREAM StreamDummy;
if (!pStream)
{
pStream = &StreamDummy;
LogRel2(("HDA: Warning: Loading of stream #%RU8 not supported, skipping to load ...\n", uStreamID));
}
rc = hdaR3StreamInit(pStream, uStreamID);
if (RT_FAILURE(rc))
{
LogRel(("HDA: Stream #%RU8: Loading initialization failed, rc=%Rrc\n", uStreamID, rc));
/* Continue. */
}
rc = SSMR3GetStructEx(pSSM, &pStream->State, sizeof(HDASTREAMSTATE),
0 /* fFlags */, g_aSSMStreamStateFields7,
NULL);
AssertRC(rc);
/*
* Load BDLEs (Buffer Descriptor List Entries) and DMA counters.
*/
rc = SSMR3GetStructEx(pSSM, &pStream->State.BDLE.Desc, sizeof(HDABDLEDESC),
0 /* fFlags */, g_aSSMBDLEDescFields7, NULL);
AssertRC(rc);
rc = SSMR3GetStructEx(pSSM, &pStream->State.BDLE.State, sizeof(HDABDLESTATE),
0 /* fFlags */, g_aSSMBDLEStateFields7, NULL);
AssertRC(rc);
Log2Func(("[SD%RU8] %R[bdle]\n", pStream->u8SD, &pStream->State.BDLE));
/*
* Load period state.
* Don't annoy other team mates (forgot this for state v7).
*/
hdaR3StreamPeriodInit(&pStream->State.Period,
pStream->u8SD, pStream->u16LVI, pStream->u32CBL, &pStream->State.Cfg);
if ( SSMR3HandleRevision(pSSM) >= 116273
|| SSMR3HandleVersion(pSSM) >= VBOX_FULL_VERSION_MAKE(5, 2, 0))
{
rc = SSMR3GetStructEx(pSSM, &pStream->State.Period, sizeof(HDASTREAMPERIOD),
0 /* fFlags */, g_aSSMStreamPeriodFields7, NULL);
AssertRC(rc);
}
/*
* Load internal (FIFO) buffer.
*/
uint32_t cbCircBufSize = 0;
rc = SSMR3GetU32(pSSM, &cbCircBufSize); /* cbCircBuf */
AssertRC(rc);
uint32_t cbCircBufUsed = 0;
rc = SSMR3GetU32(pSSM, &cbCircBufUsed); /* cbCircBuf */
AssertRC(rc);
if (cbCircBufSize) /* If 0, skip the buffer. */
{
/* Paranoia. */
AssertReleaseMsg(cbCircBufSize <= _1M,
("HDA: Saved state contains bogus DMA buffer size (%RU32) for stream #%RU8",
cbCircBufSize, uStreamID));
AssertReleaseMsg(cbCircBufUsed <= cbCircBufSize,
("HDA: Saved state contains invalid DMA buffer usage (%RU32/%RU32) for stream #%RU8",
cbCircBufUsed, cbCircBufSize, uStreamID));
AssertPtr(pStream->State.pCircBuf);
/* Do we need to cre-create the circular buffer do fit the data size? */
if (cbCircBufSize != (uint32_t)RTCircBufSize(pStream->State.pCircBuf))
{
RTCircBufDestroy(pStream->State.pCircBuf);
pStream->State.pCircBuf = NULL;
rc = RTCircBufCreate(&pStream->State.pCircBuf, cbCircBufSize);
AssertRC(rc);
}
if ( RT_SUCCESS(rc)
&& cbCircBufUsed)
{
void *pvBuf;
size_t cbBuf;
RTCircBufAcquireWriteBlock(pStream->State.pCircBuf, cbCircBufUsed, &pvBuf, &cbBuf);
if (cbBuf)
{
rc = SSMR3GetMem(pSSM, pvBuf, cbBuf);
AssertRC(rc);
}
RTCircBufReleaseWriteBlock(pStream->State.pCircBuf, cbBuf);
Assert(cbBuf == cbCircBufUsed);
}
}
Log2Func(("[SD%RU8] LPIB=%RU32, CBL=%RU32, LVI=%RU32\n",
uStreamID,
HDA_STREAM_REG(pThis, LPIB, uStreamID), HDA_STREAM_REG(pThis, CBL, uStreamID), HDA_STREAM_REG(pThis, LVI, uStreamID)));
#ifdef LOG_ENABLED
hdaR3BDLEDumpAll(pThis, pStream->u64BDLBase, pStream->u16LVI + 1);
#endif
/** @todo (Re-)initialize active periods? */
} /* for cStreams */
rc = hdaR3LoadExecPost(pThis);
AssertRC(rc);
LogFlowFuncLeaveRC(rc);
return rc;
}
/* IPRT format type handlers. */
/**
* @callback_method_impl{FNRTSTRFORMATTYPE}
*/
static DECLCALLBACK(size_t) hdaR3StrFmtBDLE(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput,
const char *pszType, void const *pvValue,
int cchWidth, int cchPrecision, unsigned fFlags,
void *pvUser)
{
RT_NOREF(pszType, cchWidth, cchPrecision, fFlags, pvUser);
PHDABDLE pBDLE = (PHDABDLE)pvValue;
return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0,
"BDLE(idx:%RU32, off:%RU32, fifow:%RU32, IOC:%RTbool, DMA[%RU32 bytes @ 0x%x])",
pBDLE->State.u32BDLIndex, pBDLE->State.u32BufOff, pBDLE->State.cbBelowFIFOW,
pBDLE->Desc.fFlags & HDA_BDLE_FLAG_IOC, pBDLE->Desc.u32BufSize, pBDLE->Desc.u64BufAdr);
}
/**
* @callback_method_impl{FNRTSTRFORMATTYPE}
*/
static DECLCALLBACK(size_t) hdaR3StrFmtSDCTL(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput,
const char *pszType, void const *pvValue,
int cchWidth, int cchPrecision, unsigned fFlags,
void *pvUser)
{
RT_NOREF(pszType, cchWidth, cchPrecision, fFlags, pvUser);
uint32_t uSDCTL = (uint32_t)(uintptr_t)pvValue;
return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0,
"SDCTL(raw:%#x, DIR:%s, TP:%RTbool, STRIPE:%x, DEIE:%RTbool, FEIE:%RTbool, IOCE:%RTbool, RUN:%RTbool, RESET:%RTbool)",
uSDCTL,
uSDCTL & HDA_SDCTL_DIR ? "OUT" : "IN",
RT_BOOL(uSDCTL & HDA_SDCTL_TP),
(uSDCTL & HDA_SDCTL_STRIPE_MASK) >> HDA_SDCTL_STRIPE_SHIFT,
RT_BOOL(uSDCTL & HDA_SDCTL_DEIE),
RT_BOOL(uSDCTL & HDA_SDCTL_FEIE),
RT_BOOL(uSDCTL & HDA_SDCTL_IOCE),
RT_BOOL(uSDCTL & HDA_SDCTL_RUN),
RT_BOOL(uSDCTL & HDA_SDCTL_SRST));
}
/**
* @callback_method_impl{FNRTSTRFORMATTYPE}
*/
static DECLCALLBACK(size_t) hdaR3StrFmtSDFIFOS(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput,
const char *pszType, void const *pvValue,
int cchWidth, int cchPrecision, unsigned fFlags,
void *pvUser)
{
RT_NOREF(pszType, cchWidth, cchPrecision, fFlags, pvUser);
uint32_t uSDFIFOS = (uint32_t)(uintptr_t)pvValue;
return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "SDFIFOS(raw:%#x, sdfifos:%RU8 B)", uSDFIFOS, uSDFIFOS ? uSDFIFOS + 1 : 0);
}
/**
* @callback_method_impl{FNRTSTRFORMATTYPE}
*/
static DECLCALLBACK(size_t) hdaR3StrFmtSDFIFOW(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput,
const char *pszType, void const *pvValue,
int cchWidth, int cchPrecision, unsigned fFlags,
void *pvUser)
{
RT_NOREF(pszType, cchWidth, cchPrecision, fFlags, pvUser);
uint32_t uSDFIFOW = (uint32_t)(uintptr_t)pvValue;
return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0, "SDFIFOW(raw: %#0x, sdfifow:%d B)", uSDFIFOW, hdaSDFIFOWToBytes(uSDFIFOW));
}
/**
* @callback_method_impl{FNRTSTRFORMATTYPE}
*/
static DECLCALLBACK(size_t) hdaR3StrFmtSDSTS(PFNRTSTROUTPUT pfnOutput, void *pvArgOutput,
const char *pszType, void const *pvValue,
int cchWidth, int cchPrecision, unsigned fFlags,
void *pvUser)
{
RT_NOREF(pszType, cchWidth, cchPrecision, fFlags, pvUser);
uint32_t uSdSts = (uint32_t)(uintptr_t)pvValue;
return RTStrFormat(pfnOutput, pvArgOutput, NULL, 0,
"SDSTS(raw:%#0x, fifordy:%RTbool, dese:%RTbool, fifoe:%RTbool, bcis:%RTbool)",
uSdSts,
RT_BOOL(uSdSts & HDA_SDSTS_FIFORDY),
RT_BOOL(uSdSts & HDA_SDSTS_DESE),
RT_BOOL(uSdSts & HDA_SDSTS_FIFOE),
RT_BOOL(uSdSts & HDA_SDSTS_BCIS));
}
/* Debug info dumpers */
static int hdaR3DbgLookupRegByName(const char *pszArgs)
{
int iReg = 0;
for (; iReg < HDA_NUM_REGS; ++iReg)
if (!RTStrICmp(g_aHdaRegMap[iReg].abbrev, pszArgs))
return iReg;
return -1;
}
static void hdaR3DbgPrintRegister(PHDASTATE pThis, PCDBGFINFOHLP pHlp, int iHdaIndex)
{
Assert( pThis
&& iHdaIndex >= 0
&& iHdaIndex < HDA_NUM_REGS);
pHlp->pfnPrintf(pHlp, "%s: 0x%x\n", g_aHdaRegMap[iHdaIndex].abbrev, pThis->au32Regs[g_aHdaRegMap[iHdaIndex].mem_idx]);
}
/**
* @callback_method_impl{FNDBGFHANDLERDEV}
*/
static DECLCALLBACK(void) hdaR3DbgInfo(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
{
PHDASTATE pThis = PDMINS_2_DATA(pDevIns, PHDASTATE);
int iHdaRegisterIndex = hdaR3DbgLookupRegByName(pszArgs);
if (iHdaRegisterIndex != -1)
hdaR3DbgPrintRegister(pThis, pHlp, iHdaRegisterIndex);
else
{
for(iHdaRegisterIndex = 0; (unsigned int)iHdaRegisterIndex < HDA_NUM_REGS; ++iHdaRegisterIndex)
hdaR3DbgPrintRegister(pThis, pHlp, iHdaRegisterIndex);
}
}
static void hdaR3DbgPrintStream(PHDASTATE pThis, PCDBGFINFOHLP pHlp, int iIdx)
{
Assert( pThis
&& iIdx >= 0
&& iIdx < HDA_MAX_STREAMS);
const PHDASTREAM pStream = &pThis->aStreams[iIdx];
pHlp->pfnPrintf(pHlp, "Stream #%d:\n", iIdx);
pHlp->pfnPrintf(pHlp, "\tSD%dCTL : %R[sdctl]\n", iIdx, HDA_STREAM_REG(pThis, CTL, iIdx));
pHlp->pfnPrintf(pHlp, "\tSD%dCTS : %R[sdsts]\n", iIdx, HDA_STREAM_REG(pThis, STS, iIdx));
pHlp->pfnPrintf(pHlp, "\tSD%dFIFOS: %R[sdfifos]\n", iIdx, HDA_STREAM_REG(pThis, FIFOS, iIdx));
pHlp->pfnPrintf(pHlp, "\tSD%dFIFOW: %R[sdfifow]\n", iIdx, HDA_STREAM_REG(pThis, FIFOW, iIdx));
pHlp->pfnPrintf(pHlp, "\tBDLE : %R[bdle]\n", &pStream->State.BDLE);
}
static void hdaR3DbgPrintBDLE(PHDASTATE pThis, PCDBGFINFOHLP pHlp, int iIdx)
{
Assert( pThis
&& iIdx >= 0
&& iIdx < HDA_MAX_STREAMS);
const PHDASTREAM pStream = &pThis->aStreams[iIdx];
const PHDABDLE pBDLE = &pStream->State.BDLE;
pHlp->pfnPrintf(pHlp, "Stream #%d BDLE:\n", iIdx);
uint64_t u64BaseDMA = RT_MAKE_U64(HDA_STREAM_REG(pThis, BDPL, iIdx),
HDA_STREAM_REG(pThis, BDPU, iIdx));
uint16_t u16LVI = HDA_STREAM_REG(pThis, LVI, iIdx);
uint32_t u32CBL = HDA_STREAM_REG(pThis, CBL, iIdx);
if (!u64BaseDMA)
return;
pHlp->pfnPrintf(pHlp, "\tCurrent: %R[bdle]\n\n", pBDLE);
pHlp->pfnPrintf(pHlp, "\tMemory:\n");
uint32_t cbBDLE = 0;
for (uint16_t i = 0; i < u16LVI + 1; i++)
{
HDABDLEDESC bd;
PDMDevHlpPhysRead(pThis->CTX_SUFF(pDevIns), u64BaseDMA + i * sizeof(HDABDLEDESC), &bd, sizeof(bd));
pHlp->pfnPrintf(pHlp, "\t\t%s #%03d BDLE(adr:0x%llx, size:%RU32, ioc:%RTbool)\n",
pBDLE->State.u32BDLIndex == i ? "*" : " ", i, bd.u64BufAdr, bd.u32BufSize, bd.fFlags & HDA_BDLE_FLAG_IOC);
cbBDLE += bd.u32BufSize;
}
pHlp->pfnPrintf(pHlp, "Total: %RU32 bytes\n", cbBDLE);
if (cbBDLE != u32CBL)
pHlp->pfnPrintf(pHlp, "Warning: %RU32 bytes does not match CBL (%RU32)!\n", cbBDLE, u32CBL);
pHlp->pfnPrintf(pHlp, "DMA counters (base @ 0x%llx):\n", u64BaseDMA);
if (!u64BaseDMA) /* No DMA base given? Bail out. */
{
pHlp->pfnPrintf(pHlp, "\tNo counters found\n");
return;
}
for (int i = 0; i < u16LVI + 1; i++)
{
uint32_t uDMACnt;
PDMDevHlpPhysRead(pThis->CTX_SUFF(pDevIns), (pThis->u64DPBase & DPBASE_ADDR_MASK) + (i * 2 * sizeof(uint32_t)),
&uDMACnt, sizeof(uDMACnt));
pHlp->pfnPrintf(pHlp, "\t#%03d DMA @ 0x%x\n", i , uDMACnt);
}
}
static int hdaR3DbgLookupStrmIdx(PHDASTATE pThis, const char *pszArgs)
{
RT_NOREF(pThis, pszArgs);
/** @todo Add args parsing. */
return -1;
}
/**
* @callback_method_impl{FNDBGFHANDLERDEV}
*/
static DECLCALLBACK(void) hdaR3DbgInfoStream(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
{
PHDASTATE pThis = PDMINS_2_DATA(pDevIns, PHDASTATE);
int iHdaStreamdex = hdaR3DbgLookupStrmIdx(pThis, pszArgs);
if (iHdaStreamdex != -1)
hdaR3DbgPrintStream(pThis, pHlp, iHdaStreamdex);
else
for(iHdaStreamdex = 0; iHdaStreamdex < HDA_MAX_STREAMS; ++iHdaStreamdex)
hdaR3DbgPrintStream(pThis, pHlp, iHdaStreamdex);
}
/**
* @callback_method_impl{FNDBGFHANDLERDEV}
*/
static DECLCALLBACK(void) hdaR3DbgInfoBDLE(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
{
PHDASTATE pThis = PDMINS_2_DATA(pDevIns, PHDASTATE);
int iHdaStreamdex = hdaR3DbgLookupStrmIdx(pThis, pszArgs);
if (iHdaStreamdex != -1)
hdaR3DbgPrintBDLE(pThis, pHlp, iHdaStreamdex);
else
for (iHdaStreamdex = 0; iHdaStreamdex < HDA_MAX_STREAMS; ++iHdaStreamdex)
hdaR3DbgPrintBDLE(pThis, pHlp, iHdaStreamdex);
}
/**
* @callback_method_impl{FNDBGFHANDLERDEV}
*/
static DECLCALLBACK(void) hdaR3DbgInfoCodecNodes(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
{
PHDASTATE pThis = PDMINS_2_DATA(pDevIns, PHDASTATE);
if (pThis->pCodec->pfnDbgListNodes)
pThis->pCodec->pfnDbgListNodes(pThis->pCodec, pHlp, pszArgs);
else
pHlp->pfnPrintf(pHlp, "Codec implementation doesn't provide corresponding callback\n");
}
/**
* @callback_method_impl{FNDBGFHANDLERDEV}
*/
static DECLCALLBACK(void) hdaR3DbgInfoCodecSelector(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
{
PHDASTATE pThis = PDMINS_2_DATA(pDevIns, PHDASTATE);
if (pThis->pCodec->pfnDbgSelector)
pThis->pCodec->pfnDbgSelector(pThis->pCodec, pHlp, pszArgs);
else
pHlp->pfnPrintf(pHlp, "Codec implementation doesn't provide corresponding callback\n");
}
/**
* @callback_method_impl{FNDBGFHANDLERDEV}
*/
static DECLCALLBACK(void) hdaR3DbgInfoMixer(PPDMDEVINS pDevIns, PCDBGFINFOHLP pHlp, const char *pszArgs)
{
PHDASTATE pThis = PDMINS_2_DATA(pDevIns, PHDASTATE);
if (pThis->pMixer)
AudioMixerDebug(pThis->pMixer, pHlp, pszArgs);
else
pHlp->pfnPrintf(pHlp, "Mixer not available\n");
}
/* PDMIBASE */
/**
* @interface_method_impl{PDMIBASE,pfnQueryInterface}
*/
static DECLCALLBACK(void *) hdaR3QueryInterface(struct PDMIBASE *pInterface, const char *pszIID)
{
PHDASTATE pThis = RT_FROM_MEMBER(pInterface, HDASTATE, IBase);
Assert(&pThis->IBase == pInterface);
PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pThis->IBase);
return NULL;
}
/* PDMDEVREG */
/**
* Attach command, internal version.
*
* This is called to let the device attach to a driver for a specified LUN
* during runtime. This is not called during VM construction, the device
* constructor has to attach to all the available drivers.
*
* @returns VBox status code.
* @param pThis HDA state.
* @param uLUN The logical unit which is being detached.
* @param fFlags Flags, combination of the PDMDEVATT_FLAGS_* \#defines.
* @param ppDrv Attached driver instance on success. Optional.
*/
static int hdaR3AttachInternal(PHDASTATE pThis, unsigned uLUN, uint32_t fFlags, PHDADRIVER *ppDrv)
{
RT_NOREF(fFlags);
/*
* Attach driver.
*/
char *pszDesc;
if (RTStrAPrintf(&pszDesc, "Audio driver port (HDA) for LUN#%u", uLUN) <= 0)
AssertLogRelFailedReturn(VERR_NO_MEMORY);
PPDMIBASE pDrvBase;
int rc = PDMDevHlpDriverAttach(pThis->pDevInsR3, uLUN,
&pThis->IBase, &pDrvBase, pszDesc);
if (RT_SUCCESS(rc))
{
PHDADRIVER pDrv = (PHDADRIVER)RTMemAllocZ(sizeof(HDADRIVER));
if (pDrv)
{
pDrv->pDrvBase = pDrvBase;
pDrv->pConnector = PDMIBASE_QUERY_INTERFACE(pDrvBase, PDMIAUDIOCONNECTOR);
AssertMsg(pDrv->pConnector != NULL, ("Configuration error: LUN#%u has no host audio interface, rc=%Rrc\n", uLUN, rc));
pDrv->pHDAState = pThis;
pDrv->uLUN = uLUN;
/*
* For now we always set the driver at LUN 0 as our primary
* host backend. This might change in the future.
*/
if (pDrv->uLUN == 0)
pDrv->fFlags |= PDMAUDIODRVFLAGS_PRIMARY;
LogFunc(("LUN#%u: pCon=%p, drvFlags=0x%x\n", uLUN, pDrv->pConnector, pDrv->fFlags));
/* Attach to driver list if not attached yet. */
if (!pDrv->fAttached)
{
RTListAppend(&pThis->lstDrv, &pDrv->Node);
pDrv->fAttached = true;
}
if (ppDrv)
*ppDrv = pDrv;
}
else
rc = VERR_NO_MEMORY;
}
else if (rc == VERR_PDM_NO_ATTACHED_DRIVER)
LogFunc(("No attached driver for LUN #%u\n", uLUN));
if (RT_FAILURE(rc))
{
/* Only free this string on failure;
* must remain valid for the live of the driver instance. */
RTStrFree(pszDesc);
}
LogFunc(("uLUN=%u, fFlags=0x%x, rc=%Rrc\n", uLUN, fFlags, rc));
return rc;
}
/**
* Detach command, internal version.
*
* This is called to let the device detach from a driver for a specified LUN
* during runtime.
*
* @returns VBox status code.
* @param pThis HDA state.
* @param pDrv Driver to detach device from.
* @param fFlags Flags, combination of the PDMDEVATT_FLAGS_* \#defines.
*/
static int hdaR3DetachInternal(PHDASTATE pThis, PHDADRIVER pDrv, uint32_t fFlags)
{
RT_NOREF(fFlags);
AudioMixerSinkRemoveStream(pThis->SinkFront.pMixSink, pDrv->Front.pMixStrm);
AudioMixerStreamDestroy(pDrv->Front.pMixStrm);
pDrv->Front.pMixStrm = NULL;
#ifdef VBOX_WITH_AUDIO_HDA_51_SURROUND
AudioMixerSinkRemoveStream(pThis->SinkCenterLFE.pMixSink, pDrv->CenterLFE.pMixStrm);
AudioMixerStreamDestroy(pDrv->CenterLFE.pMixStrm);
pDrv->CenterLFE.pMixStrm = NULL;
AudioMixerSinkRemoveStream(pThis->SinkRear.pMixSink, pDrv->Rear.pMixStrm);
AudioMixerStreamDestroy(pDrv->Rear.pMixStrm);
pDrv->Rear.pMixStrm = NULL;
#endif
AudioMixerSinkRemoveStream(pThis->SinkLineIn.pMixSink, pDrv->LineIn.pMixStrm);
AudioMixerStreamDestroy(pDrv->LineIn.pMixStrm);
pDrv->LineIn.pMixStrm = NULL;
#ifdef VBOX_WITH_AUDIO_HDA_MIC_IN
AudioMixerSinkRemoveStream(pThis->SinkMicIn.pMixSink, pDrv->MicIn.pMixStrm);
AudioMixerStreamDestroy(pDrv->MicIn.pMixStrm);
pDrv->MicIn.pMixStrm = NULL;
#endif
RTListNodeRemove(&pDrv->Node);
LogFunc(("uLUN=%u, fFlags=0x%x\n", pDrv->uLUN, fFlags));
return VINF_SUCCESS;
}
/**
* @interface_method_impl{PDMDEVREG,pfnAttach}
*/
static DECLCALLBACK(int) hdaR3Attach(PPDMDEVINS pDevIns, unsigned uLUN, uint32_t fFlags)
{
PHDASTATE pThis = PDMINS_2_DATA(pDevIns, PHDASTATE);
DEVHDA_LOCK_RETURN(pThis, VERR_IGNORED);
LogFunc(("uLUN=%u, fFlags=0x%x\n", uLUN, fFlags));
PHDADRIVER pDrv;
int rc2 = hdaR3AttachInternal(pThis, uLUN, fFlags, &pDrv);
if (RT_SUCCESS(rc2))
{
PHDASTREAM pStream = hdaR3GetStreamFromSink(pThis, &pThis->SinkFront);
if (DrvAudioHlpStreamCfgIsValid(&pStream->State.Cfg))
{
rc2 = hdaR3UpdateStream(pThis, &pStream->State.Cfg);
AssertRC(rc2);
}
#ifdef VBOX_WITH_AUDIO_HDA_51_SURROUND
pStream = hdaR3GetStreamFromSink(pThis, &pThis->SinkCenterLFE);
if (DrvAudioHlpStreamCfgIsValid(&pStream->State.Cfg))
{
rc2 = hdaR3UpdateStream(pThis, &pStream->State.Cfg);
AssertRC(rc2);
}
pStream = hdaR3GetStreamFromSink(pThis, &pThis->SinkRear);
if (DrvAudioHlpStreamCfgIsValid(&pStream->State.Cfg))
{
rc2 = hdaR3UpdateStream(pThis, &pStream->State.Cfg);
AssertRC(rc2);
}
#endif
pStream = hdaR3GetStreamFromSink(pThis, &pThis->SinkLineIn);
if (DrvAudioHlpStreamCfgIsValid(&pStream->State.Cfg))
{
rc2 = hdaR3UpdateStream(pThis, &pStream->State.Cfg);
AssertRC(rc2);
}
#ifdef VBOX_WITH_AUDIO_HDA_MIC_IN
pStream = hdaR3GetStreamFromSink(pThis, &pThis->SinkMicIn);
if (DrvAudioHlpStreamCfgIsValid(&pStream->State.Cfg))
{
rc2 = hdaR3UpdateStream(pThis, &pStream->State.Cfg);
AssertRC(rc2);
}
#endif
}
DEVHDA_UNLOCK(pThis);
return VINF_SUCCESS;
}
/**
* @interface_method_impl{PDMDEVREG,pfnDetach}
*/
static DECLCALLBACK(void) hdaR3Detach(PPDMDEVINS pDevIns, unsigned uLUN, uint32_t fFlags)
{
PHDASTATE pThis = PDMINS_2_DATA(pDevIns, PHDASTATE);
DEVHDA_LOCK(pThis);
LogFunc(("uLUN=%u, fFlags=0x%x\n", uLUN, fFlags));
PHDADRIVER pDrv, pDrvNext;
RTListForEachSafe(&pThis->lstDrv, pDrv, pDrvNext, HDADRIVER, Node)
{
if (pDrv->uLUN == uLUN)
{
int rc2 = hdaR3DetachInternal(pThis, pDrv, fFlags);
if (RT_SUCCESS(rc2))
{
RTMemFree(pDrv);
pDrv = NULL;
}
break;
}
}
DEVHDA_UNLOCK(pThis);
}
/**
* Powers off the device.
*
* @param pDevIns Device instance to power off.
*/
static DECLCALLBACK(void) hdaR3PowerOff(PPDMDEVINS pDevIns)
{
PHDASTATE pThis = PDMINS_2_DATA(pDevIns, PHDASTATE);
DEVHDA_LOCK_RETURN_VOID(pThis);
LogRel2(("HDA: Powering off ...\n"));
/* Ditto goes for the codec, which in turn uses the mixer. */
hdaCodecPowerOff(pThis->pCodec);
/*
* Note: Destroy the mixer while powering off and *not* in hdaR3Destruct,
* giving the mixer the chance to release any references held to
* PDM audio streams it maintains.
*/
if (pThis->pMixer)
{
AudioMixerDestroy(pThis->pMixer);
pThis->pMixer = NULL;
}
DEVHDA_UNLOCK(pThis);
}
/**
* Re-attaches (replaces) a driver with a new driver.
*
* This is only used by to attach the Null driver when it failed to attach the
* one that was configured.
*
* @returns VBox status code.
* @param pThis Device instance to re-attach driver to.
* @param pDrv Driver instance used for attaching to.
* If NULL is specified, a new driver will be created and appended
* to the driver list.
* @param uLUN The logical unit which is being re-detached.
* @param pszDriver New driver name to attach.
*/
static int hdaR3ReattachInternal(PHDASTATE pThis, PHDADRIVER pDrv, uint8_t uLUN, const char *pszDriver)
{
AssertPtrReturn(pThis, VERR_INVALID_POINTER);
AssertPtrReturn(pszDriver, VERR_INVALID_POINTER);
int rc;
if (pDrv)
{
rc = hdaR3DetachInternal(pThis, pDrv, 0 /* fFlags */);
if (RT_SUCCESS(rc))
rc = PDMDevHlpDriverDetach(pThis->pDevInsR3, PDMIBASE_2_PDMDRV(pDrv->pDrvBase), 0 /* fFlags */);
if (RT_FAILURE(rc))
return rc;
pDrv = NULL;
}
PVM pVM = PDMDevHlpGetVM(pThis->pDevInsR3);
PCFGMNODE pRoot = CFGMR3GetRoot(pVM);
PCFGMNODE pDev0 = CFGMR3GetChild(pRoot, "Devices/hda/0/");
/* Remove LUN branch. */
CFGMR3RemoveNode(CFGMR3GetChildF(pDev0, "LUN#%u/", uLUN));
#define RC_CHECK() if (RT_FAILURE(rc)) { AssertReleaseRC(rc); break; }
do
{
PCFGMNODE pLunL0;
rc = CFGMR3InsertNodeF(pDev0, &pLunL0, "LUN#%u/", uLUN); RC_CHECK();
rc = CFGMR3InsertString(pLunL0, "Driver", "AUDIO"); RC_CHECK();
rc = CFGMR3InsertNode(pLunL0, "Config/", NULL); RC_CHECK();
PCFGMNODE pLunL1, pLunL2;
rc = CFGMR3InsertNode (pLunL0, "AttachedDriver/", &pLunL1); RC_CHECK();
rc = CFGMR3InsertNode (pLunL1, "Config/", &pLunL2); RC_CHECK();
rc = CFGMR3InsertString(pLunL1, "Driver", pszDriver); RC_CHECK();
rc = CFGMR3InsertString(pLunL2, "AudioDriver", pszDriver); RC_CHECK();
} while (0);
if (RT_SUCCESS(rc))
rc = hdaR3AttachInternal(pThis, uLUN, 0 /* fFlags */, NULL /* ppDrv */);
LogFunc(("pThis=%p, uLUN=%u, pszDriver=%s, rc=%Rrc\n", pThis, uLUN, pszDriver, rc));
#undef RC_CHECK
return rc;
}
/**
* @interface_method_impl{PDMDEVREG,pfnReset}
*/
static DECLCALLBACK(void) hdaR3Reset(PPDMDEVINS pDevIns)
{
PHDASTATE pThis = PDMINS_2_DATA(pDevIns, PHDASTATE);
LogFlowFuncEnter();
DEVHDA_LOCK_RETURN_VOID(pThis);
/*
* 18.2.6,7 defines that values of this registers might be cleared on power on/reset
* hdaR3Reset shouldn't affects these registers.
*/
HDA_REG(pThis, WAKEEN) = 0x0;
hdaR3GCTLReset(pThis);
/* Indicate that HDA is not in reset. The firmware is supposed to (un)reset HDA,
* but we can take a shortcut.
*/
HDA_REG(pThis, GCTL) = HDA_GCTL_CRST;
DEVHDA_UNLOCK(pThis);
}
/**
* @interface_method_impl{PDMDEVREG,pfnRelocate}
*/
static DECLCALLBACK(void) hdaR3Relocate(PPDMDEVINS pDevIns, RTGCINTPTR offDelta)
{
NOREF(offDelta);
PHDASTATE pThis = PDMINS_2_DATA(pDevIns, PHDASTATE);
pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
}
/**
* @interface_method_impl{PDMDEVREG,pfnDestruct}
*/
static DECLCALLBACK(int) hdaR3Destruct(PPDMDEVINS pDevIns)
{
PDMDEV_CHECK_VERSIONS_RETURN_QUIET(pDevIns); /* this shall come first */
PHDASTATE pThis = PDMINS_2_DATA(pDevIns, PHDASTATE);
DEVHDA_LOCK(pThis); /** @todo r=bird: this will fail on early constructor failure. */
PHDADRIVER pDrv;
while (!RTListIsEmpty(&pThis->lstDrv))
{
pDrv = RTListGetFirst(&pThis->lstDrv, HDADRIVER, Node);
RTListNodeRemove(&pDrv->Node);
RTMemFree(pDrv);
}
if (pThis->pCodec)
{
hdaCodecDestruct(pThis->pCodec);
RTMemFree(pThis->pCodec);
pThis->pCodec = NULL;
}
RTMemFree(pThis->pu32CorbBuf);
pThis->pu32CorbBuf = NULL;
RTMemFree(pThis->pu64RirbBuf);
pThis->pu64RirbBuf = NULL;
for (uint8_t i = 0; i < HDA_MAX_STREAMS; i++)
hdaR3StreamDestroy(&pThis->aStreams[i]);
DEVHDA_UNLOCK(pThis);
return VINF_SUCCESS;
}
/**
* @interface_method_impl{PDMDEVREG,pfnConstruct}
*/
static DECLCALLBACK(int) hdaR3Construct(PPDMDEVINS pDevIns, int iInstance, PCFGMNODE pCfg)
{
PDMDEV_CHECK_VERSIONS_RETURN(pDevIns); /* this shall come first */
PHDASTATE pThis = PDMINS_2_DATA(pDevIns, PHDASTATE);
Assert(iInstance == 0); RT_NOREF(iInstance);
/*
* Initialize the state sufficently to make the destructor work.
*/
pThis->uAlignmentCheckMagic = HDASTATE_ALIGNMENT_CHECK_MAGIC;
RTListInit(&pThis->lstDrv);
/** @todo r=bird: There are probably other things which should be
* initialized here before we start failing. */
/*
* Validations.
*/
if (!CFGMR3AreValuesValid(pCfg, "RZEnabled\0"
"TimerHz\0"
"PosAdjustEnabled\0"
"PosAdjustFrames\0"
"DebugEnabled\0"
"DebugPathOut\0"))
{
return PDMDEV_SET_ERROR(pDevIns, VERR_PDM_DEVINS_UNKNOWN_CFG_VALUES,
N_ ("Invalid configuration for the Intel HDA device"));
}
int rc = CFGMR3QueryBoolDef(pCfg, "RZEnabled", &pThis->fRZEnabled, true);
if (RT_FAILURE(rc))
return PDMDEV_SET_ERROR(pDevIns, rc,
N_("HDA configuration error: failed to read RCEnabled as boolean"));
rc = CFGMR3QueryU16Def(pCfg, "TimerHz", &pThis->u16TimerHz, HDA_TIMER_HZ_DEFAULT /* Default value, if not set. */);
if (RT_FAILURE(rc))
return PDMDEV_SET_ERROR(pDevIns, rc,
N_("HDA configuration error: failed to read Hertz (Hz) rate as unsigned integer"));
if (pThis->u16TimerHz != HDA_TIMER_HZ_DEFAULT)
LogRel(("HDA: Using custom device timer rate (%RU16Hz)\n", pThis->u16TimerHz));
rc = CFGMR3QueryBoolDef(pCfg, "PosAdjustEnabled", &pThis->fPosAdjustEnabled, true);
if (RT_FAILURE(rc))
return PDMDEV_SET_ERROR(pDevIns, rc,
N_("HDA configuration error: failed to read position adjustment enabled as boolean"));
if (!pThis->fPosAdjustEnabled)
LogRel(("HDA: Position adjustment is disabled\n"));
rc = CFGMR3QueryU16Def(pCfg, "PosAdjustFrames", &pThis->cPosAdjustFrames, HDA_POS_ADJUST_DEFAULT);
if (RT_FAILURE(rc))
return PDMDEV_SET_ERROR(pDevIns, rc,
N_("HDA configuration error: failed to read position adjustment frames as unsigned integer"));
if (pThis->cPosAdjustFrames)
LogRel(("HDA: Using custom position adjustment (%RU16 audio frames)\n", pThis->cPosAdjustFrames));
rc = CFGMR3QueryBoolDef(pCfg, "DebugEnabled", &pThis->Dbg.fEnabled, false);
if (RT_FAILURE(rc))
return PDMDEV_SET_ERROR(pDevIns, rc,
N_("HDA configuration error: failed to read debugging enabled flag as boolean"));
rc = CFGMR3QueryStringDef(pCfg, "DebugPathOut", pThis->Dbg.szOutPath, sizeof(pThis->Dbg.szOutPath),
VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH);
if (RT_FAILURE(rc))
return PDMDEV_SET_ERROR(pDevIns, rc,
N_("HDA configuration error: failed to read debugging output path flag as string"));
if (!strlen(pThis->Dbg.szOutPath))
RTStrPrintf(pThis->Dbg.szOutPath, sizeof(pThis->Dbg.szOutPath), VBOX_AUDIO_DEBUG_DUMP_PCM_DATA_PATH);
if (pThis->Dbg.fEnabled)
LogRel2(("HDA: Debug output will be saved to '%s'\n", pThis->Dbg.szOutPath));
/*
* Use an own critical section for the device instead of the default
* one provided by PDM. This allows fine-grained locking in combination
* with TM when timer-specific stuff is being called in e.g. the MMIO handlers.
*/
rc = PDMDevHlpCritSectInit(pDevIns, &pThis->CritSect, RT_SRC_POS, "HDA");
AssertRCReturn(rc, rc);
rc = PDMDevHlpSetDeviceCritSect(pDevIns, PDMDevHlpCritSectGetNop(pDevIns));
AssertRCReturn(rc, rc);
/*
* Initialize data (most of it anyway).
*/
pThis->pDevInsR3 = pDevIns;
pThis->pDevInsR0 = PDMDEVINS_2_R0PTR(pDevIns);
pThis->pDevInsRC = PDMDEVINS_2_RCPTR(pDevIns);
/* IBase */
pThis->IBase.pfnQueryInterface = hdaR3QueryInterface;
/* PCI Device */
PCIDevSetVendorId (&pThis->PciDev, HDA_PCI_VENDOR_ID); /* nVidia */
PCIDevSetDeviceId (&pThis->PciDev, HDA_PCI_DEVICE_ID); /* HDA */
PCIDevSetCommand (&pThis->PciDev, 0x0000); /* 04 rw,ro - pcicmd. */
PCIDevSetStatus (&pThis->PciDev, VBOX_PCI_STATUS_CAP_LIST); /* 06 rwc?,ro? - pcists. */
PCIDevSetRevisionId (&pThis->PciDev, 0x01); /* 08 ro - rid. */
PCIDevSetClassProg (&pThis->PciDev, 0x00); /* 09 ro - pi. */
PCIDevSetClassSub (&pThis->PciDev, 0x03); /* 0a ro - scc; 03 == HDA. */
PCIDevSetClassBase (&pThis->PciDev, 0x04); /* 0b ro - bcc; 04 == multimedia. */
PCIDevSetHeaderType (&pThis->PciDev, 0x00); /* 0e ro - headtyp. */
PCIDevSetBaseAddress (&pThis->PciDev, 0, /* 10 rw - MMIO */
false /* fIoSpace */, false /* fPrefetchable */, true /* f64Bit */, 0x00000000);
PCIDevSetInterruptLine (&pThis->PciDev, 0x00); /* 3c rw. */
PCIDevSetInterruptPin (&pThis->PciDev, 0x01); /* 3d ro - INTA#. */
#if defined(HDA_AS_PCI_EXPRESS)
PCIDevSetCapabilityList (&pThis->PciDev, 0x80);
#elif defined(VBOX_WITH_MSI_DEVICES)
PCIDevSetCapabilityList (&pThis->PciDev, 0x60);
#else
PCIDevSetCapabilityList (&pThis->PciDev, 0x50); /* ICH6 datasheet 18.1.16 */
#endif
/// @todo r=michaln: If there are really no PCIDevSetXx for these, the meaning
/// of these values needs to be properly documented!
/* HDCTL off 0x40 bit 0 selects signaling mode (1-HDA, 0 - Ac97) 18.1.19 */
PCIDevSetByte(&pThis->PciDev, 0x40, 0x01);
/* Power Management */
PCIDevSetByte(&pThis->PciDev, 0x50 + 0, VBOX_PCI_CAP_ID_PM);
PCIDevSetByte(&pThis->PciDev, 0x50 + 1, 0x0); /* next */
PCIDevSetWord(&pThis->PciDev, 0x50 + 2, VBOX_PCI_PM_CAP_DSI | 0x02 /* version, PM1.1 */ );
#ifdef HDA_AS_PCI_EXPRESS
/* PCI Express */
PCIDevSetByte(&pThis->PciDev, 0x80 + 0, VBOX_PCI_CAP_ID_EXP); /* PCI_Express */
PCIDevSetByte(&pThis->PciDev, 0x80 + 1, 0x60); /* next */
/* Device flags */
PCIDevSetWord(&pThis->PciDev, 0x80 + 2,
/* version */ 0x1 |
/* Root Complex Integrated Endpoint */ (VBOX_PCI_EXP_TYPE_ROOT_INT_EP << 4) |
/* MSI */ (100) << 9 );
/* Device capabilities */
PCIDevSetDWord(&pThis->PciDev, 0x80 + 4, VBOX_PCI_EXP_DEVCAP_FLRESET);
/* Device control */
PCIDevSetWord( &pThis->PciDev, 0x80 + 8, 0);
/* Device status */
PCIDevSetWord( &pThis->PciDev, 0x80 + 10, 0);
/* Link caps */
PCIDevSetDWord(&pThis->PciDev, 0x80 + 12, 0);
/* Link control */
PCIDevSetWord( &pThis->PciDev, 0x80 + 16, 0);
/* Link status */
PCIDevSetWord( &pThis->PciDev, 0x80 + 18, 0);
/* Slot capabilities */
PCIDevSetDWord(&pThis->PciDev, 0x80 + 20, 0);
/* Slot control */
PCIDevSetWord( &pThis->PciDev, 0x80 + 24, 0);
/* Slot status */
PCIDevSetWord( &pThis->PciDev, 0x80 + 26, 0);
/* Root control */
PCIDevSetWord( &pThis->PciDev, 0x80 + 28, 0);
/* Root capabilities */
PCIDevSetWord( &pThis->PciDev, 0x80 + 30, 0);
/* Root status */
PCIDevSetDWord(&pThis->PciDev, 0x80 + 32, 0);
/* Device capabilities 2 */
PCIDevSetDWord(&pThis->PciDev, 0x80 + 36, 0);
/* Device control 2 */
PCIDevSetQWord(&pThis->PciDev, 0x80 + 40, 0);
/* Link control 2 */
PCIDevSetQWord(&pThis->PciDev, 0x80 + 48, 0);
/* Slot control 2 */
PCIDevSetWord( &pThis->PciDev, 0x80 + 56, 0);
#endif
/*
* Register the PCI device.
*/
rc = PDMDevHlpPCIRegister(pDevIns, &pThis->PciDev);
if (RT_FAILURE(rc))
return rc;
rc = PDMDevHlpPCIIORegionRegister(pDevIns, 0, 0x4000, PCI_ADDRESS_SPACE_MEM, hdaR3PciIoRegionMap);
if (RT_FAILURE(rc))
return rc;
#ifdef VBOX_WITH_MSI_DEVICES
PDMMSIREG MsiReg;
RT_ZERO(MsiReg);
MsiReg.cMsiVectors = 1;
MsiReg.iMsiCapOffset = 0x60;
MsiReg.iMsiNextOffset = 0x50;
rc = PDMDevHlpPCIRegisterMsi(pDevIns, &MsiReg);
if (RT_FAILURE(rc))
{
/* That's OK, we can work without MSI */
PCIDevSetCapabilityList(&pThis->PciDev, 0x50);
}
#endif
rc = PDMDevHlpSSMRegister(pDevIns, HDA_SSM_VERSION, sizeof(*pThis), hdaR3SaveExec, hdaR3LoadExec);
if (RT_FAILURE(rc))
return rc;
#ifdef VBOX_WITH_AUDIO_HDA_ASYNC_IO
LogRel(("HDA: Asynchronous I/O enabled\n"));
#endif
uint8_t uLUN;
for (uLUN = 0; uLUN < UINT8_MAX; ++uLUN)
{
LogFunc(("Trying to attach driver for LUN #%RU32 ...\n", uLUN));
rc = hdaR3AttachInternal(pThis, uLUN, 0 /* fFlags */, NULL /* ppDrv */);
if (RT_FAILURE(rc))
{
if (rc == VERR_PDM_NO_ATTACHED_DRIVER)
rc = VINF_SUCCESS;
else if (rc == VERR_AUDIO_BACKEND_INIT_FAILED)
{
hdaR3ReattachInternal(pThis, NULL /* pDrv */, uLUN, "NullAudio");
PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "HostAudioNotResponding",
N_("Host audio backend initialization has failed. Selecting the NULL audio backend "
"with the consequence that no sound is audible"));
/* Attaching to the NULL audio backend will never fail. */
rc = VINF_SUCCESS;
}
break;
}
}
LogFunc(("cLUNs=%RU8, rc=%Rrc\n", uLUN, rc));
if (RT_SUCCESS(rc))
{
rc = AudioMixerCreate("HDA Mixer", 0 /* uFlags */, &pThis->pMixer);
if (RT_SUCCESS(rc))
{
/*
* Add mixer output sinks.
*/
#ifdef VBOX_WITH_AUDIO_HDA_51_SURROUND
rc = AudioMixerCreateSink(pThis->pMixer, "[Playback] Front",
AUDMIXSINKDIR_OUTPUT, &pThis->SinkFront.pMixSink);
AssertRC(rc);
rc = AudioMixerCreateSink(pThis->pMixer, "[Playback] Center / Subwoofer",
AUDMIXSINKDIR_OUTPUT, &pThis->SinkCenterLFE.pMixSink);
AssertRC(rc);
rc = AudioMixerCreateSink(pThis->pMixer, "[Playback] Rear",
AUDMIXSINKDIR_OUTPUT, &pThis->SinkRear.pMixSink);
AssertRC(rc);
#else
rc = AudioMixerCreateSink(pThis->pMixer, "[Playback] PCM Output",
AUDMIXSINKDIR_OUTPUT, &pThis->SinkFront.pMixSink);
AssertRC(rc);
#endif
/*
* Add mixer input sinks.
*/
rc = AudioMixerCreateSink(pThis->pMixer, "[Recording] Line In",
AUDMIXSINKDIR_INPUT, &pThis->SinkLineIn.pMixSink);
AssertRC(rc);
#ifdef VBOX_WITH_AUDIO_HDA_MIC_IN
rc = AudioMixerCreateSink(pThis->pMixer, "[Recording] Microphone In",
AUDMIXSINKDIR_INPUT, &pThis->SinkMicIn.pMixSink);
AssertRC(rc);
#endif
/* There is no master volume control. Set the master to max. */
PDMAUDIOVOLUME vol = { false, 255, 255 };
rc = AudioMixerSetMasterVolume(pThis->pMixer, &vol);
AssertRC(rc);
}
}
if (RT_SUCCESS(rc))
{
/* Allocate CORB buffer. */
pThis->cbCorbBuf = HDA_CORB_SIZE * HDA_CORB_ELEMENT_SIZE;
pThis->pu32CorbBuf = (uint32_t *)RTMemAllocZ(pThis->cbCorbBuf);
if (pThis->pu32CorbBuf)
{
/* Allocate RIRB buffer. */
pThis->cbRirbBuf = HDA_RIRB_SIZE * HDA_RIRB_ELEMENT_SIZE;
pThis->pu64RirbBuf = (uint64_t *)RTMemAllocZ(pThis->cbRirbBuf);
if (pThis->pu64RirbBuf)
{
/* Allocate codec. */
pThis->pCodec = (PHDACODEC)RTMemAllocZ(sizeof(HDACODEC));
if (!pThis->pCodec)
rc = PDMDEV_SET_ERROR(pDevIns, VERR_NO_MEMORY, N_("Out of memory allocating HDA codec state"));
}
else
rc = PDMDEV_SET_ERROR(pDevIns, VERR_NO_MEMORY, N_("Out of memory allocating RIRB"));
}
else
rc = PDMDEV_SET_ERROR(pDevIns, VERR_NO_MEMORY, N_("Out of memory allocating CORB"));
if (RT_SUCCESS(rc))
{
/* Set codec callbacks to this controller. */
pThis->pCodec->pfnCbMixerAddStream = hdaR3MixerAddStream;
pThis->pCodec->pfnCbMixerRemoveStream = hdaR3MixerRemoveStream;
pThis->pCodec->pfnCbMixerControl = hdaR3MixerControl;
pThis->pCodec->pfnCbMixerSetVolume = hdaR3MixerSetVolume;
pThis->pCodec->pHDAState = pThis; /* Assign HDA controller state to codec. */
/* Construct the codec. */
rc = hdaCodecConstruct(pDevIns, pThis->pCodec, 0 /* Codec index */, pCfg);
if (RT_FAILURE(rc))
AssertRCReturn(rc, rc);
/* ICH6 datasheet defines 0 values for SVID and SID (18.1.14-15), which together with values returned for
verb F20 should provide device/codec recognition. */
Assert(pThis->pCodec->u16VendorId);
Assert(pThis->pCodec->u16DeviceId);
PCIDevSetSubSystemVendorId(&pThis->PciDev, pThis->pCodec->u16VendorId); /* 2c ro - intel.) */
PCIDevSetSubSystemId( &pThis->PciDev, pThis->pCodec->u16DeviceId); /* 2e ro. */
}
}
if (RT_SUCCESS(rc))
{
/*
* Create all hardware streams.
*/
for (uint8_t i = 0; i < HDA_MAX_STREAMS; ++i)
{
/* Create the emulation timer (per stream).
*
* Note: Use TMCLOCK_VIRTUAL_SYNC here, as the guest's HDA driver
* relies on exact (virtual) DMA timing and uses DMA Position Buffers
* instead of the LPIB registers.
*/
char szTimer[16];
RTStrPrintf2(szTimer, sizeof(szTimer), "HDA SD%RU8", i);
rc = PDMDevHlpTMTimerCreate(pDevIns, TMCLOCK_VIRTUAL_SYNC, hdaR3Timer, &pThis->aStreams[i],
TMTIMER_FLAGS_NO_CRIT_SECT, szTimer, &pThis->pTimer[i]);
AssertRCReturn(rc, rc);
/* Use our own critcal section for the device timer.
* That way we can control more fine-grained when to lock what. */
rc = TMR3TimerSetCritSect(pThis->pTimer[i], &pThis->CritSect);
AssertRCReturn(rc, rc);
rc = hdaR3StreamCreate(&pThis->aStreams[i], pThis, i /* u8SD */);
AssertRC(rc);
}
#ifdef VBOX_WITH_AUDIO_HDA_ONETIME_INIT
/*
* Initialize the driver chain.
*/
PHDADRIVER pDrv;
RTListForEach(&pThis->lstDrv, pDrv, HDADRIVER, Node)
{
/*
* Only primary drivers are critical for the VM to run. Everything else
* might not worth showing an own error message box in the GUI.
*/
if (!(pDrv->fFlags & PDMAUDIODRVFLAGS_PRIMARY))
continue;
PPDMIAUDIOCONNECTOR pCon = pDrv->pConnector;
AssertPtr(pCon);
bool fValidLineIn = AudioMixerStreamIsValid(pDrv->LineIn.pMixStrm);
# ifdef VBOX_WITH_AUDIO_HDA_MIC_IN
bool fValidMicIn = AudioMixerStreamIsValid(pDrv->MicIn.pMixStrm);
# endif
bool fValidOut = AudioMixerStreamIsValid(pDrv->Front.pMixStrm);
# ifdef VBOX_WITH_AUDIO_HDA_51_SURROUND
/** @todo Anything to do here? */
# endif
if ( !fValidLineIn
# ifdef VBOX_WITH_AUDIO_HDA_MIC_IN
&& !fValidMicIn
# endif
&& !fValidOut)
{
LogRel(("HDA: Falling back to NULL backend (no sound audible)\n"));
hdaR3Reset(pDevIns);
hdaR3ReattachInternal(pThis, pDrv, pDrv->uLUN, "NullAudio");
PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "HostAudioNotResponding",
N_("No audio devices could be opened. Selecting the NULL audio backend "
"with the consequence that no sound is audible"));
}
else
{
bool fWarn = false;
PDMAUDIOBACKENDCFG backendCfg;
int rc2 = pCon->pfnGetConfig(pCon, &backendCfg);
if (RT_SUCCESS(rc2))
{
if (backendCfg.cMaxStreamsIn)
{
# ifdef VBOX_WITH_AUDIO_HDA_MIC_IN
/* If the audio backend supports two or more input streams at once,
* warn if one of our two inputs (microphone-in and line-in) failed to initialize. */
if (backendCfg.cMaxStreamsIn >= 2)
fWarn = !fValidLineIn || !fValidMicIn;
/* If the audio backend only supports one input stream at once (e.g. pure ALSA, and
* *not* ALSA via PulseAudio plugin!), only warn if both of our inputs failed to initialize.
* One of the two simply is not in use then. */
else if (backendCfg.cMaxStreamsIn == 1)
fWarn = !fValidLineIn && !fValidMicIn;
/* Don't warn if our backend is not able of supporting any input streams at all. */
# else /* !VBOX_WITH_AUDIO_HDA_MIC_IN */
/* We only have line-in as input source. */
fWarn = !fValidLineIn;
# endif /* VBOX_WITH_AUDIO_HDA_MIC_IN */
}
if ( !fWarn
&& backendCfg.cMaxStreamsOut)
{
fWarn = !fValidOut;
}
}
else
{
LogRel(("HDA: Unable to retrieve audio backend configuration for LUN #%RU8, rc=%Rrc\n", pDrv->uLUN, rc2));
fWarn = true;
}
if (fWarn)
{
char szMissingStreams[255];
size_t len = 0;
if (!fValidLineIn)
{
LogRel(("HDA: WARNING: Unable to open PCM line input for LUN #%RU8!\n", pDrv->uLUN));
len = RTStrPrintf(szMissingStreams, sizeof(szMissingStreams), "PCM Input");
}
# ifdef VBOX_WITH_AUDIO_HDA_MIC_IN
if (!fValidMicIn)
{
LogRel(("HDA: WARNING: Unable to open PCM microphone input for LUN #%RU8!\n", pDrv->uLUN));
len += RTStrPrintf(szMissingStreams + len,
sizeof(szMissingStreams) - len, len ? ", PCM Microphone" : "PCM Microphone");
}
# endif /* VBOX_WITH_AUDIO_HDA_MIC_IN */
if (!fValidOut)
{
LogRel(("HDA: WARNING: Unable to open PCM output for LUN #%RU8!\n", pDrv->uLUN));
len += RTStrPrintf(szMissingStreams + len,
sizeof(szMissingStreams) - len, len ? ", PCM Output" : "PCM Output");
}
PDMDevHlpVMSetRuntimeError(pDevIns, 0 /*fFlags*/, "HostAudioNotResponding",
N_("Some HDA audio streams (%s) could not be opened. Guest applications generating audio "
"output or depending on audio input may hang. Make sure your host audio device "
"is working properly. Check the logfile for error messages of the audio "
"subsystem"), szMissingStreams);
}
}
}
#endif /* VBOX_WITH_AUDIO_HDA_ONETIME_INIT */
}
if (RT_SUCCESS(rc))
{
hdaR3Reset(pDevIns);
/*
* Debug and string formatter types.
*/
PDMDevHlpDBGFInfoRegister(pDevIns, "hda", "HDA info. (hda [register case-insensitive])", hdaR3DbgInfo);
PDMDevHlpDBGFInfoRegister(pDevIns, "hdabdle", "HDA stream BDLE info. (hdabdle [stream number])", hdaR3DbgInfoBDLE);
PDMDevHlpDBGFInfoRegister(pDevIns, "hdastream", "HDA stream info. (hdastream [stream number])", hdaR3DbgInfoStream);
PDMDevHlpDBGFInfoRegister(pDevIns, "hdcnodes", "HDA codec nodes.", hdaR3DbgInfoCodecNodes);
PDMDevHlpDBGFInfoRegister(pDevIns, "hdcselector", "HDA codec's selector states [node number].", hdaR3DbgInfoCodecSelector);
PDMDevHlpDBGFInfoRegister(pDevIns, "hdamixer", "HDA mixer state.", hdaR3DbgInfoMixer);
rc = RTStrFormatTypeRegister("bdle", hdaR3StrFmtBDLE, NULL);
AssertRC(rc);
rc = RTStrFormatTypeRegister("sdctl", hdaR3StrFmtSDCTL, NULL);
AssertRC(rc);
rc = RTStrFormatTypeRegister("sdsts", hdaR3StrFmtSDSTS, NULL);
AssertRC(rc);
rc = RTStrFormatTypeRegister("sdfifos", hdaR3StrFmtSDFIFOS, NULL);
AssertRC(rc);
rc = RTStrFormatTypeRegister("sdfifow", hdaR3StrFmtSDFIFOW, NULL);
AssertRC(rc);
/*
* Some debug assertions.
*/
for (unsigned i = 0; i < RT_ELEMENTS(g_aHdaRegMap); i++)
{
struct HDAREGDESC const *pReg = &g_aHdaRegMap[i];
struct HDAREGDESC const *pNextReg = i + 1 < RT_ELEMENTS(g_aHdaRegMap) ? &g_aHdaRegMap[i + 1] : NULL;
/* binary search order. */
AssertReleaseMsg(!pNextReg || pReg->offset + pReg->size <= pNextReg->offset,
("[%#x] = {%#x LB %#x} vs. [%#x] = {%#x LB %#x}\n",
i, pReg->offset, pReg->size, i + 1, pNextReg->offset, pNextReg->size));
/* alignment. */
AssertReleaseMsg( pReg->size == 1
|| (pReg->size == 2 && (pReg->offset & 1) == 0)
|| (pReg->size == 3 && (pReg->offset & 3) == 0)
|| (pReg->size == 4 && (pReg->offset & 3) == 0),
("[%#x] = {%#x LB %#x}\n", i, pReg->offset, pReg->size));
/* registers are packed into dwords - with 3 exceptions with gaps at the end of the dword. */
AssertRelease(((pReg->offset + pReg->size) & 3) == 0 || pNextReg);
if (pReg->offset & 3)
{
struct HDAREGDESC const *pPrevReg = i > 0 ? &g_aHdaRegMap[i - 1] : NULL;
AssertReleaseMsg(pPrevReg, ("[%#x] = {%#x LB %#x}\n", i, pReg->offset, pReg->size));
if (pPrevReg)
AssertReleaseMsg(pPrevReg->offset + pPrevReg->size == pReg->offset,
("[%#x] = {%#x LB %#x} vs. [%#x] = {%#x LB %#x}\n",
i - 1, pPrevReg->offset, pPrevReg->size, i + 1, pReg->offset, pReg->size));
}
#if 0
if ((pReg->offset + pReg->size) & 3)
{
AssertReleaseMsg(pNextReg, ("[%#x] = {%#x LB %#x}\n", i, pReg->offset, pReg->size));
if (pNextReg)
AssertReleaseMsg(pReg->offset + pReg->size == pNextReg->offset,
("[%#x] = {%#x LB %#x} vs. [%#x] = {%#x LB %#x}\n",
i, pReg->offset, pReg->size, i + 1, pNextReg->offset, pNextReg->size));
}
#endif
/* The final entry is a full DWORD, no gaps! Allows shortcuts. */
AssertReleaseMsg(pNextReg || ((pReg->offset + pReg->size) & 3) == 0,
("[%#x] = {%#x LB %#x}\n", i, pReg->offset, pReg->size));
}
}
# ifdef VBOX_WITH_STATISTICS
if (RT_SUCCESS(rc))
{
/*
* Register statistics.
*/
PDMDevHlpSTAMRegister(pDevIns, &pThis->StatTimer, STAMTYPE_PROFILE, "/Devices/HDA/Timer", STAMUNIT_TICKS_PER_CALL, "Profiling hdaR3Timer.");
PDMDevHlpSTAMRegister(pDevIns, &pThis->StatIn, STAMTYPE_PROFILE, "/Devices/HDA/Input", STAMUNIT_TICKS_PER_CALL, "Profiling input.");
PDMDevHlpSTAMRegister(pDevIns, &pThis->StatOut, STAMTYPE_PROFILE, "/Devices/HDA/Output", STAMUNIT_TICKS_PER_CALL, "Profiling output.");
PDMDevHlpSTAMRegister(pDevIns, &pThis->StatBytesRead, STAMTYPE_COUNTER, "/Devices/HDA/BytesRead" , STAMUNIT_BYTES, "Bytes read from HDA emulation.");
PDMDevHlpSTAMRegister(pDevIns, &pThis->StatBytesWritten, STAMTYPE_COUNTER, "/Devices/HDA/BytesWritten", STAMUNIT_BYTES, "Bytes written to HDA emulation.");
}
# endif
LogFlowFuncLeaveRC(rc);
return rc;
}
/**
* The device registration structure.
*/
const PDMDEVREG g_DeviceHDA =
{
/* u32Version */
PDM_DEVREG_VERSION,
/* szName */
"hda",
/* szRCMod */
"VBoxDDRC.rc",
/* szR0Mod */
"VBoxDDR0.r0",
/* pszDescription */
"Intel HD Audio Controller",
/* fFlags */
PDM_DEVREG_FLAGS_DEFAULT_BITS | PDM_DEVREG_FLAGS_RC | PDM_DEVREG_FLAGS_R0,
/* fClass */
PDM_DEVREG_CLASS_AUDIO,
/* cMaxInstances */
1,
/* cbInstance */
sizeof(HDASTATE),
/* pfnConstruct */
hdaR3Construct,
/* pfnDestruct */
hdaR3Destruct,
/* pfnRelocate */
hdaR3Relocate,
/* pfnMemSetup */
NULL,
/* pfnPowerOn */
NULL,
/* pfnReset */
hdaR3Reset,
/* pfnSuspend */
NULL,
/* pfnResume */
NULL,
/* pfnAttach */
hdaR3Attach,
/* pfnDetach */
hdaR3Detach,
/* pfnQueryInterface. */
NULL,
/* pfnInitComplete */
NULL,
/* pfnPowerOff */
hdaR3PowerOff,
/* pfnSoftReset */
NULL,
/* u32VersionEnd */
PDM_DEVREG_VERSION
};
#endif /* IN_RING3 */
#endif /* !VBOX_DEVICE_STRUCT_TESTCASE */
| 36.351266
| 210
| 0.595126
|
roughk
|
cb288eb1f968c86b8b67164743a542a058b9c6f1
| 3,376
|
hpp
|
C++
|
include/boost/application/detail/posix/path_impl.hpp
|
mlegenovic/Boost.Application
|
e69d4926027274dadb7d89c45964ddafa1edd7f5
|
[
"BSL-1.0"
] | null | null | null |
include/boost/application/detail/posix/path_impl.hpp
|
mlegenovic/Boost.Application
|
e69d4926027274dadb7d89c45964ddafa1edd7f5
|
[
"BSL-1.0"
] | null | null | null |
include/boost/application/detail/posix/path_impl.hpp
|
mlegenovic/Boost.Application
|
e69d4926027274dadb7d89c45964ddafa1edd7f5
|
[
"BSL-1.0"
] | null | null | null |
// Copyright 2014 Renato Tegon Forti
//
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt
// or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_APPLICATION_DETAIL_POSIX_PATH_FROM_ME_HPP
#define BOOST_APPLICATION_DETAIL_POSIX_PATH_FROM_ME_HPP
#include <boost/application/config.hpp>
#include <boost/predef/os.h>
#include <filesystem>
#include <system_error>
#include <cstdlib>
#include <pwd.h>
#include <unistd.h>
#ifdef BOOST_HAS_PRAGMA_ONCE
# pragma once
#endif
namespace boost::application::detail {
class default_path_impl
{
std::filesystem::path full_path_;
std::filesystem::path path_from_me(std::error_code &ec) {
return std::filesystem::read_symlink("/proc/self/exe", ec);
}
std::filesystem::path getenv(const char* env_name)
{
const char* res = ::getenv(env_name);
return res ? res : std::filesystem::path();
}
public:
std::filesystem::path current_path()
{
return std::filesystem::current_path();
}
const std::filesystem::path& location(std::error_code &ec)
{
if(!full_path_.empty())
return full_path_;
std::filesystem::path full_path
= path_from_me(ec);
if(ec)
full_path_ = std::filesystem::path();
full_path_ = full_path;
return full_path_;
}
const std::filesystem::path& location()
{
if(!full_path_.empty())
return full_path_;
std::error_code ec;
full_path_ = location(ec);
if (ec) {
boost::throw_exception(
std::system_error(
ec, "location() failed"
));
}
return full_path_;
}
inline std::filesystem::path home_path()
{
std::filesystem::path path = getenv("HOME");
if(path.empty())
{
struct passwd* pwd = getpwuid(getuid());
if(pwd)
return pwd->pw_dir;
return ".";
}
return path;
}
inline std::filesystem::path app_data_path()
{
std::filesystem::path path = getenv("XDG_DATA_HOME");
if(path.empty()) {
#if BOOST_OS_MACOS
return home_path() / "Library/Preferences/";
#else
return home_path() / ".local/share";
#endif
}
return path;
}
inline std::filesystem::path config_path()
{
std::filesystem::path path = getenv("XDG_CONFIG_HOME");
if(path.empty()) {
#if BOOST_OS_MACOS
return home_path() / "Library/Preferences/";
#else
return home_path() / ".config";
#endif
}
return path;
}
inline std::filesystem::path temp_path()
{
std::filesystem::path path = getenv("TMPDIR");
if(path.empty())
return "/tmp"; // Fallback if TMPDIR not available
return path;
}
};
} // namespace boost::application::detail
#endif // BOOST_APPLICATION_DETAIL_POSIX_PATH_FROM_ME_HPP
| 25.575758
| 71
| 0.534656
|
mlegenovic
|
cb29e7e9b4f4ea40ec91653b818bad6bada86e65
| 3,316
|
cpp
|
C++
|
M3ScriptHook/src/LuaStateManager.cpp
|
MartinJK/Mafia3ScriptHook
|
b27da0dfcc93118aa4eb5c45a82d0ddf70205bfc
|
[
"MIT"
] | 10
|
2016-10-09T19:23:18.000Z
|
2019-03-20T21:10:48.000Z
|
M3ScriptHook/src/LuaStateManager.cpp
|
MartinJK/Mafia3ScriptHook
|
b27da0dfcc93118aa4eb5c45a82d0ddf70205bfc
|
[
"MIT"
] | 5
|
2016-10-12T01:55:32.000Z
|
2017-05-31T09:50:19.000Z
|
M3ScriptHook/src/LuaStateManager.cpp
|
MartinJK/Mafia3ScriptHook
|
b27da0dfcc93118aa4eb5c45a82d0ddf70205bfc
|
[
"MIT"
] | 5
|
2016-10-20T21:51:22.000Z
|
2018-11-25T22:42:58.000Z
|
// Base Application taken from Klusark (GPLv2)
// https://code.google.com/archive/p/mafia2injector/
/*
* Copyright (c) 2010 Barzakh (martinjk 'at' outlook 'dot' com)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source
* distribution.
* 4. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <LuaStateManager.h>
#include <Windows.h>
#include <LuaFunctions.h>
#include <M3ScriptHook.h>
#include <ScriptSystem.h>
#include <chrono>
#include <thread>
LuaStateManager::LuaStateManager()
{
m_pLuaState = nullptr;
m_bEnded = false;
}
LuaStateManager::~LuaStateManager()
{
m_bEnded = true;
}
void LuaStateManager::StartThread()
{
M3ScriptHook::instance()->Log(__FUNCTION__);
CreateThread(0, 0, (LPTHREAD_START_ROUTINE)LuaStateManager::WatcherThread, 0, 0, 0);
}
void LuaStateManager::StateChanged(lua_State *L)
{
M3ScriptHook::instance()->Log(__FUNCTION__);
++this->m_stateChangeCount;
this->m_pLuaState = L;
LuaFunctions::instance()->Setup();
this->m_stateChangeCount == 1 ? PluginSystem::instance()->StartPlugins() :PluginSystem::instance()->RelaunchPlugins();
ScriptSystem::instance()->ReloadScripts();
}
lua_State* LuaStateManager::GetState()
{
if (this->m_pLuaState) {
return lua_newthread_(this->m_pLuaState);
}
else {
return nullptr;
}
}
bool LuaStateManager::IsStateGood(lua_State *L)
{
return L != nullptr;
}
bool LuaStateManager::HasEnded()
{
return this->m_bEnded;
}
uint32_t WINAPI LuaStateManager::WatcherThread(LPVOID) {
do {
std::this_thread::sleep_for(std::chrono::seconds(1));
} while (!LuaFunctions::instance()->IsMainScriptMachineReady());
static lua_State *lastState = nullptr;
static C_ScriptGameMachine *machine = nullptr;
static LuaStateManager *instance = LuaStateManager::instance();
while (!instance->HasEnded()) {
lua_State* nstate = GetL(machine);
if (nstate != lastState && nstate) {
instance->StateChanged(nstate);
lastState = nstate;
}
std::this_thread::sleep_for(std::chrono::seconds(10));
std::this_thread::yield();
}
return 0;
}
| 29.345133
| 119
| 0.741255
|
MartinJK
|
cb2bed5eeabe3457e28c3869cba316345319d03b
| 12,316
|
cpp
|
C++
|
sdl_core/src/thirdPartyLibs/apache-log4cxx-win32-0.10.0/apache-log4cxx-0.10.0/src/main/cpp/syslogappender.cpp
|
APCVSRepo/android_packet
|
5d4237234656b777cd9b0cae4731afea51986582
|
[
"BSD-3-Clause"
] | 4
|
2016-09-21T12:36:24.000Z
|
2020-10-29T01:45:03.000Z
|
sdl_core/src/thirdPartyLibs/apache-log4cxx-win32-0.10.0/apache-log4cxx-0.10.0/src/main/cpp/syslogappender.cpp
|
APCVSRepo/android_packet
|
5d4237234656b777cd9b0cae4731afea51986582
|
[
"BSD-3-Clause"
] | 7
|
2016-06-01T01:21:44.000Z
|
2017-11-03T08:18:23.000Z
|
sdl_core/src/thirdPartyLibs/apache-log4cxx-win32-0.10.0/apache-log4cxx-0.10.0/src/main/cpp/syslogappender.cpp
|
APCVSRepo/android_packet
|
5d4237234656b777cd9b0cae4731afea51986582
|
[
"BSD-3-Clause"
] | 8
|
2017-08-29T10:51:50.000Z
|
2021-03-24T10:19:11.000Z
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifdef OS_WINCE
#include <stdlib.h>
#endif
#include <log4cxx/net/syslogappender.h>
#include <log4cxx/helpers/loglog.h>
#include <log4cxx/helpers/stringhelper.h>
#include <log4cxx/helpers/datagramsocket.h>
#include <log4cxx/spi/loggingevent.h>
#include <log4cxx/level.h>
#include <log4cxx/helpers/transcoder.h>
#if !defined(LOG4CXX)
#define LOG4CXX 1
#endif
#include <log4cxx/private/log4cxx_private.h>
#if LOG4CXX_HAVE_SYSLOG
#include <syslog.h>
#else
/* facility codes */
#define LOG_KERN (0<<3) /* kernel messages */
#define LOG_USER (1<<3) /* random user-level messages */
#define LOG_MAIL (2<<3) /* mail system */
#define LOG_DAEMON (3<<3) /* system daemons */
#define LOG_AUTH (4<<3) /* security/authorization messages */
#define LOG_SYSLOG (5<<3) /* messages generated internally by syslogd */
#define LOG_LPR (6<<3) /* line printer subsystem */
#define LOG_NEWS (7<<3) /* network news subsystem */
#define LOG_UUCP (8<<3) /* UUCP subsystem */
#define LOG_CRON (9<<3) /* clock daemon */
#define LOG_AUTHPRIV (10<<3) /* security/authorization messages (private) */
#define LOG_FTP (11<<3) /* ftp daemon */
/* other codes through 15 reserved for system use */
#define LOG_LOCAL0 (16<<3) /* reserved for local use */
#define LOG_LOCAL1 (17<<3) /* reserved for local use */
#define LOG_LOCAL2 (18<<3) /* reserved for local use */
#define LOG_LOCAL3 (19<<3) /* reserved for local use */
#define LOG_LOCAL4 (20<<3) /* reserved for local use */
#define LOG_LOCAL5 (21<<3) /* reserved for local use */
#define LOG_LOCAL6 (22<<3) /* reserved for local use */
#define LOG_LOCAL7 (23<<3) /* reserved for local use */
#endif
#define LOG_UNDEF -1
using namespace log4cxx;
using namespace log4cxx::helpers;
using namespace log4cxx::net;
IMPLEMENT_LOG4CXX_OBJECT(SyslogAppender)
SyslogAppender::SyslogAppender()
: syslogFacility(LOG_USER), facilityPrinting(false), sw(0)
{
this->initSyslogFacilityStr();
}
SyslogAppender::SyslogAppender(const LayoutPtr& layout1,
int syslogFacility1)
: syslogFacility(syslogFacility1), facilityPrinting(false), sw(0)
{
this->layout = layout1;
this->initSyslogFacilityStr();
}
SyslogAppender::SyslogAppender(const LayoutPtr& layout1,
const LogString& syslogHost1, int syslogFacility1)
: syslogFacility(syslogFacility1), facilityPrinting(false), sw(0)
{
this->layout = layout1;
this->initSyslogFacilityStr();
setSyslogHost(syslogHost1);
}
SyslogAppender::~SyslogAppender()
{
finalize();
}
/** Release any resources held by this SyslogAppender.*/
void SyslogAppender::close()
{
closed = true;
if (sw != 0)
{
delete sw;
sw = 0;
}
}
void SyslogAppender::initSyslogFacilityStr()
{
facilityStr = getFacilityString(this->syslogFacility);
if (facilityStr.empty())
{
Pool p;
LogString msg(LOG4CXX_STR("\""));
StringHelper::toString(syslogFacility, p, msg);
msg.append(LOG4CXX_STR("\" is an unknown syslog facility. Defaulting to \"USER\"."));
LogLog::error(msg);
this->syslogFacility = LOG_USER;
facilityStr = LOG4CXX_STR("user:");
}
else
{
facilityStr += LOG4CXX_STR(":");
}
}
/**
Returns the specified syslog facility as a lower-case String,
e.g. "kern", "user", etc.
*/
LogString SyslogAppender::getFacilityString(
int syslogFacility)
{
switch(syslogFacility)
{
case LOG_KERN: return LOG4CXX_STR("kern");
case LOG_USER: return LOG4CXX_STR("user");
case LOG_MAIL: return LOG4CXX_STR("mail");
case LOG_DAEMON: return LOG4CXX_STR("daemon");
case LOG_AUTH: return LOG4CXX_STR("auth");
case LOG_SYSLOG: return LOG4CXX_STR("syslog");
case LOG_LPR: return LOG4CXX_STR("lpr");
case LOG_NEWS: return LOG4CXX_STR("news");
case LOG_UUCP: return LOG4CXX_STR("uucp");
case LOG_CRON: return LOG4CXX_STR("cron");
#ifdef LOG_AUTHPRIV
case LOG_AUTHPRIV: return LOG4CXX_STR("authpriv");
#endif
#ifdef LOG_FTP
case LOG_FTP: return LOG4CXX_STR("ftp");
#endif
case LOG_LOCAL0: return LOG4CXX_STR("local0");
case LOG_LOCAL1: return LOG4CXX_STR("local1");
case LOG_LOCAL2: return LOG4CXX_STR("local2");
case LOG_LOCAL3: return LOG4CXX_STR("local3");
case LOG_LOCAL4: return LOG4CXX_STR("local4");
case LOG_LOCAL5: return LOG4CXX_STR("local5");
case LOG_LOCAL6: return LOG4CXX_STR("local6");
case LOG_LOCAL7: return LOG4CXX_STR("local7");
default: return LogString();
}
}
int SyslogAppender::getFacility(
const LogString& s)
{
if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("KERN"), LOG4CXX_STR("kern")))
{
return LOG_KERN;
}
else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("USER"), LOG4CXX_STR("user")))
{
return LOG_USER;
}
else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("MAIL"), LOG4CXX_STR("mail")))
{
return LOG_MAIL;
}
else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("DAEMON"), LOG4CXX_STR("daemon")))
{
return LOG_DAEMON;
}
else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("AUTH"), LOG4CXX_STR("auth")))
{
return LOG_AUTH;
}
else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("SYSLOG"), LOG4CXX_STR("syslog")))
{
return LOG_SYSLOG;
}
else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("LPR"), LOG4CXX_STR("lpr")))
{
return LOG_LPR;
}
else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("NEWS"), LOG4CXX_STR("news")))
{
return LOG_NEWS;
}
else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("UUCP"), LOG4CXX_STR("uucp")))
{
return LOG_UUCP;
}
else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("CRON"), LOG4CXX_STR("cron")))
{
return LOG_CRON;
}
#ifdef LOG_AUTHPRIV
else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("AUTHPRIV"), LOG4CXX_STR("authpriv")))
{
return LOG_AUTHPRIV;
}
#endif
#ifdef LOG_FTP
else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("FTP"), LOG4CXX_STR("ftp")))
{
return LOG_FTP;
}
#endif
else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("LOCAL0"), LOG4CXX_STR("local0")))
{
return LOG_LOCAL0;
}
else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("LOCAL1"), LOG4CXX_STR("local1")))
{
return LOG_LOCAL1;
}
else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("LOCAL1"), LOG4CXX_STR("local2")))
{
return LOG_LOCAL2;
}
else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("LOCAL1"), LOG4CXX_STR("local3")))
{
return LOG_LOCAL3;
}
else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("LOCAL1"), LOG4CXX_STR("local4")))
{
return LOG_LOCAL4;
}
else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("LOCAL1"), LOG4CXX_STR("local5")))
{
return LOG_LOCAL5;
}
else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("LOCAL1"), LOG4CXX_STR("local6")))
{
return LOG_LOCAL6;
}
else if (StringHelper::equalsIgnoreCase(s, LOG4CXX_STR("LOCAL1"), LOG4CXX_STR("local7")))
{
return LOG_LOCAL7;
}
else
{
return LOG_UNDEF;
}
}
void SyslogAppender::append(const spi::LoggingEventPtr& event, Pool& p)
{
if (!isAsSevereAsThreshold(event->getLevel()))
return;
LogString msg;
layout->format(msg, event, p);
// On the local host, we can directly use the system function 'syslog'
// if it is available
#if LOG4CXX_HAVE_SYSLOG
if (sw == 0)
{
std::string sbuf;
Transcoder::encode(msg, sbuf);
// use of "%s" to avoid a security hole
::syslog(syslogFacility | event->getLevel()->getSyslogEquivalent(),
"%s", sbuf.c_str());
return;
}
#endif
// We must not attempt to append if sw is null.
if(sw == 0)
{
errorHandler->error(LOG4CXX_STR("No syslog host is set for SyslogAppedender named \"")+
this->name+LOG4CXX_STR("\"."));
return;
}
LogString sbuf(1, 0x3C /* '<' */);
StringHelper::toString((syslogFacility | event->getLevel()->getSyslogEquivalent()), p, sbuf);
sbuf.append(1, (logchar) 0x3E /* '>' */);
if (facilityPrinting)
{
sbuf.append(facilityStr);
}
sbuf.append(msg);
sw->write(sbuf);
}
void SyslogAppender::activateOptions(Pool&)
{
}
void SyslogAppender::setOption(const LogString& option, const LogString& value)
{
if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("SYSLOGHOST"), LOG4CXX_STR("sysloghost")))
{
setSyslogHost(value);
}
else if (StringHelper::equalsIgnoreCase(option, LOG4CXX_STR("FACILITY"), LOG4CXX_STR("facility")))
{
setFacility(value);
}
else
{
AppenderSkeleton::setOption(option, value);
}
}
void SyslogAppender::setSyslogHost(const LogString& syslogHost1)
{
if (this->sw != 0)
{
delete this->sw;
this->sw = 0;
}
// On the local host, we can directly use the system function 'syslog'
// if it is available (cf. append)
#if LOG4CXX_HAVE_SYSLOG
if (syslogHost1 != LOG4CXX_STR("localhost") && syslogHost1 != LOG4CXX_STR("127.0.0.1")
&& !syslogHost1.empty())
#endif
this->sw = new SyslogWriter(syslogHost1);
this->syslogHost = syslogHost1;
}
void SyslogAppender::setFacility(const LogString& facilityName)
{
if (facilityName.empty())
{
return;
}
syslogFacility = getFacility(facilityName);
if (syslogFacility == LOG_UNDEF)
{
LogLog::error(LOG4CXX_STR("[")+facilityName +
LOG4CXX_STR("] is an unknown syslog facility. Defaulting to [USER]."));
syslogFacility = LOG_USER;
}
this->initSyslogFacilityStr();
}
| 34.306407
| 107
| 0.572507
|
APCVSRepo
|
cb2c4f1e3c5b0b085e6b46dc11719ad005c3738d
| 2,039
|
cpp
|
C++
|
libraries/render/src/task/Config.cpp
|
alphaversiond/hifi
|
735944c912a29e948a557dbff13e0a1cb71d954e
|
[
"Apache-2.0"
] | 2
|
2018-05-07T16:12:38.000Z
|
2019-04-28T17:32:01.000Z
|
libraries/render/src/task/Config.cpp
|
alphaversiond/hifi
|
735944c912a29e948a557dbff13e0a1cb71d954e
|
[
"Apache-2.0"
] | null | null | null |
libraries/render/src/task/Config.cpp
|
alphaversiond/hifi
|
735944c912a29e948a557dbff13e0a1cb71d954e
|
[
"Apache-2.0"
] | null | null | null |
//
// Config.cpp
// render/src/task
//
// Created by Zach Pomerantz on 1/21/2016.
// Copyright 2016 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "Config.h"
#include "Task.h"
#include <QtCore/QThread>
using namespace task;
void JobConfig::setPresetList(const QJsonObject& object) {
for (auto it = object.begin(); it != object.end(); it++) {
JobConfig* child = findChild<JobConfig*>(it.key(), Qt::FindDirectChildrenOnly);
if (child) {
child->setPresetList(it.value().toObject());
}
}
}
void TaskConfig::connectChildConfig(QConfigPointer childConfig, const std::string& name) {
childConfig->setParent(this);
childConfig->setObjectName(name.c_str());
// Connect loaded->refresh
QObject::connect(childConfig.get(), SIGNAL(loaded()), this, SLOT(refresh()));
static const char* DIRTY_SIGNAL = "dirty()";
if (childConfig->metaObject()->indexOfSignal(DIRTY_SIGNAL) != -1) {
// Connect dirty->refresh if defined
QObject::connect(childConfig.get(), SIGNAL(dirty()), this, SLOT(refresh()));
}
}
void TaskConfig::transferChildrenConfigs(QConfigPointer source) {
if (!source) {
return;
}
// Transfer children to the new configuration
auto children = source->children();
for (auto& child : children) {
child->setParent(this);
QObject::connect(child, SIGNAL(loaded()), this, SLOT(refresh()));
static const char* DIRTY_SIGNAL = "dirty()";
if (child->metaObject()->indexOfSignal(DIRTY_SIGNAL) != -1) {
// Connect dirty->refresh if defined
QObject::connect(child, SIGNAL(dirty()), this, SLOT(refresh()));
}
}
}
void TaskConfig::refresh() {
if (QThread::currentThread() != thread()) {
QMetaObject::invokeMethod(this, "refresh", Qt::BlockingQueuedConnection);
return;
}
_task->applyConfiguration();
}
| 30.893939
| 90
| 0.642472
|
alphaversiond
|
cb2cb1a3ac7831ef9ceb690cd3bb8be97e3988a9
| 271
|
hpp
|
C++
|
ResInt.hpp
|
afarsitio5/javafar-14.github.io
|
6378758230c1f3ef524d0f7e4b8f32a5660d59b7
|
[
"CC0-1.0"
] | null | null | null |
ResInt.hpp
|
afarsitio5/javafar-14.github.io
|
6378758230c1f3ef524d0f7e4b8f32a5660d59b7
|
[
"CC0-1.0"
] | null | null | null |
ResInt.hpp
|
afarsitio5/javafar-14.github.io
|
6378758230c1f3ef524d0f7e4b8f32a5660d59b7
|
[
"CC0-1.0"
] | 1
|
2021-04-07T23:06:03.000Z
|
2021-04-07T23:06:03.000Z
|
#ifndef __RES_INT_H__
#define __RES_INT_H__
#include <Arduino.h>
class ResInt {
public:
const int valor;
const String error;
ResInt(int _valor,
String _error );
ResInt(const ResInt& ref );
const char* valida();
};
#endif
| 16.9375
| 32
| 0.612546
|
afarsitio5
|
cb2ce25b2fa2bf92a52b34d5202b20c663829cee
| 1,417
|
cpp
|
C++
|
src/chat/encryptor.cpp
|
saeschdivara/SecretWhisperer-Server
|
45e3c2a706ede3128c84dc5272edfb8d0f76a58c
|
[
"MIT"
] | null | null | null |
src/chat/encryptor.cpp
|
saeschdivara/SecretWhisperer-Server
|
45e3c2a706ede3128c84dc5272edfb8d0f76a58c
|
[
"MIT"
] | null | null | null |
src/chat/encryptor.cpp
|
saeschdivara/SecretWhisperer-Server
|
45e3c2a706ede3128c84dc5272edfb8d0f76a58c
|
[
"MIT"
] | null | null | null |
#include "encryptor.h"
#include <QtCore/QCryptographicHash>
#include <botan/botan.h>
#include <botan/pubkey.h>
#include <botan/pkcs8.h>
#include <botan/pk_keys.h>
#include <botan/rsa.h>
Encryptor::Encryptor(QObject *parent) : QObject(parent)
{
}
QByteArray Encryptor::createRandomString()
{
QByteArray randomString;
Botan::AutoSeeded_RNG rng;
const uint RANDOM_DATA_SIZE = 256;
Botan::byte randomData[RANDOM_DATA_SIZE];
rng.randomize(randomData, RANDOM_DATA_SIZE);
for (int index = 0; index < RANDOM_DATA_SIZE; ++index) {
randomString.append(randomData[index]);
}
return randomString;
}
QByteArray Encryptor::encryptAsymmetricly(QByteArray &publicKey, QByteArray &data)
{
Botan::DataSource_Memory key_pub(publicKey.toStdString());
auto publicRsaKey = Botan::X509::load_key(key_pub);
const uint DATA_SIZE = data.size();
Botan::byte msgtoencrypt[DATA_SIZE];
for (uint i = 0; i < DATA_SIZE; i++)
{
msgtoencrypt[i] = data[i];
}
Botan::PK_Encryptor_EME encryptor(*publicRsaKey, "EME1(SHA-256)");
Botan::AutoSeeded_RNG rng;
std::vector<Botan::byte> ciphertext = encryptor.encrypt(msgtoencrypt, DATA_SIZE, rng);
QByteArray keyCipherData;
keyCipherData.resize(ciphertext.size());
for ( uint i = 0; i < ciphertext.size(); i++ ) {
keyCipherData[i] = ciphertext.at(i);
}
return keyCipherData;
}
| 23.616667
| 90
| 0.689485
|
saeschdivara
|
cb312d165ce42f9aa367f53077e484d706e1ba2e
| 1,081
|
cpp
|
C++
|
Stadium_Seating.cpp
|
MigPug/C-Plus-Plus
|
53241378ded0adc509c32abb64cbfc780d7165f3
|
[
"Apache-2.0"
] | 1
|
2020-12-03T05:17:00.000Z
|
2020-12-03T05:17:00.000Z
|
Stadium_Seating.cpp
|
MigPug/Code
|
53241378ded0adc509c32abb64cbfc780d7165f3
|
[
"Apache-2.0"
] | null | null | null |
Stadium_Seating.cpp
|
MigPug/Code
|
53241378ded0adc509c32abb64cbfc780d7165f3
|
[
"Apache-2.0"
] | 1
|
2022-01-30T06:11:59.000Z
|
2022-01-30T06:11:59.000Z
|
/*
Stadium Seating
There are three seating categories at a stadium . For a softball game, Class A seats cost
$15, Class B seats cost $12, and Class C seats cost $9. Write a program that asks how
many tickets for each class of seats were sold, then displays the amount of income
generated from ticket sales. Format your dollar amount in a fixed-point notation with
two decimal points and make sure the decimal point is always displayed.
*/
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
int main()
{
double seatsA = 0, seatsB =0, seatsC = 0, total;
cout << "How many seats for Class A were sold? ";
cin >> seatsA;
seatsA= seatsA * 15;
cout << "How many seats for Class B were sold? ";
cin >> seatsB;
seatsB = seatsB * 12;
cout << "How many seats for Class C were sold? ";
cin >> seatsC;
seatsC = seatsC * 9;
total = (seatsA + seatsB + seatsC);
cout << setprecision(2) << fixed;
cout << "Revenue generated: $" << total << endl;
system("pause");
return (0);
}
| 26.365854
| 92
| 0.648474
|
MigPug
|
cb31953785045a9484cce4fd9d945ee917216a7d
| 590
|
cpp
|
C++
|
NamingThreads/NamingThreadsLinux/main.cpp
|
Watch-Later/Eureka
|
3065e76d5bf8b37d5de4f9ee75b2714a42dd4c35
|
[
"MIT"
] | 20
|
2016-05-16T11:09:04.000Z
|
2021-12-08T09:30:33.000Z
|
NamingThreads/NamingThreadsLinux/main.cpp
|
Watch-Later/Eureka
|
3065e76d5bf8b37d5de4f9ee75b2714a42dd4c35
|
[
"MIT"
] | 1
|
2018-12-30T09:55:31.000Z
|
2018-12-30T14:08:30.000Z
|
NamingThreads/NamingThreadsLinux/main.cpp
|
Watch-Later/Eureka
|
3065e76d5bf8b37d5de4f9ee75b2714a42dd4c35
|
[
"MIT"
] | 11
|
2016-05-02T09:17:12.000Z
|
2021-12-08T09:30:35.000Z
|
/*
@ 0xCCCCCCCC
*/
#include <cstdio>
#include <thread>
#include <errno.h>
#include <unistd.h>
#include <sys/prctl.h>
#include <sys/syscall.h>
pid_t GetCurrentThreadID()
{
return syscall(__NR_gettid);
}
void SetThreadName(const char* name)
{
if (GetCurrentThreadID() == getpid()) {
return;
}
int err = prctl(PR_SET_NAME, name);
if (err < 0) {
fprintf(stderr, "error: %d", errno);
}
}
int main()
{
std::thread th([] {
SetThreadName("Worker");
printf("Set thread name complete!\n");
});
th.join();
return 0;
}
| 13.72093
| 46
| 0.576271
|
Watch-Later
|
cb358c7b84f92119bced642a19a61bcecffcdaaa
| 6,884
|
cpp
|
C++
|
pin-2.11/source/tools/SignalTests/mtstress.cpp
|
swchoi1994/Project
|
e46fa191afe54d6676016d41534c3531eb51ff79
|
[
"Intel"
] | 3
|
2020-06-26T09:35:19.000Z
|
2021-01-03T16:58:11.000Z
|
pin-2.11/source/tools/SignalTests/mtstress.cpp
|
swchoi1994/Project
|
e46fa191afe54d6676016d41534c3531eb51ff79
|
[
"Intel"
] | null | null | null |
pin-2.11/source/tools/SignalTests/mtstress.cpp
|
swchoi1994/Project
|
e46fa191afe54d6676016d41534c3531eb51ff79
|
[
"Intel"
] | 2
|
2020-12-27T03:58:38.000Z
|
2020-12-27T03:58:38.000Z
|
/*BEGIN_LEGAL
Intel Open Source License
Copyright (c) 2002-2012 Intel Corporation. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer. Redistributions
in binary form must reproduce the above copyright notice, this list of
conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution. Neither the name of
the Intel Corporation nor the names of its contributors may be used to
endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE INTEL OR
ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
END_LEGAL */
/*
* This is a stress test for handling signals in a multi-threaded application.
* The root thread creates two classes of worker threads: computers and blockers.
* Computers execute a small loop that should run entirely from the Pin code cache
* once it is compiled. Blockers iteratively execute a blocking system call. The
* root thread randomly sends signals to each of the works as fast as possible.
*/
#include <cstdlib>
#include <iostream>
#include <pthread.h>
#include <cassert>
#include <signal.h>
#include <time.h>
const unsigned NUM_BLOCKERS = 8;
const unsigned NUM_COMPUTERS = 8;
const unsigned NUM_SIGNALS = 1000;
// The total number of signals received by all threads.
//
volatile unsigned NumSignalsReceived = 0;
pthread_mutex_t SignalReceivedLock = PTHREAD_MUTEX_INITIALIZER;
// Information for each worker thread.
//
struct THREAD_INFO
{
THREAD_INFO() : _ready(false)
{
pthread_mutex_init(&_readyLock, 0);
pthread_cond_init(&_readyCond, 0);
}
~THREAD_INFO()
{
pthread_cond_destroy(&_readyCond);
pthread_mutex_destroy(&_readyLock);
}
pthread_t _tid;
// This is set TRUE when the thread is ready to receive a signal.
//
bool _ready;
pthread_mutex_t _readyLock;
pthread_cond_t _readyCond;
};
THREAD_INFO *ThreadInfos;
// Each thread uses this key to find its own THREAD_INFO.
//
pthread_key_t MyInfoKey;
static void *BlockerRoot(void *);
static void *ComputerRoot(void *);
static void SetMyInfo(THREAD_INFO *);
static void Handle(int);
int main()
{
struct sigaction act;
act.sa_handler = Handle;
act.sa_flags = 0;
sigemptyset(&act.sa_mask);
if (sigaction(SIGUSR1, &act, 0) != 0)
{
std::cerr << "Unable to set SIGUSR1 handler\n";
return 1;
}
if (pthread_key_create(&MyInfoKey, 0) != 0)
{
std::cerr << "Unable to create key\n";
return 1;
}
// Create the worker threads.
//
ThreadInfos = new THREAD_INFO[NUM_BLOCKERS + NUM_COMPUTERS];
for (unsigned i = 0; i < NUM_BLOCKERS; i++)
{
THREAD_INFO *info = &ThreadInfos[i];
if (pthread_create(&info->_tid, 0, BlockerRoot, info) != 0)
{
std::cerr << "Unable to create blocker thread\n";
return 1;
}
}
for (unsigned i = 0; i < NUM_COMPUTERS; i++)
{
THREAD_INFO *info = &ThreadInfos[NUM_BLOCKERS + i];
if (pthread_create(&info->_tid, 0, ComputerRoot, info) != 0)
{
std::cerr << "Unable to create computer thread\n";
return 1;
}
}
// Randomly send signals to the workers.
//
for (unsigned i = 0; i < NUM_SIGNALS; i++)
{
unsigned index = std::rand() % (NUM_BLOCKERS + NUM_COMPUTERS);
THREAD_INFO *info = &ThreadInfos[index];
// Wait for the worker to be ready to handle a signal.
//
pthread_mutex_lock(&info->_readyLock);
while (!info->_ready)
pthread_cond_wait(&info->_readyCond, &info->_readyLock);
info->_ready = false;
pthread_mutex_unlock(&info->_readyLock);
std::cout << "Sending signal " << std::dec << i << "\n";
if (pthread_kill(info->_tid, SIGUSR1) != 0)
{
std::cerr << "Unable to send SIGUSR1 to thread index " << std::dec << index << "\n";
return 1;
}
}
// Wait for all the workers to terminate.
//
for (unsigned i = 0; i < NUM_BLOCKERS + NUM_COMPUTERS; i++)
{
if (pthread_join(ThreadInfos[i]._tid, 0) != 0)
{
std::cerr << "Unable to wait for thread index " << std::dec << i << "\n";
return 1;
}
}
delete [] ThreadInfos;
pthread_key_delete(MyInfoKey);
return 0;
}
static void *BlockerRoot(void *vinfo)
{
SetMyInfo(static_cast<THREAD_INFO *>(vinfo));
while (NumSignalsReceived < NUM_SIGNALS)
{
struct timespec tv;
tv.tv_sec = 10;
tv.tv_nsec = 0;
nanosleep(&tv, 0);
}
return 0;
}
static void *ComputerRoot(void *vinfo)
{
SetMyInfo(static_cast<THREAD_INFO *>(vinfo));
volatile double x[100];
while (NumSignalsReceived < NUM_SIGNALS)
{
for (unsigned i = 0; i < 100; i++)
x[i] = (double)(i+1);
for (unsigned i = 2; i < 100; i++)
x[i] = x[i] / x[i-1] * x[i-2] + x[i];
}
}
static void SetMyInfo(THREAD_INFO *info)
{
// Initialize the worker's thread-private data to point to it's THREAD_INFO.
// Once we do this, we are ready to handle a signal.
//
pthread_mutex_lock(&info->_readyLock);
pthread_setspecific(MyInfoKey, info);
info->_ready = true;
pthread_cond_signal(&info->_readyCond);
pthread_mutex_unlock(&info->_readyLock);
}
static void Handle(int)
{
// Count this signal.
//
pthread_mutex_lock(&SignalReceivedLock);
NumSignalsReceived++;
pthread_mutex_unlock(&SignalReceivedLock);
// Once we count the signal, this thread is ready to handle another signal.
//
THREAD_INFO *info = static_cast<THREAD_INFO *>(pthread_getspecific(MyInfoKey));
pthread_mutex_lock(&info->_readyLock);
assert(!info->_ready);
info->_ready = true;
pthread_cond_signal(&info->_readyCond);
pthread_mutex_unlock(&info->_readyLock);
}
| 29.293617
| 96
| 0.662841
|
swchoi1994
|
cb369df49755e93fdbbe09fdaefa7a0a84425f02
| 10,882
|
cpp
|
C++
|
stocks_exchange/unit-test/stock_exchange_kraken_unit_test.cpp
|
Rapprise/b2s-trader
|
ac8a3c2221d15c4df8df63842d20dafd6801e535
|
[
"BSD-2-Clause"
] | 21
|
2020-06-07T20:34:47.000Z
|
2021-08-10T20:19:59.000Z
|
stocks_exchange/unit-test/stock_exchange_kraken_unit_test.cpp
|
Rapprise/b2s-trader
|
ac8a3c2221d15c4df8df63842d20dafd6801e535
|
[
"BSD-2-Clause"
] | null | null | null |
stocks_exchange/unit-test/stock_exchange_kraken_unit_test.cpp
|
Rapprise/b2s-trader
|
ac8a3c2221d15c4df8df63842d20dafd6801e535
|
[
"BSD-2-Clause"
] | 4
|
2020-07-13T10:19:44.000Z
|
2022-03-11T12:15:43.000Z
|
/*
* Copyright (c) 2020, Rapprise.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "stock_exchange_kraken_unit_test.h"
#include "common/currency.h"
#include "common/enumerations/stock_exchange_type.h"
#include "common/exceptions/stock_exchange_exception/invalid_stock_exchange_response_exception.h"
#include "common/utils.h"
#include "gtest/gtest.h"
#include "include/query_processor.h"
#include "include/stock_exchange_library.h"
#include "include/stock_exchange_utils.h"
#include "resources/resources.h"
namespace auto_trader {
namespace stock_exchange {
namespace unit_test {
const std::string kraken_private =
"d5IeAreqJbSoZohpJPiXFh4LWY9O7t/2E43bp7ehIe3OwTIt8BKni1P9xojPshhgtYLLZ+Mpg+uHsAapUfqlbw==";
const std::string kraken_api_key = "TVCtFQP83n14APh9XW+M+PnctIog52q6XsqIp10PnTp9qRUfNvmEhMvB";
const std::string invalidOrderMessage = "Invalid response exception raised : EOrder:Invalid order";
const std::string errorWithoutTradedBalance =
"Invalid response exception raised : EGeneral:Invalid arguments:volume";
const double currencyTickOnFakeResponseXRP_USD_ask = 0.31699;
TEST(KrakenRealRequest, KrakenRealRequest_MarketHistory_Test) {
auto_trader::stock_exchange::StockExchangeLibrary stockExchangeLibrary;
auto& queryProcessor = stockExchangeLibrary.getQueryProcessor();
auto query = queryProcessor.getQuery(common::StockExchangeType::Kraken);
auto marketHistory = query->getMarketHistory(common::Currency::USD, common::Currency::BTC,
common::TickInterval::ONE_DAY);
EXPECT_TRUE(marketHistory->marketData_.size() > 0);
}
TEST(KrakenRealRequest, KrakenRealRequest_CurrencyTickRealResponse_Test) {
auto_trader::stock_exchange::StockExchangeLibrary stockExchangeLibrary;
auto& queryProcessor = stockExchangeLibrary.getQueryProcessor();
auto query = queryProcessor.getQuery(common::StockExchangeType::Kraken);
auto currencyTick = query->getCurrencyTick(common::Currency::XRP, common::Currency::USD);
EXPECT_TRUE(currencyTick.ask_ > 0);
EXPECT_TRUE(currencyTick.bid_ > 0);
EXPECT_TRUE(currencyTick.ask_ > currencyTick.bid_);
}
TEST(KrakenRealRequest, KrakenRealRequest_GetMarketOpenedOrders_Test) {
auto_trader::stock_exchange::StockExchangeLibrary stockExchangeLibrary;
auto& queryProcessor = stockExchangeLibrary.getQueryProcessor();
auto query = queryProcessor.getQuery(common::StockExchangeType::Kraken);
auto marketOpenedOrders =
query->getMarketOpenOrders(common::Currency::DASH, common::Currency::USD);
EXPECT_TRUE(marketOpenedOrders.size() > 0);
}
TEST(KrakenRealRequest, KrakenRealRequest_GetAccountOpenOrders_Test) {
auto_trader::stock_exchange::StockExchangeLibrary stockExchangeLibrary;
auto& queryProcessor = stockExchangeLibrary.getQueryProcessor();
auto query = queryProcessor.getQuery(common::StockExchangeType::Kraken);
query->updateApiKey(kraken_api_key);
query->updateSecretKey(kraken_private);
auto accountOpenOrders =
query->getAccountOpenOrders(common::Currency::BTC, common::Currency::LTC);
EXPECT_TRUE(accountOpenOrders.size() == 0);
}
TEST(KrakenRealRequest, KrakenRealRequest_CancelOrder_Test) {
auto_trader::stock_exchange::StockExchangeLibrary stockExchangeLibrary;
auto& queryProcessor = stockExchangeLibrary.getQueryProcessor();
auto query = queryProcessor.getQuery(common::StockExchangeType::Kraken);
query->updateApiKey(kraken_api_key);
query->updateSecretKey(kraken_private);
std::string message;
try {
auto isOrderCanceled =
query->cancelOrder(common::Currency::XRP, common::Currency::XRP, "asdasdasdsad");
} catch (const common::exceptions::InvalidStockExchangeResponse& ex) {
message = ex.what();
}
EXPECT_EQ(invalidOrderMessage, message);
}
TEST(KrakenRealRequest, KrakenRealRequest_BuyOrder_BadInputData_Test) {
auto_trader::stock_exchange::StockExchangeLibrary stockExchangeLibrary;
auto& queryProcessor = stockExchangeLibrary.getQueryProcessor();
auto query = queryProcessor.getQuery(common::StockExchangeType::Kraken);
query->updateApiKey(kraken_api_key);
query->updateSecretKey(kraken_private);
std::string message;
try {
auto buyOrder = query->buyOrder(common::Currency::BTC, common::Currency::XRP, 1, 123123123);
} catch (const common::exceptions::InvalidStockExchangeResponse& ex) {
message = ex.what();
}
EXPECT_EQ(errorWithoutTradedBalance, message);
}
TEST(KrakenRealRequest, KrakenRealRequest_SellOrder_BadInputData_Test) {
auto_trader::stock_exchange::StockExchangeLibrary stockExchangeLibrary;
auto& queryProcessor = stockExchangeLibrary.getQueryProcessor();
auto query = queryProcessor.getQuery(common::StockExchangeType::Kraken);
query->updateApiKey(kraken_api_key);
query->updateSecretKey(kraken_private);
std::string message;
try {
auto sellOrder = query->sellOrder(common::Currency::BTC, common::Currency::XRP, 1, 123123123);
} catch (const common::exceptions::InvalidStockExchangeResponse& ex) {
message = ex.what();
}
EXPECT_EQ(errorWithoutTradedBalance, message);
}
TEST(KrakenRealRequest, KrakenRealRequest_Kraken_Currencies_On_Valid_Pairs_Test) {
auto_trader::stock_exchange::StockExchangeLibrary stockExchangeLibrary;
auto& queryProcessor = stockExchangeLibrary.getQueryProcessor();
auto query = queryProcessor.getQuery(common::StockExchangeType::Kraken);
common::KrakenCurrency krakenCurrencies;
auto base_currencies = krakenCurrencies.getBaseCurrencies();
for (const auto& currency : base_currencies) {
auto traded_currencies = krakenCurrencies.getTradedCurrencies(currency);
for (const auto& traded_currency : traded_currencies) {
EXPECT_NO_THROW(stock_exchange_utils::getKrakenCurrencyStringFromEnum(traded_currency));
EXPECT_NO_THROW(query->getCurrencyTick(currency, traded_currency));
}
}
}
TEST(KrakenRealRequest, KrakenRealRequest_GetAccountOrderResponse_Test) {
auto_trader::stock_exchange::StockExchangeLibrary stockExchangeLibrary;
auto& queryProcessor = stockExchangeLibrary.getQueryProcessor();
auto query = queryProcessor.getQuery(common::StockExchangeType::Kraken);
query->updateApiKey(kraken_api_key);
query->updateSecretKey(kraken_private);
std::string orderUuid = "OJV7QW-QCXDP-BIGIYH";
auto order = query->getAccountOrder(common::Currency::BTC, common::Currency::QTUM, orderUuid);
EXPECT_EQ(order.uuid_, orderUuid);
}
TEST(KrakenRealRequest, KrakenRealRequest_GetAccountOrderResponse_BadUuid_Test) {
auto_trader::stock_exchange::StockExchangeLibrary stockExchangeLibrary;
auto& queryProcessor = stockExchangeLibrary.getQueryProcessor();
auto query = queryProcessor.getQuery(common::StockExchangeType::Kraken);
query->updateApiKey(kraken_api_key);
query->updateSecretKey(kraken_private);
std::string orderUuid = "asdasdasd";
auto order = query->getAccountOrder(common::Currency::ADA, common::Currency::USD, orderUuid);
EXPECT_TRUE(order.uuid_.empty());
}
TEST_F(KrakenQueryFixture, KrakenQueryFixture_getAccountOpenOrders_TestgetAccountOpenOrders) {
mockKrakenQuery->DelegateToGetOpenedOrdersResponse();
EXPECT_CALL(*mockKrakenQuery, sendRequest(testing::_)).Times(1);
auto openOrders =
mockKrakenQuery->getAccountOpenOrders(common::Currency::BTC, common::Currency::LTC);
EXPECT_EQ(openOrders.size(), 2);
}
TEST_F(KrakenQueryFixture, KrakenQueryFixture_getNonZeroBalance_TestgetNonZeroBalance) {
mockKrakenQuery->DelegateToGetBalanceResponse();
EXPECT_CALL(*mockKrakenQuery, sendRequest(testing::_)).Times(3);
auto ADA_balance = mockKrakenQuery->getBalance(common::Currency::ADA);
auto XRP_balance = mockKrakenQuery->getBalance(common::Currency::XRP);
auto USD_balance = mockKrakenQuery->getBalance(common::Currency::USD);
EXPECT_TRUE(ADA_balance > 0);
EXPECT_TRUE(XRP_balance > 0);
EXPECT_TRUE(USD_balance > 0);
}
TEST_F(KrakenQueryFixture, KrakenQueryFixture_getZeroBTC_Balance_Test) {
mockKrakenQuery->DelegateToGetBalanceResponse();
EXPECT_CALL(*mockKrakenQuery, sendRequest(testing::_)).Times(1);
auto BTC_balance = mockKrakenQuery->getBalance(common::Currency::BTC);
EXPECT_EQ(BTC_balance, 0);
}
TEST_F(KrakenQueryFixture, KrakenQueryFixture_buyOrder_Test) {
mockKrakenQuery->DelegateToBuyOrderResponse();
EXPECT_CALL(*mockKrakenQuery, sendRequest(testing::_)).Times(1);
auto buy_order = mockKrakenQuery->buyOrder(common::Currency::ADA, common::Currency::USD, 1, 1);
EXPECT_TRUE(!buy_order.uuid_.empty());
}
TEST_F(KrakenQueryFixture, KrakenQueryFixture_sellOrder_Test) {
mockKrakenQuery->DelegateToSellOrderResponse();
EXPECT_CALL(*mockKrakenQuery, sendRequest(testing::_)).Times(1);
auto sell_order = mockKrakenQuery->sellOrder(common::Currency::XRP, common::Currency::USD, 1, 1);
EXPECT_TRUE(!sell_order.uuid_.empty());
}
TEST_F(KrakenQueryFixture, KrakenQueryFixture_cancelOrder_Test) {
mockKrakenQuery->DelegateToCancelOrderResponse();
EXPECT_CALL(*mockKrakenQuery, sendRequest(testing::_)).Times(1);
auto cancelOrder =
mockKrakenQuery->cancelOrder(common::Currency::XRP, common::Currency::USD, "fake");
EXPECT_EQ(cancelOrder, true);
}
TEST_F(KrakenQueryFixture, KrakenQueryFixture_Get_Currency_Tick_Test) {
mockKrakenQuery->DelegateToCurrencyTickResponse();
EXPECT_CALL(*mockKrakenQuery, sendRequest(testing::_)).Times(1);
auto tick = mockKrakenQuery->getCurrencyTick(common::Currency::XRP, common::Currency::USD);
EXPECT_EQ(tick.ask_, currencyTickOnFakeResponseXRP_USD_ask);
}
} // namespace unit_test
} // namespace stock_exchange
} // namespace auto_trader
| 38.725979
| 99
| 0.787723
|
Rapprise
|
cb3af440a6dfb403d6e91bb51ebc0ce027812870
| 1,713
|
cc
|
C++
|
tree/cpp-bplustree/util/cli.cc
|
NewGuonx/DST_algorithm
|
8c4b2f0fe1f43044a5c37a7f993d339862d9182c
|
[
"Unlicense"
] | 231
|
2015-01-07T00:59:28.000Z
|
2022-03-23T04:55:53.000Z
|
util/cli.cc
|
gaubert/BPlusTree
|
82e2dfc3c54a2488e3a96fc356ca1af7c569098f
|
[
"Unlicense",
"MIT"
] | 2
|
2019-10-20T14:24:47.000Z
|
2021-05-08T07:48:19.000Z
|
util/cli.cc
|
gaubert/BPlusTree
|
82e2dfc3c54a2488e3a96fc356ca1af7c569098f
|
[
"Unlicense",
"MIT"
] | 83
|
2015-01-06T13:42:18.000Z
|
2022-02-24T10:31:39.000Z
|
#include "../bpt.h"
using namespace bpt;
#include <string.h>
int main(int argc, char *argv[])
{
if (argc < 3) {
fprintf(stderr, "Usage: %s database command\n", argv[0]);
return 1;
}
bpt::bplus_tree database(argv[1]);
if (!strcmp(argv[2], "search")) {
if (argc < 4) {
fprintf(stderr, "Need key.\n");
return 1;
}
if (argc == 4) {
value_t value;
if (database.search(argv[3], &value) != 0)
printf("Key %s not found\n", argv[3]);
else
printf("%d\n", value);
} else {
bpt::key_t start(argv[3]);
value_t values[512];
bool next = true;
while (next) {
int ret = database.search_range(
&start, argv[4], values, 512, &next);
if (ret < 0)
break;
for (int i = 0; i < ret; i++)
printf("%d\n", values[i]);
}
}
} else if (!strcmp(argv[2], "insert")) {
if (argc < 5) {
fprintf(stderr, "Format is [insert key value]\n");
return 1;
}
if (database.insert(argv[3], atoi(argv[4])) != 0)
printf("Key %s already exists\n", argv[3]);
} else if (!strcmp(argv[2], "update")) {
if (argc < 5) {
fprintf(stderr, "Format is [update key value]\n");
return 1;
}
if (database.update(argv[3], atoi(argv[4])) != 0)
printf("Key %s does not exists.\n", argv[3]);
} else {
fprintf(stderr, "Invalid command: %s\n", argv[2]);
return 1;
}
return 0;
}
| 27.190476
| 65
| 0.437828
|
NewGuonx
|
cb3dbd02009b0b677299e97faebaa34d6ccff415
| 529,602
|
cpp
|
C++
|
esp32/TinyCPCEMttgovga32/CPCem/Z80.cpp
|
rpsubc8/ESP32TinyCPC
|
386a0d1d47fc6f32c0b3dace67a6c2197a846a9d
|
[
"WTFPL"
] | 19
|
2020-12-04T15:12:45.000Z
|
2022-02-07T19:46:36.000Z
|
esp32/TinyCPCEMttgovga32/CPCem/Z80.cpp
|
rpsubc8/ESP32TinyCPC
|
386a0d1d47fc6f32c0b3dace67a6c2197a846a9d
|
[
"WTFPL"
] | 3
|
2021-02-20T08:42:09.000Z
|
2022-03-11T05:11:26.000Z
|
esp32/TinyCPCEMttgovga32/CPCem/Z80.cpp
|
rpsubc8/ESP32TinyCPC
|
386a0d1d47fc6f32c0b3dace67a6c2197a846a9d
|
[
"WTFPL"
] | 4
|
2021-02-20T08:07:04.000Z
|
2022-03-27T21:52:45.000Z
|
//offset 703 + 45056 = B2BF
#include "gbConfig.h"
#include <stdlib.h>
#include <stdio.h>
#include "CPCem.h"
#include "DAA.h"
#include "Z80.h"
#include <string.h>
#include "FDC.h"
#include "CRTC.h"
#include "GA.h"
#include "CRTC.h"
#include "8255.h"
#include "gb_globals.h"
#include "dataFlash/gbrom.h"
z80reg af,bc,de,hl,ix,iy,ir,saf,sbc,sde,shl;
unsigned short pc=0;
unsigned short sp;
int iff1,iff2;
int intreq;
int im;
int c8d1=0;
//JJ int model;
int rhigh=0;
//JJ int vc,sc;
unsigned short ooopc,oopc,opc;
int output=0;
int cycles=0;
int tempc;
int ins=0;
//JJ unsigned char znptable[256];
//JJ unsigned char znptable16[65536];
#ifdef use_lib_lookup_znptable
//Lo metemos a flash
const unsigned char znptable[256]={
0x44,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x08,0x0c,0x0c,0x08,0x0c,0x08,0x08,0x0c,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x0c,0x08,0x08,0x0c,0x08,0x0c,0x0c,0x08,
0x20,0x24,0x24,0x20,0x24,0x20,0x20,0x24,0x2c,0x28,0x28,0x2c,0x28,0x2c,0x2c,0x28,
0x24,0x20,0x20,0x24,0x20,0x24,0x24,0x20,0x28,0x2c,0x2c,0x28,0x2c,0x28,0x28,0x2c,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x0c,0x08,0x08,0x0c,0x08,0x0c,0x0c,0x08,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x08,0x0c,0x0c,0x08,0x0c,0x08,0x08,0x0c,
0x24,0x20,0x20,0x24,0x20,0x24,0x24,0x20,0x28,0x2c,0x2c,0x28,0x2c,0x28,0x28,0x2c,
0x20,0x24,0x24,0x20,0x24,0x20,0x20,0x24,0x2c,0x28,0x28,0x2c,0x28,0x2c,0x2c,0x28,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x8c,0x88,0x88,0x8c,0x88,0x8c,0x8c,0x88,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x88,0x8c,0x8c,0x88,0x8c,0x88,0x88,0x8c,
0xa4,0xa0,0xa0,0xa4,0xa0,0xa4,0xa4,0xa0,0xa8,0xac,0xac,0xa8,0xac,0xa8,0xa8,0xac,
0xa0,0xa4,0xa4,0xa0,0xa4,0xa0,0xa0,0xa4,0xac,0xa8,0xa8,0xac,0xa8,0xac,0xac,0xa8,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x88,0x8c,0x8c,0x88,0x8c,0x88,0x88,0x8c,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x8c,0x88,0x88,0x8c,0x88,0x8c,0x8c,0x88,
0xa0,0xa4,0xa4,0xa0,0xa4,0xa0,0xa0,0xa4,0xac,0xa8,0xa8,0xac,0xa8,0xac,0xac,0xa8,
0xa4,0xa0,0xa0,0xa4,0xa0,0xa4,0xa4,0xa0,0xa8,0xac,0xac,0xa8,0xac,0xa8,0xa8,0xac
};
#endif
#ifdef use_lib_lookup_znptable16
const unsigned char znptable16[65536]={
0x44,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,
0x00,0x04,0x04,0x00,0x04,0x00,0x00,0x04,0x04,0x00,0x00,0x04,0x00,0x04,0x04,0x00,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84,0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,
0x84,0x80,0x80,0x84,0x80,0x84,0x84,0x80,0x80,0x84,0x84,0x80,0x84,0x80,0x80,0x84
};
#endif
#ifndef use_lib_lookup_znptable
//********************************************************
inline unsigned char Get_no_lookup_znptable(unsigned char c)
{
unsigned char d,g;
unsigned char f= 0;
if (c == 0)
return 0x44;
d= (c&0xA8);
for (g=0;g<8;g++)
{
if (c&1) f++;
c>>= 1;
}
if (!(f&1))
d|= 0x04;
return d;
}
#endif
#ifndef use_lib_lookup_znptable16
//********************************************************
inline unsigned char Get_no_lookup_znptable16(unsigned short int c)
{
unsigned char d= 0;
unsigned char f= 0;
unsigned char g;
if (c == 0)
return 0x44;
if (c&0x8000) d= 0x80;
for (g=0;g<16;g++)
{
if (c&1) f++;
c>>=1;
}
if (!(f&1))
d|= 0x04;
return d;
}
#endif
//void makeznptable()
//{
// int c,d,e,f,g;
// for (c=0;c<256;c++)
// {
// d=0;
// d|=(c&0xA8);
// e=c;
// f=0;
// for (g=0;g<8;g++)
// {
// if (e&1) f++;
// e>>=1;
// }
// if (!(f&1))
// d|=4;
// znptable[c]=d;
// }
// znptable[0]|=0x40;
// for (c=0;c<65536;c++)
// {
// d=0;
// if (c&0x8000) d|=0x80;
// e=c;
// f=0;
// for (g=0;g<16;g++)
// {
// if (e&1) f++;
// e>>=1;
// }
// if (!(f&1))
// d|=4;
// znptable16[c]=d;
// }
// znptable16[0]|=0x40;
//}
void dumpram()
{
/* FILE *f=fopen("ram.dmp","wb");
fwrite(ram,65536,1,f);
fclose(f);
f=fopen("ram2.dmp","wb");
fwrite(ram+0x10000,65536,1,f);
fclose(f);*/
}
void rebuildmem()
{
#ifdef use_lib_mem_blocks
readarray[0]=lorom;
readarray[1]=ramArray[0];
readarray[2]=ramArray[0];
readarray[3]=ramArray[0];
writearray[0]=ramArray[0];
writearray[1]=ramArray[0];
writearray[2]=ramArray[0];
writearray[3]=ramArray[0];
#else
readarray[0]=lorom;
readarray[1]=ram;
readarray[2]=ram;
readarray[3]=ram;
writearray[0]=ram;
writearray[1]=ram;
writearray[2]=ram;
writearray[3]=ram;
#endif
}
/*void ImprimeTablaPrecalculada()
{
int cont=0;
printf("Table znptable\n");
for (int i=0;i<256;i++)
{
printf("0x%02x,",znptable[i]);
cont++;
if (cont>=16)
{
cont=0;
printf("\n");
}
}
cont=0;
printf("Table znptable16\n");
for (int i=0;i<65536;i++)
{
printf("0x%02x,",znptable16[i]);
cont++;
if (cont>=16)
{
cont=0;
printf("\n");
}
}
}*/
void initz80()
{
int c;
//atexit(dumpram);
//makeznptable();
//ImprimeTablaPrecalculada();
//Para la rom en memoria dinamica
//JJ lorom=(unsigned char *)calloc(0x4000,1);
for (c=0;c<16;c++)
{
//hirom[c]=(unsigned char *)calloc(0x4000,1);
//memset(hirom[c],0,16384);
//hirom[c]= NULL;
hirom[c]= (unsigned char*)gb_rom_464_1;
}
#ifdef use_lib_mem_blocks
for (c=0;c<2;c++)
memset(ramArray[c],1,0x10000);
#else
#ifdef use_lib_cheat_128k
memset(ram,1,0x10000);
#else
#ifdef use_lib_fix_psram_128k
memset(ram,1,0x10000); //Modo 128K psram
#else
memset(ram,1,0x10000); //Modo 64K
#endif
#endif
#endif
//JJ ram=(unsigned char *)calloc(0x20000,1); //Creado en Setup
rebuildmem();
}
//Lee desde Flash todas las roms
void loadroms2FlashModel()
{
//printf("Modelo %d\n",aModel);
if (model == 2)
{
#if defined(use_lib_128k) || defined(use_lib_cheat_128k) || defined(use_lib_fix_psram_128k)
lorom = (unsigned char*)gb_rom_6128_0; //16KB primeros
hirom[0]= (unsigned char*)gb_rom_6128_1;
#endif
//memcpy(lorom,gb_rom_6128,16384);
//memcpy(hirom[0],&gb_rom_6128[16384],16384);
}
else
{
if (model == 1)
{
lorom = (unsigned char*)gb_rom_664_0;
hirom[0] = (unsigned char*)gb_rom_664_1;
//memcpy(lorom,gb_rom_664,16384);
//memcpy(hirom[0],&gb_rom_664[16384],16384);
}
else
{
lorom = (unsigned char*)gb_rom_464_0;
hirom[0] = (unsigned char*)gb_rom_464_1;
//memcpy(lorom,gb_rom_464,16384);
//memcpy(hirom[0],gb_rom_464_1,16384);
}
}
hirom[7] = (unsigned char *)gb_rom_amsdos;
//memcpy(hirom[7],gb_rom_amsdos,16384);
ramconfigBefore= 255; //force bank switch
curhromBefore= 255;
}
/*void loadroms()
{
FILE *f;
if (model==2) f=fopen("6128.rom","rb");
else if (model==1) f=fopen("664.rom","rb");
else f=fopen("464.rom","rb");
fread(lorom,16384,1,f);
fread(hirom[0],16384,1,f);
fclose(f);
f=fopen("amsdos.rom","rb");
fread(hirom[7],16384,1,f);
fclose(f);
}*/
void resetz80()
{
pc=0;
iff1=iff2=0;
#ifdef use_lib_mem_blocks
for (int i=0;i<2;i++)
memset(ramArray[i],0,0x10000); //65536 64 KB
ram = ramArray[0]; //Inicio
#else
#ifdef use_lib_cheat_128k
memset(ram,0,0x10000); //truco 122880 bytes
#else
#ifdef use_lib_fix_psram_128k
memset(ram,0,0x10000); //128K psram
#else
memset(ram,0,0x10000); //hay que setear memoria 64K
#endif
#endif
#endif
loromena=1;
hiromena=0;
galines=0;
writega(0,0xC0);
}
//if (a==0xBE60 && v==0xC3) { dumpregs(); output=1; }
#define readmem(a) readarray[(a&0xFFFF)>>14][a&0xFFFF]
#define writemem(a,v) writearray[(a&0xFFFF)>>14][a&0xFFFF]=v;
#define push(v) { sp--; writearray[sp>>14][sp]=v; }
unsigned char readmemf(unsigned short a)
{
return readarray[(a&0xFFFF)>>14][a&0xFFFF];
}
unsigned char readmemf2(unsigned short a)
{
return writearray[(a&0xFFFF)>>14][a&0xFFFF];
}
inline unsigned char pull()
{
unsigned char temp=readarray[sp>>14][sp];
sp++;
return temp;
}
inline unsigned char z80in(unsigned short a)
{
if (!(a&0x4000)) return readcrtc(a);
if (!(a&0x800)) return read8255(a);
if (!(a&0x480)) return readfdc(a);
return 0xFF;
}
inline void z80out(unsigned short a, unsigned char v)
{
if (!(a&0x8000)) writega(a,v);
if (!(a&0x4000)) writecrtc(a,v);
if (!(a&0x2000))
{
curhrom=v&15;
// printf("Current hirom = %i, ena %i\n",hiromena,curhrom);
if (hiromena)
{
//if (hirom[curhrom] == NULL)
// printf ("Soy nulo z80out %d\n",curhrom);
if (hirom[curhrom] != NULL)
{//JJ flash rom
readarray[3]=hirom[curhrom]-0xC000;
}
else
{
readarray[3]= hirom[0]-0xC000; //fuerzo a rom existente 0
}
}
}
if (!(a&0x800)) write8255(a,v);
if (!(a&0x480)) writefdc(a,v);
}
inline void setzn(unsigned char v)
{
af.b.l&=~(N_FLAG|Z_FLAG|V_FLAG|0x28|C_FLAG);
#ifdef use_lib_lookup_znptable
af.b.l|=znptable[v];
#else
af.b.l|= Get_no_lookup_znptable(v);
#endif
}
inline void setznc(unsigned char v)
{
af.b.l&=~(N_FLAG|Z_FLAG|V_FLAG|0x28);
#ifdef use_lib_lookup_znptable
af.b.l|=znptable[v];
#else
af.b.l|= Get_no_lookup_znptable(v);
#endif
}
signed short temps;
inline void setadd(unsigned char a, unsigned char b)
{
#ifdef use_lib_lookup_znptable
af.b.l=znptable[(a+b)&0xFF];
#else
af.b.l= Get_no_lookup_znptable(((a+b)&0xFF));
#endif
af.b.l&=~(C_FLAG|V_FLAG);
if ((a+b)&0x100) af.b.l|=C_FLAG;
temps=(signed short)(signed char)a+(signed short)(signed char)b;
if (temps<-128 || temps>127) af.b.l|=V_FLAG;
if (((a&0xF)+(b&0xF))&0x10) af.b.l|=H_FLAG;
}
inline void setadc(unsigned char a, unsigned char b)
{
#ifdef use_lib_lookup_znptable
af.b.l=znptable[(a+b+tempc)&0xFF];
#else
af.b.l= Get_no_lookup_znptable(((a+b+tempc)&0xFF));
#endif
af.b.l&=~V_FLAG;
if ((a+b+tempc)&0x100) af.b.l|=C_FLAG;
temps=(signed short)(signed char)a+(signed short)(signed char)b;
if (temps<-128 || temps>127) af.b.l|=V_FLAG;
if (((a&0xF)+(b&0xF))&0x10) af.b.l|=H_FLAG;
}
inline void setadc16(unsigned short a, unsigned short b)
{
signed long temps2;
#ifdef use_lib_lookup_znptable16
af.b.l=znptable16[(a+b+tempc)&0xFFFF];
#else
af.b.l= Get_no_lookup_znptable16(((a+b+tempc)&0xFFFF));
#endif
af.b.l&=~V_FLAG;
temps2=(signed short)a+(signed short)b;
if (temps2<-32768 || temps2>32767) af.b.l|=V_FLAG;
if (((a&0xFFF)+(b&0xFFF))&0x1000) af.b.l|=H_FLAG;
if ((a+b+tempc)&0x10000) af.b.l|=C_FLAG;
}
inline void setadd16(unsigned short a, unsigned short b)
{
af.b.l&=~(C_FLAG|S_FLAG|H_FLAG);
if ((a+b)&0x10000) af.b.l|=C_FLAG;
if ((a&0x1800)==0x800 && ((a+b)&0x1800)==0x1000) af.b.l|=H_FLAG;
}
inline void setcp(unsigned char a, unsigned char b)
{
#ifdef use_lib_lookup_znptable
af.b.l=znptable[(a-b)&0xFF]|S_FLAG;
#else
af.b.l= Get_no_lookup_znptable(((a-b)&0xFF))|S_FLAG;
#endif
af.b.l&=~V_FLAG;
temps=(signed short)(signed char)a-(signed short)(signed char)b;
if (temps<-128 || temps>127) af.b.l|=V_FLAG;
if (!(a&8) && ((a+b)&8)) af.b.l|=H_FLAG;
if (a<b) af.b.l|=C_FLAG;
}
inline void setdec(unsigned char v)
{
af.b.l&=1;
#ifdef use_lib_lookup_znptable
af.b.l|=znptable[v]|S_FLAG;
#else
af.b.l|= Get_no_lookup_znptable(v)|S_FLAG;
#endif
if (v==0x80) af.b.l|=P_FLAG;
else af.b.l&=~P_FLAG;
if (((v-1)&0x10) && !(v&0x10)) af.b.l|=H_FLAG;
}
inline void setinc(unsigned char v)
{
af.b.l&=0x29;
#ifdef use_lib_lookup_znptable
af.b.l|=znptable[v];
#else
af.b.l|= Get_no_lookup_znptable(v);
#endif
if (v==0x7F) af.b.l|=P_FLAG;
else af.b.l&=~P_FLAG;
if (((v-1)&0x8) && !(v&0x8)) af.b.l|=H_FLAG;
}
inline void setsub(unsigned char a, unsigned char b)
{
#ifdef use_lib_lookup_znptable
af.b.l=znptable[(a-b)&0xFF]|S_FLAG;
#else
af.b.l= Get_no_lookup_znptable(((a-b)&0xFF))|S_FLAG;
#endif
af.b.l&=~V_FLAG;
temps=(signed short)(signed char)a-(signed short)(signed char)b;
if (temps<-128 || temps>127) af.b.l|=V_FLAG;
if (!(a&8) && ((a-b)&8)) af.b.l|=H_FLAG;
if (a<b) af.b.l|=C_FLAG;
}
inline void setsbc(unsigned char a, unsigned char b)
{
#ifdef use_lib_lookup_znptable
af.b.l=znptable[(a-(b+tempc))&0xFF]|S_FLAG;
#else
af.b.l= Get_no_lookup_znptable(((a-(b+tempc))&0xFF))|S_FLAG;
#endif
af.b.l&=~V_FLAG;
temps=(signed short)(signed char)a-(signed short)(signed char)b;
if (temps<-128 || temps>127) af.b.l|=V_FLAG;
if (!(a&8) && ((a-b)&8)) af.b.l|=H_FLAG;
if (a<(b+tempc)) af.b.l|=C_FLAG;
}
inline void setsbc16(unsigned short a, unsigned short b)
{
signed long temps2;
b+=(af.b.l&C_FLAG);
af.b.l&=0x28;
#ifdef use_lib_lookup_znptable16
af.b.l|=znptable16[(a-b)&0xFFFF]|S_FLAG;
#else
af.b.l|= Get_no_lookup_znptable16(((a-b)&0xFFFF))|S_FLAG;
#endif
af.b.l&=~V_FLAG;
temps2=(signed long)(signed short)a-(signed long)(signed short)b;
if (temps2<-32768 || temps2>32767) af.b.l|=V_FLAG;
if (!(a&0x800) && ((a-b)&0x800)) af.b.l|=H_FLAG;
if (a<b) af.b.l|=C_FLAG;
}
void dumpregs()
{
/*JJ
printf("AF =%04X BC =%04X DE =%04X HL =%04X IX=%04X IY=%04X\n",af.w,bc.w,de.w,hl.w,ix.w,iy.w);
printf("AF'=%04X BC'=%04X DE'=%04X HL'=%04X IR=%04X\n",saf.w,sbc.w,sde.w,shl.w,ir.w);
printf("%c%c%c%c%c%c PC =%04X SP =%04X %i ins IFF1=%i IFF2=%i\n",(af.b.l&N_FLAG)?'N':' ',(af.b.l&Z_FLAG)?'Z':' ',(af.b.l&H_FLAG)?'H':' ',(af.b.l&V_FLAG)?'V':' ',(af.b.l&S_FLAG)?'S':' ',(af.b.l&C_FLAG)?'C':' ',pc,sp,ins,iff1,iff2);
printf("%04X %04X %04X\n",opc,oopc,ooopc);
*/
}
//JJ unsigned short opc,oopc;
int a92c=0;
//JJunsigned short opc,oldpc;
unsigned short oldpc;
void execz80()
{
int c;
unsigned char opcode;
unsigned short addr,tempw;
unsigned char temp,temp2;
signed char offset;
for (c=0;c<312;c++)
{
// if ((c&63)==63) intreq=1;
pollline();
cpuline++;
cycles+=256;
while (cycles>0)
{
oldpc=opc;
opc=pc;
opcode=readmem(pc); pc++;
tempc=af.b.l&C_FLAG;
switch (opcode)
{
// t 4
case 0x00: /*NOP*/
cycles-=4;
break;
// t 12
case 0x01: /*LD BC,xxxx*/
bc.b.l=readmem(pc); pc++;
bc.b.h=readmem(pc); pc++;
cycles-=12;
break;
// t 8
case 0x02: /*LD (BC),A*/
writemem(bc.w,af.b.h);
cycles-=8;
break;
// t 4
case 0x03: /*INC BC*/
bc.w++;
cycles-=8;
break;
// t 4
case 0x04: /*INC B*/
bc.b.h++;
setinc(bc.b.h);
cycles-=4;
break;
// t 4
case 0x05: /*DEC B*/
bc.b.h--;
setdec(bc.b.h);
cycles-=4;
break;
// t 8
case 0x06: /*LD B,xx*/
bc.b.h=readmem(pc); pc++;
cycles-=8;
break;
// t 4
case 0x07: /*RLCA*/
if (af.b.h&0x80) af.b.l|=C_FLAG;
else af.b.l&=~C_FLAG;
af.b.h<<=1;
if (af.b.l&C_FLAG) af.b.h|=1;
//setznc(af.b.h);
cycles-=4;
break;
// t 4
case 0x08: /*EX AF,AF'*/
tempw=af.w; af.w=saf.w; saf.w=tempw;
cycles-=4;
break;
// t 12
case 0x09: /*ADD HL,BC*/
setadd16(hl.w,bc.w);
hl.w+=bc.w;
cycles-=12;
break;
// t 8
case 0x0A: /*LD A,(BC)*/
af.b.h=readmem(bc.w);
cycles-=8;
break;
// t 4
case 0x0B: /*DEC BC*/
bc.w--;
cycles-=8;
break;
// t 4
case 0x0C: /*INC C*/
bc.b.l++;
setinc(bc.b.l);
cycles-=4;
break;
// t 4
case 0x0D: /*DEC C*/
bc.b.l--;
setdec(bc.b.l);
cycles-=4;
break;
// t 8
case 0x0E: /*LD C,xx*/
bc.b.l=readmem(pc); pc++;
cycles-=8;
break;
// t 4
case 0x0F: /*RRCA*/
if (af.b.h&1) af.b.l|=C_FLAG;
else af.b.l&=~C_FLAG;
af.b.h>>=1;
if (af.b.l&C_FLAG) af.b.h|=0x80;
//setznc(af.b.h);
cycles-=4;
break;
// t 8 8
case 0x10: /*DJNZ*/
offset=(signed char)readmem(pc); pc++;
bc.b.h--;
if (bc.b.h)
{
pc+=offset;
cycles-=16;
}
else
{
cycles-=12;
}
break;
// t 12
case 0x11: /*LD DE,xxxx*/
de.b.l=readmem(pc); pc++;
de.b.h=readmem(pc); pc++;
cycles-=12;
break;
// t 8
case 0x12: /*LD (DE),A*/
writemem(de.w,af.b.h);
cycles-=8;
break;
// t 4
case 0x13: /*INC DE*/
de.w++;
cycles-=8;
break;
// t 4
case 0x14: /*INC D*/
de.b.h++;
setinc(de.b.h);
cycles-=4;
break;
// t 4
case 0x15: /*DEC D*/
de.b.h--;
setdec(de.b.h);
cycles-=4;
break;
// t 8
case 0x16: /*LD D,xx*/
de.b.h=readmem(pc); pc++;
cycles-=8;
break;
// t 8
case 0x17: /*RLA*/
if (af.b.h&0x80) af.b.l|=C_FLAG;
else af.b.l&=~C_FLAG;
af.b.h<<=1;
if (tempc) af.b.h|=1;
//setznc(af.b.h);
cycles-=4;
break;
// t 16
case 0x18: /*JR*/
offset=(signed char)readmem(pc); pc++;
pc+=offset;
cycles-=12;
break;
// t 12
case 0x19: /*ADD HL,DE*/
setadd16(hl.w,de.w);
hl.w+=de.w;
cycles-=12;
break;
// t 8
case 0x1A: /*LD A,(DE)*/
af.b.h=readmem(de.w);
cycles-=8;
break;
// t 4
case 0x1B: /*DEC DE*/
de.w--;
cycles-=8;
break;
// t 4
case 0x1C: /*INC E*/
de.b.l++;
setinc(de.b.l);
cycles-=4;
break;
// t 4
case 0x1D: /*DEC E*/
de.b.l--;
setdec(de.b.l);
cycles-=4;
break;
// t 8
case 0x1E: /*LD E,xx*/
de.b.l=readmem(pc); pc++;
cycles-=8;
break;
// t 4
case 0x1F: /*RRA*/
tempc=af.b.l&C_FLAG;
if (af.b.h&1) af.b.l|=C_FLAG;
else af.b.l&=~C_FLAG;
af.b.h>>=1;
if (tempc) af.b.h|=0x80;
//setznc(af.b.h);
cycles-=4;
break;
// t 8 8
case 0x20: /*JR NZ*/
offset=(signed char)readmem(pc); pc++;
if (!(af.b.l&Z_FLAG))
{
pc+=offset;
cycles-=12;
}
else
{
cycles-=8;
}
break;
// t 12
case 0x21: /*LD HL,xxxx*/
hl.b.l=readmem(pc); pc++;
hl.b.h=readmem(pc); pc++;
cycles-=12;
break;
// t 24
case 0x22: /*LD (xxxx),HL*/
addr=readmem(pc)|(readmem(pc+1)<<8); pc+=2;
writemem(addr,hl.b.l);
writemem(addr+1,hl.b.h);
cycles-=20;
break;
// t 4
case 0x23: /*INC HL*/
hl.w++;
cycles-=8;
break;
// t 4
case 0x24: /*INC H*/
hl.b.h++;
setinc(hl.b.h);
cycles-=4;
break;
// t 4
case 0x25: /*DEC H*/
hl.b.h--;
setdec(hl.b.h);
cycles-=4;
break;
// t 8
case 0x26: /*LD H,xx*/
hl.b.h=readmem(pc); pc++;
cycles-=8;
break;
// t 4
case 0x27: /*DAA*/
addr=af.b.h;
if (af.b.l&C_FLAG) addr|=256;
if (af.b.l&H_FLAG) addr|=512;
if (af.b.l&S_FLAG) addr|=1024;
af.w=DAATable[addr];
cycles-=4;
break;
// t 8 8
case 0x28: /*JR Z*/
offset=(signed char)readmem(pc); pc++;
if (af.b.l&Z_FLAG)
{
pc+=offset;
cycles-=12;
}
else
{
cycles-=8;
}
break;
// t 12
case 0x29: /*ADD HL,HL*/
setadd16(hl.w,hl.w);
hl.w+=hl.w;
cycles-=12;
break;
// t 24
case 0x2A: /*LD HL,(xxxx)*/
addr=readmem(pc)|(readmem(pc+1)<<8); pc+=2;
hl.b.l=readmem(addr);
hl.b.h=readmem(addr+1);
cycles-=20;
break;
// t 4
case 0x2B: /*DEC HL*/
hl.w--;
cycles-=8;
break;
// t 4
case 0x2C: /*INC L*/
hl.b.l++;
setinc(hl.b.l);
cycles-=4;
break;
// t 4
case 0x2D: /*DEC L*/
hl.b.l--;
setdec(hl.b.l);
cycles-=4;
break;
// t 8
case 0x2E: /*LD L,xx*/
hl.b.l=readmem(pc); pc++;
cycles-=8;
break;
// t 4
case 0x2F: /*CPL*/
af.b.h^=0xFF;
af.b.l|=(H_FLAG|S_FLAG);
cycles-=4;
break;
// t 8 8
case 0x30: /*JR NC*/
offset=(signed char)readmem(pc); pc++;
if (!(af.b.l&C_FLAG))
{
pc+=offset;
cycles-=12;
}
else
{
cycles-=8;
}
break;
// t 12
case 0x31: /*LD SP,xxxx*/
sp=readmem(pc); pc++;
sp|=(readmem(pc))<<8; pc++;
cycles-=12;
break;
// t 16
case 0x32: /*LD (xxxx),A*/
addr=readmem(pc)|(readmem(pc+1)<<8); pc+=2;
writemem(addr,af.b.h);
cycles-=16;
break;
// t 4
case 0x33: /*INC SP*/
sp++;
cycles-=8;
break;
// t 12
case 0x34: /*INC (HL)*/
temp=readmem(hl.w)+1;
setinc(temp);
writemem(hl.w,temp);
cycles-=12;
break;
// t 12
case 0x35: /*DEC (HL)*/
temp=readmem(hl.w)-1;
setdec(temp);
writemem(hl.w,temp);
cycles-=12;
break;
// t 8
case 0x36: /*LD (HL),xx*/
temp=readmem(pc); pc++;
writemem(hl.w,temp);
cycles-=12;
break;
// t 4
case 0x37: /*SCF*/
af.b.l|=C_FLAG;
cycles-=4;
break;
// t 8 8
case 0x38: /*JR C*/
offset=(signed char)readmem(pc); pc++;
if (af.b.l&C_FLAG)
{
pc+=offset;
cycles-=12;
}
else
{
cycles-=8;
}
break;
// t 12
case 0x39: /*ADD HL,SP*/
setadd16(hl.w,sp);
hl.w+=sp;
cycles-=12;
break;
// t 16
case 0x3A: /*LD A,(xxxx)*/
addr=readmem(pc)|(readmem(pc+1)<<8); pc+=2;
af.b.h=readmem(addr);
cycles-=16;
break;
// t 4
case 0x3B: /*DEC SP*/
sp--;
cycles-=8;
break;
// t 4
case 0x3C: /*INC A*/
af.b.h++;
setinc(af.b.h);
cycles-=4;
break;
// t 4
case 0x3D: /*DEC A*/
af.b.h--;
setdec(af.b.h);
cycles-=4;
break;
// t 8
case 0x3E: /*LD A,xx*/
af.b.h=readmem(pc); pc++;
cycles-=8;
break;
// t 4
case 0x3F: /*CCF*/
if (af.b.l&C_FLAG) af.b.l|=H_FLAG;
else af.b.l&=~H_FLAG;
af.b.l^=C_FLAG;
cycles-=4;
break;
/*Register to register loads*/
case 0x40: bc.b.h=bc.b.h; cycles-=4; break; /*LD B,B*/
case 0x41: bc.b.h=bc.b.l; cycles-=4; break; /*LD B,C*/
case 0x42: bc.b.h=de.b.h; cycles-=4; break; /*LD B,D*/
case 0x43: bc.b.h=de.b.l; cycles-=4; break; /*LD B,E*/
case 0x44: bc.b.h=hl.b.h; cycles-=4; break; /*LD B,H*/
case 0x45: bc.b.h=hl.b.l; cycles-=4; break; /*LD B,L*/
case 0x46: bc.b.h=readmem(hl.w); cycles-=8; break; /*LD B,(HL)*/ // t 8
case 0x47: bc.b.h=af.b.h; cycles-=4; break; /*LD B,A*/
case 0x48: bc.b.l=bc.b.h; cycles-=4; break; /*LD C,B*/
case 0x49: bc.b.l=bc.b.l; cycles-=4; break; /*LD C,C*/
case 0x4A: bc.b.l=de.b.h; cycles-=4; break; /*LD C,D*/
case 0x4B: bc.b.l=de.b.l; cycles-=4; break; /*LD C,E*/
case 0x4C: bc.b.l=hl.b.h; cycles-=4; break; /*LD C,H*/
case 0x4D: bc.b.l=hl.b.l; cycles-=4; break; /*LD C,L*/
case 0x4E: bc.b.l=readmem(hl.w); cycles-=8; break; /*LD C,(HL)*/ // t 8
case 0x4F: bc.b.l=af.b.h; cycles-=4; break; /*LD C,A*/
case 0x50: de.b.h=bc.b.h; cycles-=4; break; /*LD D,B*/
case 0x51: de.b.h=bc.b.l; cycles-=4; break; /*LD D,C*/
case 0x52: de.b.h=de.b.h; cycles-=4; break; /*LD D,D*/
case 0x53: de.b.h=de.b.l; cycles-=4; break; /*LD D,E*/
case 0x54: de.b.h=hl.b.h; cycles-=4; break; /*LD D,H*/
case 0x55: de.b.h=hl.b.l; cycles-=4; break; /*LD D,L*/
case 0x56: de.b.h=readmem(hl.w); cycles-=8; break; /*LD D,(HL)*/ // t 8
case 0x57: de.b.h=af.b.h; cycles-=4; break; /*LD D,A*/
case 0x58: de.b.l=bc.b.h; cycles-=4; break; /*LD E,B*/
case 0x59: de.b.l=bc.b.l; cycles-=4; break; /*LD E,C*/
case 0x5A: de.b.l=de.b.h; cycles-=4; break; /*LD E,D*/
case 0x5B: de.b.l=de.b.l; cycles-=4; break; /*LD E,E*/
case 0x5C: de.b.l=hl.b.h; cycles-=4; break; /*LD E,H*/
case 0x5D: de.b.l=hl.b.l; cycles-=4; break; /*LD E,L*/
case 0x5E: de.b.l=readmem(hl.w); cycles-=8; break; /*LD E,(HL)*/ // t 8
case 0x5F: de.b.l=af.b.h; cycles-=4; break; /*LD E,A*/
case 0x60: hl.b.h=bc.b.h; cycles-=4; break; /*LD H,B*/
case 0x61: hl.b.h=bc.b.l; cycles-=4; break; /*LD H,C*/
case 0x62: hl.b.h=de.b.h; cycles-=4; break; /*LD H,D*/
case 0x63: hl.b.h=de.b.l; cycles-=4; break; /*LD H,E*/
case 0x64: hl.b.h=hl.b.h; cycles-=4; break; /*LD H,H*/
case 0x65: hl.b.h=hl.b.l; cycles-=4; break; /*LD H,L*/
case 0x66: hl.b.h=readmem(hl.w); cycles-=8; break; /*LD H,(HL)*/ // t 8
case 0x67: hl.b.h=af.b.h; cycles-=4; break; /*LD H,A*/
case 0x68: hl.b.l=bc.b.h; cycles-=4; break; /*LD L,B*/
case 0x69: hl.b.l=bc.b.l; cycles-=4; break; /*LD L,C*/
case 0x6A: hl.b.l=de.b.h; cycles-=4; break; /*LD L,D*/
case 0x6B: hl.b.l=de.b.l; cycles-=4; break; /*LD L,E*/
case 0x6C: hl.b.l=hl.b.h; cycles-=4; break; /*LD L,H*/
case 0x6D: hl.b.l=hl.b.l; cycles-=4; break; /*LD L,L*/
case 0x6E: hl.b.l=readmem(hl.w); cycles-=8; break; /*LD L,(HL)*/ // t 8
case 0x6F: hl.b.l=af.b.h; cycles-=4; break; /*LD L,A*/
case 0x70: writemem(hl.w,bc.b.h); cycles-=8; break; /*LD (HL),B*/ // t 8
case 0x71: writemem(hl.w,bc.b.l); cycles-=8; break; /*LD (HL),C*/ // t 8
case 0x72: writemem(hl.w,de.b.h); cycles-=8; break; /*LD (HL),D*/ // t 8
case 0x73: writemem(hl.w,de.b.l); cycles-=8; break; /*LD (HL),E*/ // t 8
case 0x74: writemem(hl.w,hl.b.h); cycles-=8; break; /*LD (HL),H*/ // t 8
case 0x75: writemem(hl.w,hl.b.l); cycles-=8; break; /*LD (HL),L*/ // t 8
case 0x77: writemem(hl.w,af.b.h); cycles-=8; break; /*LD (HL),A*/ // t 8
case 0x78: af.b.h=bc.b.h; cycles-=4; break; /*LD A,B*/
case 0x79: af.b.h=bc.b.l; cycles-=4; break; /*LD A,C*/
case 0x7A: af.b.h=de.b.h; cycles-=4; break; /*LD A,D*/
case 0x7B: af.b.h=de.b.l; cycles-=4; break; /*LD A,E*/
case 0x7C: af.b.h=hl.b.h; cycles-=4; break; /*LD A,H*/
case 0x7D: af.b.h=hl.b.l; cycles-=4; break; /*LD A,L*/
case 0x7E: af.b.h=readmem(hl.w); cycles-=8; break; /*LD A,(HL)*/ // t 8
case 0x7F: af.b.h=af.b.h; cycles-=4; break; /*LD A,A*/
case 0x76: /*HALT*/
if (!intreq) pc--;
cycles-=4;
break;
/*Add group*/
case 0x80: setadd(af.b.h,bc.b.h); af.b.h+=bc.b.h; cycles-=4; break; /*ADD B*/
case 0x81: setadd(af.b.h,bc.b.l); af.b.h+=bc.b.l; cycles-=4; break; /*ADD C*/
case 0x82: setadd(af.b.h,de.b.h); af.b.h+=de.b.h; cycles-=4; break; /*ADD D*/
case 0x83: setadd(af.b.h,de.b.l); af.b.h+=de.b.l; cycles-=4; break; /*ADD E*/
case 0x84: setadd(af.b.h,hl.b.h); af.b.h+=hl.b.h; cycles-=4; break; /*ADD H*/
case 0x85: setadd(af.b.h,hl.b.l); af.b.h+=hl.b.l; cycles-=4; break; /*ADD L*/
case 0x86: temp=readmem(hl.w); setadd(af.b.h,temp); af.b.h+=temp; cycles-=8; break; /*ADD (HL)*/ // t 8
case 0x87: setadd(af.b.h,af.b.h); af.b.h+=af.b.h; cycles-=4; break; /*ADD A*/
/*ADC group*/
case 0x88: setadc(af.b.h,bc.b.h); af.b.h+=bc.b.h+tempc; cycles-=4; break; /*ADC B*/
case 0x89: setadc(af.b.h,bc.b.l); af.b.h+=bc.b.l+tempc; cycles-=4; break; /*ADC C*/
case 0x8A: setadc(af.b.h,de.b.h); af.b.h+=de.b.h+tempc; cycles-=4; break; /*ADC D*/
case 0x8B: setadc(af.b.h,de.b.l); af.b.h+=de.b.l+tempc; cycles-=4; break; /*ADC E*/
case 0x8C: setadc(af.b.h,hl.b.h); af.b.h+=hl.b.h+tempc; cycles-=4; break; /*ADC H*/
case 0x8D: setadc(af.b.h,hl.b.l); af.b.h+=hl.b.l+tempc; cycles-=4; break; /*ADC L*/
case 0x8E: temp=readmem(hl.w); setadc(af.b.h,temp); af.b.h+=temp+tempc; cycles-=8; break; /*ADC (HL)*/ // t 8
case 0x8F: setadc(af.b.h,af.b.h); af.b.h+=af.b.h+tempc; cycles-=4; break; /*ADC A*/
/*Subtract group*/
case 0x90: setsub(af.b.h,bc.b.h); af.b.h-=bc.b.h; cycles-=4; break; /*SUB B*/
case 0x91: setsub(af.b.h,bc.b.l); af.b.h-=bc.b.l; cycles-=4; break; /*SUB C*/
case 0x92: setsub(af.b.h,de.b.h); af.b.h-=de.b.h; cycles-=4; break; /*SUB D*/
case 0x93: setsub(af.b.h,de.b.l); af.b.h-=de.b.l; cycles-=4; break; /*SUB E*/
case 0x94: setsub(af.b.h,hl.b.h); af.b.h-=hl.b.h; cycles-=4; break; /*SUB H*/
case 0x95: setsub(af.b.h,hl.b.l); af.b.h-=hl.b.l; cycles-=4; break; /*SUB L*/
case 0x96: temp=readmem(hl.w); setsub(af.b.h,temp); af.b.h-=temp; cycles-=8; break; /*ADD (HL)*/ // t 8
case 0x97: setsub(af.b.h,af.b.h); af.b.h-=af.b.h; cycles-=4; break; /*SUB A*/
/*SBC group*/
case 0x98: setsbc(af.b.h,bc.b.h); af.b.h-=(bc.b.h+tempc); cycles-=4; break; /*SBC B*/
case 0x99: setsbc(af.b.h,bc.b.l); af.b.h-=(bc.b.l+tempc); cycles-=4; break; /*SBC C*/
case 0x9A: setsbc(af.b.h,de.b.h); af.b.h-=(de.b.h+tempc); cycles-=4; break; /*SBC D*/
case 0x9B: setsbc(af.b.h,de.b.l); af.b.h-=(de.b.l+tempc); cycles-=4; break; /*SBC E*/
case 0x9C: setsbc(af.b.h,hl.b.h); af.b.h-=(hl.b.h+tempc); cycles-=4; break; /*SBC H*/
case 0x9D: setsbc(af.b.h,hl.b.l); af.b.h-=(hl.b.l+tempc); cycles-=4; break; /*SBC L*/
case 0x9E: temp=readmem(hl.w); setsbc(af.b.h,temp); af.b.h-=(temp+tempc); cycles-=8; break; /*SBC (HL)*/ // t 8
case 0x9F: setsbc(af.b.h,af.b.h); af.b.h-=(af.b.h+tempc); cycles-=4; break; /*SBC A*/
/*AND group*/
case 0xA0: af.b.h&=bc.b.h; setzn(af.b.h); af.b.l&=~3; af.b.l|=H_FLAG; cycles-=4; break; /*AND B*/
case 0xA1: af.b.h&=bc.b.l; setzn(af.b.h); af.b.l&=~3; af.b.l|=H_FLAG; cycles-=4; break; /*AND C*/
case 0xA2: af.b.h&=de.b.h; setzn(af.b.h); af.b.l&=~3; af.b.l|=H_FLAG; cycles-=4; break; /*AND D*/
case 0xA3: af.b.h&=de.b.l; setzn(af.b.h); af.b.l&=~3; af.b.l|=H_FLAG; cycles-=4; break; /*AND E*/
case 0xA4: af.b.h&=hl.b.h; setzn(af.b.h); af.b.l&=~3; af.b.l|=H_FLAG; cycles-=4; break; /*AND H*/
case 0xA5: af.b.h&=hl.b.l; setzn(af.b.h); af.b.l&=~3; af.b.l|=H_FLAG; cycles-=4; break; /*AND L*/
case 0xA6: temp=readmem(hl.w); af.b.h&=temp; setzn(af.b.h); af.b.l&=~3; af.b.l|=H_FLAG; cycles-=8; break; /*AND (HL)*/ // t 8
case 0xA7: af.b.h&=af.b.h; setzn(af.b.h); af.b.l&=~3; af.b.l|=H_FLAG; cycles-=4; break; /*AND A*/
/*XOR group*/
case 0xA8: af.b.h^=bc.b.h; setzn(af.b.h); af.b.l&=~3; cycles-=4; break; /*XOR B*/
case 0xA9: af.b.h^=bc.b.l; setzn(af.b.h); af.b.l&=~3;cycles-=4; break; /*XOR C*/
case 0xAA: af.b.h^=de.b.h; setzn(af.b.h); af.b.l&=~3; cycles-=4; break; /*XOR D*/
case 0xAB: af.b.h^=de.b.l; setzn(af.b.h); af.b.l&=~3; cycles-=4; break; /*XOR E*/
case 0xAC: af.b.h^=hl.b.h; setzn(af.b.h); af.b.l&=~3; cycles-=4; break; /*XOR H*/
case 0xAD: af.b.h^=hl.b.l; setzn(af.b.h); af.b.l&=~3; cycles-=4; break; /*XOR L*/
case 0xAE: temp=readmem(hl.w); af.b.h^=temp; setzn(af.b.h); af.b.l&=~3; cycles-=8; break; /*XOR (HL)*/ // t 8
case 0xAF: af.b.h^=af.b.h; setzn(af.b.h); af.b.l&=~3; cycles-=4; break; /*XOR A*/
/*OR group*/
case 0xB0: af.b.h|=bc.b.h; setzn(af.b.h); af.b.l&=~3; cycles-=4; break; /*OR B*/
case 0xB1: af.b.h|=bc.b.l; setzn(af.b.h); af.b.l&=~3; cycles-=4; break; /*OR C*/
case 0xB2: af.b.h|=de.b.h; setzn(af.b.h); af.b.l&=~3; cycles-=4; break; /*OR D*/
case 0xB3: af.b.h|=de.b.l; setzn(af.b.h); af.b.l&=~3; cycles-=4; break; /*OR E*/
case 0xB4: af.b.h|=hl.b.h; setzn(af.b.h); af.b.l&=~3; cycles-=4; break; /*OR H*/
case 0xB5: af.b.h|=hl.b.l; setzn(af.b.h); af.b.l&=~3; cycles-=4; break; /*OR L*/
case 0xB6: temp=readmem(hl.w); af.b.h|=temp; setzn(af.b.h); af.b.l&=~3; cycles-=8; break; /*OR (HL)*/ // t 8
case 0xB7: af.b.h|=af.b.h; setzn(af.b.h); af.b.l&=~3; cycles-=4; break; /*OR A*/
/*CP group*/
case 0xB8: setcp(af.b.h,bc.b.h); cycles-=4; break; /*CP B*/
case 0xB9: setcp(af.b.h,bc.b.l); cycles-=4; break; /*CP C*/
case 0xBA: setcp(af.b.h,de.b.h); cycles-=4; break; /*CP D*/
case 0xBB: setcp(af.b.h,de.b.l); cycles-=4; break; /*CP E*/
case 0xBC: setcp(af.b.h,hl.b.h); cycles-=4; break; /*CP H*/
case 0xBD: setcp(af.b.h,hl.b.l); cycles-=4; break; /*CP L*/
case 0xBE: temp=readmem(hl.w); setcp(af.b.h,temp); /*if (output) { printf("CP %02X %02X\n",af.b.h,temp,ram[hl.w]); dumpregs(); dumpram(); exit(0); } */cycles-=8; break; /*CP (HL)*/ // t 8
case 0xBF: setcp(af.b.h,af.b.h); cycles-=4; break; /*CP A*/
//D96A is it
// t 12
case 0xC0: /*RET NZ*/
if (!(af.b.l&Z_FLAG))
{
pc=pull();
pc|=pull()<<8;
cycles-=16;
}
else
{
cycles-=8;
}
break;
// t 12
case 0xC1: /*POP BC*/
bc.b.l=pull();
bc.b.h=pull();
cycles-=12;
break;
// t 12
case 0xC2: /*JP NZ,xxxx*/
addr=readmem(pc)|(readmem(pc+1)<<8); pc+=2;
if (!(af.b.l&Z_FLAG))
pc=addr;
cycles-=12;
break;
// t 12
case 0xC3: /*JP xxxx*/
addr=readmem(pc)|(readmem(pc+1)<<8); pc+=2;
pc=addr;
cycles-=12;
break;
// t 8 12
case 0xC4: /*CALL NZ*/
addr=readmem(pc)|(readmem(pc+1)<<8); pc+=2;
if (!(af.b.l&Z_FLAG))
{
push(pc>>8);
push(pc&0xFF);
pc=addr;
cycles-=20;
}
else
{
cycles-=12;
}
break;
// t 12
case 0xC5: /*PUSH BC*/
push(bc.b.h);
push(bc.b.l);
cycles-=16;
break;
// t 8
case 0xC6: /*ADD xx*/
temp=readmem(pc); pc++;
setadd(af.b.h,temp);
af.b.h+=temp;
cycles-=8;
break;
// t 16
case 0xC7: /*RST 0*/
push(pc>>8);
push(pc);
pc=0x00;
cycles-=16;
break;
// t 12
case 0xC8: /*RET Z*/
if (af.b.l&Z_FLAG)
{
pc=pull();
pc|=(pull()<<8);
cycles-=16;
}
else
{
cycles-=8;
}
break;
// t 12
case 0xC9: /*RET*/
// if (pc==0xBAA7) output=1;
pc=pull();
pc|=pull()<<8;
// if (output) printf("BAA7 %04X\n",pc);
// output=0;
cycles-=12;
break;
// t 12
case 0xCA: /*JP Z,xxxx*/
addr=readmem(pc)|(readmem(pc+1)<<8); pc+=2;
if (af.b.l&Z_FLAG)
pc=addr;
cycles-=12;
break;
case 0xCB: /*More opcodes*/
opcode=readmem(pc); pc++;
ir.b.l++;
switch (opcode)
{
case 0x00: if (bc.b.h&0x80) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; bc.b.h<<=1; if (af.b.l&C_FLAG) bc.b.h|=1; setznc(bc.b.h); cycles-=8; break; /*RLC B*/
case 0x01: if (bc.b.l&0x80) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; bc.b.l<<=1; if (af.b.l&C_FLAG) bc.b.l|=1; setznc(bc.b.l); cycles-=8; break; /*RLC C*/
case 0x02: if (de.b.h&0x80) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; de.b.h<<=1; if (af.b.l&C_FLAG) de.b.h|=1; setznc(de.b.h); cycles-=8; break; /*RLC D*/
case 0x03: if (de.b.l&0x80) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; de.b.l<<=1; if (af.b.l&C_FLAG) de.b.l|=1; setznc(de.b.l); cycles-=8; break; /*RLC E*/
case 0x04: if (hl.b.h&0x80) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; hl.b.h<<=1; if (af.b.l&C_FLAG) hl.b.h|=1; setznc(hl.b.h); cycles-=8; break; /*RLC H*/
case 0x05: if (hl.b.l&0x80) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; hl.b.l<<=1; if (af.b.l&C_FLAG) hl.b.l|=1; setznc(hl.b.l); cycles-=8; break; /*RLC L*/
case 0x06: temp=readmem(hl.w); if (temp&0x80) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; temp<<=1; if (af.b.l&C_FLAG) temp|=1; setznc(temp); writemem(hl.w,temp); cycles-=16; break; /*RLC L*/ // t 16
case 0x07: if (af.b.h&0x80) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; af.b.h<<=1; if (af.b.l&C_FLAG) af.b.h|=1; setznc(af.b.h); cycles-=8; break; /*RLC A*/
case 0x08: if (bc.b.h&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; bc.b.h>>=1; if (af.b.l&C_FLAG) bc.b.h|=0x80; setznc(bc.b.h); cycles-=8; break; /*RRC B*/
case 0x09: if (bc.b.l&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; bc.b.l>>=1; if (af.b.l&C_FLAG) bc.b.l|=0x80; setznc(bc.b.l); cycles-=8; break; /*RRC C*/
case 0x0A: if (de.b.h&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; de.b.h>>=1; if (af.b.l&C_FLAG) de.b.h|=0x80; setznc(de.b.h); cycles-=8; break; /*RRC D*/
case 0x0B: if (de.b.l&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; de.b.l>>=1; if (af.b.l&C_FLAG) de.b.l|=0x80; setznc(de.b.l); cycles-=8; break; /*RRC E*/
case 0x0C: if (hl.b.h&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; hl.b.h>>=1; if (af.b.l&C_FLAG) hl.b.h|=0x80; setznc(hl.b.h); cycles-=8; break; /*RRC H*/
case 0x0D: if (hl.b.l&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; hl.b.l>>=1; if (af.b.l&C_FLAG) hl.b.l|=0x80; setznc(hl.b.l); cycles-=8; break; /*RRC L*/
case 0x0E: temp=readmem(hl.w); if (temp&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; temp>>=1; if (af.b.l&C_FLAG) temp|=0x80; setznc(temp); writemem(hl.w,temp); cycles-=16; break; /*RRC (HL)*/// t 16
case 0x0F: if (af.b.h&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; af.b.h>>=1; if (af.b.l&C_FLAG) af.b.h|=0x80; setznc(af.b.h); cycles-=8; break; /*RRC A*/
case 0x10: if (bc.b.h&0x80) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; bc.b.h<<=1; if (tempc) bc.b.h|=1; setznc(bc.b.h); cycles-=8; break; /*RL B*/
case 0x11: if (bc.b.l&0x80) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; bc.b.l<<=1; if (tempc) bc.b.l|=1; setznc(bc.b.l); cycles-=8; break; /*RL C*/
case 0x12: if (de.b.h&0x80) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; de.b.h<<=1; if (tempc) de.b.h|=1; setznc(de.b.h); cycles-=8; break; /*RL D*/
case 0x13: if (de.b.l&0x80) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; de.b.l<<=1; if (tempc) de.b.l|=1; setznc(de.b.l); cycles-=8; break; /*RL E*/
case 0x14: if (hl.b.h&0x80) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; hl.b.h<<=1; if (tempc) hl.b.h|=1; setznc(hl.b.h); cycles-=8; break; /*RL H*/
case 0x15: if (hl.b.l&0x80) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; hl.b.l<<=1; if (tempc) hl.b.l|=1; setznc(hl.b.l); cycles-=8; break; /*RL L*/
case 0x16: temp=readmem(hl.w); if (temp&0x80) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; temp<<=1; if (tempc) temp|=1; setznc(temp); writemem(hl.w,temp); cycles-=16; break; /*RL (HL)*/ // t 16
case 0x17: if (af.b.h&0x80) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; af.b.h<<=1; if (tempc) af.b.h|=1; setznc(af.b.h); cycles-=8; break; /*RL A*/
case 0x18: if (bc.b.h&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; bc.b.h>>=1; if (tempc) bc.b.h|=0x80; setznc(bc.b.h); cycles-=8; break; /*RR B*/
case 0x19: if (bc.b.l&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; bc.b.l>>=1; if (tempc) bc.b.l|=0x80; setznc(bc.b.l); cycles-=8; break; /*RR C*/
case 0x1A: if (de.b.h&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; de.b.h>>=1; if (tempc) de.b.h|=0x80; setznc(de.b.h); cycles-=8; break; /*RR D*/
case 0x1B: if (de.b.l&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; de.b.l>>=1; if (tempc) de.b.l|=0x80; setznc(de.b.l); cycles-=8; break; /*RR E*/
case 0x1C: if (hl.b.h&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; hl.b.h>>=1; if (tempc) hl.b.h|=0x80; setznc(hl.b.h); cycles-=8; break; /*RR H*/
case 0x1D: if (hl.b.l&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; hl.b.l>>=1; if (tempc) hl.b.l|=0x80; setznc(hl.b.l); cycles-=8; break; /*RR L*/
case 0x1E: temp=readmem(hl.w); if (temp&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; temp>>=1; if (tempc) temp|=0x80; setznc(temp); writemem(hl.w,temp); cycles-=16; break; /*RR (HL)*/ // t 16
case 0x1F: if (af.b.h&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; af.b.h>>=1; if (tempc) af.b.h|=0x80; setznc(af.b.h); cycles-=8; break; /*RR A*/
case 0x20: if (bc.b.h&0x80) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; bc.b.h<<=1; setznc(bc.b.h); cycles-=8; break; /*SLA B*/
case 0x21: if (bc.b.l&0x80) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; bc.b.l<<=1; setznc(bc.b.l); cycles-=8; break; /*SLA C*/
case 0x22: if (de.b.h&0x80) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; de.b.h<<=1; setznc(de.b.h); cycles-=8; break; /*SLA D*/
case 0x23: if (de.b.l&0x80) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; de.b.l<<=1; setznc(de.b.l); cycles-=8; break; /*SLA E*/
case 0x24: if (hl.b.h&0x80) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; hl.b.h<<=1; setznc(hl.b.h); cycles-=8; break; /*SLA H*/
case 0x25: if (hl.b.l&0x80) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; hl.b.l<<=1; setznc(hl.b.l); cycles-=8; break; /*SLA L*/
case 0x26: temp=readmem(hl.w); if (temp&0x80) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; temp<<=1; setznc(temp); writemem(hl.w,temp); cycles-=16; break; /*SLA (HL)*/ // t 16
case 0x27: if (af.b.h&0x80) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; af.b.h<<=1; setznc(af.b.h); cycles-=8; break; /*SLA A*/
case 0x28: if (bc.b.h&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; bc.b.h>>=1; if (bc.b.h&0x40) bc.b.h|=0x80; setznc(bc.b.h); cycles-=8; break; /*SRA B*/
case 0x29: if (bc.b.l&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; bc.b.l>>=1; if (bc.b.l&0x40) bc.b.l|=0x80; setznc(bc.b.l); cycles-=8; break; /*SRA C*/
case 0x2A: if (de.b.h&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; de.b.h>>=1; if (de.b.h&0x40) de.b.h|=0x80; setznc(de.b.h); cycles-=8; break; /*SRA D*/
case 0x2B: if (de.b.l&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; de.b.l>>=1; if (de.b.l&0x40) de.b.l|=0x80; setznc(de.b.l); cycles-=8; break; /*SRA E*/
case 0x2C: if (hl.b.h&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; hl.b.h>>=1; if (hl.b.h&0x40) hl.b.h|=0x80; setznc(hl.b.h); cycles-=8; break; /*SRA H*/
case 0x2D: if (hl.b.l&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; hl.b.l>>=1; if (hl.b.l&0x40) hl.b.l|=0x80; setznc(hl.b.l); cycles-=8; break; /*SRA L*/
case 0x2E: temp=readmem(hl.w); if (temp&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; temp>>=1; if (temp&0x40) temp|=0x80; setznc(temp); writemem(hl.w,temp); cycles-=16; break; /*SRA (HL)*/ //t 16
case 0x2F: if (af.b.h&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; af.b.h>>=1; if (af.b.h&0x40) af.b.h|=0x80; setznc(af.b.h); cycles-=8; break; /*SRA A*/
case 0x30: if (bc.b.h&0x80) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; bc.b.h<<=1; bc.b.h|=1; setznc(bc.b.h); cycles-=8; break; /*SLL B*/
case 0x31: if (bc.b.l&0x80) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; bc.b.l<<=1; bc.b.l|=1; setznc(bc.b.l); cycles-=8; break; /*SLL C*/
case 0x32: if (de.b.h&0x80) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; de.b.h<<=1; de.b.h|=1; setznc(de.b.h); cycles-=8; break; /*SLL D*/
case 0x33: if (de.b.l&0x80) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; de.b.l<<=1; de.b.l|=1; setznc(de.b.l); cycles-=8; break; /*SLL E*/
case 0x34: if (hl.b.h&0x80) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; hl.b.h<<=1; hl.b.h|=1; setznc(hl.b.h); cycles-=8; break; /*SLL H*/
case 0x35: if (hl.b.l&0x80) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; hl.b.l<<=1; hl.b.l|=1; setznc(hl.b.l); cycles-=8; break; /*SLL L*/
case 0x36: temp=readmem(hl.w); if (temp&0x80) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; temp<<=1; temp|=1; setznc(temp); writemem(hl.w,temp); cycles-=16; break; /*SLL (HL)*/ // t 16
case 0x37: if (af.b.h&0x80) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; af.b.h<<=1; af.b.h|=1; setznc(af.b.h); cycles-=8; break; /*SLL A*/
case 0x38: if (bc.b.h&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; bc.b.h>>=1; setznc(bc.b.h); cycles-=8; break; /*SRL B*/
case 0x39: if (bc.b.l&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; bc.b.l>>=1; setznc(bc.b.l); cycles-=8; break; /*SRL C*/
case 0x3A: if (de.b.h&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; de.b.h>>=1; setznc(de.b.h); cycles-=8; break; /*SRL D*/
case 0x3B: if (de.b.l&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; de.b.l>>=1; setznc(de.b.l); cycles-=8; break; /*SRL E*/
case 0x3C: if (hl.b.h&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; hl.b.h>>=1; setznc(hl.b.h); cycles-=8; break; /*SRL H*/
case 0x3D: if (hl.b.l&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; hl.b.l>>=1; setznc(hl.b.l); cycles-=8; break; /*SRL L*/
case 0x3E: temp=readmem(hl.w); if (temp&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; temp>>=1; setznc(temp); writemem(hl.w,temp); cycles-=16; break; /*SRL (HL)*/ //t 16
case 0x3F: if (af.b.h&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; af.b.h>>=1; setznc(af.b.h); cycles-=8; break; /*SRL A*/
case 0x40: setznc(bc.b.h&0x01); cycles-=8; break; /*BIT 0,B*/
case 0x41: setznc(bc.b.l&0x01); cycles-=8; break; /*BIT 0,C*/
case 0x42: setznc(de.b.h&0x01); cycles-=8; break; /*BIT 0,D*/
case 0x43: setznc(de.b.l&0x01); cycles-=8; break; /*BIT 0,E*/
case 0x44: setznc(hl.b.h&0x01); cycles-=8; break; /*BIT 0,H*/
case 0x45: setznc(hl.b.l&0x01); cycles-=8; break; /*BIT 0,L*/
case 0x46: temp=readmem(hl.w); setznc(temp&0x01); cycles-=12; break; /*BIT 0,(HL)*/
case 0x47: setznc(af.b.h&0x01); cycles-=8; break; /*BIT 0,A*/
case 0x48: setznc(bc.b.h&0x02); cycles-=8; break; /*BIT 1,B*/
case 0x49: setznc(bc.b.l&0x02); cycles-=8; break; /*BIT 1,C*/
case 0x4A: setznc(de.b.h&0x02); cycles-=8; break; /*BIT 1,D*/
case 0x4B: setznc(de.b.l&0x02); cycles-=8; break; /*BIT 1,E*/
case 0x4C: setznc(hl.b.h&0x02); cycles-=8; break; /*BIT 1,H*/
case 0x4D: setznc(hl.b.l&0x02); cycles-=8; break; /*BIT 1,L*/
case 0x4E: temp=readmem(hl.w); setznc(temp&0x02); cycles-=12; break; /*BIT 1,(HL)*/
case 0x4F: setznc(af.b.h&0x02); cycles-=8; break; /*BIT 1,A*/
case 0x50: setznc(bc.b.h&0x04); cycles-=8; break; /*BIT 2,B*/
case 0x51: setznc(bc.b.l&0x04); cycles-=8; break; /*BIT 2,C*/
case 0x52: setznc(de.b.h&0x04); cycles-=8; break; /*BIT 2,D*/
case 0x53: setznc(de.b.l&0x04); cycles-=8; break; /*BIT 2,E*/
case 0x54: setznc(hl.b.h&0x04); cycles-=8; break; /*BIT 2,H*/
case 0x55: setznc(hl.b.l&0x04); cycles-=8; break; /*BIT 2,L*/
case 0x56: temp=readmem(hl.w); setznc(temp&0x04); cycles-=12; break; /*BIT 2,(HL)*/
case 0x57: setznc(af.b.h&0x04); cycles-=8; break; /*BIT 2,A*/
case 0x58: setznc(bc.b.h&0x08); cycles-=8; break; /*BIT 3,B*/
case 0x59: setznc(bc.b.l&0x08); cycles-=8; break; /*BIT 3,C*/
case 0x5A: setznc(de.b.h&0x08); cycles-=8; break; /*BIT 3,D*/
case 0x5B: setznc(de.b.l&0x08); cycles-=8; break; /*BIT 3,E*/
case 0x5C: setznc(hl.b.h&0x08); cycles-=8; break; /*BIT 3,H*/
case 0x5D: setznc(hl.b.l&0x08); cycles-=8; break; /*BIT 3,L*/
case 0x5E: temp=readmem(hl.w); setznc(temp&0x08); cycles-=12; break; /*BIT 3,(HL)*/
case 0x5F: setznc(af.b.h&0x08); cycles-=8; break; /*BIT 3,A*/
case 0x60: setznc(bc.b.h&0x10); cycles-=8; break; /*BIT 4,B*/
case 0x61: setznc(bc.b.l&0x10); cycles-=8; break; /*BIT 4,C*/
case 0x62: setznc(de.b.h&0x10); cycles-=8; break; /*BIT 4,D*/
case 0x63: setznc(de.b.l&0x10); cycles-=8; break; /*BIT 4,E*/
case 0x64: setznc(hl.b.h&0x10); cycles-=8; break; /*BIT 4,H*/
case 0x65: setznc(hl.b.l&0x10); cycles-=8; break; /*BIT 4,L*/
case 0x66: temp=readmem(hl.w); setznc(temp&0x10); cycles-=12; break; /*BIT 4,(HL)*/
case 0x67: setznc(af.b.h&0x10); cycles-=8; break; /*BIT 4,A*/
case 0x68: setznc(bc.b.h&0x20); cycles-=8; break; /*BIT 5,B*/
case 0x69: setznc(bc.b.l&0x20); cycles-=8; break; /*BIT 5,C*/
case 0x6A: setznc(de.b.h&0x20); cycles-=8; break; /*BIT 5,D*/
case 0x6B: setznc(de.b.l&0x20); cycles-=8; break; /*BIT 5,E*/
case 0x6C: setznc(hl.b.h&0x20); cycles-=8; break; /*BIT 5,H*/
case 0x6D: setznc(hl.b.l&0x20); cycles-=8; break; /*BIT 5,L*/
case 0x6E: temp=readmem(hl.w); setznc(temp&0x20); cycles-=12; break; /*BIT 5,(HL)*/
case 0x6F: setznc(af.b.h&0x20); cycles-=8; break; /*BIT 5,A*/
case 0x70: setznc(bc.b.h&0x40); cycles-=8; break; /*BIT 6,B*/
case 0x71: setznc(bc.b.l&0x40); cycles-=8; break; /*BIT 6,C*/
case 0x72: setznc(de.b.h&0x40); cycles-=8; break; /*BIT 6,D*/
case 0x73: setznc(de.b.l&0x40); cycles-=8; break; /*BIT 6,E*/
case 0x74: setznc(hl.b.h&0x40); cycles-=8; break; /*BIT 6,H*/
case 0x75: setznc(hl.b.l&0x40); cycles-=8; break; /*BIT 6,L*/
case 0x76: temp=readmem(hl.w); setznc(temp&0x40); cycles-=12; break; /*BIT 6,(HL)*/
case 0x77: setznc(af.b.h&0x40); cycles-=8; break; /*BIT 6,A*/
case 0x78: setznc(bc.b.h&0x80); cycles-=8; break; /*BIT 7,B*/
case 0x79: setznc(bc.b.l&0x80); cycles-=8; break; /*BIT 7,C*/
case 0x7A: setznc(de.b.h&0x80); cycles-=8; break; /*BIT 7,D*/
case 0x7B: setznc(de.b.l&0x80); cycles-=8; break; /*BIT 7,E*/
case 0x7C: setznc(hl.b.h&0x80); cycles-=8; break; /*BIT 7,H*/
case 0x7D: setznc(hl.b.l&0x80); cycles-=8; break; /*BIT 7,L*/
case 0x7E: temp=readmem(hl.w); setznc(temp&0x80); cycles-=12; break; /*BIT 7,(HL)*/
case 0x7F: setznc(af.b.h&0x80); cycles-=8; break; /*BIT 7,A*/
case 0x80: bc.b.h&=~1; cycles-=8; break; /*RES 0,B*/
case 0x81: bc.b.l&=~1; cycles-=8; break; /*RES 0,C*/
case 0x82: de.b.h&=~1; cycles-=8; break; /*RES 0,D*/
case 0x83: de.b.l&=~1; cycles-=8; break; /*RES 0,E*/
case 0x84: hl.b.h&=~1; cycles-=8; break; /*RES 0,H*/
case 0x85: hl.b.l&=~1; cycles-=8; break; /*RES 0,L*/
case 0x86: temp=readmem(hl.w)&~0x01; writemem(hl.w,temp); cycles-=16; break; /*RES 0,(HL)*/ // t 16
case 0x87: af.b.h&=~1; cycles-=8; break; /*RES 0,A*/
case 0x88: bc.b.h&=~2; cycles-=8; break; /*RES 1,B*/
case 0x89: bc.b.l&=~2; cycles-=8; break; /*RES 1,C*/
case 0x8A: de.b.h&=~2; cycles-=8; break; /*RES 1,D*/
case 0x8B: de.b.l&=~2; cycles-=8; break; /*RES 1,E*/
case 0x8C: hl.b.h&=~2; cycles-=8; break; /*RES 1,H*/
case 0x8D: hl.b.l&=~2; cycles-=8; break; /*RES 1,L*/
case 0x8E: temp=readmem(hl.w)&~0x02; writemem(hl.w,temp); cycles-=16; break; /*RES 1,(HL)*/ // t 16
case 0x8F: af.b.h&=~2; cycles-=8; break; /*RES 1,A*/
case 0x90: bc.b.h&=~4; cycles-=8; break; /*RES 2,B*/
case 0x91: bc.b.l&=~4; cycles-=8; break; /*RES 2,C*/
case 0x92: de.b.h&=~4; cycles-=8; break; /*RES 2,D*/
case 0x93: de.b.l&=~4; cycles-=8; break; /*RES 2,E*/
case 0x94: hl.b.h&=~4; cycles-=8; break; /*RES 2,H*/
case 0x95: hl.b.l&=~4; cycles-=8; break; /*RES 2,L*/
case 0x96: temp=readmem(hl.w)&~0x04; writemem(hl.w,temp); cycles-=16; break; /*RES 2,(HL)*/ // t 16
case 0x97: af.b.h&=~4; cycles-=8; break; /*RES 2,A*/
case 0x98: bc.b.h&=~8; cycles-=8; break; /*RES 3,B*/
case 0x99: bc.b.l&=~8; cycles-=8; break; /*RES 3,C*/
case 0x9A: de.b.h&=~8; cycles-=8; break; /*RES 3,D*/
case 0x9B: de.b.l&=~8; cycles-=8; break; /*RES 3,E*/
case 0x9C: hl.b.h&=~8; cycles-=8; break; /*RES 3,H*/
case 0x9D: hl.b.l&=~8; cycles-=8; break; /*RES 3,L*/
case 0x9E: temp=readmem(hl.w)&~0x08; writemem(hl.w,temp); cycles-=16; break; /*RES 3,(HL)*/ // t 16
case 0x9F: af.b.h&=~8; cycles-=8; break; /*RES 3,A*/
case 0xA0: bc.b.h&=~0x10; cycles-=8; break; /*RES 4,B*/
case 0xA1: bc.b.l&=~0x10; cycles-=8; break; /*RES 4,C*/
case 0xA2: de.b.h&=~0x10; cycles-=8; break; /*RES 4,D*/
case 0xA3: de.b.l&=~0x10; cycles-=8; break; /*RES 4,E*/
case 0xA4: hl.b.h&=~0x10; cycles-=8; break; /*RES 4,H*/
case 0xA5: hl.b.l&=~0x10; cycles-=8; break; /*RES 4,L*/
case 0xA6: temp=readmem(hl.w)&~0x10; writemem(hl.w,temp); cycles-=16; break; /*RES 4,(HL)*/ // t 16
case 0xA7: af.b.h&=~0x10; cycles-=8; break; /*RES 4,A*/
case 0xA8: bc.b.h&=~0x20; cycles-=8; break; /*RES 5,B*/
case 0xA9: bc.b.l&=~0x20; cycles-=8; break; /*RES 5,C*/
case 0xAA: de.b.h&=~0x20; cycles-=8; break; /*RES 5,D*/
case 0xAB: de.b.l&=~0x20; cycles-=8; break; /*RES 5,E*/
case 0xAC: hl.b.h&=~0x20; cycles-=8; break; /*RES 5,H*/
case 0xAD: hl.b.l&=~0x20; cycles-=8; break; /*RES 5,L*/
case 0xAE: temp=readmem(hl.w)&~0x20; writemem(hl.w,temp); cycles-=16; break; /*RES 5,(HL)*/ // t 16
case 0xAF: af.b.h&=~0x20; cycles-=8; break; /*RES 5,A*/
case 0xB0: bc.b.h&=~0x40; cycles-=8; break; /*RES 6,B*/
case 0xB1: bc.b.l&=~0x40; cycles-=8; break; /*RES 6,C*/
case 0xB2: de.b.h&=~0x40; cycles-=8; break; /*RES 6,D*/
case 0xB3: de.b.l&=~0x40; cycles-=8; break; /*RES 6,E*/
case 0xB4: hl.b.h&=~0x40; cycles-=8; break; /*RES 6,H*/
case 0xB5: hl.b.l&=~0x40; cycles-=8; break; /*RES 6,L*/
case 0xB6: temp=readmem(hl.w)&~0x40; writemem(hl.w,temp); cycles-=16; break; /*RES 6,(HL)*/ // t 16
case 0xB7: af.b.h&=~0x40; cycles-=8; break; /*RES 6,A*/
case 0xB8: bc.b.h&=~0x80; cycles-=8; break; /*RES 7,B*/
case 0xB9: bc.b.l&=~0x80; cycles-=8; break; /*RES 7,C*/
case 0xBA: de.b.h&=~0x80; cycles-=8; break; /*RES 7,D*/
case 0xBB: de.b.l&=~0x80; cycles-=8; break; /*RES 7,E*/
case 0xBC: hl.b.h&=~0x80; cycles-=8; break; /*RES 7,H*/
case 0xBD: hl.b.l&=~0x80; cycles-=8; break; /*RES 7,L*/
case 0xBE: temp=readmem(hl.w)&~0x80; writemem(hl.w,temp); cycles-=16; break; /*RES 7,(HL)*/ // t 16
case 0xBF: af.b.h&=~0x80; cycles-=8; break; /*RES 7,A*/
case 0xC0: bc.b.h|=0x01; cycles-=8; break; /*SET 0,B*/
case 0xC1: bc.b.l|=0x01; cycles-=8; break; /*SET 0,C*/
case 0xC2: de.b.h|=0x01; cycles-=8; break; /*SET 0,D*/
case 0xC3: de.b.l|=0x01; cycles-=8; break; /*SET 0,E*/
case 0xC4: hl.b.h|=0x01; cycles-=8; break; /*SET 0,H*/
case 0xC5: hl.b.l|=0x01; cycles-=8; break; /*SET 0,L*/
case 0xC6: temp=readmem(hl.w)|0x01; writemem(hl.w,temp); cycles-=16; break; /*SET 0,(HL)*/ // t 16
case 0xC7: af.b.h|=0x01; cycles-=8; break; /*SET 0,A*/
case 0xC8: bc.b.h|=0x02; cycles-=8; break; /*SET 1,B*/
case 0xC9: bc.b.l|=0x02; cycles-=8; break; /*SET 1,C*/
case 0xCA: de.b.h|=0x02; cycles-=8; break; /*SET 1,D*/
case 0xCB: de.b.l|=0x02; cycles-=8; break; /*SET 1,E*/
case 0xCC: hl.b.h|=0x02; cycles-=8; break; /*SET 1,H*/
case 0xCD: hl.b.l|=0x02; cycles-=8; break; /*SET 1,L*/
case 0xCE: temp=readmem(hl.w)|0x02; writemem(hl.w,temp); cycles-=16; break; /*SET 1,(HL)*/ // t 16
case 0xCF: af.b.h|=0x02; cycles-=8; break; /*SET 1,A*/
case 0xD0: bc.b.h|=0x04; cycles-=8; break; /*SET 2,B*/
case 0xD1: bc.b.l|=0x04; cycles-=8; break; /*SET 2,C*/
case 0xD2: de.b.h|=0x04; cycles-=8; break; /*SET 2,D*/
case 0xD3: de.b.l|=0x04; cycles-=8; break; /*SET 2,E*/
case 0xD4: hl.b.h|=0x04; cycles-=8; break; /*SET 2,H*/
case 0xD5: hl.b.l|=0x04; cycles-=8; break; /*SET 2,L*/
case 0xD6: temp=readmem(hl.w)|0x04; writemem(hl.w,temp); cycles-=16; break; /*SET 2,(HL)*/ // t 16
case 0xD7: af.b.h|=0x04; cycles-=8; break; /*SET 2,A*/
case 0xD8: bc.b.h|=0x08; cycles-=8; break; /*SET 3,B*/
case 0xD9: bc.b.l|=0x08; cycles-=8; break; /*SET 3,C*/
case 0xDA: de.b.h|=0x08; cycles-=8; break; /*SET 3,D*/
case 0xDB: de.b.l|=0x08; cycles-=8; break; /*SET 3,E*/
case 0xDC: hl.b.h|=0x08; cycles-=8; break; /*SET 3,H*/
case 0xDD: hl.b.l|=0x08; cycles-=8; break; /*SET 3,L*/
case 0xDE: temp=readmem(hl.w)|0x08; writemem(hl.w,temp); cycles-=16; break; /*SET 3,(HL)*/ // t 16
case 0xDF: af.b.h|=0x08; cycles-=8; break; /*SET 3,A*/
case 0xE0: bc.b.h|=0x10; cycles-=8; break; /*SET 4,B*/
case 0xE1: bc.b.l|=0x10; cycles-=8; break; /*SET 4,C*/
case 0xE2: de.b.h|=0x10; cycles-=8; break; /*SET 4,D*/
case 0xE3: de.b.l|=0x10; cycles-=8; break; /*SET 4,E*/
case 0xE4: hl.b.h|=0x10; cycles-=8; break; /*SET 4,H*/
case 0xE5: hl.b.l|=0x10; cycles-=8; break; /*SET 4,L*/
case 0xE6: temp=readmem(hl.w)|0x10; writemem(hl.w,temp); cycles-=16; break; /*SET 4,(HL)*/ // t 16
case 0xE7: af.b.h|=0x10; cycles-=8; break; /*SET 4,A*/
case 0xE8: bc.b.h|=0x20; cycles-=8; break; /*SET 5,B*/
case 0xE9: bc.b.l|=0x20; cycles-=8; break; /*SET 5,C*/
case 0xEA: de.b.h|=0x20; cycles-=8; break; /*SET 5,D*/
case 0xEB: de.b.l|=0x20; cycles-=8; break; /*SET 5,E*/
case 0xEC: hl.b.h|=0x20; cycles-=8; break; /*SET 5,H*/
case 0xED: hl.b.l|=0x20; cycles-=8; break; /*SET 5,L*/
case 0xEE: temp=readmem(hl.w)|0x20; writemem(hl.w,temp); cycles-=16; break; /*SET 5,(HL)*/ // t 16
case 0xEF: af.b.h|=0x20; cycles-=8; break; /*SET 5,A*/
case 0xF0: bc.b.h|=0x40; cycles-=8; break; /*SET 6,B*/
case 0xF1: bc.b.l|=0x40; cycles-=8; break; /*SET 6,C*/
case 0xF2: de.b.h|=0x40; cycles-=8; break; /*SET 6,D*/
case 0xF3: de.b.l|=0x40; cycles-=8; break; /*SET 6,E*/
case 0xF4: hl.b.h|=0x40; cycles-=8; break; /*SET 6,H*/
case 0xF5: hl.b.l|=0x40; cycles-=8; break; /*SET 6,L*/
case 0xF6: temp=readmem(hl.w)|0x40; writemem(hl.w,temp); cycles-=16; break; /*SET 6,(HL)*/ // t 16
case 0xF7: af.b.h|=0x40; cycles-=8; break; /*SET 6,A*/
case 0xF8: bc.b.h|=0x80; cycles-=8; break; /*SET 7,B*/
case 0xF9: bc.b.l|=0x80; cycles-=8; break; /*SET 7,C*/
case 0xFA: de.b.h|=0x80; cycles-=8; break; /*SET 7,D*/
case 0xFB: de.b.l|=0x80; cycles-=8; break; /*SET 7,E*/
case 0xFC: hl.b.h|=0x80; cycles-=8; break; /*SET 7,H*/
case 0xFD: hl.b.l|=0x80; cycles-=8; break; /*SET 7,L*/
case 0xFE: temp=readmem(hl.w)|0x80; writemem(hl.w,temp); cycles-=16; break; /*SET 7,(HL)*/ // t 16
case 0xFF: af.b.h|=0x80; cycles-=8; break; /*SET 7,A*/
default:
//printf("Bad CB opcode %02X at %04X\n",opcode,--pc);
dumpregs();
exit(-1);
}
break;
// t 5 8?
case 0xCC: /*CALL Z*/
addr=readmem(pc)|(readmem(pc+1)<<8); pc+=2;
if (af.b.l&Z_FLAG)
{
push(pc>>8);
push(pc&0xFF);
pc=addr;
cycles-=20;
}
else
{
cycles-=12;
}
break;
// t 20
case 0xCD: /*CALL*/
addr=readmem(pc)|(readmem(pc+1)<<8); pc+=2;
push(pc>>8);
push(pc&0xFF);
pc=addr;
cycles-=20;
break;
// t 8
case 0xCE: /*ADC xx*/
temp=readmem(pc); pc++;
setadc(af.b.h,temp);
af.b.h+=(temp+tempc);
cycles-=8;
break;
// t 16
case 0xCF: /*RST 8*/
push(pc>>8);
push(pc);
pc=0x08;
cycles-=16;
break;
// t 12 -- conflict (only 5) - using Aspectrum T
case 0xD0: /*RET NC*/
if (!(af.b.l&C_FLAG))
{
pc=pull();
pc|=pull()<<8;
cycles-=16;
}
else
{
cycles-=8;
}
break;
// t 12
case 0xD1: /*POP DE*/
de.b.l=pull();
de.b.h=pull();
cycles-=12;
break;
// t 12
case 0xD2: /*JP NC,xxxx*/
addr=readmem(pc)|(readmem(pc+1)<<8); pc+=2;
if (!(af.b.l&C_FLAG))
pc=addr;
cycles-=12;
break;
// t 12
case 0xD3: /*OUT (xx),A*/
temp=readmem(pc); pc++;
z80out(temp|(af.b.h<<8),af.b.h);
cycles-=12;
break;
// t 8 12
case 0xD4: /*CALL NC*/
addr=readmem(pc)|(readmem(pc+1)<<8); pc+=2;
if (!(af.b.l&C_FLAG))
{
push(pc>>8);
push(pc&0xFF);
pc=addr;
cycles-=20;
}
else
{
cycles-=12;
}
break;
// t 12
case 0xD5: /*PUSH DE*/
push(de.b.h);
push(de.b.l);
cycles-=16;
break;
// t 8
case 0xD6: /*SUB xx*/
temp=readmem(pc); pc++;
setsub(af.b.h,temp);
af.b.h-=temp;
cycles-=8;
break;
// t 16
case 0xD7: /*RST 10*/
push(pc>>8);
push(pc);
pc=0x10;
cycles-=16;
break;
// t 12 -- CONFLICT (only 5) using ASPECTRUM T
case 0xD8: /*RET C*/
if (af.b.l&C_FLAG)
{
pc=pull();
pc|=pull()<<8;
cycles-=16;
}
else
{
cycles-=8;
}
break;
// t 4
case 0xD9: /*EXX*/
tempw=bc.w; bc.w=sbc.w; sbc.w=tempw;
tempw=de.w; de.w=sde.w; sde.w=tempw;
tempw=hl.w; hl.w=shl.w; shl.w=tempw;
cycles-=4;
break;
// t 12
case 0xDA: /*JP C,xxxx*/
addr=readmem(pc)|(readmem(pc+1)<<8); pc+=2;
if (af.b.l&C_FLAG)
pc=addr;
cycles-=12;
break;
// t 12
case 0xDB: /*IN A,(xx)*/
addr=readmem(pc); pc++;
af.b.h=z80in((af.b.h<<8)|addr);
cycles-=12;
break;
// t 8 12
case 0xDC: /*CALL C*/
addr=readmem(pc)|(readmem(pc+1)<<8); pc+=2;
if (af.b.l&C_FLAG)
{
push(pc>>8);
push(pc&0xFF);
pc=addr;
cycles-=20;
}
else
{
cycles-=12;
}
break;
case 0xDD: /*More opcodes - IX*/
ir.b.l++;
opcode=readmem(pc); pc++;
switch (opcode)
{
case 0x09: /*ADD IX,BC*/
setadd16(ix.w,bc.w);
ix.w+=bc.w;
cycles-=16; //t 16
break;
case 0x19: /*ADD IX,DE*/
setadd16(ix.w,de.w);
ix.w+=de.w;
cycles-=16; //t 16
break;
case 0x21: /*LD IX,xxxx*/
ix.b.l=readmem(pc); pc++;
ix.b.h=readmem(pc); pc++;
cycles-=16; //t 16
break;
case 0x22: /*LD (xxxx),IX*/
addr=readmem(pc)|(readmem(pc+1)<<8); pc+=2;
writemem(addr,ix.b.l);
writemem(addr+1,ix.b.h);
cycles-=24; // t 24
break;
case 0x23: /*INC IX*/
ix.w++;
cycles-=12; // t 8
break;
case 0x24: /*INC IXh*/
ix.b.h++;
setinc(ix.b.h);
cycles-=8;
break;
case 0x25: /*DEC IXh*/
ix.b.h--;
setdec(ix.b.h);
cycles-=8;
break;
case 0x26: /*LD IXh,xx*/
ix.b.h=readmem(pc); pc++;
cycles-=12; // t 12
break;
case 0x29: /*ADD IX,IX*/
setadd16(ix.w,ix.w);
ix.w+=ix.w;
cycles-=16; //t 16
break;
case 0x2A: /*LD IX,(xxxx)*/
addr=readmem(pc)|(readmem(pc+1)<<8); pc+=2;
ix.b.l=readmem(addr);
ix.b.h=readmem(addr+1);
cycles-=24; // t 24
break;
case 0x2B: /*DEC IX*/
ix.w--;
cycles-=12; // 8
break;
case 0x2C: /*INC IXl*/
ix.b.l++;
setinc(ix.b.l);
cycles-=8; // 8
break;
case 0x2D: /*DEC IXl*/
ix.b.l--;
setdec(ix.b.l);
cycles-=8; // 8
break;
case 0x2E: /*LD IXl,xx*/
ix.b.l=readmem(pc); pc++;
cycles-=12; // t 12
break;
case 0x34: /*INC (IX+d)*/
offset=(signed char)readmem(pc); pc++;
temp=readmem(ix.w+offset)+1;
setinc(temp);
writemem(ix.w+offset,temp);
cycles-=24; // t 12
break;
case 0x35: /*DEC (IX+d)*/
offset=(signed char)readmem(pc); pc++;
temp=readmem(ix.w+offset)-1;
setdec(temp);
writemem(ix.w+offset,temp);
cycles-=24; // t 12
break;
case 0x36: /*LD (IX+d),xx*/
offset=(signed char)readmem(pc); pc++;
temp=readmem(pc); pc++;
writemem(ix.w+offset,temp);
cycles-=24; // t 24
break;
case 0x39: /*ADD IX,SP*/
setadd16(ix.w,sp);
ix.w+=sp;
cycles-=16; // t 16
break;
case 0x44: bc.b.h=ix.b.h; cycles-=8; break; /*LD B,IXh*/ // NEW
case 0x45: bc.b.h=ix.b.l; cycles-=8; break; /*LD B,IXl*/
case 0x46: offset=(signed char)readmem(pc); pc++; bc.b.h=readmem(ix.w+offset); cycles-=20; break; /*LD B,(IX+d)*/ // t 24
case 0x4E: offset=(signed char)readmem(pc); pc++; bc.b.l=readmem(ix.w+offset); cycles-=20; break; /*LD C,(IX+d)*/ // t 24
case 0x56: offset=(signed char)readmem(pc); pc++; de.b.h=readmem(ix.w+offset); cycles-=20; break; /*LD D,(IX+d)*/ // t 24
case 0x5E: offset=(signed char)readmem(pc); pc++; de.b.l=readmem(ix.w+offset); cycles-=20; break; /*LD E,(IX+d)*/ // t 24
case 0x66: offset=(signed char)readmem(pc); pc++; hl.b.h=readmem(ix.w+offset); cycles-=20; break; /*LD H,(IX+d)*/ // t 24
case 0x6E: offset=(signed char)readmem(pc); pc++; hl.b.l=readmem(ix.w+offset); cycles-=20; break; /*LD L,(IX+d)*/ // t 24
case 0x7E: offset=(signed char)readmem(pc); pc++; af.b.h=readmem(ix.w+offset); cycles-=20; break; /*LD A,(IX+d)*/ // t 24
case 0x4C: bc.b.l=ix.b.h; cycles-=8; break; /*LD C,IXh*/
case 0x4D: bc.b.l=ix.b.l; cycles-=8; break; /*LD C,IXl*/
case 0x54: de.b.h=ix.b.h; cycles-=8; break; /*LD D,IXh*/
case 0x55: de.b.h=ix.b.l; cycles-=8; break; /*LD D,IXl*/
case 0x5C: de.b.l=ix.b.h; cycles-=8; break; /*LD E,IXh*/
case 0x5D: de.b.l=ix.b.l; cycles-=8; break; /*LD E,IXl*/
case 0x60: ix.b.h=bc.b.h; cycles-=8; break; /*LD IXh,B*/
case 0x61: ix.b.h=bc.b.l; cycles-=8; break; /*LD IXh,C*/
case 0x62: ix.b.h=de.b.h; cycles-=8; break; /*LD IXh,B*/
case 0x63: ix.b.h=de.b.l; cycles-=8; break; /*LD IXh,C*/
case 0x64: ix.b.h=hl.b.h; cycles-=8; break; /*LD IXh,B*/
case 0x65: ix.b.h=hl.b.l; cycles-=8; break; /*LD IXh,C*/
case 0x67: ix.b.h=af.b.h; cycles-=8; break; /*LD IXh,A*/
case 0x68: ix.b.l=bc.b.h; cycles-=8; break; /*LD IXl,B*/
case 0x69: ix.b.l=bc.b.l; cycles-=8; break; /*LD IXl,C*/
case 0x6A: ix.b.l=de.b.h; cycles-=8; break; /*LD IXl,B*/
case 0x6B: ix.b.l=de.b.l; cycles-=8; break; /*LD IXl,C*/
case 0x6C: ix.b.l=hl.b.h; cycles-=8; break; /*LD IXl,B*/
case 0x6D: ix.b.l=hl.b.l; cycles-=8; break; /*LD IXl,C*/
case 0x6F: ix.b.l=af.b.h; cycles-=8; break; /*LD IXl,A*/
case 0x70: offset=(signed char)readmem(pc); pc++; writemem(ix.w+offset,bc.b.h); cycles-=20; break; /*LD (IX+d),B*/ // t 24
case 0x71: offset=(signed char)readmem(pc); pc++; writemem(ix.w+offset,bc.b.l); cycles-=20; break; /*LD (IX+d),C*/ // t 24
case 0x72: offset=(signed char)readmem(pc); pc++; writemem(ix.w+offset,de.b.h); cycles-=20; break; /*LD (IX+d),D*/ // t 24
case 0x73: offset=(signed char)readmem(pc); pc++; writemem(ix.w+offset,de.b.l); cycles-=20; break; /*LD (IX+d),E*/ // t 24
case 0x74: offset=(signed char)readmem(pc); pc++; writemem(ix.w+offset,hl.b.h); cycles-=20; break; /*LD (IX+d),H*/ // t 24
case 0x75: offset=(signed char)readmem(pc); pc++; writemem(ix.w+offset,hl.b.l); cycles-=20; break; /*LD (IX+d),L*/ // t 24
case 0x77: offset=(signed char)readmem(pc); pc++; writemem(ix.w+offset,af.b.h); cycles-=20; break; /*LD (IX+d),A*/ // t 24
case 0x7C: af.b.h=ix.b.h; cycles-=8; break; /*LD A,IXh*/
case 0x7D: af.b.h=ix.b.l; cycles-=8; break; /*LD A,IXl*/
case 0x84: setadd(af.b.h,ix.b.h); af.b.h+=ix.b.h; cycles-=8; break; /*ADD IXh*/
case 0x85: setadd(af.b.h,ix.b.l); af.b.h+=ix.b.l; cycles-=8; break; /*ADD IXl*/
case 0x8C: setadc(af.b.h,ix.b.h); af.b.h+=ix.b.h+tempc; cycles-=4; break; /*ADC IXh*/
case 0x8D: setadc(af.b.h,ix.b.l); af.b.h+=ix.b.l+tempc; cycles-=4; break; /*ADC IXl*/
case 0x94: setsub(af.b.h,ix.b.h); af.b.h-=ix.b.h; cycles-=4; break; /*SUB IXh*/
case 0x95: setsub(af.b.h,ix.b.l); af.b.h-=ix.b.l; cycles-=4; break; /*SUB IXl*/
case 0x86: offset=(signed char)readmem(pc); pc++; temp=readmem(ix.w+offset); setadd(af.b.h,temp); af.b.h+=temp; cycles-=20; break; /*ADD (IX+d)*/ // t 28
case 0x8E: offset=(signed char)readmem(pc); pc++; temp=readmem(ix.w+offset); setadc(af.b.h,temp); af.b.h+=temp+tempc; cycles-=20; break; /*ADC (IX+d)*/ // t 28
case 0x96: offset=(signed char)readmem(pc); pc++; temp=readmem(ix.w+offset); setsub(af.b.h,temp); af.b.h-=temp; cycles-=20; break; /*SUB (IX+d)*/ // t 28
case 0xA6: offset=(signed char)readmem(pc); pc++; temp=readmem(ix.w+offset); af.b.h&=temp; setzn(af.b.h); af.b.l&=~3; af.b.l|=H_FLAG; cycles-=20; break; /*AND (IX+d)*/ // t 28
case 0xAE: offset=(signed char)readmem(pc); pc++; temp=readmem(ix.w+offset); af.b.h^=temp; setzn(af.b.h); cycles-=20; break; /*XOR (IX+d)*/ // t 28
case 0xB6: offset=(signed char)readmem(pc); pc++; temp=readmem(ix.w+offset); af.b.h|=temp; setzn(af.b.h); cycles-=20; break; /*OR (IX+d)*/ // t 28
// NEW.
case 0x9C: setsbc(af.b.h,ix.b.h); af.b.h-=(ix.b.h+tempc); cycles-=8; break; /*SBC IXh*/
case 0x9D: setsbc(af.b.h,ix.b.l); af.b.h-=(ix.b.l+tempc); cycles-=8; break; /*SBC IXl*/
case 0x9E: offset=(signed char)readmem(pc); pc++; temp=readmem(ix.w+offset); setsbc(af.b.h,temp); af.b.h-=temp; cycles-=20; break; /*SBC (IX+d)*/ // NEW
// NEW.
case 0xBC: setcp(af.b.h,ix.b.h); cycles-=8; break; /*CP IXh*/ // NEW
case 0xBD: setcp(af.b.h,ix.b.l); cycles-=8; break; /*CP IXl*/ // NEW
case 0xBE: offset=(signed char)readmem(pc); pc++; temp=readmem(ix.w+offset); setcp(af.b.h,temp); cycles-=20; break; /*CP (IX+d)*/ // t 28
// NEW.
case 0xAC: af.b.h^=ix.b.h; setzn(af.b.h); af.b.l&=~3; cycles-=8; break; /*XOR IXh*/ // NEW
case 0xAD: af.b.h^=ix.b.l; setzn(af.b.h); af.b.l&=~3; cycles-=8; break; /*XOR IXL*/ // NEW
case 0xA4: af.b.h&=ix.b.h; setzn(af.b.h); af.b.l&=~3; af.b.l|=H_FLAG; cycles-=8; break; /*AND IXh*/
case 0xA5: af.b.h&=ix.b.l; setzn(af.b.h); af.b.l&=~3; af.b.l|=H_FLAG; cycles-=8; break; /*AND IXl*/
case 0xB4: af.b.h|=ix.b.h; setzn(af.b.h); cycles-=8; break; /*OR IXh*/
case 0xB5: af.b.h|=ix.b.l; setzn(af.b.h); cycles-=8; break; /*OR IXl*/
case 0xCB: /*More opcodes*/
offset=(signed char)readmem(pc); pc++;
opcode=readmem(pc); pc++;
ir.b.l++;
switch (opcode)
{
case 0x06: temp=readmem(ix.w+offset); if (temp&0x80) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; temp<<=1; if (af.b.l&C_FLAG) temp|=1; setznc(temp); writemem(ix.w+offset,temp); cycles-=28; break; /*RLC (IX+d)*/ // t 28
case 0x0E: temp=readmem(ix.w+offset); if (temp&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; temp>>=1; if (af.b.l&C_FLAG) temp|=0x80; setznc(temp); writemem(ix.w+offset,temp); cycles-=28; break; /*RRC (IX+d)*/ // t 28
case 0x16: temp=readmem(ix.w+offset); if (temp&0x80) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; temp<<=1; if (tempc) temp|=1; setznc(temp); writemem(ix.w+offset,temp); cycles-=28; break; /*RL (IX+d)*/ // t 16
case 0x1E: temp=readmem(ix.w+offset); if (temp&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; temp>>=1; if (tempc) temp|=0x80; setznc(temp); writemem(ix.w+offset,temp); cycles-=28; break; /*RR (IX+d)*/ // t 28
case 0x26: temp=readmem(ix.w+offset); if (temp&0x80) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; temp<<=1; setznc(temp); writemem(ix.w+offset,temp); cycles-=28; break; /*SLA (IX+d)*/ //t 28
case 0x2E: temp=readmem(ix.w+offset); if (temp&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; temp>>=1; if (temp&0x40) temp|=0x80; setznc(temp); writemem(ix.w+offset,temp); cycles-=28; break; /*SRA (IX+d)*/
case 0x3E: temp=readmem(ix.w+offset); if (temp&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; temp>>=1; setznc(temp); writemem(ix.w+offset,temp); cycles-=28; break; /*SRA (IX+d)*/ // t 28
case 0x46: temp=readmem(ix.w+offset); setznc(temp&0x01); cycles-=24; break; /*BIT 0,(IX+d)*/ // t 24
case 0x4E: temp=readmem(ix.w+offset); setznc(temp&0x02); cycles-=24; break; /*BIT 1,(IX+d)*/ // t 24
case 0x56: temp=readmem(ix.w+offset); setznc(temp&0x04); cycles-=24; break; /*BIT 2,(IX+d)*/ // t 24
case 0x5E: temp=readmem(ix.w+offset); setznc(temp&0x08); cycles-=24; break; /*BIT 3,(IX+d)*/ // t 24
case 0x66: temp=readmem(ix.w+offset); setznc(temp&0x10); cycles-=24; break; /*BIT 4,(IX+d)*/ // t 24
case 0x6E: temp=readmem(ix.w+offset); setznc(temp&0x20); cycles-=24; break; /*BIT 5,(IX+d)*/ // t 24
case 0x76: temp=readmem(ix.w+offset); setznc(temp&0x40); cycles-=24; break; /*BIT 6,(IX+d)*/ // t 24
case 0x7E: temp=readmem(ix.w+offset); setznc(temp&0x80); cycles-=24; break; /*BIT 7,(IX+d)*/ // t 24
case 0x86: temp=readmem(ix.w+offset)&~0x01; writemem(ix.w+offset,temp); cycles-=28; break; /*RES 0,(IX+d)*/ // t 28
case 0x8E: temp=readmem(ix.w+offset)&~0x02; writemem(ix.w+offset,temp); cycles-=28; break; /*RES 1,(IX+d)*/ // t 28
case 0x96: temp=readmem(ix.w+offset)&~0x04; writemem(ix.w+offset,temp); cycles-=28; break; /*RES 2,(IX+d)*/ // t 28
case 0x9E: temp=readmem(ix.w+offset)&~0x08; writemem(ix.w+offset,temp); cycles-=28; break; /*RES 3,(IX+d)*/ // t 28
case 0xA6: temp=readmem(ix.w+offset)&~0x10; writemem(ix.w+offset,temp); cycles-=28; break; /*RES 4,(IX+d)*/ // t 28
case 0xAE: temp=readmem(ix.w+offset)&~0x20; writemem(ix.w+offset,temp); cycles-=28; break; /*RES 5,(IX+d)*/ // t 28
case 0xB6: temp=readmem(ix.w+offset)&~0x40; writemem(ix.w+offset,temp); cycles-=28; break; /*RES 6,(IX+d)*/ // t 28
case 0xBE: temp=readmem(ix.w+offset)&~0x80; writemem(ix.w+offset,temp); cycles-=28; break; /*RES 7,(IX+d)*/ // t 28
case 0xC6: temp=readmem(ix.w+offset)|0x01; writemem(ix.w+offset,temp); cycles-=28; break; /*SET 0,(IX+d)*/ // t 28
case 0xCE: temp=readmem(ix.w+offset)|0x02; writemem(ix.w+offset,temp); cycles-=28; break; /*SET 1,(IX+d)*/ // t 28
case 0xD6: temp=readmem(ix.w+offset)|0x04; writemem(ix.w+offset,temp); cycles-=28; break; /*SET 2,(IX+d)*/ // t 28
case 0xDE: temp=readmem(ix.w+offset)|0x08; writemem(ix.w+offset,temp); cycles-=28; break; /*SET 3,(IX+d)*/ // t 28
case 0xE6: temp=readmem(ix.w+offset)|0x10; writemem(ix.w+offset,temp); cycles-=28; break; /*SET 4,(IX+d)*/ // t 28
case 0xEE: temp=readmem(ix.w+offset)|0x20; writemem(ix.w+offset,temp); cycles-=28; break; /*SET 5,(IX+d)*/ // t 28
case 0xF6: temp=readmem(ix.w+offset)|0x40; writemem(ix.w+offset,temp); cycles-=28; break; /*SET 6,(IX+d)*/ // t 28
case 0xFE: temp=readmem(ix.w+offset)|0x80; writemem(ix.w+offset,temp); cycles-=28; break; /*SET 7,(IX+d)*/ // t 28
default:
//printf("Bad DD CB opcode %02X at %04X\n, opcode: %d",opcode,--pc, opcode);
dumpregs();
exit(-1);
}
break;
case 0xCD: /*CALL*/
addr=readmem(pc)|(readmem(pc+1)<<8); pc+=2;
push(pc>>8);
push(pc&0xFF);
pc=addr;
cycles-=20; // t 20
break;
case 0xB1: /*Invalid*/
case 0xC5:
case 0x02:
case 0xDD: /*Another prefix*/
case 0xFD:
ir.b.l--;
cycles-=4;
pc--;
break;
case 0xE1: /*POP IX*/
ix.b.l=pull();
ix.b.h=pull();
cycles-=20; // t 16
break;
case 0xE3: /*EX (SP),IX*/
tempw=ix.w;
ix.b.l=readmem(sp);
ix.b.h=readmem(sp+1);
writemem(sp,tempw&0xFF);
writemem(sp+1,tempw>>8);
cycles-=28; // t 28
break;
case 0xE5: /*PUSH IX*/
push(ix.b.h);
push(ix.b.l);
cycles-=20; // t 20
break;
case 0xE9: /*JP (IX)*/
pc=ix.w;
cycles-=8;
break;
case 0xF9: /*LD SP,IX*/
sp=ix.w;
cycles-=12; // t 8
break;
default:
//printf("Bad DD opcode %02X at %04X\n opcode: %d",opcode,--pc, opcode);
dumpregs();
exit(-1);
}
break;
case 0xDE: /*SBC xx*/
temp=readmem(pc); pc++;
setsbc(af.b.h,temp);
af.b.h-=(temp+tempc);
cycles-=8;
break;
case 0xDF: /*RST 18*/
push(pc>>8);
push(pc);
pc=0x18;
cycles-=16; // t 16
break;
case 0xE0: /*RET PO*/
if (!(af.b.l&P_FLAG))
{
pc=pull();
pc|=pull()<<8;
cycles-=12;
}
else
{
cycles-=8;
}
break;
case 0xE1: /*POP HL*/
hl.b.l=pull();
hl.b.h=pull();
cycles-=12; // t 12
break;
case 0xE2: /*JP PO,xxxx*/
addr=readmem(pc)|(readmem(pc+1)<<8); pc+=2;
if (!(af.b.l&P_FLAG))
pc=addr;
cycles-=16; // t 12
break;
case 0xE3: /*EX (SP),HL*/
tempw=hl.w;
hl.b.l=readmem(sp);
hl.b.h=readmem(sp+1);
writemem(sp,tempw&0xFF);
writemem(sp+1,tempw>>8);
cycles-=24; // t 24
break;
case 0xE4: /*CALL PO*/
addr=readmem(pc)|(readmem(pc+1)<<8); pc+=2;
if (!(af.b.l&P_FLAG))
{
push(pc>>8);
push(pc&0xFF);
pc=addr;
cycles-=20;
}
else
{
cycles-=12;
}
break;
case 0xE5: /*PUSH HL*/
push(hl.b.h);
push(hl.b.l);
cycles-=16; // t 12
break;
case 0xE6: /*AND xx*/
af.b.h&=readmem(pc); pc++;
af.b.l&=~3;
af.b.l|=H_FLAG;
setzn(af.b.h);
cycles-=8; // t 8
break;
case 0xE7: /*RST 20*/
push(pc>>8);
push(pc);
pc=0x20;
cycles-=16; //t 16
break;
case 0xE8: /*RET PE*/
if (af.b.l&P_FLAG)
{
pc=pull();
pc|=pull()<<8;
cycles-=16;
}
else
{
cycles-=8;
}
break;
case 0xE9: /*JP (HL)*/
pc=hl.w;
cycles-=4;
break;
case 0xEA: /*JP PE,xxxx*/
addr=readmem(pc)|(readmem(pc+1)<<8); pc+=2;
if (af.b.l&P_FLAG)
pc=addr;
cycles-=12; // t 12
break;
case 0xEB: /*EX DE,HL*/
tempw=de.w; de.w=hl.w; hl.w=tempw;
cycles-=4;
break;
case 0xEC: /*CALL PE*/
addr=readmem(pc)|(readmem(pc+1)<<8); pc+=2;
if (af.b.l&P_FLAG)
{
push(pc>>8);
push(pc&0xFF);
pc=addr;
cycles-=20; // t 8
}
else
{
cycles-=12; // t 12
}
break;
case 0xED: /*More opcodes*/
opcode=readmem(pc); pc++;
ir.b.l++;
switch (opcode)
{
case 0x00: /*NOP*/
case 0x01: /*NOP*/
case 0x02: /*NOP*/
case 0x03: /*NOP*/
case 0x04: /*NOP*/
case 0x05: /*NOP*/
case 0x06: /*NOP*/
case 0x07: /*NOP*/
case 0x08: /*NOP*/
case 0x09: /*NOP*/
case 0x0A: /*NOP*/
case 0x0B: /*NOP*/
case 0x0C: /*NOP*/
case 0x0D: /*NOP*/
case 0x0E: /*NOP*/
case 0x0F: /*NOP*/
case 0x10: /*NOP*/
case 0x11: /*NOP*/
case 0x12: /*NOP*/
case 0x13: /*NOP*/
case 0x14: /*NOP*/
case 0x15: /*NOP*/
case 0x16: /*NOP*/
case 0x17: /*NOP*/
case 0x18: /*NOP*/
case 0x19: /*NOP*/
case 0x1A: /*NOP*/
case 0x1B: /*NOP*/
case 0x1C: /*NOP*/
case 0x1D: /*NOP*/
case 0x1E: /*NOP*/
case 0x1F: /*NOP*/
case 0x20: /*NOP*/
case 0x21: /*NOP*/
case 0x22: /*NOP*/
case 0x23: /*NOP*/
case 0x24: /*NOP*/
case 0x25: /*NOP*/
case 0x26: /*NOP*/
case 0x27: /*NOP*/
case 0x28: /*NOP*/
case 0x29: /*NOP*/
case 0x2A: /*NOP*/
case 0x2B: /*NOP*/
case 0x2C: /*NOP*/
case 0x2D: /*NOP*/
case 0x2E: /*NOP*/
case 0x2F: /*NOP*/
case 0x30: /*NOP*/
case 0x31: /*NOP*/
case 0x32: /*NOP*/
case 0x33: /*NOP*/
case 0x34: /*NOP*/
case 0x35: /*NOP*/
case 0x36: /*NOP*/
case 0x37: /*NOP*/
case 0x38: /*NOP*/
case 0x39: /*NOP*/
case 0x3A: /*NOP*/
case 0x3B: /*NOP*/
case 0x3C: /*NOP*/
case 0x3D: /*NOP*/
case 0x3E: /*NOP*/
case 0x3F: /*NOP*/
cycles-=8;
break;
case 0x40: /*IN B,(C)*/
bc.b.h=z80in(bc.w);
setzn(bc.b.h);
cycles-=16;
break;
case 0x41: /*OUT (C),B*/
z80out(bc.w,bc.b.h);
cycles-=16;
break;
case 0x42: /*SBC HL,BC*/
setsbc16(hl.w,bc.w);
hl.w-=(bc.w+tempc);
cycles-=16;
break;
case 0x43: /*LD (xxxx),BC*/
addr=readmem(pc)|(readmem(pc+1)<<8); pc+=2;
writemem(addr,bc.b.l);
writemem(addr+1,bc.b.h);
cycles-=24;
break;
case 0x44: /*NEG*/
setsub(0,af.b.h);
af.b.h=0-af.b.h;
cycles-=8;
break;
case 0x45: /*RETN*/
iff1=iff2;
pc=pull();
pc|=(pull()<<8);
cycles-=16; // t 16
break;
case 0x46: /*IM 0*/
im=0;
cycles-=8;
break;
case 0x47: /*LD I,A*/
ir.b.h=af.b.h;
cycles-=12;
break;
case 0x48: /*IN C,(C)*/
bc.b.l=z80in(bc.w);
setzn(bc.b.l);
cycles-=16;
break;
case 0x49: /*OUT (C),C*/
z80out(bc.w,bc.b.l);
cycles-=16;
break;
case 0x4A: /*ADC HL,BC*/
setadc16(hl.w,bc.w);
hl.w+=(bc.w+tempc);
cycles-=16;
break;
case 0x4B: /*LD BC,(xxxx)*/
addr=readmem(pc)|(readmem(pc+1)<<8); pc+=2;
bc.b.l=readmem(addr);
bc.b.h=readmem(addr+1);
cycles-=24;
break;
case 0x4C: /*NEG*/
setsub(0,af.b.h);
af.b.h=0-af.b.h;
cycles-=8;
break;
case 0x4D: /*RETI*/
iff1=iff2;
pc=pull();
pc|=(pull()<<8);
cycles-=16; // t 16
break;
case 0x4E: /*IM 0*/
im=0;
cycles-=8;
break;
case 0x4F: /*LD R,A*/
ir.b.l=af.b.h;
rhigh=af.b.h&0x80;
cycles-=12;
break;
case 0x50: /*IN D,(C)*/
de.b.h=z80in(bc.w);
setzn(de.b.h);
cycles-=16;
break;
case 0x51: /*OUT (C),D*/
z80out(bc.w,de.b.h);
cycles-=16;
break;
case 0x52: /*SBC HL,DE*/
setsbc16(hl.w,de.w);
hl.w-=(de.w+tempc);
cycles-=16;
break;
case 0x53: /*LD (xxxx),DE*/
addr=readmem(pc)|(readmem(pc+1)<<8); pc+=2;
writemem(addr,de.b.l);
writemem(addr+1,de.b.h);
cycles-=24;
break;
case 0x54: /*NEG*/
setsub(0,af.b.h);
af.b.h=0-af.b.h;
cycles-=8;
break;
case 0x55: /*RETN*/
iff1=iff2;
pc=pull();
pc|=(pull()<<8);
cycles-=16; // t 16
break;
case 0x56: /*IM 1*/
im=1;
cycles-=8;
break;
case 0x57: /*LD A,I*/
af.b.h=ir.b.h;
cycles-=12; // t 8
break;
case 0x58: /*IN E,(C)*/
de.b.l=z80in(bc.w);
setzn(de.b.l);
cycles-=16;
break;
case 0x59: /*OUT (C),E*/
z80out(bc.w,de.b.l);
cycles-=16;
break;
case 0x5A: /*ADC HL,DE*/
setadc16(hl.w,de.w);
hl.w+=(de.w+tempc);
cycles-=16;
break;
case 0x5B: /*LD DE,(xxxx)*/
addr=readmem(pc)|(readmem(pc+1)<<8); pc+=2;
de.b.l=readmem(addr);
de.b.h=readmem(addr+1);
cycles-=24;
break;
case 0x5C: /*NEG*/
setsub(0,af.b.h);
af.b.h=0-af.b.h;
cycles-=8;
break;
case 0x5D: /*RETN*/
iff1=iff2;
pc=pull();
pc|=(pull()<<8);
cycles-=16; // t 16
break;
case 0x5E: /*IM 2*/
im=2;
cycles-=8;
break;
case 0x5F: /*LD A,R*/
af.b.h=(ir.b.l&0x7F)|rhigh;
cycles-=12;
break;
case 0x60: /*IN H,(C)*/
hl.b.h=z80in(bc.w);
setzn(hl.b.h);
cycles-=16;
break;
case 0x61: /*OUT (C),H*/
z80out(bc.w,hl.b.h);
cycles-=16;
break;
case 0x62: /*SBC HL,HL*/
setsbc16(hl.w,hl.w);
hl.w-=(hl.w+tempc);
cycles-=16;
break;
case 0x63: /*LD (xxxx),HL*/
addr=readmem(pc)|(readmem(pc+1)<<8); pc+=2;
writemem(addr,hl.b.l);
writemem(addr+1,hl.b.h);
cycles-=24;
break;
case 0x64: /*NEG*/
setsub(0,af.b.h);
af.b.h=0-af.b.h;
cycles-=8;
break;
case 0x65: /*RETN*/
iff1=iff2;
pc=pull();
pc|=(pull()<<8);
cycles-=16; // t 16
break;
case 0x66: /*IM 0*/
im=0;
cycles-=8;
break;
case 0x67: /*RRD*/
temp=readmem(hl.w);
temp2=temp&0xF;
temp=(temp>>4)|(af.b.h<<4);
af.b.h=(af.b.h&0xF0)|temp2;
writemem(hl.w,temp);
setznc(af.b.h);
cycles-=20;
break;
// NEW
case 0x68: /*IN L,(C)*/
hl.b.l=z80in(bc.w);
setzn(hl.b.l);
cycles-=16;
break;
// NEW
case 0x69: /*OUT (C),L*/
z80out(bc.w,hl.b.l);
cycles-=16;
break;
case 0x6A: /*ADC HL,HL*/
setadc16(hl.w,hl.w);
hl.w+=(hl.w+tempc);
cycles-=16;
break;
case 0x6B: /*LD HL,(xxxx)*/
addr=readmem(pc)|(readmem(pc+1)<<8); pc+=2;
hl.b.l=readmem(addr);
hl.b.h=readmem(addr+1);
cycles-=24;
break;
case 0x6C: /*NEG*/
setsub(0,af.b.h);
af.b.h=0-af.b.h;
cycles-=8;
break;
case 0x6D: /*RETN*/
iff1=iff2;
pc=pull();
pc|=(pull()<<8);
cycles-=16; // t 16
break;
case 0x6E: /*IM 0*/
im=0;
cycles-=8;
break;
case 0x6F: /*RLD*/
temp=readmem(hl.w);
temp2=temp>>4;
temp=(temp<<4)|(af.b.h&0xF);
af.b.h=(af.b.h&0xF0)|temp2;
writemem(hl.w,temp);
setznc(af.b.h);
cycles-=20;
break;
// These seem a bit unknown!
// case 0x70: /*IN L,(C)*/
// hl.b.l=z80in(bc.w);
// setzn(hl.b.l);
// cycles-=12;
// break;
// NEW
case 0x71: /*OUT (C),0*/
z80out(bc.w,0);
cycles-=16;
break;
case 0x72: /*SBC HL,SP*/
setsbc16(hl.w,sp);
hl.w-=(sp+tempc);
cycles-=16;
break;
case 0x73: /*LD (xxxx),SP*/
addr=readmem(pc)|(readmem(pc+1)<<8); pc+=2;
writemem(addr,sp&0xFF);
writemem(addr+1,sp>>8);
cycles-=24;
break;
case 0x74: /*NEG*/
setsub(0,af.b.h);
af.b.h=0-af.b.h;
cycles-=8;
break;
case 0x75: /*RETN*/
iff1=iff2;
pc=pull();
pc|=(pull()<<8);
cycles-=16; // t 16
break;
case 0x76: /*IM 1*/
im=1;
cycles-=8;
break;
case 0x77: /*NOP*/
cycles-=8;
break;
case 0x78: /*IN A,(C)*/
af.b.h=z80in(bc.w);
setzn(af.b.h);
cycles-=16;
break;
case 0x79: /*OUT (C),A*/
z80out(bc.w,af.b.h);
cycles-=16;
break;
case 0x7A: /*ADC HL,SP*/
setadc16(hl.w,sp);
hl.w+=(sp+tempc);
cycles-=16;
break;
case 0x7B: /*LD SP,(xxxx)*/
addr=readmem(pc)|(readmem(pc+1)<<8); pc+=2;
sp=readmem(addr);
sp|=(readmem(addr+1)<<8);
cycles-=24;
break;
case 0x7C: /*NEG*/
setsub(0,af.b.h);
af.b.h=0-af.b.h;
cycles-=8;
break;
case 0x7D: /*RETN*/
iff1=iff2;
pc=pull();
pc|=(pull()<<8);
cycles-=16; // t 16
break;
case 0x7E: /*IM 2*/
im=2;
cycles-=8;
break;
case 0x7F: /*NOP*/
case 0x80: /*NOP*/
case 0x81: /*NOP*/
case 0x82: /*NOP*/
case 0x83: /*NOP*/
case 0x84: /*NOP*/
case 0x85: /*NOP*/
case 0x86: /*NOP*/
case 0x87: /*NOP*/
case 0x88: /*NOP*/
case 0x89: /*NOP*/
case 0x8A: /*NOP*/
case 0x8B: /*NOP*/
case 0x8C: /*NOP*/
case 0x8D: /*NOP*/
case 0x8E: /*NOP*/
case 0x8F: /*NOP*/
case 0x90: /*NOP*/
case 0x91: /*NOP*/
case 0x92: /*NOP*/
case 0x93: /*NOP*/
case 0x94: /*NOP*/
case 0x95: /*NOP*/
case 0x96: /*NOP*/
case 0x97: /*NOP*/
case 0x98: /*NOP*/
case 0x99: /*NOP*/
case 0x9A: /*NOP*/
case 0x9B: /*NOP*/
case 0x9C: /*NOP*/
case 0x9D: /*NOP*/
case 0x9E: /*NOP*/
case 0x9F: /*NOP*/
cycles-=8;
break;
case 0xA0: /*LDI*/
temp=readmem(hl.w); hl.w++;
writemem(de.w,temp); de.w++;
bc.w--;
if (bc.w) af.b.l|=P_FLAG;
else af.b.l&=~P_FLAG;
cycles-=20;
break;
case 0xA1: /*CPI*/
// printf("CPI %04X %i\n",pc,curhrom);
temp=readmem(hl.w); hl.w++;
if (af.b.h-temp) af.b.l&=~Z_FLAG;
else af.b.l|=Z_FLAG;
bc.w--;
if (bc.w) af.b.l|=P_FLAG;
else af.b.l&=~P_FLAG;
cycles-=20;
break;
case 0xA2: /*INI*/
temp=z80in(bc.w);
writemem(hl.w,temp);
hl.w++;
bc.b.h--;
if (bc.b.h) af.b.l|=P_FLAG;
else af.b.l&=~P_FLAG;
af.b.l|=S_FLAG;
cycles-=20;
break;
case 0xA3: /*OUTI*/
temp=readmem(hl.w); hl.w++;
bc.b.h--;
z80out(bc.w,temp);
if (bc.b.h) af.b.l|=P_FLAG;
else af.b.l&=~P_FLAG;
af.b.l|=S_FLAG;
cycles-=20;
break;
case 0xA4: /*NOP*/
case 0xA5: /*NOP*/
case 0xA6: /*NOP*/
case 0xA7: /*NOP*/
cycles-=8;
break;
case 0xA8: /*LDD*/
temp=readmem(hl.w); hl.w--;
writemem(de.w,temp); de.w--;
bc.w--;
if (bc.w) af.b.l|=P_FLAG;
else af.b.l&=~P_FLAG;
cycles-=20; //T 20
break;
case 0xA9: /*CPD*/
//printf("CPD %04X %i\n",pc,curhrom);
temp=readmem(hl.w); hl.w--;
if (af.b.h-temp) af.b.l&=~Z_FLAG;
else af.b.l|=Z_FLAG;
bc.w--;
if (bc.w) af.b.l|=P_FLAG;
else af.b.l&=~P_FLAG;
cycles-=20;
break;
case 0xAB: /*OUTD*/
temp=readmem(hl.w); hl.w--;
bc.b.h--;
z80out(bc.w,temp);
if (bc.b.h) af.b.l|=P_FLAG;
else af.b.l&=~P_FLAG;
af.b.l|=S_FLAG;
cycles-=20;
break;
case 0xAC: /*NOP*/
case 0xAD: /*NOP*/
case 0xAE: /*NOP*/
case 0xAF: /*NOP*/
cycles-=8;
break;
case 0xB0: /*LDIR*/
temp=readmem(hl.w); hl.w++;
writemem(de.w,temp); de.w++;
bc.w--;
if (bc.w)
{
pc-=2;
cycles-=24;
}
else
cycles-=20;
if (bc.w) af.b.l|=P_FLAG;
else af.b.l&=~P_FLAG;
break;
case 0xB1: /*CPIR*/
temp=readmem(hl.w); hl.w++;
if (af.b.h==temp) af.b.l|=Z_FLAG;
else af.b.l&=~Z_FLAG;
bc.w--;
if (bc.w && af.b.h!=temp) { pc-=2; cycles-=4; }
if (bc.w) af.b.l|=P_FLAG;
else af.b.l&=~P_FLAG;
cycles-=20;
break;
case 0xB4: /*NOP*/
case 0xB5: /*NOP*/
case 0xB6: /*NOP*/
case 0xB7: /*NOP*/
cycles-=8;
break;
case 0xB8: /*LDDR*/
temp=readmem(hl.w); hl.w--;
writemem(de.w,temp); de.w--;
bc.w--;
if (bc.w)
{
pc-=2;
cycles-=24;
}
else
cycles-=20;
if (bc.w) af.b.l|=P_FLAG;
else af.b.l&=~P_FLAG;
break;
case 0xB9: /*CPDR*/
//printf("CPDR %04X %i\n",pc,curhrom);
temp=readmem(hl.w); hl.w--;
setcp(af.b.h,temp);
bc.w--;
if (bc.w && af.b.h!=temp) { pc-=2; cycles-=8; }
if (bc.w) af.b.l|=P_FLAG;
else af.b.l&=~P_FLAG;
cycles-=20;
break;
case 0xBC: /*NOP*/
case 0xBD: /*NOP*/
case 0xBE: /*NOP*/
case 0xBF: /*NOP*/
case 0xC0: /*NOP*/
case 0xC1: /*NOP*/
case 0xC2: /*NOP*/
case 0xC3: /*NOP*/
case 0xC4: /*NOP*/
case 0xC5: /*NOP*/
case 0xC6: /*NOP*/
case 0xC7: /*NOP*/
case 0xC8: /*NOP*/
case 0xC9: /*NOP*/
case 0xCA: /*NOP*/
case 0xCB: /*NOP*/
case 0xCC: /*NOP*/
case 0xCD: /*NOP*/
case 0xCE: /*NOP*/
case 0xCF: /*NOP*/
case 0xD0: /*NOP*/
case 0xD1: /*NOP*/
case 0xD2: /*NOP*/
case 0xD3: /*NOP*/
case 0xD4: /*NOP*/
case 0xD5: /*NOP*/
case 0xD6: /*NOP*/
case 0xD7: /*NOP*/
case 0xD8: /*NOP*/
case 0xD9: /*NOP*/
case 0xDA: /*NOP*/
case 0xDB: /*NOP*/
case 0xDC: /*NOP*/
case 0xDD: /*NOP*/
case 0xDE: /*NOP*/
case 0xDF: /*NOP*/
case 0xE0: /*NOP*/
case 0xE1: /*NOP*/
case 0xE2: /*NOP*/
case 0xE3: /*NOP*/
case 0xE4: /*NOP*/
case 0xE5: /*NOP*/
case 0xE6: /*NOP*/
case 0xE7: /*NOP*/
case 0xE8: /*NOP*/
case 0xE9: /*NOP*/
case 0xEA: /*NOP*/
case 0xEB: /*NOP*/
case 0xEC: /*NOP*/
case 0xED: /*NOP*/
case 0xEE: /*NOP*/
case 0xEF: /*NOP*/
case 0xF0: /*NOP*/
case 0xF1: /*NOP*/
case 0xF2: /*NOP*/
case 0xF3: /*NOP*/
case 0xF4: /*NOP*/
case 0xF5: /*NOP*/
case 0xF6: /*NOP*/
case 0xF7: /*NOP*/
case 0xF8: /*NOP*/
case 0xF9: /*NOP*/
case 0xFA: /*NOP*/
case 0xFB: /*NOP*/
case 0xFC: /*NOP*/
case 0xFD: /*NOP*/
case 0xFE: /*NOP*/
case 0xFF: /*NOP*/
cycles-=8;
break;
default:
//printf("Bad ED opcode %02X at %04X\n",opcode,--pc);
dumpregs();
exit(-1);
}
break;
case 0xEE: /*XOR xx*/
af.b.h^=readmem(pc); pc++;
af.b.l&=~3;
setzn(af.b.h);
cycles-=8;
break;
case 0xEF: /*RST 28*/
push(pc>>8);
push(pc);
pc=0x28;
cycles-=16;
break;
case 0xF0: /*RET P*/
if (!(af.b.l&N_FLAG))
{
pc=pull();
pc|=pull()<<8;
cycles-=8;
}
cycles-=8;
break;
case 0xF1: /*POP AF*/
af.b.l=pull();
af.b.h=pull();
cycles-=12;
break;
case 0xF2: /*JP P,xxxx*/
addr=readmem(pc)|(readmem(pc+1)<<8); pc+=2;
if (!(af.b.l&N_FLAG))
pc=addr;
cycles-=12;
break;
case 0xF3: /*DI*/
iff1=0;
cycles-=4;
break;
case 0xF4: /*CALL P*/
addr=readmem(pc)|(readmem(pc+1)<<8); pc+=2;
if (!(af.b.l&N_FLAG))
{
push(pc>>8);
push(pc&0xFF);
pc=addr;
cycles-=8;
}
cycles-=12;
break;
case 0xF5: /*PUSH AF*/
push(af.b.h);
push(af.b.l);
cycles-=16;
break;
case 0xF6: /*OR xx*/
af.b.h|=readmem(pc); pc++;
af.b.l&=~3;
setzn(af.b.h);
cycles-=8;
break;
case 0xF7: /*RST 30*/
push(pc>>8);
push(pc);
pc=0x30;
cycles-=16;
break;
case 0xF8: /*RET M*/
if (af.b.l&N_FLAG)
{
pc=pull();
pc|=pull()<<8;
cycles-=8;
}
cycles-=8;
break;
case 0xF9: /*LD SP,HL*/
sp=hl.w;
cycles-=4;
break;
case 0xFA: /*JP M,xxxx*/
addr=readmem(pc)|(readmem(pc+1)<<8); pc+=2;
if (af.b.l&N_FLAG)
pc=addr;
cycles-=12;
break;
case 0xFB: /*EI*/
iff1=2;
if (intreq) intreq=-1;
cycles-=4;
break;
case 0xFC: /*CALL M*/
addr=readmem(pc)|(readmem(pc+1)<<8); pc+=2;
if (af.b.l&N_FLAG)
{
push(pc>>8);
push(pc&0xFF);
pc=addr;
cycles-=8;
}
cycles-=12;
break;
case 0xFD: /*More opcodes - IY*/
ir.b.l++;
opcode=readmem(pc); pc++;
switch (opcode)
{
case 0x00: case 0x4D: case 0xE0: ir.b.l--; pc--; cycles-=4; break;
case 0x09: /*ADD IY,BC*/
setadd16(iy.w,bc.w);
iy.w+=bc.w;
cycles-=16;
break;
case 0x19: /*ADD IY,DE*/
setadd16(iy.w,de.w);
iy.w+=de.w;
cycles-=16;
break;
case 0x21: /*LD IY,xxxx*/
iy.b.l=readmem(pc); pc++;
iy.b.h=readmem(pc); pc++;
cycles-=16;
break;
case 0x22: /*LD (xxxx),IY*/
addr=readmem(pc)|(readmem(pc+1)<<8); pc+=2;
writemem(addr,iy.b.l);
writemem(addr+1,iy.b.h);
cycles-=24;
break;
case 0x23: /*INC IY*/
iy.w++;
cycles-=12;
break;
// NEW
case 0x24: /*INC IYh*/
iy.b.h++;
setinc(iy.b.h);
cycles-=8;
break;
case 0x25: /*DEC IYh*/
iy.b.h--;
setdec(iy.b.h);
cycles-=8;
break;
case 0x26: /*LD IYh,xx*/
iy.b.h=readmem(pc); pc++;
cycles-=12;
break;
case 0x29: /*ADD IY,IY*/
setadd16(iy.w,iy.w);
iy.w+=iy.w;
cycles-=16;
break;
case 0x2A: /*LD IY,(xxxx)*/
addr=readmem(pc)|(readmem(pc+1)<<8); pc+=2;
iy.b.l=readmem(addr);
iy.b.h=readmem(addr+1);
cycles-=24;
break;
case 0x2B: /*DEC IY*/
iy.w--;
cycles-=12;
break;
case 0x2C: /*INC IYl*/
iy.b.l++;
setinc(iy.b.l);
cycles-=8;
break;
case 0x2D: /*DEC IYl*/
iy.b.l--;
setdec(iy.b.l);
cycles-=8;
break;
// NEW
case 0x2E: /*LD IYl,xx*/
iy.b.l=readmem(pc); pc++;
cycles-=12; // t 12
break;
case 0x34: /*INC (IY+d)*/
offset=(signed char)readmem(pc); pc++;
temp=readmem(iy.w+offset)+1;
setinc(temp);
writemem(iy.w+offset,temp);
cycles-=24;
break;
case 0x35: /*DEC (IY+d)*/
offset=(signed char)readmem(pc); pc++;
temp=readmem(iy.w+offset)-1;
setdec(temp);
writemem(iy.w+offset,temp);
cycles-=24;
break;
case 0x36: /*LD (IY+d),xx*/
offset=(signed char)readmem(pc); pc++;
temp=readmem(pc); pc++;
writemem(iy.w+offset,temp);
cycles-=24;
break;
case 0x39: /*ADD IY,SP*/
setadd16(iy.w,sp);
iy.w+=sp;
cycles-=16;
break;
case 0x3A: /*LD A,(xxxx)*/
addr=readmem(pc)|(readmem(pc+1)<<8); pc+=2;
af.b.h=readmem(addr);
cycles-=20;
break;
// t 4
case 0x3B: /*DEC SP*/
sp--;
cycles-=12;
break;
// t 4
case 0x3C: /*INC A*/
af.b.h++;
setinc(af.b.h);
cycles-=4;
break;
// t 4
case 0x3D: /*DEC A*/
af.b.h--;
setdec(af.b.h);
cycles-=4;
break;
// t 8
case 0x3E: /*LD A,xx*/
af.b.h=readmem(pc); pc++;
cycles-=8;
break;
// t 4
case 0x3F: /*CCF*/
if (af.b.l&C_FLAG) af.b.l|=H_FLAG;
else af.b.l&=~H_FLAG;
af.b.l^=C_FLAG;
cycles-=4;
break;
case 0x40: bc.b.h=bc.b.h; cycles-=8; break; /*LD B,B*/
case 0x41: bc.b.h=bc.b.l; cycles-=8; break; /*LD B,C*/
case 0x42: bc.b.h=de.b.h; cycles-=8; break; /*LD B,D*/
case 0x43: bc.b.h=de.b.l; cycles-=8; break; /*LD B,E*/
case 0x44: bc.b.h=iy.b.h; cycles-=8; break; /*LD B,IYh*/ // NEW
case 0x45: bc.b.h=iy.b.l; cycles-=8; break; /*LD B,IYl*/
case 0x46: offset=(signed char)readmem(pc); pc++; bc.b.h=readmem(iy.w+offset); cycles-=20; break; /*LD B,(IY+d)*/
case 0x4E: offset=(signed char)readmem(pc); pc++; bc.b.l=readmem(iy.w+offset); cycles-=20; break; /*LD C,(IY+d)*/
case 0x4F: bc.b.l=af.b.h; cycles-=8; break; /*LD C,A*/
case 0x50: de.b.h=bc.b.h; cycles-=8; break; /*LD D,B*/
case 0x51: de.b.h=bc.b.l; cycles-=8; break; /*LD D,C*/
case 0x52: de.b.h=de.b.h; cycles-=8; break; /*LD D,D*/
case 0x53: de.b.h=de.b.l; cycles-=8; break; /*LD D,E*/
case 0x54: de.b.h=iy.b.h; cycles-=8; break; /*LD D,IYh*/
case 0x55: de.b.h=iy.b.l; cycles-=8; break; /*LD D,IYl*/
case 0x56: offset=(signed char)readmem(pc); pc++; de.b.h=readmem(iy.w+offset); cycles-=20; break; /*LD D,(IY+d)*/
case 0x57: de.b.h=af.b.h; cycles-=8; break; /*LD D,A*/
case 0x58: de.b.l=bc.b.h; cycles-=8; break; /*LD E,B*/
case 0x59: de.b.l=bc.b.l; cycles-=8; break; /*LD E,C*/
case 0x5A: de.b.l=de.b.h; cycles-=8; break; /*LD E,D*/
case 0x5B: de.b.l=de.b.l; cycles-=8; break; /*LD E,E*/
case 0x5C: de.b.l=iy.b.h; cycles-=8; break; /*LD E,IYh*/
case 0x5D: de.b.l=iy.b.l; cycles-=8; break; /*LD E,IYl*/
case 0x5E: offset=(signed char)readmem(pc); pc++; de.b.l=readmem(iy.w+offset); cycles-=20; break; /*LD E,(IY+d)*/
case 0x5F: de.b.l=af.b.h; cycles-=8; break; /*LD E,A*/
case 0x60: iy.b.h=bc.b.h; cycles-=8; break; /*LD IYh,B*/
case 0x61: iy.b.h=bc.b.l; cycles-=8; break; /*LD IYh,C*/
case 0x62: iy.b.h=de.b.h; cycles-=8; break; /*LD IYh,B*/
case 0x63: iy.b.h=de.b.l; cycles-=8; break; /*LD IYh,C*/
case 0x64: iy.b.h=hl.b.h; cycles-=8; break; /*LD IYh,B*/
case 0x65: iy.b.h=hl.b.l; cycles-=8; break; /*LD IYh,C*/
case 0x66: offset=(signed char)readmem(pc); pc++; hl.b.h=readmem(iy.w+offset); cycles-=20; break; /*LD H,(IY+d)*/
case 0x67: iy.b.h=af.b.h; cycles-=8; break; /*LD IYh,A*/
case 0x68: iy.b.l=bc.b.h; cycles-=8; break; /*LD IYl,B*/
case 0x69: iy.b.l=bc.b.l; cycles-=8; break; /*LD IYl,C*/
case 0x6A: iy.b.l=de.b.h; cycles-=8; break; /*LD IYl,B*/
case 0x6B: iy.b.l=de.b.l; cycles-=8; break; /*LD IYl,C*/
case 0x6C: iy.b.l=hl.b.h; cycles-=8; break; /*LD IYl,B*/
case 0x6D: iy.b.l=hl.b.l; cycles-=8; break; /*LD IYl,C*/
case 0x6E: offset=(signed char)readmem(pc); pc++; hl.b.l=readmem(iy.w+offset); cycles-=20; break; /*LD L,(IY+d)*/
case 0x6F: iy.b.l=af.b.h; cycles-=8; break; /*LD IYl,A*/
case 0x70: offset=(signed char)readmem(pc); pc++; writemem(iy.w+offset,bc.b.h); cycles-=20; break; /*LD (IY+d),B*/
case 0x71: offset=(signed char)readmem(pc); pc++; writemem(iy.w+offset,bc.b.l); cycles-=20; break; /*LD (IY+d),C*/
case 0x72: offset=(signed char)readmem(pc); pc++; writemem(iy.w+offset,de.b.h); cycles-=20; break; /*LD (IY+d),D*/
case 0x73: offset=(signed char)readmem(pc); pc++; writemem(iy.w+offset,de.b.l); cycles-=20; break; /*LD (IY+d),E*/
case 0x74: offset=(signed char)readmem(pc); pc++; writemem(iy.w+offset,hl.b.h); cycles-=20; break; /*LD (IY+d),H*/
case 0x75: offset=(signed char)readmem(pc); pc++; writemem(iy.w+offset,hl.b.l); cycles-=20; break; /*LD (IY+d),L*/
case 0x76: /*HALT*/
if (!intreq) pc--;
cycles-=8;
break;
case 0x77: offset=(signed char)readmem(pc); pc++; writemem(iy.w+offset,af.b.h); cycles-=20; break; /*LD (IY+d),A*/
case 0x78: af.b.h=bc.b.h; cycles-=8; break; /*LD A,B*/
case 0x79: af.b.h=bc.b.l; cycles-=8; break; /*LD A,C*/
case 0x7A: af.b.h=de.b.h; cycles-=8; break; /*LD A,D*/
case 0x7B: af.b.h=de.b.l; cycles-=8; break; /*LD A,E*/
case 0x7C: af.b.h=iy.b.h; cycles-=8; break; /*LD A,IYh*/
case 0x7D: af.b.h=iy.b.l; cycles-=8; break; /*LD A,IYl*/
case 0x7E: offset=(signed char)readmem(pc); pc++; af.b.h=readmem(iy.w+offset); cycles-=20; break; /*LD A,(IY+d)*/
case 0x7F: af.b.h=af.b.h; cycles-=8; break; /*LD A,A*/
case 0x80: setadd(af.b.h,bc.b.h); af.b.h+=bc.b.h; cycles-=8; break; /*ADD B*/
case 0x81: setadd(af.b.h,bc.b.l); af.b.h+=bc.b.l; cycles-=8; break; /*ADD C*/
case 0x82: setadd(af.b.h,de.b.h); af.b.h+=de.b.h; cycles-=8; break; /*ADD D*/
case 0x83: setadd(af.b.h,de.b.l); af.b.h+=de.b.l; cycles-=8; break; /*ADD E*/
case 0x84: setadd(af.b.h,iy.b.h); af.b.h+=iy.b.h; cycles-=8; break; /*ADD IYh*/
case 0x85: setadd(af.b.h,iy.b.l); af.b.h+=iy.b.l; cycles-=8; break; /*ADD IYl*/
case 0x86: offset=(signed char)readmem(pc); pc++; temp=readmem(iy.w+offset); setadd(af.b.h,temp); af.b.h+=temp; cycles-=20; break; /*ADD (IY+d)*/
case 0x87: setadd(af.b.h,af.b.h); af.b.h+=af.b.h; cycles-=8; break; /*ADD A*/
case 0x88: setadc(af.b.h,bc.b.h); af.b.h+=bc.b.h+tempc; cycles-=8; break; /*ADC B*/
case 0x89: setadc(af.b.h,bc.b.l); af.b.h+=bc.b.l+tempc; cycles-=8; break; /*ADC C*/
case 0x8A: setadc(af.b.h,de.b.h); af.b.h+=de.b.h+tempc; cycles-=8; break; /*ADC D*/
case 0x8B: setadc(af.b.h,de.b.l); af.b.h+=de.b.l+tempc; cycles-=8; break; /*ADC E*/
case 0x8E: offset=(signed char)readmem(pc); pc++; temp=readmem(iy.w+offset); setadc(af.b.h,temp); af.b.h+=temp+tempc; cycles-=20; break; /*ADC (IY+d)*/ // t 28
case 0x8C: setadc(af.b.h,iy.b.h); af.b.h+=iy.b.h+tempc; cycles-=8; break; /*ADC IYh*/
case 0x8D: setadc(af.b.h,iy.b.l); af.b.h+=iy.b.l+tempc; cycles-=8; break; /*ADC IYl*/
case 0x94: setsub(af.b.h,iy.b.h); af.b.h-=iy.b.h; cycles-=8; break; /*SUB IYh*/
case 0x95: setsub(af.b.h,iy.b.l); af.b.h-=iy.b.l; cycles-=8; break; /*SUB IYl*/
case 0x96: offset=(signed char)readmem(pc); pc++; temp=readmem(iy.w+offset); setsub(af.b.h,temp); af.b.h-=temp; cycles-=20; break; /*SUB (IY+d)*/
case 0x9C: setsbc(af.b.h,iy.b.h); af.b.h-=(iy.b.h+tempc); cycles-=8; break; /*SBC IYh*/
case 0x9D: setsbc(af.b.h,iy.b.l); af.b.h-=(iy.b.l+tempc); cycles-=8; break; /*SBC IYl*/
case 0x9E: offset=(signed char)readmem(pc); pc++; temp=readmem(iy.w+offset); setsbc(af.b.h,temp); af.b.h-=(temp+tempc); cycles-=20; break; /*SBC (IY+d)*/
case 0xA6: offset=(signed char)readmem(pc); pc++; temp=readmem(iy.w+offset); af.b.h&=temp; setzn(af.b.h); af.b.l&=~3; af.b.l|=H_FLAG; cycles-=20; break; /*AND (IY+d)*/
case 0xAE: offset=(signed char)readmem(pc); pc++; temp=readmem(iy.w+offset); af.b.h^=temp; setzn(af.b.h); cycles-=20; break; /*XOR (IY+d)*/
case 0xB6: offset=(signed char)readmem(pc); pc++; temp=readmem(iy.w+offset); af.b.h|=temp; setzn(af.b.h); cycles-=20; break; /*OR (IY+d)*/
case 0xBE: offset=(signed char)readmem(pc); pc++; temp=readmem(iy.w+offset); setcp(af.b.h,temp); cycles-=20; break; /*CP (IY+d)*/
case 0xA4: af.b.h&=iy.b.h; setzn(af.b.h); af.b.l&=~3; af.b.l|=H_FLAG; cycles-=8; break; /*AND IYh*/
case 0xA5: af.b.h&=iy.b.l; setzn(af.b.h); af.b.l&=~3; af.b.l|=H_FLAG; cycles-=8; break; /*AND IYl*/
case 0xB4: af.b.h|=iy.b.h; setzn(af.b.h); cycles-=8; break; /*OR IYh*/
case 0xB5: af.b.h|=iy.b.l; setzn(af.b.h); cycles-=8; break; /*OR IYl*/
// NEW.
case 0xAC: af.b.h^=iy.b.h; setzn(af.b.h); af.b.l&=~3; cycles-=8; break; /*XOR IYh*/ // NEW
case 0xAD: af.b.h^=iy.b.l; setzn(af.b.h); af.b.l&=~3; cycles-=8; break; /*XOR IYL*/ // NEW
// NEW.
case 0xBC: setcp(af.b.h,iy.b.h); cycles-=8; break; /*CP IYh*/ // NEW
case 0xBD: setcp(af.b.h,iy.b.l); cycles-=8; break; /*CP IYl*/ // NEW
case 0xCB: /*More opcodes*/
offset=(signed char)readmem(pc); pc++;
opcode=readmem(pc); pc++;
ir.b.l++;
switch (opcode)
{
case 0x06: temp=readmem(iy.w+offset); if (temp&0x80) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; temp<<=1; if (af.b.l&C_FLAG) temp|=1; setznc(temp); writemem(iy.w+offset,temp); cycles-=28; break; /*RLC (IY+d)*/
case 0x0E: temp=readmem(iy.w+offset); if (temp&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; temp>>=1; if (af.b.l&C_FLAG) temp|=0x80; setznc(temp); writemem(iy.w+offset,temp); cycles-=28; break; /*RRC (IY+d)*/
case 0x16: temp=readmem(iy.w+offset); if (temp&0x80) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; temp<<=1; if (tempc) temp|=1; setznc(temp); writemem(iy.w+offset,temp); cycles-=28; break; /*RL (IY+d)*/
case 0x1E: temp=readmem(iy.w+offset); if (temp&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; temp>>=1; if (tempc) temp|=0x80; setznc(temp); writemem(iy.w+offset,temp); cycles-=28; break; /*RR (IY+d)*/
case 0x26: temp=readmem(iy.w+offset); if (temp&0x80) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; temp<<=1; setznc(temp); writemem(iy.w+offset,temp); cycles-=28; break; /*SLA (IY+d)*/
case 0x2E: temp=readmem(iy.w+offset); if (temp&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; temp>>=1; if (temp&0x40) temp|=0x80; setznc(temp); writemem(iy.w+offset,temp); cycles-=28; break; /*SRA (IY+d)*/
case 0x3E: temp=readmem(iy.w+offset); if (temp&1) af.b.l|=C_FLAG; else af.b.l&=~C_FLAG; temp>>=1; setznc(temp); writemem(iy.w+offset,temp); cycles-=28; break; /*SRL (IY+d)*/
case 0x46: temp=readmem(iy.w+offset); setznc(temp&0x01); cycles-=24; break; /*BIT 0,(IY+d)*/
case 0x4E: temp=readmem(iy.w+offset); setznc(temp&0x02); cycles-=24; break; /*BIT 1,(IY+d)*/
case 0x56: temp=readmem(iy.w+offset); setznc(temp&0x04); cycles-=24; break; /*BIT 2,(IY+d)*/
case 0x5E: temp=readmem(iy.w+offset); setznc(temp&0x08); cycles-=24; break; /*BIT 3,(IY+d)*/
case 0x66: temp=readmem(iy.w+offset); setznc(temp&0x10); cycles-=24; break; /*BIT 4,(IY+d)*/
case 0x6E: temp=readmem(iy.w+offset); setznc(temp&0x20); cycles-=24; break; /*BIT 5,(IY+d)*/
case 0x76: temp=readmem(iy.w+offset); setznc(temp&0x40); cycles-=24; break; /*BIT 6,(IY+d)*/
case 0x7E: temp=readmem(iy.w+offset); setznc(temp&0x80); cycles-=24; break; /*BIT 7,(IY+d)*/
case 0x86: temp=readmem(iy.w+offset)&~0x01; writemem(iy.w+offset,temp); cycles-=28; break; /*RES 0,(IY+d)*/
case 0x8E: temp=readmem(iy.w+offset)&~0x02; writemem(iy.w+offset,temp); cycles-=28; break; /*RES 1,(IY+d)*/
case 0x96: temp=readmem(iy.w+offset)&~0x04; writemem(iy.w+offset,temp); cycles-=28; break; /*RES 2,(IY+d)*/
case 0x9E: temp=readmem(iy.w+offset)&~0x08; writemem(iy.w+offset,temp); cycles-=28; break; /*RES 3,(IY+d)*/
case 0xA6: temp=readmem(iy.w+offset)&~0x10; writemem(iy.w+offset,temp); cycles-=28; break; /*RES 4,(IY+d)*/
case 0xAE: temp=readmem(iy.w+offset)&~0x20; writemem(iy.w+offset,temp); cycles-=28; break; /*RES 5,(IY+d)*/
case 0xB6: temp=readmem(iy.w+offset)&~0x40; writemem(iy.w+offset,temp); cycles-=28; break; /*RES 6,(IY+d)*/
case 0xBE: temp=readmem(iy.w+offset)&~0x80; writemem(iy.w+offset,temp); cycles-=28; break; /*RES 7,(IY+d)*/
case 0xC6: temp=readmem(iy.w+offset)|0x01; writemem(iy.w+offset,temp); cycles-=28; break; /*SET 0,(IY+d)*/
case 0xCE: temp=readmem(iy.w+offset)|0x02; writemem(iy.w+offset,temp); cycles-=28; break; /*SET 1,(IY+d)*/
case 0xD6: temp=readmem(iy.w+offset)|0x04; writemem(iy.w+offset,temp); cycles-=28; break; /*SET 2,(IY+d)*/
case 0xDE: temp=readmem(iy.w+offset)|0x08; writemem(iy.w+offset,temp); cycles-=28; break; /*SET 3,(IY+d)*/
case 0xE6: temp=readmem(iy.w+offset)|0x10; writemem(iy.w+offset,temp); cycles-=28; break; /*SET 4,(IY+d)*/
case 0xEE: temp=readmem(iy.w+offset)|0x20; writemem(iy.w+offset,temp); cycles-=28; break; /*SET 5,(IY+d)*/
case 0xF6: temp=readmem(iy.w+offset)|0x40; writemem(iy.w+offset,temp); cycles-=28; break; /*SET 6,(IY+d)*/
case 0xFE: temp=readmem(iy.w+offset)|0x80; writemem(iy.w+offset,temp); cycles-=28; break; /*SET 7,(IY+d)*/
default:
//printf("Bad FD CB opcode %02X at %04X\n",opcode,--pc);
dumpregs();
exit(-1);
}
break;
case 0xE1: /*POP IY*/
iy.b.l=pull();
iy.b.h=pull();
cycles-=20;
break;
case 0xE3: /*EX (SP),Iy*/
tempw=ix.w;
iy.b.l=readmem(sp);
iy.b.h=readmem(sp+1);
writemem(sp,tempw&0xFF);
writemem(sp+1,tempw>>8);
cycles-=28; // t 28
break;
case 0xE5: /*PUSH IY*/
push(iy.b.h);
push(iy.b.l);
cycles-=20;
break;
case 0xE9: /*JP (IY)*/
pc=iy.w;
cycles-=8;
break;
case 0xF9: /*LD SP,IY*/
sp=iy.w;
cycles-=12;
break;
case 0xDD: /*Another prefix*/
case 0xFD:
ir.b.l--;
cycles-=4;
pc--;
break;
default:
//printf("Bad FD opcode %02X at %04X\n",opcode,--pc);
dumpregs();
exit(-1);
}
break;
case 0xFE: /*CP xx*/
temp=readmem(pc); pc++;
setcp(af.b.h,temp);
cycles-=8;
break;
case 0xFF: /*RST 38*/
push(pc>>8);
push(pc);
pc=0x38;
cycles-=16;
break;
default:
//printf("Bad opcode %02X at %04X\n",opcode,--pc);
dumpregs();
exit(-1);
}
ir.b.l++;
if (intreq==1 && iff1==1)
{
cleargacount();
intreq=0;
iff2=iff1;
iff1=0;
push(pc>>8);
push(pc&0xFF);
switch (im)
{
case 0:
pc=0x38;
cycles-=20;
break;
case 1:
pc=0x38;
cycles-=20;
break;
case 2:
addr=(ir.b.h<<8)|0xFF; pc=readmem(addr)|(readmem(addr+1)<<8);
cycles-=76;
break;
default:
//printf("Bad IM %i\n",im);
dumpregs();
exit(-1);
}
}
if (intreq==-1) intreq=1;
if (iff1==3) iff1=iff2=1;
if (iff1==2) iff1=3;
}
}
}
| 70.925673
| 261
| 0.604099
|
rpsubc8
|
cb3f44d815159ffece5fd125e2da8271ac3964d2
| 6,448
|
cpp
|
C++
|
src/API/STGOctree.cpp
|
squarefk/spheretree-fixed
|
79ec91538030a271f7aba16e22dc20c9ebb63444
|
[
"Unlicense"
] | 17
|
2016-08-12T13:15:41.000Z
|
2021-11-11T10:03:48.000Z
|
src/API/STGOctree.cpp
|
squarefk/spheretree-fixed
|
79ec91538030a271f7aba16e22dc20c9ebb63444
|
[
"Unlicense"
] | null | null | null |
src/API/STGOctree.cpp
|
squarefk/spheretree-fixed
|
79ec91538030a271f7aba16e22dc20c9ebb63444
|
[
"Unlicense"
] | 9
|
2016-04-26T16:15:45.000Z
|
2020-10-29T00:12:12.000Z
|
/*************************************************************************\
C O P Y R I G H T
Copyright 2003 Image Synthesis Group, Trinity College Dublin, Ireland.
All Rights Reserved.
Permission to use, copy, modify and distribute this software and its
documentation for educational, research and non-profit purposes, without
fee, and without a written agreement is hereby granted, provided that the
above copyright notice and the following paragraphs appear in all copies.
D I S C L A I M E R
IN NO EVENT SHALL TRININTY COLLEGE DUBLIN BE LIABLE TO ANY PARTY FOR
DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING,
BUT NOT LIMITED TO, LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE
AND ITS DOCUMENTATION, EVEN IF TRINITY COLLEGE DUBLIN HAS BEEN ADVISED OF
THE POSSIBILITY OF SUCH DAMAGES.
TRINITY COLLEGE DUBLIN DISCLAIM ANY WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE SOFTWARE PROVIDED HEREIN IS ON AN "AS IS" BASIS, AND TRINITY
COLLEGE DUBLIN HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
ENHANCEMENTS, OR MODIFICATIONS.
The authors may be contacted at the following e-mail addresses:
Gareth_Bradshaw@yahoo.co.uk isg@cs.tcd.ie
Further information about the ISG and it's project can be found at the ISG
web site :
isg.cs.tcd.ie
\**************************************************************************/
#include "STGOctree.h"
#include "SFWhite.h"
#include "../Geometry/CubeTri.h"
STGOctree::STGOctree(){
sur = NULL;
surTester = NULL;
}
STGOctree::STGOctree(const Surface &sur){
setSurface(sur);
}
void STGOctree::setSurface(const Surface &sur){
this->sur = &sur;
}
void STGOctree::constructTree(SphereTree *st) const{
CHECK_DEBUG(st != NULL, "Need SphereTree");
CHECK_DEBUG(sur != NULL, "Need Surface : use setSurface");
constructTree(st, *sur, surTester);
}
void STGOctree::constructTree(SphereTree *st, const Surface &sur, const SurfaceTester *surTester){
CHECK_DEBUG(st->degree == 8, "OCTREE i.e. degree == 8");
CHECK_DEBUG0(st->levels >= 0);
getSpheres(st, sur, 2, surTester);
}
void STGOctree::filterTriangles(Array<int> *selTris, const Array<int> &srcTris, const Surface &sur, const Point3D &pMin, float edgeLength){
selTris->setSize(0);
double extra = edgeLength*EPSILON_LARGE + EPSILON_LARGE;
int numTris = srcTris.getSize();
for (int i = 0; i < numTris; i++){
// get triangle
int tNum = srcTris.index(i);
const Surface::Triangle *tri = &sur.triangles.index(tNum);
// get vertices
Point3D pTri[3];
for (int j = 0; j < 3; j++)
pTri[j] = sur.vertices.index(tri->v[j]).p;
// test for triangle - cube overlap
if (overlapTest(pMin, edgeLength, pTri, extra))
selTris->addItem() = tNum;
}
}
void STGOctree::getChildren(SphereTree *tree, const Surface &sur, int node, int level, int divs,
const Point3D &pMin, float size, const Array<int> &tris, const SurfaceTester *surTester){
// work out the size of the new spheres
float subSize = size / divs;
// generate children and recurse
int firstChild = tree->getFirstChild(node);
int numChildren = 0;
for (int i = 0; i < divs; i++){
float x = pMin.x + i*subSize;
for (int j = 0; j < divs; j++){
float y = pMin.y + j*subSize;
for (int k = 0; k < divs; k++){
float z = pMin.z + k*subSize;
Point3D pMinNew = {x, y, z};
// find the triangles overlapping the cube
Array<int> selTris;
filterTriangles(&selTris, tris, sur, pMinNew, subSize);
// create sphere
STSphere sph;
sph.c.x = x + subSize/2.0f;
sph.c.y = y + subSize/2.0f;
sph.c.z = z + subSize/2.0f;
sph.r = sph.c.distance(pMinNew);
if (selTris.getSize()){
// store sphere
int childNum = firstChild + numChildren;
numChildren++;
tree->nodes.index(childNum)= sph;
// generate children
if (level < tree->levels-1)
getChildren(tree, sur, childNum, level+1, divs, pMinNew, subSize, selTris, surTester);
}
else if (surTester){ // making solid octree
// test center point
Point3D pC;
pC.x = x + subSize/2.0f;
pC.y = y + subSize/2.0f;
pC.z = z + subSize/2.0f;
Point3D pClose;
bool in = surTester->getClosestPointConditional(&pClose, pC, true);
if (in){
// store sphere
int childNum = firstChild + numChildren;
numChildren++;
tree->nodes.index(childNum)= sph;
// generate children (if the sphere overlap's surface)
int completelyInternal = pClose.distance(pC) > sph.r;
//OUTPUTINFO("Internal Node (%s)\n", completelyInternal? "Complete":"SubDivide");
if (level < tree->levels-1 && !completelyInternal)
getChildren(tree, sur, childNum, level+1, divs, pMinNew, subSize, selTris, surTester);
}
}
}
}
}
// invalidate rest of child spheres
int totChild = divs*divs*divs;
for (int i = numChildren; i < totChild; i++){
int childNum = firstChild+i;
tree->initNode(childNum, level+1);
}
}
void STGOctree::getSpheres(SphereTree *tree, const Surface &sur, int divs, const SurfaceTester *surTester){
// get bounding box
STSphere s;
float sizeX = sur.pMax.x - sur.pMin.x;
float sizeY = sur.pMax.y - sur.pMin.y;
float sizeZ = sur.pMax.z - sur.pMin.z;
float size = sizeX;
if (sizeY > size)
size = sizeY;
if (sizeZ > size)
size = sizeZ;
// get bounding sphere
//s.c.x = sur.pMin.x + size/2.0f;
//s.c.y = sur.pMin.y + size/2.0f;
//s.c.z = sur.pMin.z + size/2.0f;
//s.r = s.c.distance(sur.pMin);
//tree->nodes.index(0) = s;
// changed to use tighter sphere
SFWhite::makeSphere(&tree->nodes.index(0), sur.vertices);
// generate list of triangles contained in the parent box (for recursion)
Array<int> tris;
int numTris = sur.triangles.getSize();
tris.resize(numTris);
for (int i = 0; i < numTris; i++)
tris.index(i) = i;
getChildren(tree, sur, 0, 1, divs, sur.pMin, size, tris, surTester);
}
| 33.237113
| 139
| 0.611663
|
squarefk
|
cb40819bb404c9356225d0d51fa01d882f72d349
| 569
|
hpp
|
C++
|
src/behaviours/include/AvoidNest.hpp
|
BCLab-UNM/SwarmBaseCode-Modular-Public
|
2061796570baf65deeb74f29444fcaf3b6464aa1
|
[
"MIT"
] | null | null | null |
src/behaviours/include/AvoidNest.hpp
|
BCLab-UNM/SwarmBaseCode-Modular-Public
|
2061796570baf65deeb74f29444fcaf3b6464aa1
|
[
"MIT"
] | null | null | null |
src/behaviours/include/AvoidNest.hpp
|
BCLab-UNM/SwarmBaseCode-Modular-Public
|
2061796570baf65deeb74f29444fcaf3b6464aa1
|
[
"MIT"
] | null | null | null |
#ifndef _AVOID_NEST_HPP
#define _AVOID_NEST_HPP
#include "BehaviorManager.hpp"
#include "SwarmieSensors.hpp"
#include "Timer.hpp"
#include <cmath>
class AvoidNest : public Behavior
{
private:
int _tagsLeft;
int _tagsRight;
bool _persist;
bool _tooClose;
SwarmieAction _savedAction;
Timer* _persistenceTimer;
void TagHandler(const SwarmieSensors& sensors);
public:
AvoidNest(Timer* timer);
~AvoidNest() {}
void Update(const SwarmieSensors& sensors, const SwarmieAction& ll_action) override;
};
#endif // _AVOID_NEST_HPP
| 18.966667
| 87
| 0.72935
|
BCLab-UNM
|
cb40820c726939ae3832b6109a59bc038afc0e41
| 15,691
|
cpp
|
C++
|
SurgSim/Devices/TrackIR/win32/TrackIRScaffold.cpp
|
dbungert/opensurgsim
|
bd30629f2fd83f823632293959b7654275552fa9
|
[
"Apache-2.0"
] | 24
|
2015-01-19T16:18:59.000Z
|
2022-03-13T03:29:11.000Z
|
SurgSim/Devices/TrackIR/win32/TrackIRScaffold.cpp
|
dbungert/opensurgsim
|
bd30629f2fd83f823632293959b7654275552fa9
|
[
"Apache-2.0"
] | 3
|
2018-12-21T14:54:08.000Z
|
2022-03-14T12:38:07.000Z
|
SurgSim/Devices/TrackIR/win32/TrackIRScaffold.cpp
|
dbungert/opensurgsim
|
bd30629f2fd83f823632293959b7654275552fa9
|
[
"Apache-2.0"
] | 8
|
2015-04-10T19:45:36.000Z
|
2022-02-02T17:00:59.000Z
|
// This file is a part of the OpenSurgSim project.
// Copyright 2013, SimQuest Solutions Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "SurgSim/Devices/TrackIR/TrackIRScaffold.h"
#include <algorithm>
#include <list>
#include <memory>
#include <boost/thread/locks.hpp>
#include <boost/thread/mutex.hpp>
#include <cameralibrary.h>
#include "SurgSim/Devices/TrackIR/TrackIRDevice.h"
#include "SurgSim/Devices/TrackIR/TrackIRThread.h"
#include "SurgSim/Framework/Assert.h"
#include "SurgSim/Framework/Log.h"
#include "SurgSim/Framework/SharedInstance.h"
#include "SurgSim/DataStructures/DataGroup.h"
#include "SurgSim/DataStructures/DataGroupBuilder.h"
#include "SurgSim/Math/Matrix.h"
#include "SurgSim/Math/RigidTransform.h"
#include "SurgSim/Math/Vector.h"
using SurgSim::DataStructures::DataGroupBuilder;
using SurgSim::Math::makeRotationMatrix;
using SurgSim::Math::Matrix33d;
using SurgSim::Math::RigidTransform3d;
using SurgSim::Math::Vector3d;
namespace SurgSim
{
namespace Devices
{
struct TrackIRScaffold::DeviceData
{
/// Constructor
/// \param device Device to be wrapped
/// \param cameraID The camera identifier
explicit DeviceData(TrackIRDevice* device, int cameraID) :
deviceObject(device),
thread(),
vector(CameraLibrary::cModuleVector::Create()),
vectorProcessor(new CameraLibrary::cModuleVectorProcessing())
{
CameraLibrary::CameraList list;
list.Refresh();
camera = CameraLibrary::CameraManager::X().GetCamera(list[cameraID].UID());
SURGSIM_ASSERT(nullptr != camera) << "Failed to obtain a camera from CameraLibrary.";
camera->SetVideoType(CameraLibrary::BitPackedPrecisionMode);
CameraLibrary::cVectorProcessingSettings vectorProcessorSettings;
vectorProcessorSettings = *(vectorProcessor->Settings());
vectorProcessorSettings.Arrangement = CameraLibrary::cVectorSettings::VectorClip;
vectorProcessorSettings.ShowPivotPoint = false;
vectorProcessorSettings.ShowProcessed = false;
vectorProcessorSettings.ScaleTranslationX = device->defaultPositionScale();
vectorProcessorSettings.ScaleTranslationY = device->defaultPositionScale();
vectorProcessorSettings.ScaleTranslationZ = device->defaultPositionScale();
vectorProcessorSettings.ScaleRotationPitch = device->defaultOrientationScale();
vectorProcessorSettings.ScaleRotationYaw = device->defaultOrientationScale();
vectorProcessorSettings.ScaleRotationRoll = device->defaultOrientationScale();
vectorProcessor->SetSettings(vectorProcessorSettings);
//== Plug in focal length in (mm) by converting it from pixels -> mm
CameraLibrary::cVectorSettings vectorSettings;
vectorSettings = *(vector->Settings());
vectorSettings.Arrangement = CameraLibrary::cVectorSettings::VectorClip;
vectorSettings.Enabled = true;
camera->GetDistortionModel(lensDistortion);
vectorSettings.ImagerFocalLength = lensDistortion.HorizontalFocalLength /
static_cast<double>(camera->PhysicalPixelWidth()) *
camera->ImagerWidth();
vectorSettings.ImagerHeight = camera->ImagerHeight();
vectorSettings.ImagerWidth = camera->ImagerWidth();
vectorSettings.PrincipalX = camera->PhysicalPixelWidth() / 2.0;
vectorSettings.PrincipalY = camera->PhysicalPixelHeight() / 2.0;
vectorSettings.PixelWidth = camera->PhysicalPixelWidth();
vectorSettings.PixelHeight = camera->PhysicalPixelHeight();
vector->SetSettings(vectorSettings);
}
~DeviceData()
{
camera->Release();
}
Core::DistortionModel lensDistortion;
CameraLibrary::Camera* camera;
CameraLibrary::cModuleVector* vector;
CameraLibrary::cModuleVectorProcessing* vectorProcessor;
/// The corresponding device object.
SurgSim::Devices::TrackIRDevice* const deviceObject;
/// Processing thread.
std::unique_ptr<SurgSim::Devices::TrackIRThread> thread;
/// The mutex that protects the externally modifiable parameters.
boost::mutex parametersMutex;
private:
// Prevent copy construction and copy assignment. (VS2012 does not support "= delete" yet.)
DeviceData(const DeviceData&) /*= delete*/;
DeviceData& operator=(const DeviceData&) /*= delete*/;
};
struct TrackIRScaffold::StateData
{
public:
/// Initialize the state.
StateData() : isApiInitialized(false)
{
}
/// True if the API has been initialized (and not finalized).
bool isApiInitialized;
/// The list of known devices.
std::list<std::unique_ptr<TrackIRScaffold::DeviceData>> activeDeviceList;
/// The mutex that protects the list of known devices.
boost::mutex mutex;
private:
// Prevent copy construction and copy assignment. (VS2012 does not support "= delete" yet.)
StateData(const StateData&) /*= delete*/;
StateData& operator=(const StateData&) /*= delete*/;
};
TrackIRScaffold::TrackIRScaffold() :
m_logger(Framework::Logger::getLogger("Devices/TrackIR")),
m_state(new StateData)
{
SURGSIM_LOG_DEBUG(m_logger) << "Shared scaffold created.";
}
TrackIRScaffold::~TrackIRScaffold()
{
// The following block controls the duration of the mutex being locked.
{
boost::lock_guard<boost::mutex> lock(m_state->mutex);
if (!m_state->activeDeviceList.empty())
{
SURGSIM_LOG_SEVERE(m_logger) << "TrackIR: Destroying scaffold while devices are active!?!";
for (auto it = std::begin(m_state->activeDeviceList); it != std::end(m_state->activeDeviceList); ++it)
{
stopCamera((*it).get());
if ((*it)->thread)
{
destroyPerDeviceThread(it->get());
}
}
m_state->activeDeviceList.clear();
}
if (m_state->isApiInitialized)
{
if (!finalizeSdk())
{
SURGSIM_LOG_SEVERE(m_logger) << "Finalizing TrackIR SDK failed.";
}
}
}
SURGSIM_LOG_DEBUG(m_logger) << "TrackIR: Shared scaffold destroyed.";
}
bool TrackIRScaffold::registerDevice(TrackIRDevice* device)
{
boost::lock_guard<boost::mutex> lock(m_state->mutex);
if (!m_state->isApiInitialized)
{
if (!initializeSdk())
{
SURGSIM_LOG_SEVERE(m_logger) << "Failed to initialize TrackIR SDK in TrackIRScaffold::registerDevice(). "
<< "Continuing without the TrackIR device.";
}
}
// Only proceed when initializationSdk() is successful.
if (m_state->isApiInitialized)
{
// Make sure the object is unique.
auto sameObject = std::find_if(m_state->activeDeviceList.cbegin(), m_state->activeDeviceList.cend(),
[device](const std::unique_ptr<DeviceData>& info) { return info->deviceObject == device; });
SURGSIM_ASSERT(sameObject == m_state->activeDeviceList.end()) << "TrackIR: Tried to register a device" <<
" which is already registered!";
// Make sure the name is unique.
const std::string name = device->getName();
auto sameName = std::find_if(m_state->activeDeviceList.cbegin(), m_state->activeDeviceList.cend(),
[&name](const std::unique_ptr<DeviceData>& info) { return info->deviceObject->getName() == name; });
SURGSIM_ASSERT(sameName == m_state->activeDeviceList.end()) << "TrackIR: Tried to register a device" <<
" when the same name is already present!";
// The handling of multiple cameras could be done in different ways, each with trade-offs.
// Instead of choosing an approach now, we assert on attempting to use more than one camera.
SURGSIM_ASSERT(m_state->activeDeviceList.size() < 1) << "There is already an active TrackIR camera."
<< " TrackIRScaffold only supports one TrackIR camera right now.";
CameraLibrary::CameraList cameraList;
cameraList.Refresh();
if (cameraList.Count() > static_cast<int>(m_state->activeDeviceList.size()))
{
int cameraID = static_cast<int>(m_state->activeDeviceList.size());
std::unique_ptr<DeviceData> info(new DeviceData(device, cameraID));
createPerDeviceThread(info.get());
SURGSIM_ASSERT(info->thread) << "Failed to create a per-device thread for TrackIR device: " <<
info->deviceObject->getName() << ", with ID number " << cameraID << ".";
startCamera(info.get());
m_state->activeDeviceList.emplace_back(std::move(info));
SURGSIM_LOG_INFO(m_logger) << "Device " << device->getName() << " initialized.";
}
else
{
SURGSIM_LOG_SEVERE(m_logger) << "Registration failed. Is a TrackIR device plugged in?";
m_state->isApiInitialized = false;
}
}
return m_state->isApiInitialized;
}
bool TrackIRScaffold::unregisterDevice(const TrackIRDevice* const device)
{
bool found = false;
{
boost::lock_guard<boost::mutex> lock(m_state->mutex);
auto matching = std::find_if(m_state->activeDeviceList.begin(), m_state->activeDeviceList.end(),
[device](const std::unique_ptr<DeviceData>& info) { return info->deviceObject == device; });
if (matching != m_state->activeDeviceList.end())
{
stopCamera((*matching).get());
if ((*matching)->thread)
{
destroyPerDeviceThread(matching->get());
}
m_state->activeDeviceList.erase(matching);
// the iterator is now invalid but that's OK
found = true;
SURGSIM_LOG_INFO(m_logger) << "Device " << device->getName() << " unregistered.";
}
}
SURGSIM_LOG_IF(!found, m_logger, SEVERE) << "Attempted to release a non-registered device " << device->getName();
return found;
}
void TrackIRScaffold::setPositionScale(const TrackIRDevice* device, double scale)
{
boost::lock_guard<boost::mutex> lock(m_state->mutex);
auto matching = std::find_if(m_state->activeDeviceList.begin(), m_state->activeDeviceList.end(),
[device](const std::unique_ptr<DeviceData>& info) { return info->deviceObject == device; });
if (matching != m_state->activeDeviceList.end())
{
boost::lock_guard<boost::mutex> lock((*matching)->parametersMutex);
CameraLibrary::cVectorProcessingSettings* vectorProcessorSettings = (*matching)->vectorProcessor->Settings();
vectorProcessorSettings->ScaleTranslationX = scale;
vectorProcessorSettings->ScaleTranslationY = scale;
vectorProcessorSettings->ScaleTranslationZ = scale;
}
}
void TrackIRScaffold::setOrientationScale(const TrackIRDevice* device, double scale)
{
boost::lock_guard<boost::mutex> lock(m_state->mutex);
auto matching = std::find_if(m_state->activeDeviceList.begin(), m_state->activeDeviceList.end(),
[device](const std::unique_ptr<DeviceData>& info) { return info->deviceObject == device; });
if (matching != m_state->activeDeviceList.end())
{
boost::lock_guard<boost::mutex> lock((*matching)->parametersMutex);
CameraLibrary::cVectorProcessingSettings* vectorProcessorSettings = (*matching)->vectorProcessor->Settings();
vectorProcessorSettings->ScaleRotationPitch = scale;
vectorProcessorSettings->ScaleRotationYaw = scale;
vectorProcessorSettings->ScaleRotationRoll = scale;
}
}
bool TrackIRScaffold::runInputFrame(TrackIRScaffold::DeviceData* info)
{
if (!updateDevice(info))
{
return false;
}
info->deviceObject->pushInput();
return true;
}
bool TrackIRScaffold::updateDevice(TrackIRScaffold::DeviceData* info)
{
SurgSim::DataStructures::DataGroup& inputData = info->deviceObject->getInputData();
boost::lock_guard<boost::mutex> lock(info->parametersMutex);
CameraLibrary::Frame *frame = info->camera->GetFrame();
bool poseValid = false;
double x, y, z, pitch, yaw, roll;
if (frame)
{
info->vector->BeginFrame();
for(int i = 0; i < frame->ObjectCount(); ++i)
{
CameraLibrary::cObject *obj = frame->Object(i);
float xValue = obj->X();
float yValue = obj->Y();
Core::Undistort2DPoint(info->lensDistortion, xValue, yValue);
info->vector->PushMarkerData(xValue, yValue, obj->Area(), obj->Width(), obj->Height());
}
info->vector->Calculate();
info->vectorProcessor->PushData(info->vector);
// Vector Clip uses 3 markers to identify the pose, i.e. 6DOF
// Otherwise, the pose is considered as invalid.
if(info->vectorProcessor->MarkerCount() == 3)
{
info->vectorProcessor->GetOrientation(yaw, pitch, roll); // Rotations are Euler Angles in degrees.
info->vectorProcessor->GetPosition(x, y, z); // Positions are reported in millimeters.
poseValid = true;
}
frame->Release();
}
if (poseValid)
{
// Positions returned from CameraSDK are right-handed.
Vector3d position(x / 1000.0, y / 1000.0, z / 1000.0); // Convert millimeter to meter
// The angles returned from CameraSDK are Euler angles (y-x'-z'' intrinsic rotations): X=pitch, Y=yaw, Z=roll.
// OSS use right handed coordinate system (X:Right, Y:Up, Z:Outward) and right hand rule for rotations.
Matrix33d rotationX = makeRotationMatrix(pitch * M_PI / 180.0, Vector3d(Vector3d::UnitX()));
Matrix33d rotationY = makeRotationMatrix(yaw * M_PI / 180.0, Vector3d(Vector3d::UnitY()));
Matrix33d rotationZ = makeRotationMatrix(roll * M_PI / 180.0, Vector3d(Vector3d::UnitZ()));
Matrix33d orientation = rotationY * rotationX * rotationZ;
RigidTransform3d pose;
pose.linear() = orientation;
pose.translation() = position;
inputData.poses().set(SurgSim::DataStructures::Names::POSE, pose);
}
else // Invalid pose. inputData.poses().hasData("pose") will be set to 'false'.
{
inputData.poses().reset(SurgSim::DataStructures::Names::POSE);
}
return true;
}
bool TrackIRScaffold::initializeSdk()
{
SURGSIM_ASSERT(!m_state->isApiInitialized) << "TrackIR API already initialized.";
if (!CameraLibrary::CameraManager::X().AreCamerasInitialized())
{
CameraLibrary::CameraManager::X().WaitForInitialization();
}
if (CameraLibrary::CameraManager::X().GetCamera())
{
m_state->isApiInitialized = true;
}
return m_state->isApiInitialized;
}
bool TrackIRScaffold::finalizeSdk()
{
SURGSIM_ASSERT(m_state->isApiInitialized) << "TrackIR API already finalized.";
if (!CameraLibrary::CameraManager::X().AreCamerasShutdown())
{
// Dec-17-2013-HW It's a bug in TrackIR CameraSDK that after calling CameraLibrary::CameraManager::X().Shutdown(),
// calls to CameraLibrary::CameraManager::X().WaitForInitialization will throw memory violation error.
//CameraLibrary::CameraManager::X().Shutdown();
}
m_state->isApiInitialized = false;
return !m_state->isApiInitialized;
}
bool TrackIRScaffold::createPerDeviceThread(DeviceData* deviceData)
{
SURGSIM_ASSERT(!deviceData->thread) << "Device " << deviceData->deviceObject->getName() << " already has a thread.";
std::unique_ptr<TrackIRThread> thread(new TrackIRThread(this, deviceData));
thread->start();
deviceData->thread = std::move(thread);
return true;
}
bool TrackIRScaffold::destroyPerDeviceThread(DeviceData* deviceData)
{
SURGSIM_ASSERT(deviceData->thread) << "No thread attached to device " << deviceData->deviceObject->getName();
std::unique_ptr<TrackIRThread> thread = std::move(deviceData->thread);
thread->stop();
thread.reset();
return true;
}
bool TrackIRScaffold::startCamera(DeviceData* info)
{
info->camera->Start();
return info->camera->IsCameraRunning();
}
bool TrackIRScaffold::stopCamera(DeviceData* info)
{
info->camera->Stop();
return !(info->camera->IsCameraRunning());
}
SurgSim::DataStructures::DataGroup TrackIRScaffold::buildDeviceInputData()
{
DataGroupBuilder builder;
builder.addPose("pose");
return builder.createData();
}
std::shared_ptr<TrackIRScaffold> TrackIRScaffold::getOrCreateSharedInstance()
{
static SurgSim::Framework::SharedInstance<TrackIRScaffold> sharedInstance;
return sharedInstance.get();
}
}; // namespace Devices
}; // namespace SurgSim
| 34.485714
| 117
| 0.736728
|
dbungert
|
cb4228247489e8a081d561cea3ee795112a74380
| 3,843
|
cpp
|
C++
|
src/sudoku/solution_queue.cpp
|
samwarring/sudoku
|
0dee535363358e3124c869cd91f2b02a124e4c20
|
[
"MIT"
] | null | null | null |
src/sudoku/solution_queue.cpp
|
samwarring/sudoku
|
0dee535363358e3124c869cd91f2b02a124e4c20
|
[
"MIT"
] | 16
|
2020-04-25T19:53:04.000Z
|
2020-07-13T00:06:56.000Z
|
src/sudoku/solution_queue.cpp
|
samwarring/sudoku
|
0dee535363358e3124c869cd91f2b02a124e4c20
|
[
"MIT"
] | null | null | null |
#include <sudoku/solution_queue.h>
namespace sudoku
{
SolutionQueue::SolutionQueue(size_t maxSize) : maxSize_(maxSize)
{
}
SolutionQueue::Producer::Producer(SolutionQueue& queue) : queue_(queue)
{
std::lock_guard<std::mutex> lock(queue_.mutex_);
queue_.numProducers_++;
}
SolutionQueue::Producer::Producer(const Producer& other) : queue_(other.queue_)
{
std::lock_guard<std::mutex> lock(queue_.mutex_);
queue_.numProducers_++;
}
SolutionQueue::Producer::Producer(Producer&& other) : queue_(other.queue_)
{
other.moved_ = true;
}
SolutionQueue::Producer::~Producer()
{
if (!moved_) {
std::lock_guard<std::mutex> lock(queue_.mutex_);
queue_.numProducers_--;
// If this is the last producer, notify remaining consumers.
if (queue_.numProducers_ == 0) {
queue_.condVar_.notify_all();
}
}
}
bool SolutionQueue::Producer::push(std::vector<CellValue> solution, Metrics metrics)
{
// Wait until the queue has free capacity, or until there are
// no more consumers.
std::unique_lock<std::mutex> lock(queue_.mutex_);
queue_.condVar_.wait(lock, [&](){
return (queue_.valuesQueue_.size() < queue_.maxSize_) || (queue_.numConsumers_ == 0);
});
// If there are no consumers, then return false now.
if (queue_.numConsumers_ == 0) {
return false;
}
// There must be free capacity in the queue. Add the solution to the
// queue, and notify a consumer thread which may be waiting.
queue_.valuesQueue_.emplace(std::move(solution));
queue_.metricsQueue_.push(metrics);
queue_.condVar_.notify_one();
return true;
}
SolutionQueue::Consumer::Consumer(SolutionQueue& queue) : queue_(queue)
{
std::lock_guard<std::mutex> lock(queue_.mutex_);
queue_.numConsumers_++;
}
SolutionQueue::Consumer::Consumer(const Consumer& other) : queue_(other.queue_)
{
std::lock_guard<std::mutex> lock(queue_.mutex_);
queue_.numConsumers_++;
}
SolutionQueue::Consumer::Consumer(Consumer&& other) : queue_(other.queue_)
{
other.moved_ = true;
}
SolutionQueue::Consumer::~Consumer()
{
if (!moved_) {
std::lock_guard<std::mutex> lock(queue_.mutex_);
queue_.numConsumers_--;
// If this is the last consumer, notify remaining producers.
if (queue_.numConsumers_ == 0) {
queue_.condVar_.notify_all();
}
}
}
bool SolutionQueue::Consumer::pop(std::vector<CellValue>& solution, Metrics& metrics)
{
// Wait until the queue contains at least one element, or until
// there are no more producers.
std::unique_lock<std::mutex> lock(queue_.mutex_);
queue_.condVar_.wait(lock, [&](){
return (queue_.valuesQueue_.size() > 0) || (queue_.numProducers_ == 0);
});
// If there are no more producers, there still may be solutions left
// to proces in the queue. We only quit if there are no more producers
// AND the queue is empty.
if (queue_.numProducers_ == 0 && queue_.valuesQueue_.size() == 0) {
return false;
}
// We know there is at least one producer, and the queue is not empty.
// Retrieve the front of the queue. Notify a consumer which may be
// waiting to write the the queue.
solution = std::move(queue_.valuesQueue_.front());
metrics = queue_.metricsQueue_.front();
queue_.valuesQueue_.pop();
queue_.metricsQueue_.pop();
queue_.condVar_.notify_one();
return true;
}
}
| 32.567797
| 97
| 0.602394
|
samwarring
|
cb44ebde7a41bfeec0322340fc7ede0343421d3a
| 6,634
|
cc
|
C++
|
3rdParty/V8/v7.1.302.28/test/cctest/trace-extension.cc
|
cclauss/arangodb
|
089f7a7e60483f0fb73171d159f922dd3de283e9
|
[
"BSL-1.0",
"Apache-2.0"
] | 4
|
2019-04-20T15:56:13.000Z
|
2019-12-23T07:14:01.000Z
|
3rdParty/V8/v7.1.302.28/test/cctest/trace-extension.cc
|
fceller/arangodb
|
22eec2e35407d868ac36f06b9abdbee3fb3c3ef3
|
[
"Apache-2.0"
] | 1
|
2019-02-13T09:53:48.000Z
|
2019-02-13T09:53:48.000Z
|
3rdParty/V8/v7.1.302.28/test/cctest/trace-extension.cc
|
fceller/arangodb
|
22eec2e35407d868ac36f06b9abdbee3fb3c3ef3
|
[
"Apache-2.0"
] | 10
|
2015-10-15T06:16:55.000Z
|
2019-06-23T18:52:25.000Z
|
// Copyright 2014 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "test/cctest/trace-extension.h"
#include "include/v8-profiler.h"
#include "src/vm-state-inl.h"
#include "test/cctest/cctest.h"
namespace v8 {
namespace internal {
const char* TraceExtension::kSource =
"native function trace();"
"native function js_trace();"
"native function js_entry_sp();"
"native function js_entry_sp_level2();";
v8::Local<v8::FunctionTemplate> TraceExtension::GetNativeFunctionTemplate(
v8::Isolate* isolate, v8::Local<v8::String> name) {
v8::Local<v8::Context> context = isolate->GetCurrentContext();
if (name->Equals(context, v8::String::NewFromUtf8(isolate, "trace",
v8::NewStringType::kNormal)
.ToLocalChecked())
.FromJust()) {
return v8::FunctionTemplate::New(isolate, TraceExtension::Trace);
} else if (name->Equals(context,
v8::String::NewFromUtf8(isolate, "js_trace",
v8::NewStringType::kNormal)
.ToLocalChecked())
.FromJust()) {
return v8::FunctionTemplate::New(isolate, TraceExtension::JSTrace);
} else if (name->Equals(context,
v8::String::NewFromUtf8(isolate, "js_entry_sp",
v8::NewStringType::kNormal)
.ToLocalChecked())
.FromJust()) {
return v8::FunctionTemplate::New(isolate, TraceExtension::JSEntrySP);
} else if (name->Equals(context,
v8::String::NewFromUtf8(isolate, "js_entry_sp_level2",
v8::NewStringType::kNormal)
.ToLocalChecked())
.FromJust()) {
return v8::FunctionTemplate::New(isolate, TraceExtension::JSEntrySPLevel2);
}
UNREACHABLE();
}
Address TraceExtension::GetFP(const v8::FunctionCallbackInfo<v8::Value>& args) {
// Convert frame pointer from encoding as smis in the arguments to a pointer.
CHECK_EQ(2, args.Length()); // Ignore second argument on 32-bit platform.
#if defined(V8_HOST_ARCH_32_BIT)
Address fp = *reinterpret_cast<Address*>(*args[0]);
#elif defined(V8_HOST_ARCH_64_BIT)
uint64_t kSmiValueMask =
(static_cast<uintptr_t>(1) << (kSmiValueSize - 1)) - 1;
uint64_t low_bits =
(*reinterpret_cast<Smi**>(*args[0]))->value() & kSmiValueMask;
uint64_t high_bits =
(*reinterpret_cast<Smi**>(*args[1]))->value() & kSmiValueMask;
Address fp =
static_cast<Address>((high_bits << (kSmiValueSize - 1)) | low_bits);
#else
#error Host architecture is neither 32-bit nor 64-bit.
#endif
printf("Trace: %p\n", reinterpret_cast<void*>(fp));
return fp;
}
static struct { v8::TickSample* sample; } trace_env = {nullptr};
void TraceExtension::InitTraceEnv(v8::TickSample* sample) {
trace_env.sample = sample;
}
void TraceExtension::DoTrace(Address fp) {
RegisterState regs;
regs.fp = reinterpret_cast<void*>(fp);
// sp is only used to define stack high bound
regs.sp = reinterpret_cast<void*>(
reinterpret_cast<Address>(trace_env.sample) - 10240);
trace_env.sample->Init(CcTest::isolate(), regs,
v8::TickSample::kSkipCEntryFrame, true);
}
void TraceExtension::Trace(const v8::FunctionCallbackInfo<v8::Value>& args) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(args.GetIsolate());
i::VMState<EXTERNAL> state(isolate);
Address address = reinterpret_cast<Address>(&TraceExtension::Trace);
i::ExternalCallbackScope call_scope(isolate, address);
DoTrace(GetFP(args));
}
// Hide c_entry_fp to emulate situation when sampling is done while
// pure JS code is being executed
static void DoTraceHideCEntryFPAddress(Address fp) {
v8::internal::Address saved_c_frame_fp =
*(CcTest::i_isolate()->c_entry_fp_address());
CHECK(saved_c_frame_fp);
*(CcTest::i_isolate()->c_entry_fp_address()) = 0;
i::TraceExtension::DoTrace(fp);
*(CcTest::i_isolate()->c_entry_fp_address()) = saved_c_frame_fp;
}
void TraceExtension::JSTrace(const v8::FunctionCallbackInfo<v8::Value>& args) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(args.GetIsolate());
i::VMState<EXTERNAL> state(isolate);
Address address = reinterpret_cast<Address>(&TraceExtension::JSTrace);
i::ExternalCallbackScope call_scope(isolate, address);
DoTraceHideCEntryFPAddress(GetFP(args));
}
Address TraceExtension::GetJsEntrySp() {
CHECK(CcTest::i_isolate()->thread_local_top());
return CcTest::i_isolate()->js_entry_sp();
}
void TraceExtension::JSEntrySP(
const v8::FunctionCallbackInfo<v8::Value>& args) {
CHECK(GetJsEntrySp());
}
void TraceExtension::JSEntrySPLevel2(
const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::HandleScope scope(args.GetIsolate());
const Address js_entry_sp = GetJsEntrySp();
CHECK(js_entry_sp);
CompileRun("js_entry_sp();");
CHECK_EQ(js_entry_sp, GetJsEntrySp());
}
} // namespace internal
} // namespace v8
| 39.488095
| 80
| 0.678927
|
cclauss
|
cb45098d43af681ef458b5381157a9694310b2cf
| 6,040
|
cpp
|
C++
|
src/error.cpp
|
BlubBlab/micromacro-with-OpenCV
|
c1a17d5faef38fc8532fb1a52ae1c41e7d2d3a34
|
[
"BSD-3-Clause"
] | null | null | null |
src/error.cpp
|
BlubBlab/micromacro-with-OpenCV
|
c1a17d5faef38fc8532fb1a52ae1c41e7d2d3a34
|
[
"BSD-3-Clause"
] | null | null | null |
src/error.cpp
|
BlubBlab/micromacro-with-OpenCV
|
c1a17d5faef38fc8532fb1a52ae1c41e7d2d3a34
|
[
"BSD-3-Clause"
] | null | null | null |
/******************************************************************************
Project: MicroMacro
Author: SolarStrike Software
URL: www.solarstrike.net
License: Modified BSD (see license.txt)
******************************************************************************/
#include "error.h"
#include "strl.h"
#include "logger.h"
#include "macro.h"
#include "ncurses_lua.h"
#include <vector>
#include <string>
#include <string.h>
extern "C"
{
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
}
const char *getErrorString(int errcode)
{
switch(errcode)
{
case MicroMacro::ERR_OK:
return "Everything is OK";
break;
case MicroMacro::ERR_CLOSE:
return "Close request signal sent";
break;
case MicroMacro::ERR_DOUBLE_INIT:
return "Double initialization not allowed";
break;
case MicroMacro::ERR_INIT_FAIL:
return "Initialization failure";
break;
case MicroMacro::ERR_CLEANUP_FAIL:
return "Failure to properly cleanup";
break;
case MicroMacro::ERR_NO_STATE:
return "Attempt to use Lua state when no state has been created";
break;
case MicroMacro::ERR_RUN:
return "Runtime error";
break;
case MicroMacro::ERR_MEM:
return "Memory error";
break;
case MicroMacro::ERR_SYNTAX:
return "Syntax error";
break;
case MicroMacro::ERR_FILE:
return "File error";
break;
case MicroMacro::ERR_ERR:
return "Error inside of an error: Errorception. I don\'t even know what\'s right anymore.";
break;
case MicroMacro::ERR_NOFUNCTION:
return "Function does not exist or could not be found";
break;
case MicroMacro::ERR_UNKNOWN:
default:
return "Unknown or undefined error";
break;
}
}
std::string getWindowsErrorString(int errCode)
{
char *tmp = NULL;
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL, errCode, 0, (CHAR*)&tmp, 0, NULL);
if( tmp == NULL )
return "";
std::string retval = tmp;
LocalFree(tmp);
retval.erase( retval.size()-2 ); // chop off trailing \r\n
return retval;
}
void wrongArgsReal(lua_State *s, const char *name)
{
luaL_error(s, "Wrong number of parameters supplied to %s().\n", name);
}
void badAllocationReal(const char *file, const char *func, int line)
{
// Log the error
char buffer[1024];
#ifdef DISPLAY_DEBUG_MESSAGES
sprintf(buffer, "Bad allocation, %s:%d in function %s\n", file, line, func);
#else
sprintf(buffer, "Bad allocation in function %s, line %d\n", func, line);
#endif
fprintf(stderr, buffer);
Logger::instance()->add("%s", buffer);
// Shut down Ncurses (if needed)
if( Ncurses_lua::is_initialized() )
{
Ncurses_lua::cleanup(Macro::instance()->getEngine()->getLuaState());
}
// Let the user know something bad happened, give them time to see the error
printf("\a\a\a"); // Ding!
system("pause");
// Time to go home
exit(MicroMacro::ERR_MEM);
}
int checkType(lua_State *L, int acceptableTypes, int arg)
{
int ok = false;
std::vector<short> acceptableTypeIDs;
acceptableTypeIDs.reserve(10);
// Check each type
if( acceptableTypes & LT_NIL )
{
acceptableTypeIDs.push_back(LUA_TNIL);
if( lua_isnil(L, arg) )
ok = true;
}
if( acceptableTypes & LT_NUMBER )
{
acceptableTypeIDs.push_back(LUA_TNUMBER);
if( lua_isnumber(L, arg) )
ok = true;
}
if( acceptableTypes & LT_STRING )
{
acceptableTypeIDs.push_back(LUA_TSTRING);
if( lua_isstring(L, arg) )
ok = true;
}
if( acceptableTypes & LT_BOOLEAN )
{
acceptableTypeIDs.push_back(LUA_TBOOLEAN);
if( lua_isboolean(L, arg) )
ok = true;
}
if( acceptableTypes & LT_TABLE )
{
acceptableTypeIDs.push_back(LUA_TTABLE);
if( lua_istable(L, arg) )
ok = true;
}
if( acceptableTypes & LT_FUNCTION )
{
acceptableTypeIDs.push_back(LUA_TFUNCTION);
if( lua_isfunction(L, arg) )
ok = true;
}
if( acceptableTypes & LT_THREAD )
{
acceptableTypeIDs.push_back(LUA_TTHREAD);
if( lua_isthread(L, arg) )
ok = true;
}
if( acceptableTypes & LT_USERDATA )
{
acceptableTypeIDs.push_back(LUA_TUSERDATA);
if( lua_isuserdata(L, arg) )
ok = true;
}
if( !ok )
{
char expected[256];
strlcpy((char*)&expected, "unknown", 8);
size_t buff_left = sizeof(expected)-1; // What's left to use (below)
for(size_t i = 0; i < acceptableTypeIDs.size(); i++)
{
if( i == 0 )
{
size_t buff_used = 0;
buff_used = strlcpy((char*)&expected, lua_typename(L, acceptableTypeIDs.at(i)), buff_left);
buff_left = sizeof(expected) - 1 - buff_used;
}
else if( i == acceptableTypeIDs.size() - 1 )
{
const char *or_txt = " or ";
strlcat((char*)&expected, or_txt, buff_left);
buff_left -= strlen(or_txt);
strlcat((char*)&expected, lua_typename(L, acceptableTypeIDs.at(i)), buff_left);
buff_left = sizeof(expected) - 1 - strlen((char*)&expected);
}
else
{
const char *comma_txt = ", ";
strlcat((char*)&expected, comma_txt, buff_left);
buff_left -= strlen(comma_txt);
strlcat((char*)&expected, lua_typename(L, acceptableTypeIDs.at(i)), buff_left);
buff_left -= sizeof(expected) - 1 - strlen((char*)&expected);
}
}
luaL_typerror(L, arg, expected);
}
return 0;
}
int luaL_typerror(lua_State *L, int narg, const char *tname)
{
const char *msg = lua_pushfstring(L, "%s expected, got %s", tname,
luaL_typename(L, narg));
return luaL_argerror(L, narg, msg);
}
void pushLuaErrorEvent(lua_State *L, const char *fmt, ...)
{
// Get Lua state info
lua_Debug ar;
lua_getstack(L, 1, &ar);
lua_getinfo(L, "nSl", &ar);
// Prep a string that tells us where the error originated
char scriptinfo[256];
slprintf(scriptinfo, sizeof(scriptinfo)-1, " %s:%d", ar.short_src, ar.currentline);
// Actually format the error we were given
char buffer[2048];
va_list va_alist;
va_start(va_alist, fmt);
_vsnprintf_s(buffer, sizeof(buffer), fmt, va_alist);
va_end(va_alist);
// Queue it
MicroMacro::Event e;
e.type = MicroMacro::EVENT_ERROR;
e.msg = buffer;
e.msg += scriptinfo;
//Macro::instance()->getEventQueue()->push(e);
Macro::instance()->pushEvent(e);
}
| 23.501946
| 95
| 0.665232
|
BlubBlab
|
cb4608985ca07706758e1f4c511dc8a060def709
| 1,699
|
cpp
|
C++
|
stimulus.cpp
|
dcblack/ModernSystemC
|
953740c6d796cd3a2f60108c5093f0366d6ee3bd
|
[
"Apache-2.0"
] | 29
|
2019-06-17T20:46:21.000Z
|
2022-03-21T13:13:42.000Z
|
stimulus.cpp
|
dcblack/ModernSystemC
|
953740c6d796cd3a2f60108c5093f0366d6ee3bd
|
[
"Apache-2.0"
] | 4
|
2019-11-07T18:42:32.000Z
|
2021-09-16T19:03:21.000Z
|
stimulus.cpp
|
dcblack/ModernSystemC
|
953740c6d796cd3a2f60108c5093f0366d6ee3bd
|
[
"Apache-2.0"
] | 7
|
2020-02-04T17:17:28.000Z
|
2021-11-05T23:16:23.000Z
|
/**
* @file stimulus.cpp
*/
#include "stimulus.hpp"
#include "objection.hpp"
#include "report.hpp"
#include <random>
using namespace sc_core;
namespace {
char const * const MSGID{ "/Doulos/Example/Modern/Stimulus_module" };
}
//..............................................................................
Stimulus_module::Stimulus_module( sc_module_name instance ) //< Constructor
: sc_module( instance )
{
SC_HAS_PROCESS( Stimulus_module );
SC_THREAD( stimulus_thread );
}
//..............................................................................
Stimulus_module::~Stimulus_module( void ) = default;
//..............................................................................
void Stimulus_module::stimulus_thread( void )
{
Objection generating_data( name() );
unsigned int seed = 1;
std::default_random_engine generator(seed);
std::uniform_real_distribution<double> distribution (-128.0,128.0);
std::vector<double> directed = { 0.0, 1.0, 2.0, 3.0, 4.0, 5.0 };
size_t samples = directed.size()*directed.size()*directed.size();
REPORT( INFO, "Sending " << samples << " directed samples" );
for( auto const& x : directed ) {
for( auto const& y : directed ) {
for( auto const& z : directed ) {
Coordinate xyz{ x, y, z };
rawout_port->write( xyz );
INFO( DEBUG, "Sent " << xyz );
}
}
}
samples = 1000;
REPORT( INFO, "Sending " << samples << " random samples" );
for( size_t n=0; n<samples; ++n ) {
Coordinate xyz = { distribution(generator), distribution(generator), distribution(generator) };
rawout_port->write( xyz );
INFO( DEBUG, "Sent " << xyz );
}
REPORT( INFO, "Stimulus complete" );
}
| 32.673077
| 99
| 0.560918
|
dcblack
|