脱离Windows,并跨平台

This commit is contained in:
sin365 2024-07-29 10:46:59 +08:00
parent 68e785525d
commit 140de72f79
218 changed files with 3403 additions and 10515 deletions

View File

@ -0,0 +1,455 @@
using System;
namespace MAME.Core.AxiBitmap
{
public struct AxiColor
{
public byte r, g, b, a;
// 构造函数
public AxiColor(byte _r, byte _g, byte _b)
{
r = _r;
g = _g;
b = _b;
a = 255;
}
public AxiColor(byte _r, byte _g, byte _b, byte _a)
{
r = _r;
g = _g;
b = _b;
a = _a;
}
public static AxiColor FromArgb(int argb)
{
byte a = (byte)((argb >> 24) & 0xFF);
byte r = (byte)((argb >> 16) & 0xFF);
byte g = (byte)((argb >> 8) & 0xFF);
byte b = (byte)(argb & 0xFF);
return new AxiColor { r = r, g = g, b = b, a = a };
}
public static int ToArgb(AxiColor color)
{
return (color.a << 24) | (color.r << 16) | (color.g << 8) | color.b;
}
#region
public static AxiColor Transparent => new AxiColor(0, 0, 0, 0);
public static AxiColor AliceBlue => new AxiColor(240, 248, 255);
public static AxiColor AntiqueWhite => new AxiColor(250, 235, 215);
public static AxiColor Aqua => new AxiColor(0, 255, 255);
public static AxiColor Aquamarine => new AxiColor(127, 255, 212);
public static AxiColor Azure => new AxiColor(240, 255, 255);
public static AxiColor Beige => new AxiColor(245, 245, 220);
public static AxiColor Bisque => new AxiColor(255, 228, 196);
public static AxiColor Black => new AxiColor(0, 0, 0);
public static AxiColor BlanchedAlmond => new AxiColor(255, 235, 205);
public static AxiColor Blue => new AxiColor(0, 0, 255);
public static AxiColor BlueViolet => new AxiColor(138, 43, 226);
public static AxiColor Brown => new AxiColor(165, 42, 42);
public static AxiColor BurlyWood => new AxiColor(222, 184, 135);
public static AxiColor CadetBlue => new AxiColor(95, 158, 160);
public static AxiColor Chartreuse => new AxiColor(127, 255, 0);
public static AxiColor Chocolate => new AxiColor(210, 105, 30);
public static AxiColor Coral => new AxiColor(255, 127, 80);
public static AxiColor CornflowerBlue => new AxiColor(100, 149, 237);
public static AxiColor Cornsilk => new AxiColor(255, 248, 220);
public static AxiColor Crimson => new AxiColor(220, 20, 60);
public static AxiColor Cyan => new AxiColor(0, 255, 255);
public static AxiColor DarkBlue => new AxiColor(0, 0, 139);
public static AxiColor DarkCyan => new AxiColor(0, 139, 139);
public static AxiColor DarkGoldenrod => new AxiColor(184, 134, 11);
public static AxiColor DarkGray => new AxiColor(169, 169, 169);
public static AxiColor DarkGreen => new AxiColor(0, 100, 0);
public static AxiColor DarkKhaki => new AxiColor(189, 183, 107);
public static AxiColor DarkMagenta => new AxiColor(139, 0, 139);
public static AxiColor DarkOliveGreen => new AxiColor(85, 107, 47);
public static AxiColor DarkOrange => new AxiColor(255, 140, 0);
public static AxiColor DarkOrchid => new AxiColor(153, 50, 204);
public static AxiColor DarkRed => new AxiColor(139, 0, 0);
public static AxiColor DarkSalmon => new AxiColor(233, 150, 122);
public static AxiColor DarkSeaGreen => new AxiColor(143, 188, 143);
public static AxiColor DarkSlateBlue => new AxiColor(72, 61, 139);
public static AxiColor DarkSlateGray => new AxiColor(47, 79, 79);
public static AxiColor DarkViolet => new AxiColor(148, 0, 211);
public static AxiColor DeepPink => new AxiColor(255, 20, 147);
public static AxiColor DeepSkyBlue => new AxiColor(0, 191, 255);
public static AxiColor DimGray => new AxiColor(105, 105, 105);
public static AxiColor DodgerBlue => new AxiColor(30, 144, 255);
public static AxiColor FireBrick => new AxiColor(178, 34, 34);
public static AxiColor FloralWhite => new AxiColor(255, 250, 240);
public static AxiColor ForestGreen => new AxiColor(34, 139, 34);
public static AxiColor Fuchsia => new AxiColor(255, 0, 255);
public static AxiColor Gainsboro => new AxiColor(220, 220, 220);
public static AxiColor GhostWhite => new AxiColor(248, 248, 255);
public static AxiColor Gold => new AxiColor(255, 215, 0);
public static AxiColor Goldenrod => new AxiColor(218, 165, 32);
public static AxiColor Gray => new AxiColor(128, 128, 128);
public static AxiColor Green => new AxiColor(0, 128, 0);
public static AxiColor GreenYellow => new AxiColor(173, 255, 47);
public static AxiColor Honeydew => new AxiColor(240, 255, 240);
public static AxiColor HotPink => new AxiColor(255, 105, 180);
public static AxiColor IndianRed => new AxiColor(205, 92, 92);
public static AxiColor Indigo => new AxiColor(75, 0, 130);
public static AxiColor Ivory => new AxiColor(255, 255, 240);
public static AxiColor Khaki => new AxiColor(240, 230, 140);
public static AxiColor Lavender => new AxiColor(230, 230, 250);
public static AxiColor LavenderBlush => new AxiColor(255, 240, 245);
public static AxiColor LawnGreen => new AxiColor(124, 252, 0);
public static AxiColor LemonChiffon => new AxiColor(255, 250, 205);
public static AxiColor LightBlue => new AxiColor(173, 216, 230);
public static AxiColor LightCoral => new AxiColor(240, 128, 128);
public static AxiColor LightCyan => new AxiColor(224, 255, 255);
public static AxiColor LightGoldenrodYellow => new AxiColor(250, 250, 210);
public static AxiColor LightGray => new AxiColor(211, 211, 211);
public static AxiColor LightGreen => new AxiColor(144, 238, 144);
public static AxiColor LightPink => new AxiColor(255, 182, 193);
public static AxiColor LightSalmon => new AxiColor(255, 160, 122);
public static AxiColor LightSeaGreen => new AxiColor(32, 178, 170);
public static AxiColor LightSkyBlue => new AxiColor(135, 206, 250);
public static AxiColor LightSlateGray => new AxiColor(119, 136, 153);
public static AxiColor LightYellow => new AxiColor(255, 255, 224);
public static AxiColor Lime => new AxiColor(0, 255, 0);
public static AxiColor LimeGreen => new AxiColor(50, 205, 50);
public static AxiColor Linen => new AxiColor(250, 240, 230);
public static AxiColor Magenta => new AxiColor(255, 0, 255);
public static AxiColor Maroon => new AxiColor(176, 48, 96);
public static AxiColor MediumAquamarine => new AxiColor(102, 205, 170);
public static AxiColor MediumBlue => new AxiColor(0, 0, 205);
public static AxiColor MediumOrchid => new AxiColor(186, 85, 211);
public static AxiColor MediumPurple => new AxiColor(147, 112, 219);
public static AxiColor MediumSeaGreen => new AxiColor(60, 179, 113);
public static AxiColor MediumSlateBlue => new AxiColor(123, 104, 238);
public static AxiColor MediumSpringGreen => new AxiColor(0, 250, 154);
public static AxiColor MediumTurquoise => new AxiColor(72, 209, 204);
public static AxiColor MediumVioletRed => new AxiColor(199, 21, 133);
public static AxiColor MidnightBlue => new AxiColor(25, 25, 112);
public static AxiColor MintCream => new AxiColor(245, 255, 250);
public static AxiColor MistyRose => new AxiColor(255, 228, 225);
public static AxiColor Moccasin => new AxiColor(255, 228, 181);
public static AxiColor NavajoWhite => new AxiColor(255, 222, 173);
public static AxiColor Navy => new AxiColor(0, 0, 128);
public static AxiColor OldLace => new AxiColor(253, 245, 230);
public static AxiColor Olive => new AxiColor(128, 128, 0);
public static AxiColor OliveDrab => new AxiColor(107, 142, 35);
public static AxiColor Orange => new AxiColor(255, 165, 0);
public static AxiColor OrangeRed => new AxiColor(255, 69, 0);
public static AxiColor Orchid => new AxiColor(218, 112, 214);
public static AxiColor PaleGoldenrod => new AxiColor(238, 232, 170);
public static AxiColor PaleGreen => new AxiColor(152, 251, 152);
public static AxiColor PaleTurquoise => new AxiColor(175, 238, 238);
public static AxiColor PaleVioletRed => new AxiColor(219, 112, 147);
public static AxiColor PapayaWhip => new AxiColor(255, 239, 213);
public static AxiColor PeachPuff => new AxiColor(255, 218, 185);
public static AxiColor Peru => new AxiColor(205, 133, 63);
public static AxiColor Pink => new AxiColor(255, 192, 203);
public static AxiColor Plum => new AxiColor(221, 160, 221);
public static AxiColor PowderBlue => new AxiColor(176, 224, 230);
public static AxiColor Purple => new AxiColor(160, 32, 240);
public static AxiColor Red => new AxiColor(255, 0, 0);
public static AxiColor RosyBrown => new AxiColor(188, 143, 143);
public static AxiColor RoyalBlue => new AxiColor(65, 105, 225);
public static AxiColor SaddleBrown => new AxiColor(139, 69, 19);
public static AxiColor Salmon => new AxiColor(250, 128, 114);
public static AxiColor SandyBrown => new AxiColor(244, 164, 96);
public static AxiColor SeaGreen => new AxiColor(46, 139, 87);
public static AxiColor SeaShell => new AxiColor(255, 245, 238);
public static AxiColor Sienna => new AxiColor(160, 82, 45);
public static AxiColor Silver => new AxiColor(192, 192, 192);
public static AxiColor SkyBlue => new AxiColor(135, 206, 235);
public static AxiColor SlateBlue => new AxiColor(106, 90, 205);
public static AxiColor SlateGray => new AxiColor(112, 128, 144);
public static AxiColor Snow => new AxiColor(255, 250, 250);
public static AxiColor SpringGreen => new AxiColor(0, 255, 127);
public static AxiColor SteelBlue => new AxiColor(70, 130, 180);
public static AxiColor Tan => new AxiColor(210, 180, 140);
public static AxiColor Teal => new AxiColor(0, 128, 128);
public static AxiColor Thistle => new AxiColor(216, 191, 216);
public static AxiColor Tomato => new AxiColor(255, 99, 71);
public static AxiColor Turquoise => new AxiColor(64, 224, 208);
public static AxiColor Violet => new AxiColor(238, 130, 238);
public static AxiColor Wheat => new AxiColor(245, 222, 179);
public static AxiColor White => new AxiColor(255, 255, 255);
public static AxiColor WhiteSmoke => new AxiColor(245, 245, 245);
public static AxiColor Yellow => new AxiColor(255, 255, 0);
public static AxiColor YellowGreen => new AxiColor(154, 205, 50);
#endregion
}
public struct Rectangle
{
public int X;
public int Y;
public int Width;
public int Height;
public Rectangle(int x, int y, int width, int height)
{
X = x;
Y = y;
Width = width;
Height = height;
}
public int Right => X + Width;
public int Bottom => Y + Height;
public int Area { get { return Width * Height; } }
public bool Contains(int pointX, int pointY) { return pointX >= X && pointX < X + Width && pointY >= Y && pointY < Y + Height; }
}
public enum RotateFlipType
{
RotateNoneFlipNone = 0,
Rotate90FlipNone = 1,
Rotate180FlipNone = 2,
Rotate270FlipNone = 3,
RotateNoneFlipX = 4,
Rotate90FlipX = 5,
Rotate180FlipX = 6,
Rotate270FlipX = 7,
RotateNoneFlipY = Rotate180FlipX, // 注意FlipY 可以通过FlipX两次来实现但这里为了完整性列出
Rotate90FlipY = 5, // 注意FlipY在这里与FlipX相同角度的旋转结合因为直接FlipY不是90度的倍数
Rotate180FlipY = 6,
Rotate270FlipY = 7,
// 注意上面的FlipY情况实际上在90度旋转的上下文中并不直接对应因为FlipY通常意味着沿Y轴翻转
// 但在这里我们假设FlipX和FlipY在枚举中是为了完整性。在实际应用中您可能只需要处理FlipNone。
}
public class AxiBitmap
{
public AxiColor[] mData;
public int Width;
public int Height;
public AxiBitmap(int width, int height)
{
Width = width;
Height = height;
mData = new AxiColor[width * height];
}
public void SetPixel(int x, int y, AxiColor color)
{
mData[y * Width + x] = color;
}
public AxiColor GetPixel(int x, int y)
{
return mData[y * Width + x];
}
//public AxiBitmap Clone(Rectangle rect)
//{
// // 检查矩形是否超出位图边界
// if (rect.X < 0 || rect.Right > Width || rect.Y < 0 || rect.Bottom > Height)
// {
// throw new ArgumentException("out of");
// }
// AxiBitmap clonedBitmap = new AxiBitmap(rect.Width, rect.Height);
// int srcStartIndex = rect.Y * Width + rect.X;
// for (int y = 0; y < rect.Height; y++)
// {
// Array.Copy(mData, srcStartIndex + y * Width, clonedBitmap.mData, y * rect.Width, rect.Width);
// }
// return clonedBitmap;
//}
}
public static class AxiBitmapEx
{
public static int ToArgb(this AxiColor color)
{
return (color.a << 24) | (color.r << 16) | (color.g << 8) | color.b;
}
//public static AxiBitmap Clone(this AxiBitmap baseBitmap, Rectangle rect)
//{
// unsafe
// {
// if (rect.X < 0 || rect.Right > baseBitmap.Width || rect.Y < 0 || rect.Bottom > baseBitmap.Height)
// {
// throw new ArgumentException("The rectangle is out of the bitmap bounds.");
// }
// AxiBitmap clonedBitmap = new AxiBitmap(rect.Width, rect.Height);
// for (int y = 0; y < rect.Height; y++)
// {
// int srcStartIndex = (rect.Y + y) * baseBitmap.Width * sizeof(AxiColor) + rect.X * sizeof(AxiColor);
// int dstStartIndex = y * rect.Width * sizeof(AxiColor);
// Array.Copy(baseBitmap.mData, srcStartIndex, clonedBitmap.mData, dstStartIndex, rect.Width * sizeof(AxiColor));
// }
// return clonedBitmap;
// }
//}
public static void Clear(this AxiBitmap baseBitmap, AxiColor color)
{
}
public static int[] CloneIntColorArr(int[] baseBitmap, int Width, int Height, Rectangle rect)
{
// 检查矩形是否超出位图边界
if (rect.X < 0 || rect.Right > Width || rect.Y < 0 || rect.Bottom > Height)
{
throw new ArgumentException("out of");
}
//int[] result = new int[Width * Height];
int[] result = new int[rect.Width * rect.Height];
int srcStartIndex = rect.Y * Width + rect.X;
for (int y = 0; y < rect.Height; y++)
{
Array.Copy(baseBitmap, srcStartIndex + y * Width, result, y * rect.Width, rect.Width);
}
return result;
}
//public static int[] CloneIntColorArr(int[] baseBitmap, int Width, int Height, Rectangle rect)
//{
// unsafe
// {
// if (rect.X < 0 || rect.Right > Width || rect.Y < 0 || rect.Bottom > Height)
// {
// throw new ArgumentException("The rectangle is out of the bitmap bounds.");
// }
// int[] result = new int[Width * Height];
// for (int y = 0; y < rect.Height; y++)
// {
// int srcStartIndex = (rect.Y + y) * Width * sizeof(int) + rect.X * sizeof(int);
// int dstStartIndex = y * rect.Width * sizeof(int);
// Array.Copy(baseBitmap, srcStartIndex, result, dstStartIndex, rect.Width * sizeof(int));
// }
// return result;
// }
//}
// DrawImage 方法,用于在当前 AxiBitmap 上绘制另一个 AxiBitmap 的一部分
public static void DrawImage(this AxiBitmap baseBitmap, AxiBitmap source, Rectangle destRect, Rectangle srcRect)
{
if (!source.Contains(srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height))
throw new ArgumentException("Err");
// 遍历源矩形的每个像素
for (int y = srcRect.Y; y < srcRect.Bottom; y++)
{
for (int x = srcRect.X; x < srcRect.Right; x++)
{
// 计算目标位置
int destX = destRect.X + (x - srcRect.X);
int destY = destRect.Y + (y - srcRect.Y);
// 确保目标位置在当前位图范围内(如果需要)
// if (destX < 0 || destX >= Width || destY < 0 || destY >= Height)
// continue; // 或者抛出异常,取决于你的需求
// 获取源像素并设置到目标位置
AxiColor sourceColor = source.GetPixel(x, y);
baseBitmap.SetPixel(destX, destY, sourceColor);
// 如果需要处理透明度混合,则在这里添加代码
// 注意:你的 AxiColor 已经包含了 alpha 通道,但 SetPixel 并没有使用它
// 你可能需要实现一个混合像素的方法,比如 BlendPixels
}
}
}
// 辅助方法,用于检查一个点是否在位图范围内
private static bool Contains(this AxiBitmap baseBitmap, int x, int y, int width, int height)
{
return x >= 0 && x + width <= baseBitmap.Width && y >= 0 && y + height <= baseBitmap.Height;
}
// ... 其他省略 ...
public static void RotateFlip(this AxiBitmap baseBitmap, RotateFlipType rotateFlipType)
{
// 先处理旋转部分
switch (rotateFlipType)
{
case RotateFlipType.Rotate90FlipNone:
Rotate90(baseBitmap);
break;
case RotateFlipType.Rotate180FlipNone:
Rotate180(baseBitmap);
break;
case RotateFlipType.Rotate270FlipNone:
Rotate270(baseBitmap);
break;
// 如果需要处理FlipX或FlipY可以添加额外的case或方法
default:
// 无需旋转或翻转
break;
}
// 注意这里没有处理FlipX或FlipY因为通常它们不是通过旋转来实现的
// 如果需要FlipX或FlipY请添加额外的逻辑
}
private static void Rotate90(this AxiBitmap baseBitmap)
{
int newWidth = baseBitmap.Height;
int newHeight = baseBitmap.Width;
AxiColor[] newData = new AxiColor[baseBitmap.mData.Length];
for (int x = 0; x < baseBitmap.Width; x++)
{
for (int y = 0; y < baseBitmap.Height; y++)
{
int oldIndex = (y * baseBitmap.Width + x);
int newIndex = (newHeight - 1 - x) * newWidth + y;
newData[newIndex] = baseBitmap.mData[oldIndex];
}
}
baseBitmap.mData = newData;
baseBitmap.Width = newWidth;
baseBitmap.Height = newHeight;
}
private static void Rotate180(this AxiBitmap baseBitmap)
{
for (int y = 0; y < baseBitmap.Height / 2; y++)
{
for (int x = 0; x < baseBitmap.Width; x++)
{
int topLeftIndex = y * baseBitmap.Width + x;
int bottomRightIndex = (baseBitmap.Height - 1 - y) * baseBitmap.Width + x;
AxiColor temp = baseBitmap.mData[topLeftIndex];
baseBitmap.mData[topLeftIndex] = baseBitmap.mData[bottomRightIndex];
baseBitmap.mData[bottomRightIndex] = temp;
}
}
}
private static void Rotate270(this AxiBitmap baseBitmap)
{
// Rotate270 可以通过 Rotate90 两次或 Rotate180 后再 Rotate90 来实现
// 这里直接实现 Rotate270 以避免额外的旋转调用
int newWidth = baseBitmap.Height;
int newHeight = baseBitmap.Width;
AxiColor[] newData = new AxiColor[baseBitmap.mData.Length];
for (int x = 0; x < baseBitmap.Width; x++)
{
for (int y = 0; y < baseBitmap.Height; y++)
{
int oldIndex = (y * baseBitmap.Width + x);
int newIndex = y * newWidth + (newWidth - 1 - x);
newData[newIndex] = baseBitmap.mData[oldIndex];
}
}
baseBitmap.mData = newData;
baseBitmap.Width = newWidth;
baseBitmap.Height = newHeight;
}
}
}

View File

@ -1,298 +0,0 @@
using mame;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.Globalization;
using System.IO;
using static System.Net.Mime.MediaTypeNames;
using static System.Net.WebRequestMethods;
namespace MAME.Core.Common
{
public partial class cpsForm
{
private mainForm _myParentForm;
private string[] sde2 = new string[] { "," };
private int locationX, locationY;
#region
public bool cbLockpal = false;
public bool cbRowscroll = false;
public string tbInput = string.Empty;
public bool cbL0 = false;
public bool cbL1 = false;
public bool cbL2 = false;
public bool cbL3 = false;
public string tbFile = string.Empty;
public string tbPoint = string.Empty;
public int cbLayer = 0;
public string tbCode = string.Empty;
public string tbColor = string.Empty;
public string tbScroll1x = string.Empty;
public string tbScroll1y = string.Empty;
public string tbScroll2x = string.Empty;
public string tbScroll2y = string.Empty;
public string tbScroll3x = string.Empty;
public string tbScroll3y = string.Empty;
public string tbScrollsx = string.Empty;
public string tbScrollsy = string.Empty;
public List<string> tbResult = new List<string>();
#endregion
public cpsForm(mainForm form)
{
this._myParentForm = form;
}
private void cpsForm_Load(object sender, EventArgs e)
{
cbL0 = true;
cbL1 = true;
cbL2 = true;
cbL3 = true;
tbFile = "00";
tbPoint = "512,512,0,256";
cbLayer = 0;
tbCode = "0000";
tbColor = "00";
}
private void GetData()
{
tbScroll1x = CPS.scroll1x.ToString("X4");
tbScroll1y = CPS.scroll1y.ToString("X4");
tbScroll2x = CPS.scroll2x.ToString("X4");
tbScroll2y = CPS.scroll2y.ToString("X4");
tbScroll3x = CPS.scroll3x.ToString("X4");
tbScroll3y = CPS.scroll3y.ToString("X4");
tbScrollsx = CPS.scrollxSG.ToString();
tbScrollsy = CPS.scrollySG.ToString();
}
private Bitmap GetTile0(int gfxset, int code1, int iColor)
{
int i1, i2, i3, i4, i5, i6;
int iCode, iByte, cols, rows;
int tilewidth, tileheight;
int iOffset;
int idx = 0;
Color c1;
Bitmap bm1;
int width, height;
int x0, y0, dx0, dy0;
int ratio = 4;
width = 0x200;
height = 0x200;
tilewidth = 8;
tileheight = 8;
cols = width / tilewidth / ratio;
rows = height / tileheight / ratio;
bm1 = new Bitmap(width, height);
BitmapData bmData;
bmData = bm1.LockBits(new Rectangle(0, 0, bm1.Width, bm1.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
unsafe
{
byte* ptr = (byte*)(bmData.Scan0);
byte* ptr2 = (byte*)0;
for (i3 = 0; i3 < cols; i3++)
{
for (i4 = 0; i4 < rows; i4++)
{
iCode = code1 + i4 * 0x10 + i3;
x0 = tilewidth * i3;
y0 = tileheight * i4;
dx0 = 1;
dy0 = 1;
for (i1 = 0; i1 < tilewidth; i1++)
{
for (i2 = 0; i2 < tileheight; i2++)
{
iOffset = iCode * 0x80 + gfxset * 8 + i1 + i2 * 16;
iByte = CPS.gfx1rom[iOffset];
idx = iColor * 0x10 + iByte;
c1 = CPS.cc1G[idx];
for (i5 = 0; i5 < ratio; i5++)
{
for (i6 = 0; i6 < ratio; i6++)
{
ptr2 = ptr + (((y0 + dy0 * i2) * ratio + i6) * width + ((x0 + dx0 * i1) * ratio + i5)) * 4;
*ptr2 = c1.B;
*(ptr2 + 1) = c1.G;
*(ptr2 + 2) = c1.R;
*(ptr2 + 3) = c1.A;
}
}
}
}
}
}
}
bm1.UnlockBits(bmData);
return bm1;
}
private Bitmap GetTile1(int code1, int iColor)
{
int i1, i2, i3, i4, i5, i6;
int iCode, iByte, cols, rows;
int tilewidth, tileheight;
int iOffset;
int idx = 0;
Color c1;
Bitmap bm1;
int width, height;
int x0, y0, dx0, dy0;
int ratio = 2;
width = 0x200;
height = 0x200;
tilewidth = 16;
tileheight = 16;
cols = width / tilewidth / ratio;
rows = height / tileheight / ratio;
bm1 = new Bitmap(width, height);
BitmapData bmData;
bmData = bm1.LockBits(new Rectangle(0, 0, bm1.Width, bm1.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
unsafe
{
byte* ptr = (byte*)(bmData.Scan0);
byte* ptr2 = (byte*)0;
for (i3 = 0; i3 < cols; i3++)
{
for (i4 = 0; i4 < rows; i4++)
{
iCode = code1 + i4 * 0x10 + i3;
x0 = tilewidth * i3;
y0 = tileheight * i4;
dx0 = 1;
dy0 = 1;
for (i1 = 0; i1 < tilewidth; i1++)
{
for (i2 = 0; i2 < tileheight; i2++)
{
iOffset = iCode * 0x40 * 4 + i1 + i2 * 16;
iByte = CPS.gfx1rom[iOffset];
idx = iColor * 0x10 + iByte;
c1 = CPS.cc1G[idx];
for (i5 = 0; i5 < ratio; i5++)
{
for (i6 = 0; i6 < ratio; i6++)
{
ptr2 = ptr + (((y0 + dy0 * i2) * ratio + i6) * width + ((x0 + dx0 * i1) * ratio + i5)) * 4;
*ptr2 = c1.B;
*(ptr2 + 1) = c1.G;
*(ptr2 + 2) = c1.R;
*(ptr2 + 3) = c1.A;
}
}
}
}
}
}
}
bm1.UnlockBits(bmData);
return bm1;
}
private Bitmap GetTile2(int code1, int iColor)
{
int i1, i2, i3, i4, i5, i6;
int iCode, iByte, cols, rows;
int tilewidth, tileheight;
int iOffset;
int idx = 0;
Color c1;
Bitmap bm1;
int width, height;
int x0, y0, dx0, dy0;
int ratio = 1;
width = 0x200;
height = 0x200;
tilewidth = 32;
tileheight = 32;
cols = width / tilewidth / ratio;
rows = height / tileheight / ratio;
bm1 = new Bitmap(width, height);
BitmapData bmData;
bmData = bm1.LockBits(new Rectangle(0, 0, bm1.Width, bm1.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
unsafe
{
byte* ptr = (byte*)(bmData.Scan0);
byte* ptr2 = (byte*)0;
for (i3 = 0; i3 < cols; i3++)
{
for (i4 = 0; i4 < rows; i4++)
{
iCode = code1 + i4 * 0x10 + i3;
x0 = tilewidth * i3;
y0 = tileheight * i4;
dx0 = 1;
dy0 = 1;
for (i1 = 0; i1 < tilewidth; i1++)
{
for (i2 = 0; i2 < tileheight; i2++)
{
iOffset = iCode * 0x40 * 16 + i1 + i2 * 16 * 2;
iByte = CPS.gfx1rom[iOffset];
idx = iColor * 0x10 + iByte;
c1 = CPS.cc1G[idx];
for (i5 = 0; i5 < ratio; i5++)
{
for (i6 = 0; i6 < ratio; i6++)
{
ptr2 = ptr + (((y0 + dy0 * i2) * ratio + i6) * width + ((x0 + dx0 * i1) * ratio + i5)) * 4;
*ptr2 = c1.B;
*(ptr2 + 1) = c1.G;
*(ptr2 + 2) = c1.R;
*(ptr2 + 3) = c1.A;
}
}
}
}
}
}
}
bm1.UnlockBits(bmData);
return bm1;
}
private void DumpRam()
{
BinaryWriter bw1 = new BinaryWriter(new FileStream("dump1.dat", FileMode.Create));
bw1.Write(Memory.mainram, 0, 0x10000);
bw1.Close();
BinaryWriter bw2 = new BinaryWriter(new FileStream("dump2.dat", FileMode.Create));
bw2.Write(CPS.gfxram, 0, 0x30000);
bw2.Close();
BinaryWriter bw3 = new BinaryWriter(new FileStream("dump3.dat", FileMode.Create));
int i;
for (i = 0; i < 0x20; i++)
{
bw3.Write(CPS.cps_a_regs[i]);
}
for (i = 0; i < 0x20; i++)
{
bw3.Write(CPS.cps_b_regs[i]);
}
bw3.Close();
}
private void WriteRam()
{
byte[] bb1 = new byte[0x10000], bb2 = new byte[0x30000], bb3 = new byte[0x80];
BinaryReader br1 = new BinaryReader(new FileStream("dump1.dat", FileMode.Open));
br1.Read(bb1, 0, 0x10000);
br1.Close();
Array.Copy(bb1, Memory.mainram, 0x10000);
BinaryReader br2 = new BinaryReader(new FileStream("dump2.dat", FileMode.Open));
br2.Read(bb2, 0, 0x30000);
br2.Close();
Array.Copy(bb2, CPS.gfxram, 0x30000);
BinaryReader br3 = new BinaryReader(new FileStream("dump3.dat", FileMode.Open));
br3.Read(bb3, 0, 0x80);
br3.Close();
int i;
for (i = 0; i < 0x20; i++)
{
CPS.cps_a_regs[i] = (ushort)(bb3[i * 2] + bb3[i * 2 + 1] * 0x100);
}
for (i = 0; i < 0x20; i++)
{
CPS.cps_b_regs[i] = (ushort)(bb3[0x40 + i * 2] + bb3[0x40 + i * 2 + 1] * 0x100);
}
}
}
}

View File

@ -1,28 +0,0 @@
using mame;
using System;
using System.Drawing;
using System.Drawing.Imaging;
using static System.Net.Mime.MediaTypeNames;
namespace MAME.Core.Common
{
public class konami68000Form
{
private mainForm _myParentForm;
private int locationX, locationY;
#region
public bool cbT0 = false;
public bool cbT1 = false;
public bool cbT2 = false;
public bool cbSprite = false;
public Bitmap pictureBox1;
public string tbSprite;
#endregion
public konami68000Form(mainForm form)
{
this._myParentForm = form;
tbSprite = "0000-4000";
}
}
}

View File

@ -0,0 +1,25 @@
using MAME.Core.run_interface;
using System;
namespace mame
{
public static class EmuLogger
{
#region
static Action<string> Act_Log;
public static void BindFunc(ILog ilog)
{
Act_Log -= Act_Log;
Act_Log += ilog.Log;
}
public static void Log(string msg)
{
Act_Log?.Invoke(msg);
}
#endregion
}
}

View File

@ -5,9 +5,4 @@
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ImageProcessor.Core" Version="1.1.0" />
<PackageReference Include="LamarCodeGeneration" Version="6.3.0" />
</ItemGroup>
</Project>

View File

@ -3,11 +3,10 @@ using cpu.nec;
using mame;
using System;
using System.Collections.Generic;
using System.Text;
namespace MAME.Core.Common
{
public partial class cheatForm
public partial class cheatMotion
{
public enum LockState
{
@ -15,7 +14,6 @@ namespace MAME.Core.Common
LOCK_SECOND,
LOCK_FRAME,
}
private mainForm _myParentForm;
public LockState lockState = LockState.LOCK_NONE;
public List<int[]> lsCheatdata1;
public List<int[]> lsCheatdata2;
@ -27,9 +25,8 @@ namespace MAME.Core.Common
#region
List<string> mTxList_tbResult = new List<string>();
#endregion
public cheatForm(mainForm form)
public cheatMotion()
{
this._myParentForm = form;
cheatForm_Load();
}
private void cheatForm_Load()
@ -69,45 +66,45 @@ namespace MAME.Core.Common
}
private void GetCheatdata()
{
// lsCheatdata1 = new List<int[]>();
// lsCheatdata2 = new List<int[]>();
// int i1, i2, i3, iAddress, iOffsetAddress1, iOffsetAddress2, iValue2, n3;
// string[] ss1, ss2, ss3;
// foreach (ListViewItem item1 in listViewControl1.myListView.Items)
// {
// if (item1.Checked)
// {
// i1 = listViewControl1.myListView.Items.IndexOf(item1);
// i2 = Array.IndexOf(listViewControl1.ssCItem[i1], item1.SubItems[1].Text);
// ss1 = listViewControl1.ssCValue[i1][i2].Split(sde7, StringSplitOptions.RemoveEmptyEntries);
// n3 = ss1.Length;
// for (i3 = 0; i3 < n3; i3++)
// {
// ss3 = ss1[i3].Split(sde6, StringSplitOptions.RemoveEmptyEntries);
// iValue2 = Convert.ToInt32(ss3[1], 16);
// if (ss3[0].IndexOf("$") >= 0)
// {
// ss2 = ss3[0].Split(sde9, StringSplitOptions.RemoveEmptyEntries);
// iOffsetAddress1 = Convert.ToInt32(ss2[0], 16);
// iOffsetAddress2 = Convert.ToInt32(ss2[1], 16);
// lsCheatdata1.Add(new int[] { iOffsetAddress1, iOffsetAddress2, iValue2 });
// }
// else if (ss3[0].IndexOf("+") >= 0)
// {
// ss2 = ss3[0].Split(sde10, StringSplitOptions.RemoveEmptyEntries);
// iOffsetAddress1 = Convert.ToInt32(ss2[0], 16);
// iOffsetAddress2 = Convert.ToInt32(ss2[1], 16);
// iAddress = iOffsetAddress1 + iOffsetAddress2;
// lsCheatdata2.Add(new int[] { iAddress, iValue2 });
// }
// else
// {
// iAddress = Convert.ToInt32(ss3[0], 16);
// lsCheatdata2.Add(new int[] { iAddress, iValue2 });
// }
// }
// }
// }
// lsCheatdata1 = new List<int[]>();
// lsCheatdata2 = new List<int[]>();
// int i1, i2, i3, iAddress, iOffsetAddress1, iOffsetAddress2, iValue2, n3;
// string[] ss1, ss2, ss3;
// foreach (ListViewItem item1 in listViewControl1.myListView.Items)
// {
// if (item1.Checked)
// {
// i1 = listViewControl1.myListView.Items.IndexOf(item1);
// i2 = Array.IndexOf(listViewControl1.ssCItem[i1], item1.SubItems[1].Text);
// ss1 = listViewControl1.ssCValue[i1][i2].Split(sde7, StringSplitOptions.RemoveEmptyEntries);
// n3 = ss1.Length;
// for (i3 = 0; i3 < n3; i3++)
// {
// ss3 = ss1[i3].Split(sde6, StringSplitOptions.RemoveEmptyEntries);
// iValue2 = Convert.ToInt32(ss3[1], 16);
// if (ss3[0].IndexOf("$") >= 0)
// {
// ss2 = ss3[0].Split(sde9, StringSplitOptions.RemoveEmptyEntries);
// iOffsetAddress1 = Convert.ToInt32(ss2[0], 16);
// iOffsetAddress2 = Convert.ToInt32(ss2[1], 16);
// lsCheatdata1.Add(new int[] { iOffsetAddress1, iOffsetAddress2, iValue2 });
// }
// else if (ss3[0].IndexOf("+") >= 0)
// {
// ss2 = ss3[0].Split(sde10, StringSplitOptions.RemoveEmptyEntries);
// iOffsetAddress1 = Convert.ToInt32(ss2[0], 16);
// iOffsetAddress2 = Convert.ToInt32(ss2[1], 16);
// iAddress = iOffsetAddress1 + iOffsetAddress2;
// lsCheatdata2.Add(new int[] { iAddress, iValue2 });
// }
// else
// {
// iAddress = Convert.ToInt32(ss3[0], 16);
// lsCheatdata2.Add(new int[] { iAddress, iValue2 });
// }
// }
// }
// }
}
public void ApplyCheat()
{

View File

@ -0,0 +1,38 @@
using System.Collections.Generic;
namespace MAME.Core.Common
{
public partial class cpsMotion
{
private string[] sde2 = new string[] { "," };
private int locationX, locationY;
#region
public bool cbLockpal = false;
public bool cbRowscroll = false;
public string tbInput = string.Empty;
public bool cbL0 = false;
public bool cbL1 = false;
public bool cbL2 = false;
public bool cbL3 = false;
public string tbFile = string.Empty;
public string tbPoint = string.Empty;
public int cbLayer = 0;
public string tbCode = string.Empty;
public string tbColor = string.Empty;
public string tbScroll1x = string.Empty;
public string tbScroll1y = string.Empty;
public string tbScroll2x = string.Empty;
public string tbScroll2y = string.Empty;
public string tbScroll3x = string.Empty;
public string tbScroll3y = string.Empty;
public string tbScrollsx = string.Empty;
public string tbScrollsy = string.Empty;
public List<string> tbResult = new List<string>();
#endregion
public cpsMotion()
{
}
}
}

View File

@ -0,0 +1,19 @@
namespace MAME.Core.Common
{
public class konami68000Motion
{
private int locationX, locationY;
#region
public bool cbT0 = false;
public bool cbT1 = false;
public bool cbT2 = false;
public bool cbSprite = false;
public string tbSprite;
#endregion
public konami68000Motion()
{
tbSprite = "0000-4000";
}
}
}

View File

@ -1,18 +1,11 @@
using cpu.m68000;
using mame;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Globalization;
using System.Text;
using System.Threading.Tasks;
using static System.Net.Mime.MediaTypeNames;
namespace MAME.Core.Common
{
public class m68000Form
public class m68000Motion
{
private mainForm _myParentForm;
private string[] sde6 = new string[1] { "," }, sde7 = new string[1] { ";" }, sde9 = new string[1] { "$" }, sde10 = new string[] { "+" };
private bool bLogNew, bNew;
public static int iStatus, iRAddress, iWAddress, iROp, iWOp, iValue;
@ -41,8 +34,8 @@ namespace MAME.Core.Common
Boolean b_cbPC = false;
Boolean b_cbTotal = false;
Boolean b_cbLog = false;
string mTx_tbIML = string.Empty;
string mTx_tbUSP = string.Empty;
string mTx_tbIML = string.Empty;
string mTx_tbUSP = string.Empty;
string mTx_tbSSP = string.Empty;
string mTx_tbCycles = string.Empty;
string mTx_tbPC = string.Empty;
@ -61,9 +54,8 @@ namespace MAME.Core.Common
M68000_STOP,
}
public static M68000State m68000State, m68000FState;
public m68000Form(mainForm form)
public m68000Motion()
{
this._myParentForm = form;
int i;
mTxList_tbDs = new string[8];
mTxList_tbAs = new string[8];

View File

@ -1,16 +1,12 @@
using cpu.m6809;
using mame;
using System;
using System.Collections.Generic;
using System.Globalization;
using static System.Net.Mime.MediaTypeNames;
namespace MAME.Core.Common
{
public partial class m6809Form
public partial class m6809Motion
{
private mainForm _myParentForm;
//private Disassembler disassembler;
private bool bLogNew;
public static int iStatus;
@ -38,29 +34,28 @@ namespace MAME.Core.Common
public string tbDisassemble = string.Empty;
#endregion
public m6809Form(mainForm form)
public m6809Motion()
{
this._myParentForm = form;
}
public void GetData()
{
int reg, offset;
reg = M6809.mm1[0].PPC.LowWord / 0x2000;
offset = M6809.mm1[0].PPC.LowWord & 0x1fff;
tbD = M6809.mm1[0].D.LowWord.ToString("X4");
tbDp = M6809.mm1[0].DP.LowWord.ToString("X4");
tbU = M6809.mm1[0].U.LowWord.ToString("X4");
tbS = M6809.mm1[0].S.LowWord.ToString("X4");
tbX = M6809.mm1[0].X.LowWord.ToString("X4");
tbY = M6809.mm1[0].Y.LowWord.ToString("X4");
tbCc = M6809.mm1[0].CC.ToString("X2");
tbIrqstate0 = M6809.mm1[0].irq_state[0].ToString("X2");
tbIrqstate1 = M6809.mm1[0].irq_state[1].ToString("X2");
tbIntstate = M6809.mm1[0].int_state.ToString("X2");
tbNmistate = M6809.mm1[0].nmi_state.ToString("X2");
tbPPC = (Namcos1.user1rom_offset[0, reg] + offset).ToString("X6");
tbCycles = M6809.mm1[0].TotalExecutedCycles.ToString("X16");
tbDisassemble = M6809.mm1[0].m6809_dasm(M6809.mm1[0].PPC.LowWord);
tbD = M6809.mm1[0].D.LowWord.ToString("X4");
tbDp = M6809.mm1[0].DP.LowWord.ToString("X4");
tbU = M6809.mm1[0].U.LowWord.ToString("X4");
tbS = M6809.mm1[0].S.LowWord.ToString("X4");
tbX = M6809.mm1[0].X.LowWord.ToString("X4");
tbY = M6809.mm1[0].Y.LowWord.ToString("X4");
tbCc = M6809.mm1[0].CC.ToString("X2");
tbIrqstate0 = M6809.mm1[0].irq_state[0].ToString("X2");
tbIrqstate1 = M6809.mm1[0].irq_state[1].ToString("X2");
tbIntstate = M6809.mm1[0].int_state.ToString("X2");
tbNmistate = M6809.mm1[0].nmi_state.ToString("X2");
tbPPC = (Namcos1.user1rom_offset[0, reg] + offset).ToString("X6");
tbCycles = M6809.mm1[0].TotalExecutedCycles.ToString("X16");
tbDisassemble = M6809.mm1[0].m6809_dasm(M6809.mm1[0].PPC.LowWord);
}
public void m6809_start_debug()

View File

@ -1,52 +1,60 @@
using mame;
using MAME.Core.run_interface;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Xml.Linq;
namespace MAME.Core.Common
{
public class mainForm
public class mainMotion
{
public string tsslStatus;
public cheatForm cheatform;
public m68000Form m68000form;
public z80Form z80form;
public m6809Form m6809form;
public cpsForm cpsform;
public neogeoForm neogeoform;
public konami68000Form konami68000form;
public cheatMotion cheatmotion;
public m68000Motion m68000motion;
public z80Motion z80motion;
public m6809Motion m6809motion;
public cpsMotion cpsmotion;
public neogeoMotion neogeomotion;
public konami68000Motion konami68000motion;
public string sSelect;
public static Thread t1;
public static IResources resource;
public mainForm()
public mainMotion()
{
neogeoform = new neogeoForm(this);
cheatform = new cheatForm(this);
m68000form = new m68000Form(this);
m6809form = new m6809Form(this);
z80form = new z80Form(this);
cpsform = new cpsForm(this);
konami68000form = new konami68000Form(this);
neogeomotion = new neogeoMotion();
cheatmotion = new cheatMotion();
m68000motion = new m68000Motion();
m6809motion = new m6809Motion();
z80motion = new z80Motion();
cpsmotion = new cpsMotion();
konami68000motion = new konami68000Motion();
}
public void Init(IResources iRes,
public void Init(
string RomDir,
ILog ilog,
IResources iRes,
IVideoPlayer ivp,
ISoundPlayer isp,
IKeyboard ikb,
IMouse imou)
{
Mame.RomRoot = RomDir;
EmuLogger.BindFunc(ilog);
Video.BindFunc(ivp);
Sound.BindFunc(isp);
resource = iRes;
StreamReader sr1 = new StreamReader("mame.ini");
sr1.ReadLine();
sSelect = sr1.ReadLine();
sr1.Close();
//StreamReader sr1 = new StreamReader("mame.ini");
//sr1.ReadLine();
//sSelect = sr1.ReadLine();
//sr1.Close();
//TODO 上次选择
sSelect = "samsho2";
RomInfo.Rom = new RomInfo();
@ -87,7 +95,7 @@ namespace MAME.Core.Common
RomInfo.Rom = RomInfo.GetRomByName(Name);
if (RomInfo.Rom == null)
{
Console.WriteLine("Not Found");
EmuLogger.Log("Not Found");
return;
}
@ -207,13 +215,13 @@ namespace MAME.Core.Common
}
if (Machine.bRom)
{
Console.Write("MAME.NET: " + Machine.sDescription + " [" + Machine.sName + "]");
EmuLogger.Log("MAME.NET: " + Machine.sDescription + " [" + Machine.sName + "]");
Mame.init_machine(this);
Generic.nvram_load();
}
else
{
Console.Write("error rom");
EmuLogger.Log("error rom");
}
}

View File

@ -1,17 +1,12 @@
using mame;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.Globalization;
using System.IO;
using static System.Net.Mime.MediaTypeNames;
namespace MAME.Core.Common
{
public partial class neogeoForm
public partial class neogeoMotion
{
private mainForm _myParentForm;
private string[] sde2 = new string[] { "," };
private int locationX, locationY;
public List<string> tbResult;
@ -20,15 +15,13 @@ namespace MAME.Core.Common
public string tbFile = string.Empty;
public string tbSOffset = string.Empty;
public string tbPensoffset = string.Empty;
public Bitmap pictureBox1;
#region
bool cbL0 = false;
bool cbL1 = false;
#endregion
public neogeoForm(mainForm form)
public neogeoMotion()
{
this._myParentForm = form;
tbResult = new List<string>();
neogeoForm_Load();
}

View File

@ -1,8 +1,5 @@
using cpu.z80;
using System;
using System.Collections.Generic;
using System.Globalization;
using static System.Net.Mime.MediaTypeNames;
namespace MAME.Core.Common
{
@ -15,9 +12,8 @@ namespace MAME.Core.Common
STEP3,
STOP,
}
public partial class z80Form
public partial class z80Motion
{
private mainForm _myParentForm;
private Disassembler disassembler;
private bool bLogNew;
public static int iStatus;
@ -34,15 +30,15 @@ namespace MAME.Core.Common
string mTx_tbShadowBC = string.Empty;
string mTx_tbShadowDE = string.Empty;
string mTx_tbShadowHL = string.Empty;
string mTx_tbI = string.Empty;
string mTx_tbR = string.Empty;
string mTx_tbIX = string.Empty;
string mTx_tbIY = string.Empty;
string mTx_tbSP = string.Empty;
string mTx_tbI = string.Empty;
string mTx_tbR = string.Empty;
string mTx_tbIX = string.Empty;
string mTx_tbIY = string.Empty;
string mTx_tbSP = string.Empty;
string mTx_tbRPC = string.Empty;
string mTx_tbPPC = string.Empty;
string mTx_tbR2 = string.Empty;
string mTx_tbWZ = string.Empty;
string mTx_tbR2 = string.Empty;
string mTx_tbWZ = string.Empty;
string mTx_tbCycles = string.Empty;
string mTx_tbDisassemble = string.Empty;
@ -59,9 +55,8 @@ namespace MAME.Core.Common
Z80A_STOP,
}
public static Z80AState z80State, z80FState;
public z80Form(mainForm form)
public z80Motion()
{
this._myParentForm = form;
disassembler = new Disassembler();
Disassembler.GenerateOpcodeSizes();
}

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace cpu.m6502
namespace cpu.m6502
{
public partial class M6502
{

View File

@ -1,19 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using mame;
using System;
using System.IO;
using mame;
namespace cpu.m6502
{
public partial class M6502 : cpuexec_data
{
{
public static M6502[] mm1;
public Action[] insn,insn6502;
public Action[] insn, insn6502;
public byte subtype;
public Register ppc,pc,sp,zp,ea;
public byte p,a,x,y,pending_irq,after_cli,nmi_state,irq_state,so_state;
public Register ppc, pc, sp, zp, ea;
public byte p, a, x, y, pending_irq, after_cli, nmi_state, irq_state, so_state;
public delegate int irq_delegate(int i);
public irq_delegate irq_callback;
public delegate byte read8handler(ushort offset);
@ -21,7 +18,7 @@ namespace cpu.m6502
public read8handler rdmem_id;
public write8handler wrmem_id;
private ushort M6502_NMI_VEC = 0xfffa, M6502_RST_VEC = 0xfffc, M6502_IRQ_VEC = 0xfffe;
private int M6502_SET_OVERFLOW=1;
private int M6502_SET_OVERFLOW = 1;
private int m6502_IntOccured;
protected ulong totalExecutedCycles;
protected int pendingCycles;
@ -54,7 +51,7 @@ namespace cpu.m6502
{
return ReadMemory(offset);
}
private void default_wdmem_id(ushort offset,byte data )
private void default_wdmem_id(ushort offset, byte data)
{
WriteMemory(offset, data);
}
@ -62,37 +59,37 @@ namespace cpu.m6502
{
insn6502 = new Action[]{
m6502_00,m6502_01,m6502_02,m6502_03,m6502_04,m6502_05,m6502_06,m6502_07,
m6502_08,m6502_09,m6502_0a,m6502_0b,m6502_0c,m6502_0d,m6502_0e,m6502_0f,
m6502_10,m6502_11,m6502_12,m6502_13,m6502_14,m6502_15,m6502_16,m6502_17,
m6502_18,m6502_19,m6502_1a,m6502_1b,m6502_1c,m6502_1d,m6502_1e,m6502_1f,
m6502_20,m6502_21,m6502_22,m6502_23,m6502_24,m6502_25,m6502_26,m6502_27,
m6502_28,m6502_29,m6502_2a,m6502_2b,m6502_2c,m6502_2d,m6502_2e,m6502_2f,
m6502_30,m6502_31,m6502_32,m6502_33,m6502_34,m6502_35,m6502_36,m6502_37,
m6502_38,m6502_39,m6502_3a,m6502_3b,m6502_3c,m6502_3d,m6502_3e,m6502_3f,
m6502_40,m6502_41,m6502_42,m6502_43,m6502_44,m6502_45,m6502_46,m6502_47,
m6502_48,m6502_49,m6502_4a,m6502_4b,m6502_4c,m6502_4d,m6502_4e,m6502_4f,
m6502_50,m6502_51,m6502_52,m6502_53,m6502_54,m6502_55,m6502_56,m6502_57,
m6502_58,m6502_59,m6502_5a,m6502_5b,m6502_5c,m6502_5d,m6502_5e,m6502_5f,
m6502_60,m6502_61,m6502_62,m6502_63,m6502_64,m6502_65,m6502_66,m6502_67,
m6502_68,m6502_69,m6502_6a,m6502_6b,m6502_6c,m6502_6d,m6502_6e,m6502_6f,
m6502_70,m6502_71,m6502_72,m6502_73,m6502_74,m6502_75,m6502_76,m6502_77,
m6502_78,m6502_79,m6502_7a,m6502_7b,m6502_7c,m6502_7d,m6502_7e,m6502_7f,
m6502_80,m6502_81,m6502_82,m6502_83,m6502_84,m6502_85,m6502_86,m6502_87,
m6502_88,m6502_89,m6502_8a,m6502_8b,m6502_8c,m6502_8d,m6502_8e,m6502_8f,
m6502_90,m6502_91,m6502_92,m6502_93,m6502_94,m6502_95,m6502_96,m6502_97,
m6502_98,m6502_99,m6502_9a,m6502_9b,m6502_9c,m6502_9d,m6502_9e,m6502_9f,
m6502_a0,m6502_a1,m6502_a2,m6502_a3,m6502_a4,m6502_a5,m6502_a6,m6502_a7,
m6502_a8,m6502_a9,m6502_aa,m6502_ab,m6502_ac,m6502_ad,m6502_ae,m6502_af,
m6502_b0,m6502_b1,m6502_b2,m6502_b3,m6502_b4,m6502_b5,m6502_b6,m6502_b7,
m6502_b8,m6502_b9,m6502_ba,m6502_bb,m6502_bc,m6502_bd,m6502_be,m6502_bf,
m6502_c0,m6502_c1,m6502_c2,m6502_c3,m6502_c4,m6502_c5,m6502_c6,m6502_c7,
m6502_c8,m6502_c9,m6502_ca,m6502_cb,m6502_cc,m6502_cd,m6502_ce,m6502_cf,
m6502_d0,m6502_d1,m6502_d2,m6502_d3,m6502_d4,m6502_d5,m6502_d6,m6502_d7,
m6502_d8,m6502_d9,m6502_da,m6502_db,m6502_dc,m6502_dd,m6502_de,m6502_df,
m6502_e0,m6502_e1,m6502_e2,m6502_e3,m6502_e4,m6502_e5,m6502_e6,m6502_e7,
m6502_e8,m6502_e9,m6502_ea,m6502_eb,m6502_ec,m6502_ed,m6502_ee,m6502_ef,
m6502_f0,m6502_f1,m6502_f2,m6502_f3,m6502_f4,m6502_f5,m6502_f6,m6502_f7,
m6502_f8,m6502_f9,m6502_fa,m6502_fb,m6502_fc,m6502_fd,m6502_fe,m6502_ff
m6502_08,m6502_09,m6502_0a,m6502_0b,m6502_0c,m6502_0d,m6502_0e,m6502_0f,
m6502_10,m6502_11,m6502_12,m6502_13,m6502_14,m6502_15,m6502_16,m6502_17,
m6502_18,m6502_19,m6502_1a,m6502_1b,m6502_1c,m6502_1d,m6502_1e,m6502_1f,
m6502_20,m6502_21,m6502_22,m6502_23,m6502_24,m6502_25,m6502_26,m6502_27,
m6502_28,m6502_29,m6502_2a,m6502_2b,m6502_2c,m6502_2d,m6502_2e,m6502_2f,
m6502_30,m6502_31,m6502_32,m6502_33,m6502_34,m6502_35,m6502_36,m6502_37,
m6502_38,m6502_39,m6502_3a,m6502_3b,m6502_3c,m6502_3d,m6502_3e,m6502_3f,
m6502_40,m6502_41,m6502_42,m6502_43,m6502_44,m6502_45,m6502_46,m6502_47,
m6502_48,m6502_49,m6502_4a,m6502_4b,m6502_4c,m6502_4d,m6502_4e,m6502_4f,
m6502_50,m6502_51,m6502_52,m6502_53,m6502_54,m6502_55,m6502_56,m6502_57,
m6502_58,m6502_59,m6502_5a,m6502_5b,m6502_5c,m6502_5d,m6502_5e,m6502_5f,
m6502_60,m6502_61,m6502_62,m6502_63,m6502_64,m6502_65,m6502_66,m6502_67,
m6502_68,m6502_69,m6502_6a,m6502_6b,m6502_6c,m6502_6d,m6502_6e,m6502_6f,
m6502_70,m6502_71,m6502_72,m6502_73,m6502_74,m6502_75,m6502_76,m6502_77,
m6502_78,m6502_79,m6502_7a,m6502_7b,m6502_7c,m6502_7d,m6502_7e,m6502_7f,
m6502_80,m6502_81,m6502_82,m6502_83,m6502_84,m6502_85,m6502_86,m6502_87,
m6502_88,m6502_89,m6502_8a,m6502_8b,m6502_8c,m6502_8d,m6502_8e,m6502_8f,
m6502_90,m6502_91,m6502_92,m6502_93,m6502_94,m6502_95,m6502_96,m6502_97,
m6502_98,m6502_99,m6502_9a,m6502_9b,m6502_9c,m6502_9d,m6502_9e,m6502_9f,
m6502_a0,m6502_a1,m6502_a2,m6502_a3,m6502_a4,m6502_a5,m6502_a6,m6502_a7,
m6502_a8,m6502_a9,m6502_aa,m6502_ab,m6502_ac,m6502_ad,m6502_ae,m6502_af,
m6502_b0,m6502_b1,m6502_b2,m6502_b3,m6502_b4,m6502_b5,m6502_b6,m6502_b7,
m6502_b8,m6502_b9,m6502_ba,m6502_bb,m6502_bc,m6502_bd,m6502_be,m6502_bf,
m6502_c0,m6502_c1,m6502_c2,m6502_c3,m6502_c4,m6502_c5,m6502_c6,m6502_c7,
m6502_c8,m6502_c9,m6502_ca,m6502_cb,m6502_cc,m6502_cd,m6502_ce,m6502_cf,
m6502_d0,m6502_d1,m6502_d2,m6502_d3,m6502_d4,m6502_d5,m6502_d6,m6502_d7,
m6502_d8,m6502_d9,m6502_da,m6502_db,m6502_dc,m6502_dd,m6502_de,m6502_df,
m6502_e0,m6502_e1,m6502_e2,m6502_e3,m6502_e4,m6502_e5,m6502_e6,m6502_e7,
m6502_e8,m6502_e9,m6502_ea,m6502_eb,m6502_ec,m6502_ed,m6502_ee,m6502_ef,
m6502_f0,m6502_f1,m6502_f2,m6502_f3,m6502_f4,m6502_f5,m6502_f6,m6502_f7,
m6502_f8,m6502_f9,m6502_fa,m6502_fb,m6502_fc,m6502_fd,m6502_fe,m6502_ff
};
insn = insn6502;
}
@ -158,18 +155,18 @@ namespace cpu.m6502
byte op;
ppc.d = pc.d;
//debugger_instruction_hook(Machine, PCD);
if (pending_irq!=0)
if (pending_irq != 0)
{
m6502_take_irq();
}
op=ReadOp(pc.LowWord);
op = ReadOp(pc.LowWord);
pc.LowWord++;
pendingCycles -= 1;
insn[op]();
if (after_cli!=0)
if (after_cli != 0)
{
after_cli = 0;
if (irq_state !=(byte)LineState.CLEAR_LINE)
if (irq_state != (byte)LineState.CLEAR_LINE)
{
pending_irq = 1;
}

View File

@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using mame;
namespace cpu.m6502
namespace cpu.m6502
{
public partial class M6502
{
@ -30,7 +24,7 @@ namespace cpu.m6502
protected void m6502_21() { int tmp; EA_IDX(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; AND(tmp); }
protected void m6502_41() { int tmp; EA_IDX(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; EOR(tmp); }
protected void m6502_61() { int tmp; EA_IDX(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; ADC(tmp); }
protected void m6502_81() { int tmp=0; STA(ref tmp); EA_IDX(); wrmem_id((ushort)ea.d, (byte)tmp); pendingCycles -= 1; }
protected void m6502_81() { int tmp = 0; STA(ref tmp); EA_IDX(); wrmem_id((ushort)ea.d, (byte)tmp); pendingCycles -= 1; }
protected void m6502_a1() { int tmp; EA_IDX(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; LDA(tmp); }
protected void m6502_c1() { int tmp; EA_IDX(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; CMP(tmp); }
protected void m6502_e1() { int tmp; EA_IDX(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; SBC(tmp); }
@ -39,7 +33,7 @@ namespace cpu.m6502
protected void m6502_31() { int tmp; EA_IDY_P(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; AND(tmp); }
protected void m6502_51() { int tmp; EA_IDY_P(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; EOR(tmp); }
protected void m6502_71() { int tmp; EA_IDY_P(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; ADC(tmp); }
protected void m6502_91() { int tmp=0; STA(ref tmp); EA_IDY_NP(); wrmem_id((ushort)ea.d, (byte)tmp); pendingCycles -= 1; }
protected void m6502_91() { int tmp = 0; STA(ref tmp); EA_IDY_NP(); wrmem_id((ushort)ea.d, (byte)tmp); pendingCycles -= 1; }
protected void m6502_b1() { int tmp; EA_IDY_P(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; LDA(tmp); }
protected void m6502_d1() { int tmp; EA_IDY_P(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; CMP(tmp); }
protected void m6502_f1() { int tmp; EA_IDY_P(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; SBC(tmp); }
@ -66,7 +60,7 @@ namespace cpu.m6502
protected void m6502_23() { int tmp; EA_IDX(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; WRMEM((ushort)ea.d, (byte)tmp); RLA(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_43() { int tmp; EA_IDX(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; WRMEM((ushort)ea.d, (byte)tmp); SRE(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_63() { int tmp; EA_IDX(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; WRMEM((ushort)ea.d, (byte)tmp); RRA(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_83() { int tmp=0; SAX(ref tmp); EA_IDX(); wrmem_id((ushort)ea.d, (byte)tmp); pendingCycles -= 1; }
protected void m6502_83() { int tmp = 0; SAX(ref tmp); EA_IDX(); wrmem_id((ushort)ea.d, (byte)tmp); pendingCycles -= 1; }
protected void m6502_a3() { int tmp; EA_IDX(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; LAX(tmp); }
protected void m6502_c3() { int tmp; EA_IDX(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; WRMEM((ushort)ea.d, (byte)tmp); DCP(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_e3() { int tmp; EA_IDX(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; WRMEM((ushort)ea.d, (byte)tmp); ISB(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
@ -75,7 +69,7 @@ namespace cpu.m6502
protected void m6502_33() { int tmp; EA_IDY_NP(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; WRMEM((ushort)ea.d, (byte)tmp); RLA(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_53() { int tmp; EA_IDY_NP(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; WRMEM((ushort)ea.d, (byte)tmp); SRE(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_73() { int tmp; EA_IDY_NP(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; WRMEM((ushort)ea.d, (byte)tmp); RRA(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_93() { int tmp=0; EA_IDY_NP(); SAH(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_93() { int tmp = 0; EA_IDY_NP(); SAH(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_b3() { int tmp; EA_IDY_P(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; LAX(tmp); }
protected void m6502_d3() { int tmp; EA_IDY_NP(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; WRMEM((ushort)ea.d, (byte)tmp); DCP(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_f3() { int tmp; EA_IDY_NP(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; WRMEM((ushort)ea.d, (byte)tmp); ISB(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
@ -84,7 +78,7 @@ namespace cpu.m6502
protected void m6502_24() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); BIT(tmp); }
protected void m6502_44() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); }
protected void m6502_64() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); }
protected void m6502_84() { int tmp=0; STY(ref tmp); EA_ZPG(); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_84() { int tmp = 0; STY(ref tmp); EA_ZPG(); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_a4() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); LDY(tmp); }
protected void m6502_c4() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); CPY(tmp); }
protected void m6502_e4() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); CPX(tmp); }
@ -93,7 +87,7 @@ namespace cpu.m6502
protected void m6502_34() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); }
protected void m6502_54() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); }
protected void m6502_74() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); }
protected void m6502_94() { int tmp=0; STY(ref tmp); EA_ZPX(); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_94() { int tmp = 0; STY(ref tmp); EA_ZPX(); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_b4() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); LDY(tmp); }
protected void m6502_d4() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); }
protected void m6502_f4() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); }
@ -102,7 +96,7 @@ namespace cpu.m6502
protected void m6502_25() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); AND(tmp); }
protected void m6502_45() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); EOR(tmp); }
protected void m6502_65() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); ADC(tmp); }
protected void m6502_85() { int tmp=0; STA(ref tmp); EA_ZPG(); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_85() { int tmp = 0; STA(ref tmp); EA_ZPG(); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_a5() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); LDA(tmp); }
protected void m6502_c5() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); CMP(tmp); }
protected void m6502_e5() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); SBC(tmp); }
@ -111,7 +105,7 @@ namespace cpu.m6502
protected void m6502_35() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); AND(tmp); }
protected void m6502_55() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); EOR(tmp); }
protected void m6502_75() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); ADC(tmp); }
protected void m6502_95() { int tmp=0; STA(ref tmp); EA_ZPX(); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_95() { int tmp = 0; STA(ref tmp); EA_ZPX(); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_b5() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); LDA(tmp); }
protected void m6502_d5() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); CMP(tmp); }
protected void m6502_f5() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); SBC(tmp); }
@ -120,7 +114,7 @@ namespace cpu.m6502
protected void m6502_26() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); ROL(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_46() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); LSR(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_66() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); ROR(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_86() { int tmp=0; STX(ref tmp); EA_ZPG(); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_86() { int tmp = 0; STX(ref tmp); EA_ZPG(); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_a6() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); LDX(tmp); }
protected void m6502_c6() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); DEC(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_e6() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); INC(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
@ -129,7 +123,7 @@ namespace cpu.m6502
protected void m6502_36() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); ROL(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_56() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); LSR(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_76() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); ROR(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_96() { int tmp=0; STX(ref tmp); EA_ZPY(); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_96() { int tmp = 0; STX(ref tmp); EA_ZPY(); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_b6() { int tmp; EA_ZPY(); tmp = RDMEM((ushort)ea.d); LDX(tmp); }
protected void m6502_d6() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); DEC(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_f6() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); INC(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
@ -138,7 +132,7 @@ namespace cpu.m6502
protected void m6502_27() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); RLA(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_47() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); SRE(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_67() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); RRA(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_87() { int tmp=0; SAX(ref tmp); EA_ZPG(); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_87() { int tmp = 0; SAX(ref tmp); EA_ZPG(); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_a7() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); LAX(tmp); }
protected void m6502_c7() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); DCP(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_e7() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); ISB(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
@ -147,7 +141,7 @@ namespace cpu.m6502
protected void m6502_37() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); RLA(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_57() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); SRE(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_77() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); RRA(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_97() { int tmp=0; SAX(ref tmp); EA_ZPY(); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_97() { int tmp = 0; SAX(ref tmp); EA_ZPY(); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_b7() { int tmp; EA_ZPY(); tmp = RDMEM((ushort)ea.d); LAX(tmp); }
protected void m6502_d7() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); DCP(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_f7() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); ISB(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
@ -183,7 +177,7 @@ namespace cpu.m6502
protected void m6502_39() { int tmp; EA_ABY_P(); tmp = RDMEM((ushort)ea.d); AND(tmp); }
protected void m6502_59() { int tmp; EA_ABY_P(); tmp = RDMEM((ushort)ea.d); EOR(tmp); }
protected void m6502_79() { int tmp; EA_ABY_P(); tmp = RDMEM((ushort)ea.d); ADC(tmp); }
protected void m6502_99() { int tmp=0; STA(ref tmp); EA_ABY_NP(); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_99() { int tmp = 0; STA(ref tmp); EA_ABY_NP(); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_b9() { int tmp; EA_ABY_P(); tmp = RDMEM((ushort)ea.d); LDA(tmp); }
protected void m6502_d9() { int tmp; EA_ABY_P(); tmp = RDMEM((ushort)ea.d); CMP(tmp); }
protected void m6502_f9() { int tmp; EA_ABY_P(); tmp = RDMEM((ushort)ea.d); SBC(tmp); }
@ -219,7 +213,7 @@ namespace cpu.m6502
protected void m6502_3b() { int tmp; EA_ABY_NP(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); RLA(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_5b() { int tmp; EA_ABY_NP(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); SRE(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_7b() { int tmp; EA_ABY_NP(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); RRA(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_9b() { int tmp=0; EA_ABY_NP(); SSH(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_9b() { int tmp = 0; EA_ABY_NP(); SSH(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_bb() { int tmp; EA_ABY_P(); tmp = RDMEM((ushort)ea.d); AST(tmp); }
protected void m6502_db() { int tmp; EA_ABY_NP(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); DCP(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_fb() { int tmp; EA_ABY_NP(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); ISB(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
@ -228,7 +222,7 @@ namespace cpu.m6502
protected void m6502_2c() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); BIT(tmp); }
protected void m6502_4c() { EA_ABS(); JMP(); }
protected void m6502_6c() { int tmp; EA_IND(); JMP(); }
protected void m6502_8c() { int tmp=0; STY(ref tmp); EA_ABS(); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_8c() { int tmp = 0; STY(ref tmp); EA_ABS(); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_ac() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); LDY(tmp); }
protected void m6502_cc() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); CPY(tmp); }
protected void m6502_ec() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); CPX(tmp); }
@ -237,7 +231,7 @@ namespace cpu.m6502
protected void m6502_3c() { int tmp; EA_ABX_P(); tmp = RDMEM((ushort)ea.d); }
protected void m6502_5c() { int tmp; EA_ABX_P(); tmp = RDMEM((ushort)ea.d); }
protected void m6502_7c() { int tmp; EA_ABX_P(); tmp = RDMEM((ushort)ea.d); }
protected void m6502_9c() { int tmp=0; EA_ABX_NP(); SYH(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_9c() { int tmp = 0; EA_ABX_NP(); SYH(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_bc() { int tmp; EA_ABX_P(); tmp = RDMEM((ushort)ea.d); LDY(tmp); }
protected void m6502_dc() { int tmp; EA_ABX_P(); tmp = RDMEM((ushort)ea.d); }
protected void m6502_fc() { int tmp; EA_ABX_P(); tmp = RDMEM((ushort)ea.d); }
@ -246,7 +240,7 @@ namespace cpu.m6502
protected void m6502_2d() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); AND(tmp); }
protected void m6502_4d() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); EOR(tmp); }
protected void m6502_6d() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); ADC(tmp); }
protected void m6502_8d() { int tmp=0; STA(ref tmp); EA_ABS(); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_8d() { int tmp = 0; STA(ref tmp); EA_ABS(); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_ad() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); LDA(tmp); }
protected void m6502_cd() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); CMP(tmp); }
protected void m6502_ed() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); SBC(tmp); }
@ -255,7 +249,7 @@ namespace cpu.m6502
protected void m6502_3d() { int tmp; EA_ABX_P(); tmp = RDMEM((ushort)ea.d); AND(tmp); }
protected void m6502_5d() { int tmp; EA_ABX_P(); tmp = RDMEM((ushort)ea.d); EOR(tmp); }
protected void m6502_7d() { int tmp; EA_ABX_P(); tmp = RDMEM((ushort)ea.d); ADC(tmp); }
protected void m6502_9d() { int tmp=0; STA(ref tmp); EA_ABX_NP(); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_9d() { int tmp = 0; STA(ref tmp); EA_ABX_NP(); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_bd() { int tmp; EA_ABX_P(); tmp = RDMEM((ushort)ea.d); LDA(tmp); }
protected void m6502_dd() { int tmp; EA_ABX_P(); tmp = RDMEM((ushort)ea.d); CMP(tmp); }
protected void m6502_fd() { int tmp; EA_ABX_P(); tmp = RDMEM((ushort)ea.d); SBC(tmp); }
@ -264,7 +258,7 @@ namespace cpu.m6502
protected void m6502_2e() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); ROL(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_4e() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); LSR(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_6e() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); ROR(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_8e() { int tmp=0; STX(ref tmp); EA_ABS(); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_8e() { int tmp = 0; STX(ref tmp); EA_ABS(); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_ae() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); LDX(tmp); }
protected void m6502_ce() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); DEC(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_ee() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); INC(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
@ -273,7 +267,7 @@ namespace cpu.m6502
protected void m6502_3e() { int tmp; EA_ABX_NP(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); ROL(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_5e() { int tmp; EA_ABX_NP(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); LSR(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_7e() { int tmp; EA_ABX_NP(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); ROR(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_9e() { int tmp=0; EA_ABY_NP(); SXH(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_9e() { int tmp = 0; EA_ABY_NP(); SXH(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_be() { int tmp; EA_ABY_P(); tmp = RDMEM((ushort)ea.d); LDX(tmp); }
protected void m6502_de() { int tmp; EA_ABX_NP(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); DEC(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_fe() { int tmp; EA_ABX_NP(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); INC(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
@ -282,7 +276,7 @@ namespace cpu.m6502
protected void m6502_2f() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); RLA(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_4f() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); SRE(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_6f() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); RRA(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_8f() { int tmp=0; SAX(ref tmp); EA_ABS(); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_8f() { int tmp = 0; SAX(ref tmp); EA_ABS(); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_af() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); LAX(tmp); }
protected void m6502_cf() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); DCP(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_ef() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); ISB(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
@ -291,7 +285,7 @@ namespace cpu.m6502
protected void m6502_3f() { int tmp; EA_ABX_NP(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); RLA(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_5f() { int tmp; EA_ABX_NP(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); SRE(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_7f() { int tmp; EA_ABX_NP(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); RRA(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_9f() { int tmp=0; EA_ABY_NP(); SAH(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_9f() { int tmp = 0; EA_ABY_NP(); SAH(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_bf() { int tmp; EA_ABY_P(); tmp = RDMEM((ushort)ea.d); LAX(tmp); }
protected void m6502_df() { int tmp; EA_ABX_NP(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); DCP(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }
protected void m6502_ff() { int tmp; EA_ABX_NP(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); ISB(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); }

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using mame;
using mame;
namespace cpu.m6502
{
@ -468,7 +464,7 @@ namespace cpu.m6502
PULL(ref p);
PULL(ref pc.LowByte);
PULL(ref pc.HighByte);
p |=(byte)(F_T | F_B);
p |= (byte)(F_T | F_B);
if ((irq_state != (byte)LineState.CLEAR_LINE) && ((p & F_I) == 0))
{
after_cli = 1;
@ -491,7 +487,7 @@ namespace cpu.m6502
int sum = a - tmp - c;
int lo = (a & 0x0f) - (tmp & 0x0f) - c;
int hi = (a & 0xf0) - (tmp & 0xf0);
if ((lo & 0x10)!=0)
if ((lo & 0x10) != 0)
{
lo -= 6;
hi--;

View File

@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using mame;
using System;
using System.IO;
using mame;
namespace cpu.m6800
{
@ -178,24 +174,24 @@ namespace cpu.m6800
{
m6800_insn = new Action[256]
{
illegal,nop, illegal,illegal,illegal,illegal,tap, tpa,
inx, dex, clv, sev, clc, sec, cli, sei,
sba, cba, illegal,illegal,illegal,illegal,tab, tba,
illegal,daa, illegal,aba, illegal,illegal,illegal,illegal,
bra, brn, bhi, bls, bcc, bcs, bne, beq,
bvc, bvs, bpl, bmi, bge, blt, bgt, ble,
tsx, ins, pula, pulb, des, txs, psha, pshb,
illegal,rts, illegal,rti, illegal,illegal,wai, swi,
nega, illegal,illegal,coma, lsra, illegal,rora, asra,
asla, rola, deca, illegal,inca, tsta, illegal,clra,
negb, illegal,illegal,comb, lsrb, illegal,rorb, asrb,
aslb, rolb, decb, illegal,incb, tstb, illegal,clrb,
illegal,nop, illegal,illegal,illegal,illegal,tap, tpa,
inx, dex, clv, sev, clc, sec, cli, sei,
sba, cba, illegal,illegal,illegal,illegal,tab, tba,
illegal,daa, illegal,aba, illegal,illegal,illegal,illegal,
bra, brn, bhi, bls, bcc, bcs, bne, beq,
bvc, bvs, bpl, bmi, bge, blt, bgt, ble,
tsx, ins, pula, pulb, des, txs, psha, pshb,
illegal,rts, illegal,rti, illegal,illegal,wai, swi,
nega, illegal,illegal,coma, lsra, illegal,rora, asra,
asla, rola, deca, illegal,inca, tsta, illegal,clra,
negb, illegal,illegal,comb, lsrb, illegal,rorb, asrb,
aslb, rolb, decb, illegal,incb, tstb, illegal,clrb,
neg_ix, illegal,illegal,com_ix, lsr_ix, illegal,ror_ix, asr_ix,
asl_ix, rol_ix, dec_ix, illegal,inc_ix, tst_ix, jmp_ix, clr_ix,
neg_ex, illegal,illegal,com_ex, lsr_ex, illegal,ror_ex, asr_ex,
asl_ex, rol_ex, dec_ex, illegal,inc_ex, tst_ex, jmp_ex, clr_ex,
suba_im,cmpa_im,sbca_im,illegal,anda_im,bita_im,lda_im, sta_im,
eora_im,adca_im,ora_im, adda_im,cmpx_im,bsr, lds_im, sts_im,
eora_im,adca_im,ora_im, adda_im,cmpx_im,bsr, lds_im, sts_im,
suba_di,cmpa_di,sbca_di,illegal,anda_di,bita_di,lda_di, sta_di,
eora_di,adca_di,ora_di, adda_di,cmpx_di,jsr_di, lds_di, sts_di,
suba_ix,cmpa_ix,sbca_ix,illegal,anda_ix,bita_ix,lda_ix, sta_ix,
@ -211,26 +207,26 @@ namespace cpu.m6800
subb_ex,cmpb_ex,sbcb_ex,illegal,andb_ex,bitb_ex,ldb_ex, stb_ex,
eorb_ex,adcb_ex,orb_ex, addb_ex,illegal,illegal,ldx_ex, stx_ex
};
hd63701_insn=new Action[]
hd63701_insn = new Action[]
{
trap, nop, trap ,trap ,lsrd, asld, tap, tpa,
inx, dex, clv, sev, clc, sec, cli, sei,
sba, cba, undoc1, undoc2, trap ,trap ,tab, tba,
xgdx, daa, slp ,aba, trap ,trap ,trap ,trap ,
bra, brn, bhi, bls, bcc, bcs, bne, beq,
bvc, bvs, bpl, bmi, bge, blt, bgt, ble,
tsx, ins, pula, pulb, des, txs, psha, pshb,
pulx, rts, abx, rti, pshx, mul, wai, swi,
nega, trap ,trap ,coma, lsra, trap ,rora, asra,
asla, rola, deca, trap ,inca, tsta, trap ,clra,
negb, trap ,trap ,comb, lsrb, trap ,rorb, asrb,
aslb, rolb, decb, trap ,incb, tstb, trap ,clrb,
trap, nop, trap ,trap ,lsrd, asld, tap, tpa,
inx, dex, clv, sev, clc, sec, cli, sei,
sba, cba, undoc1, undoc2, trap ,trap ,tab, tba,
xgdx, daa, slp ,aba, trap ,trap ,trap ,trap ,
bra, brn, bhi, bls, bcc, bcs, bne, beq,
bvc, bvs, bpl, bmi, bge, blt, bgt, ble,
tsx, ins, pula, pulb, des, txs, psha, pshb,
pulx, rts, abx, rti, pshx, mul, wai, swi,
nega, trap ,trap ,coma, lsra, trap ,rora, asra,
asla, rola, deca, trap ,inca, tsta, trap ,clra,
negb, trap ,trap ,comb, lsrb, trap ,rorb, asrb,
aslb, rolb, decb, trap ,incb, tstb, trap ,clrb,
neg_ix, aim_ix, oim_ix, com_ix, lsr_ix, eim_ix, ror_ix, asr_ix,
asl_ix, rol_ix, dec_ix, tim_ix, inc_ix, tst_ix, jmp_ix, clr_ix,
neg_ex, aim_di, oim_di, com_ex, lsr_ex, eim_di, ror_ex, asr_ex,
asl_ex, rol_ex, dec_ex, tim_di, inc_ex, tst_ex, jmp_ex, clr_ex,
suba_im,cmpa_im,sbca_im,subd_im,anda_im,bita_im,lda_im, sta_im,
eora_im,adca_im,ora_im, adda_im,cpx_im ,bsr, lds_im, sts_im,
eora_im,adca_im,ora_im, adda_im,cpx_im ,bsr, lds_im, sts_im,
suba_di,cmpa_di,sbca_di,subd_di,anda_di,bita_di,lda_di, sta_di,
eora_di,adca_di,ora_di, adda_di,cpx_di ,jsr_di, lds_di, sts_di,
suba_ix,cmpa_ix,sbca_ix,subd_ix,anda_ix,bita_ix,lda_ix, sta_ix,
@ -353,9 +349,9 @@ namespace cpu.m6800
if (irq_state[0] != (byte)LineState.CLEAR_LINE)
{
ENTER_INTERRUPT(0xfff8);
if( irq_callback!=null )
if (irq_callback != null)
{
irq_callback(0);
irq_callback(0);
}
}
else
@ -921,7 +917,7 @@ namespace cpu.m6800
do
{
int prevCycles = pendingCycles;
if ((wai_state & (M6800_WAI | M6800_SLP))!=0)
if ((wai_state & (M6800_WAI | M6800_SLP)) != 0)
{
EAT_CYCLES();
}
@ -931,7 +927,7 @@ namespace cpu.m6800
//debugger_instruction_hook(Machine, PCD);
ireg = ReadOp(PC.LowWord);
PC.LowWord++;
insn[ireg]();
insn[ireg]();
INCREMENT_COUNTER(this.cycles[ireg]);
int delta = prevCycles - pendingCycles;
totalExecutedCycles += (ulong)delta;
@ -1042,7 +1038,7 @@ namespace cpu.m6800
}
private void m6803_internal_registers_w(int offset, byte data)
{
int latch09=0;
int latch09 = 0;
switch (offset)
{
case 0x00:
@ -1385,6 +1381,6 @@ namespace cpu.m6800
INCREMENT_COUNTER(extra_cycles);
extra_cycles = 0;
return cycles - pendingCycles;
}
}
}
}

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using mame;
using mame;
namespace cpu.m6800
{
@ -11,7 +6,7 @@ namespace cpu.m6800
{
protected void illegal()
{
}
protected void trap()
{
@ -243,11 +238,11 @@ namespace cpu.m6800
}
protected void pula()
{
D.HighByte=PULLBYTE();
D.HighByte = PULLBYTE();
}
protected void pulb()
{
D.LowByte=PULLBYTE();
D.LowByte = PULLBYTE();
}
protected void des()
{
@ -267,11 +262,11 @@ namespace cpu.m6800
}
protected void pulx()
{
X=PULLWORD();
X = PULLWORD();
}
protected void rts()
{
PC=PULLWORD();
PC = PULLWORD();
//CHANGE_PC();
}
protected void abx()
@ -280,11 +275,11 @@ namespace cpu.m6800
}
protected void rti()
{
cc=PULLBYTE();
D.LowByte=PULLBYTE();
D.HighByte=PULLBYTE();
X=PULLWORD();
PC=PULLWORD();
cc = PULLBYTE();
D.LowByte = PULLBYTE();
D.HighByte = PULLBYTE();
X = PULLWORD();
PC = PULLWORD();
//CHANGE_PC();
CHECK_IRQ_LINES();
}

View File

@ -22,7 +22,7 @@ namespace cpu.m68000
{
var info = new DisassemblyInfo { Mnemonic = "UNKNOWN", PC = pc, Length = 2 };
op = (ushort)ReadOpWord(pc);
if (Opcodes[op] == MOVE) MOVE_Disasm(info);//
else if (Opcodes[op] == MOVEA) MOVEA_Disasm(info);
else if (Opcodes[op] == MOVEQ) MOVEQ_Disasm(info);

View File

@ -555,7 +555,7 @@ namespace cpu.m68000
}
info.Length = pc - info.PC;
}
}
void ORI()
{
@ -1036,10 +1036,10 @@ namespace cpu.m68000
int mode = (op >> 3) & 0x07;
int reg = op & 0x07;
info.Mnemonic = "asl";
info.Args=DisassembleValue(mode, reg, 1, ref pc);
info.Args = DisassembleValue(mode, reg, 1, ref pc);
info.Length = pc - info.PC;
}
void ASRd()
{
int rot = (op >> 9) & 7;

View File

@ -1922,7 +1922,7 @@ namespace cpu.m68000
uint dest = D[dreg].u32;
if (source == 0)
{
{
TrapVector(5);
}
else
@ -1985,7 +1985,7 @@ namespace cpu.m68000
else
{
V = true;
}
}
}
pendingCycles -= 158 + EACyclesBW[mode, reg];
}

View File

@ -284,7 +284,7 @@ namespace cpu.m68000
{
//D[reg].u8 = (byte)(result | 0x80);
}*/
WriteValueB(mode, reg,(sbyte)(result | 0x80));
WriteValueB(mode, reg, (sbyte)(result | 0x80));
pendingCycles -= (mode == 0) ? 4 : 14 + EACyclesBW[mode, reg];
}

View File

@ -133,7 +133,7 @@ namespace cpu.m68000
{
int mode = (op >> 3) & 7;
int reg = (op >> 0) & 7;
/*ushort sr = (ushort)(SR & 0xFF00);
sr |= (byte)ReadValueB(mode, reg);
SR = (short)sr;*/

View File

@ -1,9 +1,8 @@
using System;
using System.Runtime.InteropServices;
using System.IO;
using mame;
using System;
using System.Globalization;
using System.Collections.Generic;
using mame;
using System.IO;
using System.Runtime.InteropServices;
namespace cpu.m68000
{
@ -72,14 +71,14 @@ namespace cpu.m68000
return;
if (value == true) // entering supervisor mode
{
//Console.WriteLine("&^&^&^&^& ENTER SUPERVISOR MODE");
//EmuLogger.Log("&^&^&^&^& ENTER SUPERVISOR MODE");
usp = A[7].s32;
A[7].s32 = ssp;
s = true;
}
else
{ // exiting supervisor mode
//Console.WriteLine("&^&^&^&^& LEAVE SUPERVISOR MODE");
//EmuLogger.Log("&^&^&^&^& LEAVE SUPERVISOR MODE");
ssp = A[7].s32;
A[7].s32 = usp;
s = false;
@ -149,7 +148,7 @@ namespace cpu.m68000
N = (value & 0x0008) != 0;
X = (value & 0x0010) != 0;
}
}
}
public int Interrupt { get; set; }
// Memory Access
@ -176,7 +175,7 @@ namespace cpu.m68000
}
public override void set_irq_line(int irqline, LineState state)
{
if (irqline ==(int)LineState.INPUT_LINE_NMI)
if (irqline == (int)LineState.INPUT_LINE_NMI)
irqline = 7;
switch (state)
{
@ -212,12 +211,12 @@ namespace cpu.m68000
public void Step()
{
//Console.WriteLine(Disassemble(PC));
//EmuLogger.Log(Disassemble(PC));
op = (ushort)ReadOpWord(PC);PC += 2;
op = (ushort)ReadOpWord(PC); PC += 2;
Opcodes[op]();
}
public override int ExecuteCycles(int cycles)
{
if (!stopped)
@ -410,7 +409,7 @@ namespace cpu.m68000
else
{
//Console.WriteLine("Skipping unrecognized identifier " + args[0]);
//EmuLogger.Log("Skipping unrecognized identifier " + args[0]);
}
}
}

View File

@ -542,7 +542,7 @@ namespace cpu.m68000
int GetIndex()
{
//Console.WriteLine("IN INDEX PORTION - NOT VERIFIED!!!");
//EmuLogger.Log("IN INDEX PORTION - NOT VERIFIED!!!");
// TODO kid chameleon triggers this in startup sequence
short extension = ReadOpWord(PC); PC += 2;
@ -571,7 +571,7 @@ namespace cpu.m68000
int PeekIndex()
{
//Console.WriteLine("IN INDEX PORTION - NOT VERIFIED!!!");
//EmuLogger.Log("IN INDEX PORTION - NOT VERIFIED!!!");
short extension = ReadOpWord(PC);

View File

@ -150,7 +150,7 @@ namespace cpu.m68000
else if (component == "Xn") opList = AppendPermutations(opList, Xn3);
else if (component == "CondMain") opList = AppendPermutations(opList, ConditionMain);
else if (component == "CondAll") opList = AppendPermutations(opList, ConditionAll);
else if (component == "Data1") opList = AppendData(opList, 1);
else if (component == "Data1") opList = AppendData(opList, 1);
else if (component == "Data3") opList = AppendData(opList, 3);
else if (component == "Data4") opList = AppendData(opList, 4);
else if (component == "Data8") opList = AppendData(opList, 8);
@ -864,7 +864,7 @@ namespace cpu.m68000
"1110", // GT Greater Than (signed)
"1111" // LE Less or Equal (signed)
};
#endregion
}
}

View File

@ -5,33 +5,33 @@
static readonly int[,] MoveCyclesBW = new int[12, 9]
{
{ 4, 4, 8, 8, 8, 12, 14, 12, 16 },
{ 4, 4, 8, 8, 8, 12, 14, 12, 16 },
{ 8, 8, 12, 12, 12, 16, 18, 16, 20 },
{ 8, 8, 12, 12, 12, 16, 18, 16, 20 },
{ 10, 10, 14, 14, 14, 18, 20, 18, 22 },
{ 12, 12, 16, 16, 16, 20, 22, 20, 24 },
{ 14, 14, 18, 18, 18, 22, 24, 22, 26 },
{ 12, 12, 16, 16, 16, 20, 22, 20, 24 },
{ 16, 16, 20, 20, 20, 24, 26, 24, 28 },
{ 12, 12, 16, 16, 16, 20, 22, 20, 24 },
{ 14, 14, 18, 18, 18, 22, 24, 22, 26 },
{ 8, 8, 12, 12, 12, 16, 18, 16, 20 }
{ 4, 4, 8, 8, 8, 12, 14, 12, 16 },
{ 8, 8, 12, 12, 12, 16, 18, 16, 20 },
{ 8, 8, 12, 12, 12, 16, 18, 16, 20 },
{ 10, 10, 14, 14, 14, 18, 20, 18, 22 },
{ 12, 12, 16, 16, 16, 20, 22, 20, 24 },
{ 14, 14, 18, 18, 18, 22, 24, 22, 26 },
{ 12, 12, 16, 16, 16, 20, 22, 20, 24 },
{ 16, 16, 20, 20, 20, 24, 26, 24, 28 },
{ 12, 12, 16, 16, 16, 20, 22, 20, 24 },
{ 14, 14, 18, 18, 18, 22, 24, 22, 26 },
{ 8, 8, 12, 12, 12, 16, 18, 16, 20 }
};
static readonly int[,] MoveCyclesL = new int[12, 9]
{
{ 4, 4, 12, 12, 12, 16, 18, 16, 20 },
{ 4, 4, 12, 12, 12, 16, 18, 16, 20 },
{ 12, 12, 20, 20, 20, 24, 26, 24, 28 },
{ 12, 12, 20, 20, 20, 24, 26, 24, 28 },
{ 14, 14, 22, 22, 22, 26, 28, 26, 30 },
{ 16, 16, 24, 24, 24, 28, 30, 28, 32 },
{ 18, 18, 26, 26, 26, 30, 32, 30, 34 },
{ 16, 16, 24, 24, 24, 28, 30, 28, 32 },
{ 20, 20, 28, 28, 28, 32, 34, 32, 36 },
{ 16, 16, 24, 24, 24, 28, 30, 28, 32 },
{ 18, 18, 26, 26, 26, 30, 32, 30, 34 },
{ 12, 12, 20, 20, 20, 24, 26, 24, 28 }
{ 4, 4, 12, 12, 12, 16, 18, 16, 20 },
{ 4, 4, 12, 12, 12, 16, 18, 16, 20 },
{ 12, 12, 20, 20, 20, 24, 26, 24, 28 },
{ 12, 12, 20, 20, 20, 24, 26, 24, 28 },
{ 14, 14, 22, 22, 22, 26, 28, 26, 30 },
{ 16, 16, 24, 24, 24, 28, 30, 28, 32 },
{ 18, 18, 26, 26, 26, 30, 32, 30, 34 },
{ 16, 16, 24, 24, 24, 28, 30, 28, 32 },
{ 20, 20, 28, 28, 28, 32, 34, 32, 36 },
{ 16, 16, 24, 24, 24, 28, 30, 28, 32 },
{ 18, 18, 26, 26, 26, 30, 32, 30, 34 },
{ 12, 12, 20, 20, 20, 24, 26, 24, 28 }
};
static readonly int[,] EACyclesBW = new int[8, 8]

View File

@ -1,17 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using mame;
using System;
using System.IO;
using mame;
namespace cpu.m6805
{
public partial class M6805 : cpuexec_data
{
public static M6805 m1;
public Register ea,pc,s;
public Register ea, pc, s;
public int subtype;
public ushort sp_mask;
public ushort sp_low;
@ -23,7 +19,7 @@ namespace cpu.m6805
public int nmi_state;
public byte CFLAG = 0x01, ZFLAG = 0x02, NFLAG = 0x04, IFLAG = 0x08, HFLAG = 0x10;
public int SUBTYPE_M6805 = 0, SUBTYPE_M68705 = 1, SUBTYPE_HD63705 = 2;
public byte[] flags8i=new byte[256] /* increment */
public byte[] flags8i = new byte[256] /* increment */
{
0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
@ -42,7 +38,7 @@ namespace cpu.m6805
0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,
0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04
};
public byte[] flags8d=new byte[256] /* decrement */
public byte[] flags8d = new byte[256] /* decrement */
{
0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
@ -61,7 +57,7 @@ namespace cpu.m6805
0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,
0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04
};
public byte[] cycles1 =new byte[]
public byte[] cycles1 = new byte[]
{
/* 0 1 2 3 4 5 6 7 8 9 A B C D E F */
/*0*/ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
@ -108,7 +104,7 @@ namespace cpu.m6805
public Func<ushort, byte> ReadOp, ReadOpArg;
public Func<ushort, byte> ReadMemory;
public Action<ushort, byte> WriteMemory;
public M6805()
{
irq_state = new int[9];
@ -141,7 +137,7 @@ namespace cpu.m6805
b = ReadOpArg(pc.LowWord++);
}
private void IMMWORD(ref Register w)
{
{
w.d = 0;
w.HighByte = ReadOpArg(pc.LowWord);
w.LowByte = ReadOpArg((ushort)(pc.LowWord + 1));
@ -165,19 +161,19 @@ namespace cpu.m6805
}
private void CLR_NZ()
{
cc&=(byte)~(NFLAG|ZFLAG);
cc &= (byte)~(NFLAG | ZFLAG);
}
private void CLR_HNZC()
{
cc&=(byte)~(HFLAG|NFLAG|ZFLAG|CFLAG);
cc &= (byte)~(HFLAG | NFLAG | ZFLAG | CFLAG);
}
private void CLR_Z()
{
cc&=(byte)~(ZFLAG);
cc &= (byte)~(ZFLAG);
}
private void CLR_NZC()
{
cc&=(byte)~(NFLAG|ZFLAG|CFLAG);
cc &= (byte)~(NFLAG | ZFLAG | CFLAG);
}
private void CLR_ZC()
{
@ -185,7 +181,7 @@ namespace cpu.m6805
}
private void SET_Z(byte b)
{
if(b==0)
if (b == 0)
{
SEZ();
}
@ -196,30 +192,30 @@ namespace cpu.m6805
}
private void SET_N8(byte b)
{
cc|=(byte)((b&0x80)>>5);
cc |= (byte)((b & 0x80) >> 5);
}
private void SET_H(byte a,byte b,byte r)
private void SET_H(byte a, byte b, byte r)
{
cc|=(byte)((a^b^r)&0x10);
cc |= (byte)((a ^ b ^ r) & 0x10);
}
private void SET_C8(ushort b)
{
cc|=(byte)((b&0x100)>>8);
cc |= (byte)((b & 0x100) >> 8);
}
private void SET_FLAGS8I(byte b)
{
cc|=flags8i[b&0xff];
cc |= flags8i[b & 0xff];
}
private void SET_FLAGS8D(byte b)
{
cc|=flags8d[b&0xff];
cc |= flags8d[b & 0xff];
}
private void SET_NZ8(byte b)
{
SET_N8(b);
SET_Z(b);
}
private void SET_FLAGS8(byte a,byte b,ushort r)
private void SET_FLAGS8(byte a, byte b, ushort r)
{
SET_N8((byte)r);
SET_Z8((byte)r);
@ -236,7 +232,7 @@ namespace cpu.m6805
}
private void IMM8()
{
ea.LowWord= pc.LowWord++;
ea.LowWord = pc.LowWord++;
}
private void EXTENDED()
{
@ -244,54 +240,54 @@ namespace cpu.m6805
}
private void INDEXED()
{
ea.LowWord=x;
ea.LowWord = x;
}
private void INDEXED1()
{
ea.d=0;
ea.d = 0;
IMMBYTE(ref ea.LowByte);
ea.LowWord+=x;
ea.LowWord += x;
}
private void INDEXED2()
{
IMMWORD(ref ea);
ea.LowWord+=x;
ea.LowWord += x;
}
private void SEC()
{
cc|=CFLAG;
cc |= CFLAG;
}
private void CLC()
{
cc&=(byte)~CFLAG;
cc &= (byte)~CFLAG;
}
private void SEZ()
{
cc|=ZFLAG;
cc |= ZFLAG;
}
private void CLZ()
{
cc&=(byte)~ZFLAG;
cc &= (byte)~ZFLAG;
}
private void SEN()
{
cc|=NFLAG;
cc |= NFLAG;
}
private void CLN()
{
cc&=(byte)~NFLAG;
cc &= (byte)~NFLAG;
}
private void SEH()
{
cc|=HFLAG;
cc |= HFLAG;
}
private void CLH()
{
cc&=(byte)~HFLAG;
cc &= (byte)~HFLAG;
}
private void SEI()
{
cc|=IFLAG;
cc |= IFLAG;
}
private void CLI()
{
@ -300,31 +296,31 @@ namespace cpu.m6805
private void DIRBYTE(ref byte b)
{
DIRECT();
b=ReadMemory((ushort)ea.d);
b = ReadMemory((ushort)ea.d);
}
private void EXTBYTE(ref byte b)
{
EXTENDED();
b=ReadMemory((ushort)ea.d);
b = ReadMemory((ushort)ea.d);
}
private void IDXBYTE(ref byte b)
{
INDEXED();
b=ReadMemory((ushort)ea.d);
b = ReadMemory((ushort)ea.d);
}
private void IDX1BYTE(ref byte b)
{
INDEXED1();
b=ReadMemory((ushort)ea.d);
b = ReadMemory((ushort)ea.d);
}
private void IDX2BYTE(ref byte b)
{
INDEXED2();
b=ReadMemory((ushort)ea.d);
b = ReadMemory((ushort)ea.d);
}
private void BRANCH(bool f)
{
byte t=0;
byte t = 0;
IMMBYTE(ref t);
if (f)
{
@ -553,7 +549,7 @@ namespace cpu.m6805
public int m6805_execute(int cycles)
{
byte ireg;
pendingCycles = cycles;
pendingCycles = cycles;
do
{
int prevCycles = pendingCycles;
@ -828,7 +824,7 @@ namespace cpu.m6805
case 0xfd: jsr_ix(); break;
case 0xfe: ldx_ix(); break;
case 0xff: stx_ix(); break;
}
}
pendingCycles -= cycles1[ireg];
int delta = prevCycles - pendingCycles;
totalExecutedCycles += (ulong)delta;

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using mame;
using mame;
namespace cpu.m6805
{
@ -18,7 +13,7 @@ namespace cpu.m6805
/* $00/$02/$04/$06/$08/$0A/$0C/$0E BRSET direct,relative ---- */
protected void brset(byte bit)
{
byte t=0, r=0;
byte t = 0, r = 0;
DIRBYTE(ref r);
IMMBYTE(ref t);
CLC();
@ -1116,7 +1111,7 @@ namespace cpu.m6805
/* $b5 BITA direct -**- */
protected void bita_di()
{
byte t=0, r;
byte t = 0, r;
DIRBYTE(ref t);
r = (byte)(a & t);
CLR_NZ();

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace cpu.m6809
namespace cpu.m6809
{
public partial class M6809
{
@ -340,8 +335,8 @@ namespace cpu.m6809
public static string[] m6809_regs = new string[] { "X", "Y", "U", "S", "PC" };
public static string[] m6809_regs_te = new string[]
{
"D", "X", "Y", "U", "S", "PC", "inv", "inv",
"A", "B", "CC", "DP", "inv", "inv", "inv", "inv"
"D", "X", "Y", "U", "S", "PC", "inv", "inv",
"A", "B", "CC", "DP", "inv", "inv", "inv", "inv"
};
public byte op;
public void DisassemblerInit()
@ -366,7 +361,7 @@ namespace cpu.m6809
i1 = 1;
}
buffer = ReadOp(p).ToString("X2");
bool indirect,opcode_found = false;
bool indirect, opcode_found = false;
do
{
opcode = ReadOp(p);
@ -592,10 +587,10 @@ namespace cpu.m6809
}
else
if (numoperands == 1)
{
ea = operandarray[0];
buffer += "#$" + ea.ToString("X2");
}
{
ea = operandarray[0];
buffer += "#$" + ea.ToString("X2");
}
break;
case m6809_addressing_modes.IMM_RR:

View File

@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using mame;
using System;
using System.IO;
using mame;
namespace cpu.m6809
{
@ -498,7 +494,7 @@ namespace cpu.m6809
private ushort RM16(ushort Addr)
{
ushort result = (ushort)(RM(Addr) << 8);
return (ushort)(result | RM((ushort)((Addr + 1) &0xffff)));
return (ushort)(result | RM((ushort)((Addr + 1) & 0xffff)));
}
private void WM16(ushort Addr, Register p)
{
@ -544,7 +540,7 @@ namespace cpu.m6809
PUSHBYTE(D.LowByte);
PUSHBYTE(D.HighByte);
PUSHBYTE(CC);
extra_cycles += 19;
extra_cycles += 19;
}
CC |= (byte)(CC_IF | CC_II);
PC.LowWord = RM16(0xfffc);

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using mame;
using mame;
namespace cpu.m6809
{
@ -1713,13 +1709,13 @@ namespace cpu.m6809
}
void ldx_ex()
{
X=EXTWORD();
X = EXTWORD();
CLR_NZV();
SET_NZ16(X.LowWord);
}
void ldy_ex()
{
Y=EXTWORD();
Y = EXTWORD();
CLR_NZV();
SET_NZ16(Y.LowWord);
}
@ -1841,7 +1837,7 @@ namespace cpu.m6809
}
void ldd_im()
{
D=IMMWORD();
D = IMMWORD();
CLR_NZV();
SET_NZ16(D.LowWord);
}
@ -2274,7 +2270,7 @@ namespace cpu.m6809
}
void ldd_ex()
{
D=EXTWORD();
D = EXTWORD();
CLR_NZV();
SET_NZ16(D.LowWord);
}
@ -2287,13 +2283,13 @@ namespace cpu.m6809
}
void ldu_ex()
{
U=EXTWORD();
U = EXTWORD();
CLR_NZV();
SET_NZ16(U.LowWord);
}
void lds_ex()
{
S=EXTWORD();
S = EXTWORD();
CLR_NZV();
SET_NZ16(S.LowWord);
int_state |= M6809_LDS;

View File

@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using mame;
using System;
using System.IO;
using System.Runtime.InteropServices;
using mame;
namespace cpu.nec
{
@ -22,7 +18,7 @@ namespace cpu.nec
{
totalExecutedCycles = value;
}
}
}
public override int PendingCycles
{
get
@ -82,7 +78,7 @@ namespace cpu.nec
}
}
}
}
}
public struct necbasicregs
{
//public ushort[] w;//[8];
@ -116,7 +112,7 @@ namespace cpu.nec
public int iNOP;
public static Nec[] nn1;
public Mod_RM mod_RM;
public byte[] v25v35_decryptiontable;
public byte[] v25v35_decryptiontable;
public nec_Regs I;
public int chip_type;
public static int prefix_base;
@ -208,7 +204,7 @@ namespace cpu.nec
ushort var = ReadWord((I.sregs[2] << 4) + I.regs.b[8] + I.regs.b[9] * 0x100);
I.regs.b[i * 2] = (byte)(var % 0x100);
I.regs.b[i * 2 + 1] = (byte)(var / 0x100);
ushort w4 =(ushort)(I.regs.b[8] + I.regs.b[9] * 0x100 + 2);
ushort w4 = (ushort)(I.regs.b[8] + I.regs.b[9] * 0x100 + 2);
I.regs.b[8] = (byte)(w4 % 0x100);
I.regs.b[9] = (byte)(w4 / 0x100);
}
@ -636,7 +632,7 @@ namespace cpu.nec
{
int result, result2;
b1 = false;
result = (short)(I.regs.b[0]+I.regs.b[1]*0x100);
result = (short)(I.regs.b[0] + I.regs.b[1] * 0x100);
result2 = result % (short)((sbyte)tmp);
if ((result /= (short)((sbyte)tmp)) > 0xff)
{
@ -796,7 +792,7 @@ namespace cpu.nec
mod_RM.regw = new int[256];
mod_RM.regb = new int[256];
mod_RM.RMw = new int[256];
mod_RM.RMb = new int[256];
mod_RM.RMb = new int[256];
nec_instruction = new nec_delegate[]{
i_add_br8,
i_add_wr16,
@ -813,7 +809,7 @@ namespace cpu.nec
i_or_ald8,
i_or_axd16,
i_push_cs,
i_pre_nec,
i_pre_nec,
i_adc_br8,
i_adc_wr16,
i_adc_r8b,
@ -928,7 +924,7 @@ namespace cpu.nec
i_jnle,
i_80pre,
i_81pre,
i_82pre,
i_82pre,
i_83pre,
i_test_br8,
i_test_wr16,
@ -1056,32 +1052,32 @@ namespace cpu.nec
i_ffpre
};
GetEA = new getea_delegate[192]{
EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007,
EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007,
EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007,
EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007,
EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007,
EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007,
EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007,
EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007,
EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007,
EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007,
EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007,
EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007,
EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007,
EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007,
EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007,
EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007,
EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107,
EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107,
EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107,
EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107,
EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107,
EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107,
EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107,
EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107,
EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107,
EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107,
EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107,
EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107,
EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107,
EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107,
EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107,
EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107,
EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207,
EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207,
EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207,
EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207,
EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207,
EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207,
EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207,
EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207
EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207,
EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207,
EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207,
EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207,
EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207,
EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207,
EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207,
EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207
};
}
public override void Reset()
@ -1194,7 +1190,7 @@ namespace cpu.nec
public void SaveStateBinary(BinaryWriter writer)
{
int i;
writer.Write(I.regs.b,0,16);
writer.Write(I.regs.b, 0, 16);
for (i = 0; i < 4; i++)
{
writer.Write(I.sregs[i]);
@ -1267,7 +1263,7 @@ namespace cpu.nec
{
pendingCycles = cycles;
while (pendingCycles > 0)
{
{
int prevCycles = pendingCycles;
if (I.pending_irq != 0 && I.no_interrupt == 0)
{

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace cpu.nec
namespace cpu.nec
{
partial class Nec
{
@ -13,7 +8,7 @@ namespace cpu.nec
int EA_000()
{
EO = (ushort)(I.regs.b[6] + I.regs.b[7] * 0x100 + I.regs.b[12] + I.regs.b[13] * 0x100);
EA = DefaultBase(3,I) + EO;
EA = DefaultBase(3, I) + EO;
return EA;
}
int EA_001()

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace cpu.nec
namespace cpu.nec
{
partial class Nec
{
@ -820,7 +815,7 @@ namespace cpu.nec
void i_repnc()
{
int next = fetchop();
ushort c = (ushort)(I.regs.b[2]+I.regs.b[3]*0x100);// I.regs.w[1];
ushort c = (ushort)(I.regs.b[2] + I.regs.b[3] * 0x100);// I.regs.w[1];
switch (next)
{ /* Segments */
case 0x26: seg_prefix = 1; prefix_base = (I.sregs[0] << 4); next = fetchop(); CLK(2); break;
@ -885,7 +880,7 @@ namespace cpu.nec
tmp = FETCHWORD();
PUSH((ushort)tmp);
//CLKW(12, 12, 5, 12, 8, 5, I.regs.w[4]);
CLKW(12, 12, 5, 12, 8, 5, I.regs.b[8]+I.regs.b[9]*0x100);
CLKW(12, 12, 5, 12, 8, 5, I.regs.b[8] + I.regs.b[9] * 0x100);
}
void i_imul_d16()
{
@ -906,7 +901,7 @@ namespace cpu.nec
int tmp = (ushort)((short)((sbyte)FETCH()));
PUSH((ushort)tmp);
//CLKW(11, 11, 5, 11, 7, 3, I.regs.w[4]);
CLKW(11, 11, 5, 11, 7, 3, I.regs.b[8]+I.regs.b[9]*0x100);
CLKW(11, 11, 5, 11, 7, 3, I.regs.b[8] + I.regs.b[9] * 0x100);
}
void i_imul_d8()
{
@ -919,7 +914,7 @@ namespace cpu.nec
I.CarryVal = I.OverVal = (uint)(((((int)dst) >> 15 != 0) && (((int)dst) >> 15 != -1)) ? 1 : 0);
//I.regs.w[mod_RM.regw[ModRM]] = (ushort)dst;
I.regs.b[mod_RM.regw[ModRM] * 2] = (byte)(dst % 0x100);
I.regs.b[mod_RM.regw[ModRM] * 2+1] = (byte)(dst / 0x100);
I.regs.b[mod_RM.regw[ModRM] * 2 + 1] = (byte)(dst / 0x100);
pendingCycles -= (ModRM >= 0xc0) ? 31 : 39;
}
void i_insb()
@ -927,7 +922,7 @@ namespace cpu.nec
//PutMemB(0, I.regs.w[7], ReadIOByte(I.regs.w[2]));
PutMemB(0, I.regs.b[14] + I.regs.b[15] * 0x100, ReadIOByte(I.regs.b[4] + I.regs.b[5] * 0x100));
//I.regs.w[7] += (ushort)(-2 * (I.DF ? 1 : 0) + 1);
ushort w7 =(ushort)(I.regs.b[14] + I.regs.b[15] * 0x100);
ushort w7 = (ushort)(I.regs.b[14] + I.regs.b[15] * 0x100);
w7 += (ushort)(-2 * (I.DF ? 1 : 0) + 1);
I.regs.b[14] = (byte)(w7 % 0x100);
I.regs.b[15] = (byte)(w7 / 0x100);
@ -1401,7 +1396,7 @@ namespace cpu.nec
void i_cwd()
{
//I.regs.w[2] = (ushort)(((I.regs.b[1] & 0x80) != 0) ? 0xffff : 0);
ushort w2= (ushort)(((I.regs.b[1] & 0x80) != 0) ? 0xffff : 0);
ushort w2 = (ushort)(((I.regs.b[1] & 0x80) != 0) ? 0xffff : 0);
I.regs.b[4] = (byte)(w2 % 0x100);
I.regs.b[5] = (byte)(w2 / 0x100);
CLK(4);
@ -1573,7 +1568,7 @@ namespace cpu.nec
ushort w7 = (ushort)(I.regs.b[14] + I.regs.b[15] * 0x100 + (-4 * (I.DF ? 1 : 0) + 2));
I.regs.b[14] = (byte)(w7 % 0x100);
I.regs.b[15] = (byte)(w7 / 0x100);
CLKW(8, 8, 5, 8, 4, 3, I.regs.b[14]+I.regs.b[15]*0x100);
CLKW(8, 8, 5, 8, 4, 3, I.regs.b[14] + I.regs.b[15] * 0x100);
}
void i_lodsb()
{
@ -1609,14 +1604,14 @@ namespace cpu.nec
}
void i_scasw()
{
ushort src = GetMemW(0, I.regs.b[14]+I.regs.b[15]*0x100);
ushort dst = (ushort)(I.regs.b[0]+I.regs.b[1]*0x100);
ushort src = GetMemW(0, I.regs.b[14] + I.regs.b[15] * 0x100);
ushort dst = (ushort)(I.regs.b[0] + I.regs.b[1] * 0x100);
SUBW(ref src, ref dst);
//I.regs.w[7] += (ushort)(-4 * (I.DF ? 1 : 0) + 2);
ushort w7 = (ushort)(I.regs.b[14] + I.regs.b[15] * 0x100 + (-4 * (I.DF ? 1 : 0) + 2));
I.regs.b[14] = (byte)(w7 % 0x100);
I.regs.b[15] = (byte)(w7 / 0x100);
CLKW(8, 8, 5, 8, 4, 3, I.regs.b[14]+I.regs.b[15]*0x100);
CLKW(8, 8, 5, 8, 4, 3, I.regs.b[14] + I.regs.b[15] * 0x100);
}
void i_mov_ald8()
{
@ -1832,7 +1827,7 @@ namespace cpu.nec
}
if (level != 0)
{
PUSH((ushort)(I.regs.b[10]+I.regs.b[11]*0x100));
PUSH((ushort)(I.regs.b[10] + I.regs.b[11] * 0x100));
}
}
void i_leave()
@ -2010,7 +2005,7 @@ namespace cpu.nec
}
void i_trans()
{
int dest = (I.regs.b[6]+I.regs.b[7]*0x100 + I.regs.b[0]) & 0xffff;
int dest = (I.regs.b[6] + I.regs.b[7] * 0x100 + I.regs.b[0]) & 0xffff;
I.regs.b[0] = GetMemB(3, dest);
CLKS(9, 9, 5);
}
@ -2161,7 +2156,7 @@ namespace cpu.nec
ushort w0 = ReadIOWord(I.regs.b[4] + I.regs.b[5] * 0x100);
I.regs.b[0] = (byte)(w0 % 0x100);
I.regs.b[1] = (byte)(w0 / 0x100);
CLKW(12, 12, 7, 12, 8, 5, I.regs.b[4]+I.regs.b[5]*0x100);
CLKW(12, 12, 7, 12, 8, 5, I.regs.b[4] + I.regs.b[5] * 0x100);
}
void i_outdxal()
{
@ -2174,7 +2169,7 @@ namespace cpu.nec
//WriteIOWord(I.regs.w[2], I.regs.w[0]);
//CLKW(12, 12, 5, 12, 8, 3, I.regs.w[2]);
WriteIOWord(I.regs.b[4] + I.regs.b[5] * 0x100, (ushort)(I.regs.b[0] + I.regs.b[1] * 0x100));
CLKW(12, 12, 5, 12, 8, 3, I.regs.b[4]+I.regs.b[5]*0x100);
CLKW(12, 12, 5, 12, 8, 3, I.regs.b[4] + I.regs.b[5] * 0x100);
}
void i_lock()
{
@ -2331,7 +2326,7 @@ namespace cpu.nec
case 0x10: PutbackRMWord(ModRM, (ushort)(~tmp)); pendingCycles -= (ModRM >= 0xc0) ? 2 : 16; break;
case 0x18: I.CarryVal = (uint)((tmp != 0) ? 1 : 0); tmp = (~tmp) + 1; SetSZPF_Word((int)tmp); PutbackRMWord(ModRM, (ushort)(tmp & 0xffff)); pendingCycles -= (ModRM >= 0xc0) ? 2 : 16; break;
case 0x20:
uresult = (uint)((I.regs.b[0]+I.regs.b[1]*0x100) * tmp);
uresult = (uint)((I.regs.b[0] + I.regs.b[1] * 0x100) * tmp);
//I.regs.w[0] = (ushort)(uresult & 0xffff);
//I.regs.w[2] = (ushort)(uresult >> 16);
I.regs.b[0] = (byte)((ushort)(uresult & 0xffff) % 0x100);
@ -2342,13 +2337,13 @@ namespace cpu.nec
pendingCycles -= (ModRM >= 0xc0) ? 30 : 36;
break;
case 0x28:
result = (int)((short)(I.regs.b[0]+I.regs.b[1]*0x100)) * (int)((short)tmp);
result = (int)((short)(I.regs.b[0] + I.regs.b[1] * 0x100)) * (int)((short)tmp);
//I.regs.w[0] = (ushort)(result & 0xffff);
//I.regs.w[2] = (ushort)(result >> 16);
I.regs.b[0] = (byte)((ushort)(result & 0xffff) % 0x100);
I.regs.b[1] = (byte)((ushort)(result & 0xffff) / 0x100);
I.regs.b[4] = (byte)((ushort)(result >>16) % 0x100);
I.regs.b[5] = (byte)((ushort)(result >>16) / 0x100);
I.regs.b[4] = (byte)((ushort)(result >> 16) % 0x100);
I.regs.b[5] = (byte)((ushort)(result >> 16) / 0x100);
I.CarryVal = I.OverVal = (uint)(((I.regs.b[4] + I.regs.b[5] * 0x100) != 0) ? 1 : 0);
pendingCycles -= (ModRM >= 0xc0) ? 30 : 36;
break;

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace cpu.nec
namespace cpu.nec
{
partial class Nec
{
@ -57,7 +52,7 @@ namespace cpu.nec
//I.regs.w[mod_RM.RMw[ModRM]] = FETCHWORD();
ushort w = FETCHWORD();
I.regs.b[mod_RM.RMw[ModRM] * 2] = (byte)(w % 0x100);
I.regs.b[mod_RM.RMw[ModRM] * 2+1] = (byte)(w / 0x100);
I.regs.b[mod_RM.RMw[ModRM] * 2 + 1] = (byte)(w / 0x100);
}
else
{
@ -104,34 +99,34 @@ namespace cpu.nec
WriteByte(EA, val);
}
}
void DEF_br8(out int ModRM,out byte src, out byte dst)
void DEF_br8(out int ModRM, out byte src, out byte dst)
{
ModRM = FETCH();
src = RegByte(ModRM);
dst = GetRMByte(ModRM);
}
void DEF_wr16(out int ModRM,out ushort src, out ushort dst)
void DEF_wr16(out int ModRM, out ushort src, out ushort dst)
{
ModRM = FETCH();
src = RegWord(ModRM);
dst = GetRMWord(ModRM);
}
void DEF_r8b(out int ModRM,out byte src, out byte dst)
void DEF_r8b(out int ModRM, out byte src, out byte dst)
{
ModRM = FETCH();
dst = RegByte(ModRM);
src = GetRMByte(ModRM);
}
void DEF_r16w(out int ModRM,out ushort src,out ushort dst)
void DEF_r16w(out int ModRM, out ushort src, out ushort dst)
{
ModRM = FETCH();
dst = RegWord(ModRM);
ModRM = FETCH();
dst = RegWord(ModRM);
src = GetRMWord(ModRM);
}
void DEF_ald8(out byte src, out byte dst)
{
src = FETCH();
dst = I.regs.b[0];
src = FETCH();
dst = I.regs.b[0];
}
void DEF_axd16(out ushort src, out ushort dst)
{

View File

@ -6,7 +6,7 @@
//VgMuseum.Z80.Disassembler disasm = new Disassembler();
//ushort pc = RegPC.Word;
//string str = disasm.Disassemble(() => ReadMemory(pc++));
//Console.WriteLine(str);
//EmuLogger.Log(str);
//please note that however much youre tempted to, timings can't be put in a table here because they depend on how the instruction executes at runtime
@ -140,8 +140,8 @@ namespace cpu.z80
}
readonly static string[] mnemonics = new string[]
{
"NOP", "LD BC, nn", "LD (BC), A", "INC BC", //0x04
{
"NOP", "LD BC, nn", "LD (BC), A", "INC BC", //0x04
"INC B", "DEC B", "LD B, n", "RLCA", //0x08
"EX AF, AF'", "ADD HL, BC", "LD A, (BC)", "DEC BC", //0x0C
"INC C", "DEC C", "LD C, n", "RRCA", //0x10
@ -208,8 +208,8 @@ namespace cpu.z80
};
readonly static string[] mnemonicsDD = new string[]
{
"NOP", "LD BC, nn", "LD (BC), A", "INC BC", //0x04
{
"NOP", "LD BC, nn", "LD (BC), A", "INC BC", //0x04
"INC B", "DEC B", "LD B, n", "RLCA", //0x08
"EX AF, AF'", "ADD IX, BC", "LD A, (BC)", "DEC BC", //0x0C
"INC C", "DEC C", "LD C, n", "RRCA", //0x10
@ -276,8 +276,8 @@ namespace cpu.z80
};
readonly static string[] mnemonicsFD = new string[]
{
"NOP", "LD BC, nn", "LD (BC), A", "INC BC", //0x04
{
"NOP", "LD BC, nn", "LD (BC), A", "INC BC", //0x04
"INC B", "DEC B", "LD B, n", "RLCA", //0x08
"EX AF, AF'", "ADD IY, BC", "LD A, (BC)", "DEC BC", //0x0C
"INC C", "DEC C", "LD C, n", "RRCA", //0x10
@ -344,121 +344,121 @@ namespace cpu.z80
};
readonly static string[] mnemonicsDDCB = new string[]
{
"RLC (IX+d)->B", "RLC (IX+d)->C", "RLC (IX+d)->D", "RLC (IX+d)->E", "RLC (IX+d)->H", "RLC (IX+d)->L", "RLC (IX+d)", "RLC (IX+d)->A",
"RRC (IX+d)->B", "RRC (IX+d)->C", "RRC (IX+d)->D", "RRC (IX+d)->E", "RRC (IX+d)->H", "RRC (IX+d)->L", "RRC (IX+d)", "RRC (IX+d)->A",
"RL (IX+d)->B", "RL (IX+d)->C", "RL (IX+d)->D", "RL (IX+d)->E", "RL (IX+d)->H", "RL (IX+d)->L", "RL (IX+d)", "RL (IX+d)->A",
"RR (IX+d)->B", "RR (IX+d)->C", "RR (IX+d)->D", "RR (IX+d)->E", "RR (IX+d)->H", "RR (IX+d)->L", "RR (IX+d)", "RR (IX+d)->A",
"SLA (IX+d)->B", "SLA (IX+d)->C", "SLA (IX+d)->D", "SLA (IX+d)->E", "SLA (IX+d)->H", "SLA (IX+d)->L", "SLA (IX+d)", "SLA (IX+d)->A",
"SRA (IX+d)->B", "SRA (IX+d)->C", "SRA (IX+d)->D", "SRA (IX+d)->E", "SRA (IX+d)->H", "SRA (IX+d)->L", "SRA (IX+d)", "SRA (IX+d)->A",
"SL1 (IX+d)->B", "SL1 (IX+d)->C", "SL1 (IX+d)->D", "SL1 (IX+d)->E", "SL1 (IX+d)->H", "SL1 (IX+d)->L", "SL1 (IX+d)", "SL1 (IX+d)->A",
"SRL (IX+d)->B", "SRL (IX+d)->C", "SRL (IX+d)->D", "SRL (IX+d)->E", "SRL (IX+d)->H", "SRL (IX+d)->L", "SRL (IX+d)", "SRL (IX+d)->A",
"BIT 0, (IX+d)", "BIT 0, (IX+d)", "BIT 0, (IX+d)", "BIT 0, (IX+d)", "BIT 0, (IX+d)", "BIT 0, (IX+d)", "BIT 0, (IX+d)", "BIT 0, (IX+d)",
"BIT 1, (IX+d)", "BIT 1, (IX+d)", "BIT 1, (IX+d)", "BIT 1, (IX+d)", "BIT 1, (IX+d)", "BIT 1, (IX+d)", "BIT 1, (IX+d)", "BIT 1, (IX+d)",
"BIT 2, (IX+d)", "BIT 2, (IX+d)", "BIT 2, (IX+d)", "BIT 2, (IX+d)", "BIT 2, (IX+d)", "BIT 2, (IX+d)", "BIT 2, (IX+d)", "BIT 2, (IX+d)",
"BIT 3, (IX+d)", "BIT 3, (IX+d)", "BIT 3, (IX+d)", "BIT 3, (IX+d)", "BIT 3, (IX+d)", "BIT 3, (IX+d)", "BIT 3, (IX+d)", "BIT 3, (IX+d)",
"BIT 4, (IX+d)", "BIT 4, (IX+d)", "BIT 4, (IX+d)", "BIT 4, (IX+d)", "BIT 4, (IX+d)", "BIT 4, (IX+d)", "BIT 4, (IX+d)", "BIT 4, (IX+d)",
"BIT 5, (IX+d)", "BIT 5, (IX+d)", "BIT 5, (IX+d)", "BIT 5, (IX+d)", "BIT 5, (IX+d)", "BIT 5, (IX+d)", "BIT 5, (IX+d)", "BIT 5, (IX+d)",
"BIT 6, (IX+d)", "BIT 6, (IX+d)", "BIT 6, (IX+d)", "BIT 6, (IX+d)", "BIT 6, (IX+d)", "BIT 6, (IX+d)", "BIT 6, (IX+d)", "BIT 6, (IX+d)",
"BIT 7, (IX+d)", "BIT 7, (IX+d)", "BIT 7, (IX+d)", "BIT 7, (IX+d)", "BIT 7, (IX+d)", "BIT 7, (IX+d)", "BIT 7, (IX+d)", "BIT 7, (IX+d)",
"RES 0 (IX+d)->B", "RES 0 (IX+d)->C", "RES 0 (IX+d)->D", "RES 0 (IX+d)->E", "RES 0 (IX+d)->H", "RES 0 (IX+d)->L", "RES 0 (IX+d)", "RES 0 (IX+d)->A",
"RES 1 (IX+d)->B", "RES 1 (IX+d)->C", "RES 1 (IX+d)->D", "RES 1 (IX+d)->E", "RES 1 (IX+d)->H", "RES 1 (IX+d)->L", "RES 1 (IX+d)", "RES 1 (IX+d)->A",
"RES 2 (IX+d)->B", "RES 2 (IX+d)->C", "RES 2 (IX+d)->D", "RES 2 (IX+d)->E", "RES 2 (IX+d)->H", "RES 2 (IX+d)->L", "RES 2 (IX+d)", "RES 2 (IX+d)->A",
"RES 3 (IX+d)->B", "RES 3 (IX+d)->C", "RES 3 (IX+d)->D", "RES 3 (IX+d)->E", "RES 3 (IX+d)->H", "RES 3 (IX+d)->L", "RES 3 (IX+d)", "RES 3 (IX+d)->A",
"RES 4 (IX+d)->B", "RES 4 (IX+d)->C", "RES 4 (IX+d)->D", "RES 4 (IX+d)->E", "RES 4 (IX+d)->H", "RES 4 (IX+d)->L", "RES 4 (IX+d)", "RES 4 (IX+d)->A",
"RES 5 (IX+d)->B", "RES 5 (IX+d)->C", "RES 5 (IX+d)->D", "RES 5 (IX+d)->E", "RES 5 (IX+d)->H", "RES 5 (IX+d)->L", "RES 5 (IX+d)", "RES 5 (IX+d)->A",
"RES 6 (IX+d)->B", "RES 6 (IX+d)->C", "RES 6 (IX+d)->D", "RES 6 (IX+d)->E", "RES 6 (IX+d)->H", "RES 6 (IX+d)->L", "RES 6 (IX+d)", "RES 6 (IX+d)->A",
"RES 7 (IX+d)->B", "RES 7 (IX+d)->C", "RES 7 (IX+d)->D", "RES 7 (IX+d)->E", "RES 7 (IX+d)->H", "RES 7 (IX+d)->L", "RES 7 (IX+d)", "RES 7 (IX+d)->A",
"SET 0 (IX+d)->B", "SET 0 (IX+d)->C", "SET 0 (IX+d)->D", "SET 0 (IX+d)->E", "SET 0 (IX+d)->H", "SET 0 (IX+d)->L", "SET 0 (IX+d)", "SET 0 (IX+d)->A",
"SET 1 (IX+d)->B", "SET 1 (IX+d)->C", "SET 1 (IX+d)->D", "SET 1 (IX+d)->E", "SET 1 (IX+d)->H", "SET 1 (IX+d)->L", "SET 1 (IX+d)", "SET 1 (IX+d)->A",
"SET 2 (IX+d)->B", "SET 2 (IX+d)->C", "SET 2 (IX+d)->D", "SET 2 (IX+d)->E", "SET 2 (IX+d)->H", "SET 2 (IX+d)->L", "SET 2 (IX+d)", "SET 2 (IX+d)->A",
"SET 3 (IX+d)->B", "SET 3 (IX+d)->C", "SET 3 (IX+d)->D", "SET 3 (IX+d)->E", "SET 3 (IX+d)->H", "SET 3 (IX+d)->L", "SET 3 (IX+d)", "SET 3 (IX+d)->A",
"SET 4 (IX+d)->B", "SET 4 (IX+d)->C", "SET 4 (IX+d)->D", "SET 4 (IX+d)->E", "SET 4 (IX+d)->H", "SET 4 (IX+d)->L", "SET 4 (IX+d)", "SET 4 (IX+d)->A",
"SET 5 (IX+d)->B", "SET 5 (IX+d)->C", "SET 5 (IX+d)->D", "SET 5 (IX+d)->E", "SET 5 (IX+d)->H", "SET 5 (IX+d)->L", "SET 5 (IX+d)", "SET 5 (IX+d)->A",
"SET 6 (IX+d)->B", "SET 6 (IX+d)->C", "SET 6 (IX+d)->D", "SET 6 (IX+d)->E", "SET 6 (IX+d)->H", "SET 6 (IX+d)->L", "SET 6 (IX+d)", "SET 6 (IX+d)->A",
"SET 7 (IX+d)->B", "SET 7 (IX+d)->C", "SET 7 (IX+d)->D", "SET 7 (IX+d)->E", "SET 7 (IX+d)->H", "SET 7 (IX+d)->L", "SET 7 (IX+d)", "SET 7 (IX+d)->A",
};
{
"RLC (IX+d)->B", "RLC (IX+d)->C", "RLC (IX+d)->D", "RLC (IX+d)->E", "RLC (IX+d)->H", "RLC (IX+d)->L", "RLC (IX+d)", "RLC (IX+d)->A",
"RRC (IX+d)->B", "RRC (IX+d)->C", "RRC (IX+d)->D", "RRC (IX+d)->E", "RRC (IX+d)->H", "RRC (IX+d)->L", "RRC (IX+d)", "RRC (IX+d)->A",
"RL (IX+d)->B", "RL (IX+d)->C", "RL (IX+d)->D", "RL (IX+d)->E", "RL (IX+d)->H", "RL (IX+d)->L", "RL (IX+d)", "RL (IX+d)->A",
"RR (IX+d)->B", "RR (IX+d)->C", "RR (IX+d)->D", "RR (IX+d)->E", "RR (IX+d)->H", "RR (IX+d)->L", "RR (IX+d)", "RR (IX+d)->A",
"SLA (IX+d)->B", "SLA (IX+d)->C", "SLA (IX+d)->D", "SLA (IX+d)->E", "SLA (IX+d)->H", "SLA (IX+d)->L", "SLA (IX+d)", "SLA (IX+d)->A",
"SRA (IX+d)->B", "SRA (IX+d)->C", "SRA (IX+d)->D", "SRA (IX+d)->E", "SRA (IX+d)->H", "SRA (IX+d)->L", "SRA (IX+d)", "SRA (IX+d)->A",
"SL1 (IX+d)->B", "SL1 (IX+d)->C", "SL1 (IX+d)->D", "SL1 (IX+d)->E", "SL1 (IX+d)->H", "SL1 (IX+d)->L", "SL1 (IX+d)", "SL1 (IX+d)->A",
"SRL (IX+d)->B", "SRL (IX+d)->C", "SRL (IX+d)->D", "SRL (IX+d)->E", "SRL (IX+d)->H", "SRL (IX+d)->L", "SRL (IX+d)", "SRL (IX+d)->A",
"BIT 0, (IX+d)", "BIT 0, (IX+d)", "BIT 0, (IX+d)", "BIT 0, (IX+d)", "BIT 0, (IX+d)", "BIT 0, (IX+d)", "BIT 0, (IX+d)", "BIT 0, (IX+d)",
"BIT 1, (IX+d)", "BIT 1, (IX+d)", "BIT 1, (IX+d)", "BIT 1, (IX+d)", "BIT 1, (IX+d)", "BIT 1, (IX+d)", "BIT 1, (IX+d)", "BIT 1, (IX+d)",
"BIT 2, (IX+d)", "BIT 2, (IX+d)", "BIT 2, (IX+d)", "BIT 2, (IX+d)", "BIT 2, (IX+d)", "BIT 2, (IX+d)", "BIT 2, (IX+d)", "BIT 2, (IX+d)",
"BIT 3, (IX+d)", "BIT 3, (IX+d)", "BIT 3, (IX+d)", "BIT 3, (IX+d)", "BIT 3, (IX+d)", "BIT 3, (IX+d)", "BIT 3, (IX+d)", "BIT 3, (IX+d)",
"BIT 4, (IX+d)", "BIT 4, (IX+d)", "BIT 4, (IX+d)", "BIT 4, (IX+d)", "BIT 4, (IX+d)", "BIT 4, (IX+d)", "BIT 4, (IX+d)", "BIT 4, (IX+d)",
"BIT 5, (IX+d)", "BIT 5, (IX+d)", "BIT 5, (IX+d)", "BIT 5, (IX+d)", "BIT 5, (IX+d)", "BIT 5, (IX+d)", "BIT 5, (IX+d)", "BIT 5, (IX+d)",
"BIT 6, (IX+d)", "BIT 6, (IX+d)", "BIT 6, (IX+d)", "BIT 6, (IX+d)", "BIT 6, (IX+d)", "BIT 6, (IX+d)", "BIT 6, (IX+d)", "BIT 6, (IX+d)",
"BIT 7, (IX+d)", "BIT 7, (IX+d)", "BIT 7, (IX+d)", "BIT 7, (IX+d)", "BIT 7, (IX+d)", "BIT 7, (IX+d)", "BIT 7, (IX+d)", "BIT 7, (IX+d)",
"RES 0 (IX+d)->B", "RES 0 (IX+d)->C", "RES 0 (IX+d)->D", "RES 0 (IX+d)->E", "RES 0 (IX+d)->H", "RES 0 (IX+d)->L", "RES 0 (IX+d)", "RES 0 (IX+d)->A",
"RES 1 (IX+d)->B", "RES 1 (IX+d)->C", "RES 1 (IX+d)->D", "RES 1 (IX+d)->E", "RES 1 (IX+d)->H", "RES 1 (IX+d)->L", "RES 1 (IX+d)", "RES 1 (IX+d)->A",
"RES 2 (IX+d)->B", "RES 2 (IX+d)->C", "RES 2 (IX+d)->D", "RES 2 (IX+d)->E", "RES 2 (IX+d)->H", "RES 2 (IX+d)->L", "RES 2 (IX+d)", "RES 2 (IX+d)->A",
"RES 3 (IX+d)->B", "RES 3 (IX+d)->C", "RES 3 (IX+d)->D", "RES 3 (IX+d)->E", "RES 3 (IX+d)->H", "RES 3 (IX+d)->L", "RES 3 (IX+d)", "RES 3 (IX+d)->A",
"RES 4 (IX+d)->B", "RES 4 (IX+d)->C", "RES 4 (IX+d)->D", "RES 4 (IX+d)->E", "RES 4 (IX+d)->H", "RES 4 (IX+d)->L", "RES 4 (IX+d)", "RES 4 (IX+d)->A",
"RES 5 (IX+d)->B", "RES 5 (IX+d)->C", "RES 5 (IX+d)->D", "RES 5 (IX+d)->E", "RES 5 (IX+d)->H", "RES 5 (IX+d)->L", "RES 5 (IX+d)", "RES 5 (IX+d)->A",
"RES 6 (IX+d)->B", "RES 6 (IX+d)->C", "RES 6 (IX+d)->D", "RES 6 (IX+d)->E", "RES 6 (IX+d)->H", "RES 6 (IX+d)->L", "RES 6 (IX+d)", "RES 6 (IX+d)->A",
"RES 7 (IX+d)->B", "RES 7 (IX+d)->C", "RES 7 (IX+d)->D", "RES 7 (IX+d)->E", "RES 7 (IX+d)->H", "RES 7 (IX+d)->L", "RES 7 (IX+d)", "RES 7 (IX+d)->A",
"SET 0 (IX+d)->B", "SET 0 (IX+d)->C", "SET 0 (IX+d)->D", "SET 0 (IX+d)->E", "SET 0 (IX+d)->H", "SET 0 (IX+d)->L", "SET 0 (IX+d)", "SET 0 (IX+d)->A",
"SET 1 (IX+d)->B", "SET 1 (IX+d)->C", "SET 1 (IX+d)->D", "SET 1 (IX+d)->E", "SET 1 (IX+d)->H", "SET 1 (IX+d)->L", "SET 1 (IX+d)", "SET 1 (IX+d)->A",
"SET 2 (IX+d)->B", "SET 2 (IX+d)->C", "SET 2 (IX+d)->D", "SET 2 (IX+d)->E", "SET 2 (IX+d)->H", "SET 2 (IX+d)->L", "SET 2 (IX+d)", "SET 2 (IX+d)->A",
"SET 3 (IX+d)->B", "SET 3 (IX+d)->C", "SET 3 (IX+d)->D", "SET 3 (IX+d)->E", "SET 3 (IX+d)->H", "SET 3 (IX+d)->L", "SET 3 (IX+d)", "SET 3 (IX+d)->A",
"SET 4 (IX+d)->B", "SET 4 (IX+d)->C", "SET 4 (IX+d)->D", "SET 4 (IX+d)->E", "SET 4 (IX+d)->H", "SET 4 (IX+d)->L", "SET 4 (IX+d)", "SET 4 (IX+d)->A",
"SET 5 (IX+d)->B", "SET 5 (IX+d)->C", "SET 5 (IX+d)->D", "SET 5 (IX+d)->E", "SET 5 (IX+d)->H", "SET 5 (IX+d)->L", "SET 5 (IX+d)", "SET 5 (IX+d)->A",
"SET 6 (IX+d)->B", "SET 6 (IX+d)->C", "SET 6 (IX+d)->D", "SET 6 (IX+d)->E", "SET 6 (IX+d)->H", "SET 6 (IX+d)->L", "SET 6 (IX+d)", "SET 6 (IX+d)->A",
"SET 7 (IX+d)->B", "SET 7 (IX+d)->C", "SET 7 (IX+d)->D", "SET 7 (IX+d)->E", "SET 7 (IX+d)->H", "SET 7 (IX+d)->L", "SET 7 (IX+d)", "SET 7 (IX+d)->A",
};
readonly static string[] mnemonicsFDCB = new string[]
{
"RLC (IY+d)->B", "RLC (IY+d)->C", "RLC (IY+d)->D", "RLC (IY+d)->E", "RLC (IY+d)->H", "RLC (IY+d)->L", "RLC (IY+d)", "RLC (IY+d)->A",
"RRC (IY+d)->B", "RRC (IY+d)->C", "RRC (IY+d)->D", "RRC (IY+d)->E", "RRC (IY+d)->H", "RRC (IY+d)->L", "RRC (IY+d)", "RRC (IY+d)->A",
"RL (IY+d)->B", "RL (IY+d)->C", "RL (IY+d)->D", "RL (IY+d)->E", "RL (IY+d)->H", "RL (IY+d)->L", "RL (IY+d)", "RL (IY+d)->A",
"RR (IY+d)->B", "RR (IY+d)->C", "RR (IY+d)->D", "RR (IY+d)->E", "RR (IY+d)->H", "RR (IY+d)->L", "RR (IY+d)", "RR (IY+d)->A",
"SLA (IY+d)->B", "SLA (IY+d)->C", "SLA (IY+d)->D", "SLA (IY+d)->E", "SLA (IY+d)->H", "SLA (IY+d)->L", "SLA (IY+d)", "SLA (IY+d)->A",
"SRA (IY+d)->B", "SRA (IY+d)->C", "SRA (IY+d)->D", "SRA (IY+d)->E", "SRA (IY+d)->H", "SRA (IY+d)->L", "SRA (IY+d)", "SRA (IY+d)->A",
"SL1 (IY+d)->B", "SL1 (IY+d)->C", "SL1 (IY+d)->D", "SL1 (IY+d)->E", "SL1 (IY+d)->H", "SL1 (IY+d)->L", "SL1 (IY+d)", "SL1 (IY+d)->A",
"SRL (IY+d)->B", "SRL (IY+d)->C", "SRL (IY+d)->D", "SRL (IY+d)->E", "SRL (IY+d)->H", "SRL (IY+d)->L", "SRL (IY+d)", "SRL (IY+d)->A",
"BIT 0, (IY+d)", "BIT 0, (IY+d)", "BIT 0, (IY+d)", "BIT 0, (IY+d)", "BIT 0, (IY+d)", "BIT 0, (IY+d)", "BIT 0, (IY+d)", "BIT 0, (IY+d)",
"BIT 1, (IY+d)", "BIT 1, (IY+d)", "BIT 1, (IY+d)", "BIT 1, (IY+d)", "BIT 1, (IY+d)", "BIT 1, (IY+d)", "BIT 1, (IY+d)", "BIT 1, (IY+d)",
"BIT 2, (IY+d)", "BIT 2, (IY+d)", "BIT 2, (IY+d)", "BIT 2, (IY+d)", "BIT 2, (IY+d)", "BIT 2, (IY+d)", "BIT 2, (IY+d)", "BIT 2, (IY+d)",
"BIT 3, (IY+d)", "BIT 3, (IY+d)", "BIT 3, (IY+d)", "BIT 3, (IY+d)", "BIT 3, (IY+d)", "BIT 3, (IY+d)", "BIT 3, (IY+d)", "BIT 3, (IY+d)",
"BIT 4, (IY+d)", "BIT 4, (IY+d)", "BIT 4, (IY+d)", "BIT 4, (IY+d)", "BIT 4, (IY+d)", "BIT 4, (IY+d)", "BIT 4, (IY+d)", "BIT 4, (IY+d)",
"BIT 5, (IY+d)", "BIT 5, (IY+d)", "BIT 5, (IY+d)", "BIT 5, (IY+d)", "BIT 5, (IY+d)", "BIT 5, (IY+d)", "BIT 5, (IY+d)", "BIT 5, (IY+d)",
"BIT 6, (IY+d)", "BIT 6, (IY+d)", "BIT 6, (IY+d)", "BIT 6, (IY+d)", "BIT 6, (IY+d)", "BIT 6, (IY+d)", "BIT 6, (IY+d)", "BIT 6, (IY+d)",
"BIT 7, (IY+d)", "BIT 7, (IY+d)", "BIT 7, (IY+d)", "BIT 7, (IY+d)", "BIT 7, (IY+d)", "BIT 7, (IY+d)", "BIT 7, (IY+d)", "BIT 7, (IY+d)",
"RES 0 (IY+d)->B", "RES 0 (IY+d)->C", "RES 0 (IY+d)->D", "RES 0 (IY+d)->E", "RES 0 (IY+d)->H", "RES 0 (IY+d)->L", "RES 0 (IY+d)", "RES 0 (IY+d)->A",
"RES 1 (IY+d)->B", "RES 1 (IY+d)->C", "RES 1 (IY+d)->D", "RES 1 (IY+d)->E", "RES 1 (IY+d)->H", "RES 1 (IY+d)->L", "RES 1 (IY+d)", "RES 1 (IY+d)->A",
"RES 2 (IY+d)->B", "RES 2 (IY+d)->C", "RES 2 (IY+d)->D", "RES 2 (IY+d)->E", "RES 2 (IY+d)->H", "RES 2 (IY+d)->L", "RES 2 (IY+d)", "RES 2 (IY+d)->A",
"RES 3 (IY+d)->B", "RES 3 (IY+d)->C", "RES 3 (IY+d)->D", "RES 3 (IY+d)->E", "RES 3 (IY+d)->H", "RES 3 (IY+d)->L", "RES 3 (IY+d)", "RES 3 (IY+d)->A",
"RES 4 (IY+d)->B", "RES 4 (IY+d)->C", "RES 4 (IY+d)->D", "RES 4 (IY+d)->E", "RES 4 (IY+d)->H", "RES 4 (IY+d)->L", "RES 4 (IY+d)", "RES 4 (IY+d)->A",
"RES 5 (IY+d)->B", "RES 5 (IY+d)->C", "RES 5 (IY+d)->D", "RES 5 (IY+d)->E", "RES 5 (IY+d)->H", "RES 5 (IY+d)->L", "RES 5 (IY+d)", "RES 5 (IY+d)->A",
"RES 6 (IY+d)->B", "RES 6 (IY+d)->C", "RES 6 (IY+d)->D", "RES 6 (IY+d)->E", "RES 6 (IY+d)->H", "RES 6 (IY+d)->L", "RES 6 (IY+d)", "RES 6 (IY+d)->A",
"RES 7 (IY+d)->B", "RES 7 (IY+d)->C", "RES 7 (IY+d)->D", "RES 7 (IY+d)->E", "RES 7 (IY+d)->H", "RES 7 (IY+d)->L", "RES 7 (IY+d)", "RES 7 (IY+d)->A",
"SET 0 (IY+d)->B", "SET 0 (IY+d)->C", "SET 0 (IY+d)->D", "SET 0 (IY+d)->E", "SET 0 (IY+d)->H", "SET 0 (IY+d)->L", "SET 0 (IY+d)", "SET 0 (IY+d)->A",
"SET 1 (IY+d)->B", "SET 1 (IY+d)->C", "SET 1 (IY+d)->D", "SET 1 (IY+d)->E", "SET 1 (IY+d)->H", "SET 1 (IY+d)->L", "SET 1 (IY+d)", "SET 1 (IY+d)->A",
"SET 2 (IY+d)->B", "SET 2 (IY+d)->C", "SET 2 (IY+d)->D", "SET 2 (IY+d)->E", "SET 2 (IY+d)->H", "SET 2 (IY+d)->L", "SET 2 (IY+d)", "SET 2 (IY+d)->A",
"SET 3 (IY+d)->B", "SET 3 (IY+d)->C", "SET 3 (IY+d)->D", "SET 3 (IY+d)->E", "SET 3 (IY+d)->H", "SET 3 (IY+d)->L", "SET 3 (IY+d)", "SET 3 (IY+d)->A",
"SET 4 (IY+d)->B", "SET 4 (IY+d)->C", "SET 4 (IY+d)->D", "SET 4 (IY+d)->E", "SET 4 (IY+d)->H", "SET 4 (IY+d)->L", "SET 4 (IY+d)", "SET 4 (IY+d)->A",
"SET 5 (IY+d)->B", "SET 5 (IY+d)->C", "SET 5 (IY+d)->D", "SET 5 (IY+d)->E", "SET 5 (IY+d)->H", "SET 5 (IY+d)->L", "SET 5 (IY+d)", "SET 5 (IY+d)->A",
"SET 6 (IY+d)->B", "SET 6 (IY+d)->C", "SET 6 (IY+d)->D", "SET 6 (IY+d)->E", "SET 6 (IY+d)->H", "SET 6 (IY+d)->L", "SET 6 (IY+d)", "SET 6 (IY+d)->A",
"SET 7 (IY+d)->B", "SET 7 (IY+d)->C", "SET 7 (IY+d)->D", "SET 7 (IY+d)->E", "SET 7 (IY+d)->H", "SET 7 (IY+d)->L", "SET 7 (IY+d)", "SET 7 (IY+d)->A",
};
{
"RLC (IY+d)->B", "RLC (IY+d)->C", "RLC (IY+d)->D", "RLC (IY+d)->E", "RLC (IY+d)->H", "RLC (IY+d)->L", "RLC (IY+d)", "RLC (IY+d)->A",
"RRC (IY+d)->B", "RRC (IY+d)->C", "RRC (IY+d)->D", "RRC (IY+d)->E", "RRC (IY+d)->H", "RRC (IY+d)->L", "RRC (IY+d)", "RRC (IY+d)->A",
"RL (IY+d)->B", "RL (IY+d)->C", "RL (IY+d)->D", "RL (IY+d)->E", "RL (IY+d)->H", "RL (IY+d)->L", "RL (IY+d)", "RL (IY+d)->A",
"RR (IY+d)->B", "RR (IY+d)->C", "RR (IY+d)->D", "RR (IY+d)->E", "RR (IY+d)->H", "RR (IY+d)->L", "RR (IY+d)", "RR (IY+d)->A",
"SLA (IY+d)->B", "SLA (IY+d)->C", "SLA (IY+d)->D", "SLA (IY+d)->E", "SLA (IY+d)->H", "SLA (IY+d)->L", "SLA (IY+d)", "SLA (IY+d)->A",
"SRA (IY+d)->B", "SRA (IY+d)->C", "SRA (IY+d)->D", "SRA (IY+d)->E", "SRA (IY+d)->H", "SRA (IY+d)->L", "SRA (IY+d)", "SRA (IY+d)->A",
"SL1 (IY+d)->B", "SL1 (IY+d)->C", "SL1 (IY+d)->D", "SL1 (IY+d)->E", "SL1 (IY+d)->H", "SL1 (IY+d)->L", "SL1 (IY+d)", "SL1 (IY+d)->A",
"SRL (IY+d)->B", "SRL (IY+d)->C", "SRL (IY+d)->D", "SRL (IY+d)->E", "SRL (IY+d)->H", "SRL (IY+d)->L", "SRL (IY+d)", "SRL (IY+d)->A",
"BIT 0, (IY+d)", "BIT 0, (IY+d)", "BIT 0, (IY+d)", "BIT 0, (IY+d)", "BIT 0, (IY+d)", "BIT 0, (IY+d)", "BIT 0, (IY+d)", "BIT 0, (IY+d)",
"BIT 1, (IY+d)", "BIT 1, (IY+d)", "BIT 1, (IY+d)", "BIT 1, (IY+d)", "BIT 1, (IY+d)", "BIT 1, (IY+d)", "BIT 1, (IY+d)", "BIT 1, (IY+d)",
"BIT 2, (IY+d)", "BIT 2, (IY+d)", "BIT 2, (IY+d)", "BIT 2, (IY+d)", "BIT 2, (IY+d)", "BIT 2, (IY+d)", "BIT 2, (IY+d)", "BIT 2, (IY+d)",
"BIT 3, (IY+d)", "BIT 3, (IY+d)", "BIT 3, (IY+d)", "BIT 3, (IY+d)", "BIT 3, (IY+d)", "BIT 3, (IY+d)", "BIT 3, (IY+d)", "BIT 3, (IY+d)",
"BIT 4, (IY+d)", "BIT 4, (IY+d)", "BIT 4, (IY+d)", "BIT 4, (IY+d)", "BIT 4, (IY+d)", "BIT 4, (IY+d)", "BIT 4, (IY+d)", "BIT 4, (IY+d)",
"BIT 5, (IY+d)", "BIT 5, (IY+d)", "BIT 5, (IY+d)", "BIT 5, (IY+d)", "BIT 5, (IY+d)", "BIT 5, (IY+d)", "BIT 5, (IY+d)", "BIT 5, (IY+d)",
"BIT 6, (IY+d)", "BIT 6, (IY+d)", "BIT 6, (IY+d)", "BIT 6, (IY+d)", "BIT 6, (IY+d)", "BIT 6, (IY+d)", "BIT 6, (IY+d)", "BIT 6, (IY+d)",
"BIT 7, (IY+d)", "BIT 7, (IY+d)", "BIT 7, (IY+d)", "BIT 7, (IY+d)", "BIT 7, (IY+d)", "BIT 7, (IY+d)", "BIT 7, (IY+d)", "BIT 7, (IY+d)",
"RES 0 (IY+d)->B", "RES 0 (IY+d)->C", "RES 0 (IY+d)->D", "RES 0 (IY+d)->E", "RES 0 (IY+d)->H", "RES 0 (IY+d)->L", "RES 0 (IY+d)", "RES 0 (IY+d)->A",
"RES 1 (IY+d)->B", "RES 1 (IY+d)->C", "RES 1 (IY+d)->D", "RES 1 (IY+d)->E", "RES 1 (IY+d)->H", "RES 1 (IY+d)->L", "RES 1 (IY+d)", "RES 1 (IY+d)->A",
"RES 2 (IY+d)->B", "RES 2 (IY+d)->C", "RES 2 (IY+d)->D", "RES 2 (IY+d)->E", "RES 2 (IY+d)->H", "RES 2 (IY+d)->L", "RES 2 (IY+d)", "RES 2 (IY+d)->A",
"RES 3 (IY+d)->B", "RES 3 (IY+d)->C", "RES 3 (IY+d)->D", "RES 3 (IY+d)->E", "RES 3 (IY+d)->H", "RES 3 (IY+d)->L", "RES 3 (IY+d)", "RES 3 (IY+d)->A",
"RES 4 (IY+d)->B", "RES 4 (IY+d)->C", "RES 4 (IY+d)->D", "RES 4 (IY+d)->E", "RES 4 (IY+d)->H", "RES 4 (IY+d)->L", "RES 4 (IY+d)", "RES 4 (IY+d)->A",
"RES 5 (IY+d)->B", "RES 5 (IY+d)->C", "RES 5 (IY+d)->D", "RES 5 (IY+d)->E", "RES 5 (IY+d)->H", "RES 5 (IY+d)->L", "RES 5 (IY+d)", "RES 5 (IY+d)->A",
"RES 6 (IY+d)->B", "RES 6 (IY+d)->C", "RES 6 (IY+d)->D", "RES 6 (IY+d)->E", "RES 6 (IY+d)->H", "RES 6 (IY+d)->L", "RES 6 (IY+d)", "RES 6 (IY+d)->A",
"RES 7 (IY+d)->B", "RES 7 (IY+d)->C", "RES 7 (IY+d)->D", "RES 7 (IY+d)->E", "RES 7 (IY+d)->H", "RES 7 (IY+d)->L", "RES 7 (IY+d)", "RES 7 (IY+d)->A",
"SET 0 (IY+d)->B", "SET 0 (IY+d)->C", "SET 0 (IY+d)->D", "SET 0 (IY+d)->E", "SET 0 (IY+d)->H", "SET 0 (IY+d)->L", "SET 0 (IY+d)", "SET 0 (IY+d)->A",
"SET 1 (IY+d)->B", "SET 1 (IY+d)->C", "SET 1 (IY+d)->D", "SET 1 (IY+d)->E", "SET 1 (IY+d)->H", "SET 1 (IY+d)->L", "SET 1 (IY+d)", "SET 1 (IY+d)->A",
"SET 2 (IY+d)->B", "SET 2 (IY+d)->C", "SET 2 (IY+d)->D", "SET 2 (IY+d)->E", "SET 2 (IY+d)->H", "SET 2 (IY+d)->L", "SET 2 (IY+d)", "SET 2 (IY+d)->A",
"SET 3 (IY+d)->B", "SET 3 (IY+d)->C", "SET 3 (IY+d)->D", "SET 3 (IY+d)->E", "SET 3 (IY+d)->H", "SET 3 (IY+d)->L", "SET 3 (IY+d)", "SET 3 (IY+d)->A",
"SET 4 (IY+d)->B", "SET 4 (IY+d)->C", "SET 4 (IY+d)->D", "SET 4 (IY+d)->E", "SET 4 (IY+d)->H", "SET 4 (IY+d)->L", "SET 4 (IY+d)", "SET 4 (IY+d)->A",
"SET 5 (IY+d)->B", "SET 5 (IY+d)->C", "SET 5 (IY+d)->D", "SET 5 (IY+d)->E", "SET 5 (IY+d)->H", "SET 5 (IY+d)->L", "SET 5 (IY+d)", "SET 5 (IY+d)->A",
"SET 6 (IY+d)->B", "SET 6 (IY+d)->C", "SET 6 (IY+d)->D", "SET 6 (IY+d)->E", "SET 6 (IY+d)->H", "SET 6 (IY+d)->L", "SET 6 (IY+d)", "SET 6 (IY+d)->A",
"SET 7 (IY+d)->B", "SET 7 (IY+d)->C", "SET 7 (IY+d)->D", "SET 7 (IY+d)->E", "SET 7 (IY+d)->H", "SET 7 (IY+d)->L", "SET 7 (IY+d)", "SET 7 (IY+d)->A",
};
readonly static string[] mnemonicsCB = new string[]
{
"RLC B", "RLC C", "RLC D", "RLC E", "RLC H", "RLC L", "RLC (HL)", "RLC A",
"RRC B", "RRC C", "RRC D", "RRC E", "RRC H", "RRC L", "RRC (HL)", "RRC A",
"RL B", "RL C", "RL D", "RL E", "RL H", "RL L", "RL (HL)", "RL A",
"RR B", "RR C", "RR D", "RR E", "RR H", "RR L", "RR (HL)", "RR A",
"SLA B", "SLA C", "SLA D", "SLA E", "SLA H", "SLA L", "SLA (HL)", "SLA A",
"SRA B", "SRA C", "SRA D", "SRA E", "SRA H", "SRA L", "SRA (HL)", "SRA A",
"SL1 B", "SL1 C", "SL1 D", "SL1 E", "SL1 H", "SL1 L", "SL1 (HL)", "SL1 A",
"SRL B", "SRL C", "SRL D", "SRL E", "SRL H", "SRL L", "SRL (HL)", "SRL A",
"BIT 0, B", "BIT 0, C", "BIT 0, D", "BIT 0, E", "BIT 0, H", "BIT 0, L", "BIT 0, (HL)", "BIT 0, A",
"BIT 1, B", "BIT 1, C", "BIT 1, D", "BIT 1, E", "BIT 1, H", "BIT 1, L", "BIT 1, (HL)", "BIT 1, A",
"BIT 2, B", "BIT 2, C", "BIT 2, D", "BIT 2, E", "BIT 2, H", "BIT 2, L", "BIT 2, (HL)", "BIT 2, A",
"BIT 3, B", "BIT 3, C", "BIT 3, D", "BIT 3, E", "BIT 3, H", "BIT 3, L", "BIT 3, (HL)", "BIT 3, A",
"BIT 4, B", "BIT 4, C", "BIT 4, D", "BIT 4, E", "BIT 4, H", "BIT 4, L", "BIT 4, (HL)", "BIT 4, A",
"BIT 5, B", "BIT 5, C", "BIT 5, D", "BIT 5, E", "BIT 5, H", "BIT 5, L", "BIT 5, (HL)", "BIT 5, A",
"BIT 6, B", "BIT 6, C", "BIT 6, D", "BIT 6, E", "BIT 6, H", "BIT 6, L", "BIT 6, (HL)", "BIT 6, A",
"BIT 7, B", "BIT 7, C", "BIT 7, D", "BIT 7, E", "BIT 7, H", "BIT 7, L", "BIT 7, (HL)", "BIT 7, A",
"RES 0, B", "RES 0, C", "RES 0, D", "RES 0, E", "RES 0, H", "RES 0, L", "RES 0, (HL)", "RES 0, A",
"RES 1, B", "RES 1, C", "RES 1, D", "RES 1, E", "RES 1, H", "RES 1, L", "RES 1, (HL)", "RES 1, A",
"RES 2, B", "RES 2, C", "RES 2, D", "RES 2, E", "RES 2, H", "RES 2, L", "RES 2, (HL)", "RES 2, A",
"RES 3, B", "RES 3, C", "RES 3, D", "RES 3, E", "RES 3, H", "RES 3, L", "RES 3, (HL)", "RES 3, A",
"RES 4, B", "RES 4, C", "RES 4, D", "RES 4, E", "RES 4, H", "RES 4, L", "RES 4, (HL)", "RES 4, A",
"RES 5, B", "RES 5, C", "RES 5, D", "RES 5, E", "RES 5, H", "RES 5, L", "RES 5, (HL)", "RES 5, A",
"RES 6, B", "RES 6, C", "RES 6, D", "RES 6, E", "RES 6, H", "RES 6, L", "RES 6, (HL)", "RES 6, A",
"RES 7, B", "RES 7, C", "RES 7, D", "RES 7, E", "RES 7, H", "RES 7, L", "RES 7, (HL)", "RES 7, A",
"SET 0, B", "SET 0, C", "SET 0, D", "SET 0, E", "SET 0, H", "SET 0, L", "SET 0, (HL)", "SET 0, A",
"SET 1, B", "SET 1, C", "SET 1, D", "SET 1, E", "SET 1, H", "SET 1, L", "SET 1, (HL)", "SET 1, A",
"SET 2, B", "SET 2, C", "SET 2, D", "SET 2, E", "SET 2, H", "SET 2, L", "SET 2, (HL)", "SET 2, A",
"SET 3, B", "SET 3, C", "SET 3, D", "SET 3, E", "SET 3, H", "SET 3, L", "SET 3, (HL)", "SET 3, A",
"SET 4, B", "SET 4, C", "SET 4, D", "SET 4, E", "SET 4, H", "SET 4, L", "SET 4, (HL)", "SET 4, A",
"SET 5, B", "SET 5, C", "SET 5, D", "SET 5, E", "SET 5, H", "SET 5, L", "SET 5, (HL)", "SET 5, A",
"SET 6, B", "SET 6, C", "SET 6, D", "SET 6, E", "SET 6, H", "SET 6, L", "SET 6, (HL)", "SET 6, A",
"SET 7, B", "SET 7, C", "SET 7, D", "SET 7, E", "SET 7, H", "SET 7, L", "SET 7, (HL)", "SET 7, A",
};
{
"RLC B", "RLC C", "RLC D", "RLC E", "RLC H", "RLC L", "RLC (HL)", "RLC A",
"RRC B", "RRC C", "RRC D", "RRC E", "RRC H", "RRC L", "RRC (HL)", "RRC A",
"RL B", "RL C", "RL D", "RL E", "RL H", "RL L", "RL (HL)", "RL A",
"RR B", "RR C", "RR D", "RR E", "RR H", "RR L", "RR (HL)", "RR A",
"SLA B", "SLA C", "SLA D", "SLA E", "SLA H", "SLA L", "SLA (HL)", "SLA A",
"SRA B", "SRA C", "SRA D", "SRA E", "SRA H", "SRA L", "SRA (HL)", "SRA A",
"SL1 B", "SL1 C", "SL1 D", "SL1 E", "SL1 H", "SL1 L", "SL1 (HL)", "SL1 A",
"SRL B", "SRL C", "SRL D", "SRL E", "SRL H", "SRL L", "SRL (HL)", "SRL A",
"BIT 0, B", "BIT 0, C", "BIT 0, D", "BIT 0, E", "BIT 0, H", "BIT 0, L", "BIT 0, (HL)", "BIT 0, A",
"BIT 1, B", "BIT 1, C", "BIT 1, D", "BIT 1, E", "BIT 1, H", "BIT 1, L", "BIT 1, (HL)", "BIT 1, A",
"BIT 2, B", "BIT 2, C", "BIT 2, D", "BIT 2, E", "BIT 2, H", "BIT 2, L", "BIT 2, (HL)", "BIT 2, A",
"BIT 3, B", "BIT 3, C", "BIT 3, D", "BIT 3, E", "BIT 3, H", "BIT 3, L", "BIT 3, (HL)", "BIT 3, A",
"BIT 4, B", "BIT 4, C", "BIT 4, D", "BIT 4, E", "BIT 4, H", "BIT 4, L", "BIT 4, (HL)", "BIT 4, A",
"BIT 5, B", "BIT 5, C", "BIT 5, D", "BIT 5, E", "BIT 5, H", "BIT 5, L", "BIT 5, (HL)", "BIT 5, A",
"BIT 6, B", "BIT 6, C", "BIT 6, D", "BIT 6, E", "BIT 6, H", "BIT 6, L", "BIT 6, (HL)", "BIT 6, A",
"BIT 7, B", "BIT 7, C", "BIT 7, D", "BIT 7, E", "BIT 7, H", "BIT 7, L", "BIT 7, (HL)", "BIT 7, A",
"RES 0, B", "RES 0, C", "RES 0, D", "RES 0, E", "RES 0, H", "RES 0, L", "RES 0, (HL)", "RES 0, A",
"RES 1, B", "RES 1, C", "RES 1, D", "RES 1, E", "RES 1, H", "RES 1, L", "RES 1, (HL)", "RES 1, A",
"RES 2, B", "RES 2, C", "RES 2, D", "RES 2, E", "RES 2, H", "RES 2, L", "RES 2, (HL)", "RES 2, A",
"RES 3, B", "RES 3, C", "RES 3, D", "RES 3, E", "RES 3, H", "RES 3, L", "RES 3, (HL)", "RES 3, A",
"RES 4, B", "RES 4, C", "RES 4, D", "RES 4, E", "RES 4, H", "RES 4, L", "RES 4, (HL)", "RES 4, A",
"RES 5, B", "RES 5, C", "RES 5, D", "RES 5, E", "RES 5, H", "RES 5, L", "RES 5, (HL)", "RES 5, A",
"RES 6, B", "RES 6, C", "RES 6, D", "RES 6, E", "RES 6, H", "RES 6, L", "RES 6, (HL)", "RES 6, A",
"RES 7, B", "RES 7, C", "RES 7, D", "RES 7, E", "RES 7, H", "RES 7, L", "RES 7, (HL)", "RES 7, A",
"SET 0, B", "SET 0, C", "SET 0, D", "SET 0, E", "SET 0, H", "SET 0, L", "SET 0, (HL)", "SET 0, A",
"SET 1, B", "SET 1, C", "SET 1, D", "SET 1, E", "SET 1, H", "SET 1, L", "SET 1, (HL)", "SET 1, A",
"SET 2, B", "SET 2, C", "SET 2, D", "SET 2, E", "SET 2, H", "SET 2, L", "SET 2, (HL)", "SET 2, A",
"SET 3, B", "SET 3, C", "SET 3, D", "SET 3, E", "SET 3, H", "SET 3, L", "SET 3, (HL)", "SET 3, A",
"SET 4, B", "SET 4, C", "SET 4, D", "SET 4, E", "SET 4, H", "SET 4, L", "SET 4, (HL)", "SET 4, A",
"SET 5, B", "SET 5, C", "SET 5, D", "SET 5, E", "SET 5, H", "SET 5, L", "SET 5, (HL)", "SET 5, A",
"SET 6, B", "SET 6, C", "SET 6, D", "SET 6, E", "SET 6, H", "SET 6, L", "SET 6, (HL)", "SET 6, A",
"SET 7, B", "SET 7, C", "SET 7, D", "SET 7, E", "SET 7, H", "SET 7, L", "SET 7, (HL)", "SET 7, A",
};
readonly static string[] mnemonicsED = new string[]
{
"NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP",
"NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP",
"NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP",
"NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP",
"IN B, C", "OUT C, B", "SBC HL, BC", "LD (nn), BC", //0x44
{
"NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP",
"NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP",
"NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP",
"NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP",
"IN B, C", "OUT C, B", "SBC HL, BC", "LD (nn), BC", //0x44
"NEG", "RETN", "IM $0", "LD I, A", //0x48
"IN C, C", "OUT C, C", "ADC HL, BC", "LD BC, (nn)", //0x4C
"NEG", "RETI", "IM $0", "LD R, A", //0x50
@ -601,7 +601,7 @@ namespace cpu.z80
return format;
}
public string Disassemble2(byte[] code,int offset)
public string Disassemble2(byte[] code, int offset)
{
return Result2(DisassembleInternal2(code), code, offset);
}

View File

@ -1,7 +1,4 @@
using System.IO;
using mame;
namespace cpu.z80
namespace cpu.z80
{
public partial class Z80A
{
@ -25,7 +22,7 @@ namespace cpu.z80
{
halted = false;
RegPC.Word++;
}
}
totalExecutedCycles += 11; pendingCycles -= 11;
nonMaskableInterruptPending = false;
//iff2 = iff1;

View File

@ -33,8 +33,8 @@ namespace cpu.z80
private bool halted;
public bool Halted { get { return halted; } set { halted = value; } }
public Func<int> IRQCallback = delegate() { return 0; };
public Action NMICallback = delegate() { };
public Func<int> IRQCallback = delegate () { return 0; };
public Action NMICallback = delegate () { };
private void ResetInterrupts()
{

View File

@ -1,5 +1,5 @@
using System.Runtime.InteropServices;
using System;
using System;
using System.Runtime.InteropServices;
namespace cpu.z80
{

View File

@ -47,7 +47,7 @@
}
}
private ushort[, , ,] TableALU;
private ushort[,,,] TableALU;
private void InitTableALU()
{
TableALU = new ushort[8, 256, 256, 2]; // Class, OP1, OP2, Carry
@ -191,7 +191,7 @@
}
}
private ushort[, ,] TableRotShift;
private ushort[,,] TableRotShift;
private void InitTableRotShift()
{
TableRotShift = new ushort[2, 8, 65536]; // All, operation, AF
@ -299,7 +299,7 @@
private int[] cc_op, cc_cb, cc_ed, cc_xy, cc_xycb, cc_ex;
private void InitTableCc()
{
cc_op=new int[0x100]{
cc_op = new int[0x100]{
4,10, 7, 6, 4, 4, 7, 4, 4,11, 7, 6, 4, 4, 7, 4,
8,10, 7, 6, 4, 4, 7, 4,12,11, 7, 6, 4, 4, 7, 4,
7,10,16, 6, 4, 4, 7, 4, 7,11,16, 6, 4, 4, 7, 4,

View File

@ -1,8 +1,7 @@
using System;
using mame;
using System;
using System.Globalization;
using System.Collections.Generic;
using System.IO;
using mame;
// This Z80 emulator is a modified version of Ben Ryves 'Brazil' emulator.
// It is MIT licensed.
@ -29,7 +28,7 @@ namespace cpu.z80
{
totalExecutedCycles = value;
}
}
}
public override int PendingCycles
{
get
@ -279,7 +278,7 @@ namespace cpu.z80
pendingCycles = int.Parse(args[1]);
else
Console.WriteLine("Skipping unrecognized identifier " + args[0]);
EmuLogger.Log("Skipping unrecognized identifier " + args[0]);
}
}
}

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mame
namespace mame
{
public struct Atime
{
@ -21,7 +16,7 @@ namespace mame
public static long ATTOSECONDS_PER_SECOND = (long)(1e18);
public static Atime ATTOTIME_ZERO = new Atime(0, 0);
public static Atime ATTOTIME_NEVER = new Atime(1000000000, 0);
public static long ATTOSECONDS_PER_NANOSECOND=(long)1e9;
public static long ATTOSECONDS_PER_NANOSECOND = (long)1e9;
public static Atime ATTOTIME_IN_NSEC(long ns)
{
return new Atime((int)(ns / 1000000000), (long)((ns % 1000000000) * ATTOSECONDS_PER_NANOSECOND));
@ -151,7 +146,7 @@ namespace mame
return ATTOTIME_ZERO;
/* split attoseconds into upper and lower halves which fit into 32 bits */
attohi = divu_64x32_rem((ulong)_time1.attoseconds, 1000000000,out attolo);
attohi = divu_64x32_rem((ulong)_time1.attoseconds, 1000000000, out attolo);
/* scale the lower half, then split into high/low parts */
temp = mulu_32x32(attolo, factor);
@ -200,7 +195,7 @@ namespace mame
attohi = divu_64x32_rem((ulong)_time1.attoseconds, 1000000000, out attolo);
/* divide the seconds and get the remainder */
result.seconds = (int)divu_64x32_rem((ulong)_time1.seconds, factor, out remainder);
result.seconds = (int)divu_64x32_rem((ulong)_time1.seconds, factor, out remainder);
/* combine the upper half of attoseconds with the remainder and divide that */
temp = (ulong)attohi + mulu_32x32(remainder, 1000000000);

View File

@ -29,8 +29,8 @@ namespace mame
public Timer.emu_timer partial_frame_timer;
public Atime partial_frame_period;
public virtual ulong TotalExecutedCycles { get; set; }
public virtual int PendingCycles { get; set; }
public virtual int ExecuteCycles(int cycles) { return 0; }
public virtual int PendingCycles { get; set; }
public virtual int ExecuteCycles(int cycles) { return 0; }
public virtual void Reset() { }
public virtual void set_irq_line(int irqline, LineState state) { }
public virtual void cpunum_set_input_line_and_vector(int cpunum, int line, LineState state, int vector) { }
@ -38,7 +38,7 @@ namespace mame
public class Cpuexec
{
public static byte SUSPEND_REASON_HALT = 0x01, SUSPEND_REASON_RESET = 0x02, SUSPEND_REASON_SPIN = 0x04, SUSPEND_REASON_TRIGGER = 0x08, SUSPEND_REASON_DISABLE = 0x10, SUSPEND_ANY_REASON = 0xff;
public static int iType, bLog, bLog0, bLog1, bLog2, bLog3,bLogS;
public static int iType, bLog, bLog0, bLog1, bLog2, bLog3, bLogS;
public static bool bLog02, bLog12, bLog22, bLog32;
public static bool b11 = true, b12 = true, b13 = true, b14 = true;
public static int iloops, activecpu, icpu, ncpu, iloops2;
@ -488,7 +488,7 @@ namespace mame
case "opwolf":
case "opwolfa":
case "opwolfj":
case "opwolfu":
case "opwolfu":
case "opwolfp":
MC68000.m1 = new MC68000();
Z80A.nZ80 = 1;
@ -741,7 +741,7 @@ namespace mame
cpu[2].cycles_per_second = 3579545;
cpu[0].attoseconds_per_cycle = Attotime.ATTOSECONDS_PER_SECOND / cpu[0].cycles_per_second;
cpu[1].attoseconds_per_cycle = Attotime.ATTOSECONDS_PER_SECOND / cpu[1].cycles_per_second;
cpu[2].attoseconds_per_cycle = Attotime.ATTOSECONDS_PER_SECOND / cpu[2].cycles_per_second;
cpu[2].attoseconds_per_cycle = Attotime.ATTOSECONDS_PER_SECOND / cpu[2].cycles_per_second;
vblank_interrupts_per_frame = 1;
break;
}
@ -943,7 +943,7 @@ namespace mame
M6502.mm1[0].ReadOp = Dataeast.D0ReadOp;
M6502.mm1[0].ReadOpArg = Dataeast.D0ReadOpArg;
M6502.mm1[0].ReadMemory = Dataeast.D0ReadMemory;
M6502.mm1[0].WriteMemory = Dataeast.D0WriteMemory;
M6502.mm1[0].WriteMemory = Dataeast.D0WriteMemory;
M6502.mm1[1].ReadOpArg = Dataeast.D1ReadOpArg;
M6502.mm1[1].ReadMemory = Dataeast.D1ReadMemory;
M6502.mm1[1].WriteMemory = Dataeast.D1WriteMemory;
@ -987,7 +987,7 @@ namespace mame
Z80A.zz1[1].WriteMemory = Tehkan.Z1WriteMemory;
Z80A.zz1[1].ReadHardware = Tehkan.Z1ReadHardware;
Z80A.zz1[1].WriteHardware = Tehkan.Z1WriteHardware;
Z80A.zz1[1].IRQCallback = Tehkan.Z1IRQCallback;
Z80A.zz1[1].IRQCallback = Tehkan.Z1IRQCallback;
break;
case "Neo Geo":
MC68000.m1.ReadOpByte = Neogeo.MReadOpByte;
@ -1373,14 +1373,14 @@ namespace mame
MC68000.m1.WriteByte = PGM.MPWriteByte_orlegend;
MC68000.m1.WriteWord = PGM.MPWriteWord_orlegend;
break;
/*case "drgw2":
MC68000.m1.ReadByte = PGM.MPReadByte_drgw2;
MC68000.m1.ReadWord = MC68000.m1.ReadPcrelWord= PGM.MPReadWord_drgw2;
MC68000.m1.ReadLong = MC68000.m1.ReadPcrelLong= PGM.MPReadLong_drgw2;
MC68000.m1.WriteByte = PGM.MPWriteByte_drgw2;
MC68000.m1.WriteWord = PGM.MPWriteWord_drgw2;
MC68000.m1.WriteLong = PGM.MPWriteLong_drgw2;
break;*/
/*case "drgw2":
MC68000.m1.ReadByte = PGM.MPReadByte_drgw2;
MC68000.m1.ReadWord = MC68000.m1.ReadPcrelWord= PGM.MPReadWord_drgw2;
MC68000.m1.ReadLong = MC68000.m1.ReadPcrelLong= PGM.MPReadLong_drgw2;
MC68000.m1.WriteByte = PGM.MPWriteByte_drgw2;
MC68000.m1.WriteWord = PGM.MPWriteWord_drgw2;
MC68000.m1.WriteLong = PGM.MPWriteLong_drgw2;
break;*/
}
break;
case "M72":
@ -1999,7 +1999,7 @@ namespace mame
case "gngt":
case "makaimur":
case "makaimurc":
case "makaimurg":
case "makaimurg":
M6809.mm1[0].ReadOp = Capcom.MReadOpByte_gng;
M6809.mm1[0].ReadOpArg = Capcom.MReadOpByte_gng;
M6809.mm1[0].RM = Capcom.MReadByte_gng;
@ -2105,7 +2105,7 @@ namespace mame
Z80A.zz1[1].ReadHardware = Capcom.Z1ReadHardware;
Z80A.zz1[1].WriteHardware = Capcom.Z1WriteHardware;
Z80A.zz1[1].IRQCallback = Capcom.Z1IRQCallback;
break;
break;
}
break;
}
@ -2118,46 +2118,46 @@ namespace mame
case "Neo Geo":
case "PGM":
case "Taito B":
m68000Form.m68000State = m68000Form.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000form.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000form.m68000_stop_debug;
z80Form.z80State = z80Form.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug;
m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug;
z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug;
break;
case "Tehkan":
z80Form.z80State = z80Form.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug;
z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug;
Z80A.zz1[1].debugger_start_cpu_hook_callback = null_callback;
Z80A.zz1[1].debugger_stop_cpu_hook_callback = null_callback;
break;
case "IGS011":
m68000Form.m68000State = m68000Form.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000form.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000form.m68000_stop_debug;
m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug;
break;
case "SunA8":
z80Form.z80State = z80Form.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug;
z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug;
Z80A.zz1[1].debugger_start_cpu_hook_callback = null_callback;
Z80A.zz1[1].debugger_stop_cpu_hook_callback = null_callback;
break;
case "Namco System 1":
m6809Form.m6809State = CPUState.RUN;
m6809Motion.m6809State = CPUState.RUN;
M6809.mm1[0].DisassemblerInit();
M6809.mm1[0].debugger_start_cpu_hook_callback = Machine.FORM.m6809form.m6809_start_debug;
M6809.mm1[0].debugger_stop_cpu_hook_callback = Machine.FORM.m6809form.m6809_stop_debug;
M6809.mm1[0].debugger_start_cpu_hook_callback = Machine.FORM.m6809motion.m6809_start_debug;
M6809.mm1[0].debugger_stop_cpu_hook_callback = Machine.FORM.m6809motion.m6809_stop_debug;
M6809.mm1[1].debugger_start_cpu_hook_callback = null_callback;
M6809.mm1[1].debugger_stop_cpu_hook_callback = null_callback;
M6809.mm1[2].debugger_start_cpu_hook_callback = null_callback;
M6809.mm1[2].debugger_stop_cpu_hook_callback = null_callback;
break;
case "M72":
z80Form.z80State = z80Form.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug;
z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug;
break;
case "M92":
break;
@ -2186,35 +2186,35 @@ namespace mame
case "boblcave":
case "bublcave11":
case "bublcave10":
z80Form.z80State = z80Form.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug;
Z80A.zz1[1].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug;
Z80A.zz1[1].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug;
Z80A.zz1[2].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug;
Z80A.zz1[2].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug;
z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug;
Z80A.zz1[1].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug;
Z80A.zz1[1].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug;
Z80A.zz1[2].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug;
Z80A.zz1[2].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug;
break;
case "opwolf":
case "opwolfa":
case "opwolfj":
case "opwolfu":
case "opwolfu":
case "opwolfp":
m68000Form.m68000State = m68000Form.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000form.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000form.m68000_stop_debug;
z80Form.z80State = z80Form.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug;
m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug;
z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug;
break;
case "opwolfb":
m68000Form.m68000State = m68000Form.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000form.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000form.m68000_stop_debug;
z80Form.z80State = z80Form.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug;
Z80A.zz1[1].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug;
Z80A.zz1[1].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug;
m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug;
z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug;
Z80A.zz1[1].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug;
Z80A.zz1[1].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug;
break;
}
break;
@ -2222,17 +2222,17 @@ namespace mame
switch (Machine.sName)
{
case "cuebrick":
m68000Form.m68000State = m68000Form.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000form.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000form.m68000_stop_debug;
m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug;
break;
default:
m68000Form.m68000State = m68000Form.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000form.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000form.m68000_stop_debug;
z80Form.z80State = z80Form.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug;
m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug;
z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug;
break;
}
break;
@ -2250,13 +2250,13 @@ namespace mame
case "makaimurc":
case "makaimurg":
case "diamond":
m6809Form.m6809State = CPUState.RUN;
m6809Motion.m6809State = CPUState.RUN;
M6809.mm1[0].DisassemblerInit();
M6809.mm1[0].debugger_start_cpu_hook_callback = Machine.FORM.m6809form.m6809_start_debug;
M6809.mm1[0].debugger_stop_cpu_hook_callback = Machine.FORM.m6809form.m6809_stop_debug;
z80Form.z80State = z80Form.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug;
M6809.mm1[0].debugger_start_cpu_hook_callback = Machine.FORM.m6809motion.m6809_start_debug;
M6809.mm1[0].debugger_stop_cpu_hook_callback = Machine.FORM.m6809motion.m6809_stop_debug;
z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug;
break;
case "sf":
case "sfua":
@ -2264,14 +2264,14 @@ namespace mame
case "sfjan":
case "sfan":
case "sfp":
m68000Form.m68000State = m68000Form.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000form.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000form.m68000_stop_debug;
z80Form.z80State = z80Form.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug;
Z80A.zz1[1].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug;
Z80A.zz1[1].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug;
m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug;
z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug;
Z80A.zz1[1].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug;
Z80A.zz1[1].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug;
break;
}
break;
@ -2428,7 +2428,7 @@ namespace mame
Atime tbase = Timer.global_basetime;
int ran;
Atime at;
int i,j;
int i, j;
for (icpu = 0; icpu < ncpu; icpu++)
{
cpu[icpu].suspend = cpu[icpu].nextsuspend;
@ -2472,9 +2472,9 @@ namespace mame
cpu[icpu].eatcycles = cpu[icpu].nexteatcycles;
}
Timer.timer_set_global_time(target);
if (Timer.global_basetime.attoseconds == 0 && Machine.FORM.cheatform.lockState == cheatForm.LockState.LOCK_SECOND)
if (Timer.global_basetime.attoseconds == 0 && Machine.FORM.cheatmotion.lockState == cheatMotion.LockState.LOCK_SECOND)
{
Machine.FORM.cheatform.ApplyCheat();
Machine.FORM.cheatmotion.ApplyCheat();
}
}
public static void cpu_boost_interleave(Atime timeslice_time, Atime boost_duration)
@ -2616,7 +2616,7 @@ namespace mame
IGS011.lhb_interrupt();
Timer.timer_adjust_periodic(Cpuexec.cpu[0].partial_frame_timer, Cpuexec.cpu[0].partial_frame_period, Attotime.ATTOTIME_NEVER);
break;
}
}
break;
case "PGM":
PGM.drgw_interrupt();
@ -2682,7 +2682,7 @@ namespace mame
case "opwolf":
case "opwolfa":
case "opwolfj":
case "opwolfu":
case "opwolfu":
case "opwolfp":
if (!cpunum_is_suspended(0, (byte)(SUSPEND_REASON_HALT | SUSPEND_REASON_RESET | SUSPEND_REASON_DISABLE)))
{
@ -2753,7 +2753,7 @@ namespace mame
case "sfp":
Generic.irq_0_6_line_hold();
break;
}
}
break;
}
}
@ -2810,7 +2810,7 @@ namespace mame
{
Timer.timer_adjust_periodic(Cpuexec.cpu[1].partial_frame_timer, Cpuexec.cpu[1].partial_frame_period, Attotime.ATTOTIME_NEVER);
}
break;
break;
case "Taito":
switch (Machine.sName)
{

View File

@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Runtime.InteropServices;
namespace mame
@ -47,7 +45,7 @@ namespace mame
INPUT_LINE_NMI = MAX_INPUT_LINES - 3,
INPUT_LINE_RESET = MAX_INPUT_LINES - 2,
INPUT_LINE_HALT = MAX_INPUT_LINES - 1,
}
}
public class irq
{
public int cpunum;
@ -59,7 +57,7 @@ namespace mame
{
}
public irq(int _cpunum, int _line, LineState _state,int _vector, Atime _time)
public irq(int _cpunum, int _line, LineState _state, int _vector, Atime _time)
{
cpunum = _cpunum;
line = _line;
@ -123,7 +121,7 @@ namespace mame
interrupt_vector[i, j] = 0xff;
input_event_index[i, j] = 0;
}
}
}
}
public static void cps1_irq_handler_mus(int irq)
{
@ -143,7 +141,7 @@ namespace mame
{
if (cpunum < Cpuexec.ncpu && line >= 0 && line < (int)LineState.MAX_INPUT_LINES)
{
interrupt_vector[cpunum,line] = vector;
interrupt_vector[cpunum, line] = vector;
return;
}
}
@ -162,12 +160,12 @@ namespace mame
{
int i1 = 1;
}
foreach(irq irq1 in lirq)
foreach (irq irq1 in lirq)
{
if (Attotime.attotime_compare(irq1.time, Timer.global_basetime) <= 0)
{
input_line_state[irq1.cpunum,irq1.line] = (byte)irq1.state;
input_line_vector[irq1.cpunum,irq1.line] = irq1.vector;
input_line_state[irq1.cpunum, irq1.line] = (byte)irq1.state;
input_line_vector[irq1.cpunum, irq1.line] = irq1.vector;
if (irq1.line == (int)LineState.INPUT_LINE_RESET)
{
if (irq1.state == LineState.ASSERT_LINE)
@ -214,7 +212,7 @@ namespace mame
{
Cpuexec.cpu_triggerint(irq1.cpunum);
}
}
}
lsirq.Add(irq1);
}
}
@ -293,7 +291,7 @@ namespace mame
}
public static void SaveStateBinary(BinaryWriter writer)
{
int i,j, n;
int i, j, n;
n = lirq.Count;
writer.Write(n);
for (i = 0; i < n; i++)
@ -341,11 +339,11 @@ namespace mame
{
writer.Write(input_event_index[i, j]);
}
}
}
}
public static void LoadStateBinary(BinaryReader reader)
{
int i,j, n;
int i, j, n;
n = reader.ReadInt32();
lirq = new List<irq>();
for (i = 0; i < n; i++)

View File

@ -1,10 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Drawing;
using System.IO;
using System.Text;
using System.Runtime.InteropServices;
using Bitmap = MAME.Core.AxiBitmap.AxiBitmap;
using Color = MAME.Core.AxiBitmap.AxiColor;
namespace mame
{
@ -24,68 +19,68 @@ namespace mame
public byte animation_counter;
}
public static crosshair_global global;
public static byte[] crosshair_raw_top =new byte[]
public static byte[] crosshair_raw_top = new byte[]
{
0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,
0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x00,
0x00,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xf0,0x00,
0x01,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xf8,0x00,
0x03,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xfc,0x00,
0x07,0xfe,0x00,0x00,0x00,0x0f,0xfe,0x00,0x00,0x00,0x07,0xfe,0x00,
0x0f,0xff,0x00,0x00,0x01,0xff,0xff,0xf0,0x00,0x00,0x0f,0xff,0x00,
0x1f,0xff,0x80,0x00,0x1f,0xff,0xff,0xff,0x00,0x00,0x1f,0xff,0x80,
0x3f,0xff,0x80,0x00,0xff,0xff,0xff,0xff,0xe0,0x00,0x1f,0xff,0xc0,
0x7f,0xff,0xc0,0x03,0xff,0xff,0xff,0xff,0xf8,0x00,0x3f,0xff,0xe0,
0xff,0xff,0xe0,0x07,0xff,0xff,0xff,0xff,0xfc,0x00,0x7f,0xff,0xf0,
0x7f,0xff,0xf0,0x1f,0xff,0xff,0xff,0xff,0xff,0x00,0xff,0xff,0xe0,
0x3f,0xff,0xf8,0x7f,0xff,0xff,0xff,0xff,0xff,0xc1,0xff,0xff,0xc0,
0x0f,0xff,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,0xe1,0xff,0xff,0x00,
0x07,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfb,0xff,0xfe,0x00,
0x03,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfc,0x00,
0x01,0xff,0xff,0xff,0xff,0xf0,0x01,0xff,0xff,0xff,0xff,0xf8,0x00,
0x00,0x7f,0xff,0xff,0xff,0x00,0x00,0x1f,0xff,0xff,0xff,0xe0,0x00,
0x00,0x3f,0xff,0xff,0xf8,0x00,0x00,0x03,0xff,0xff,0xff,0xc0,0x00,
0x00,0x1f,0xff,0xff,0xe0,0x00,0x00,0x00,0xff,0xff,0xff,0x80,0x00,
0x00,0x0f,0xff,0xff,0x80,0x00,0x00,0x00,0x3f,0xff,0xff,0x00,0x00,
0x00,0x03,0xff,0xfe,0x00,0x00,0x00,0x00,0x0f,0xff,0xfc,0x00,0x00,
0x00,0x01,0xff,0xfc,0x00,0x00,0x00,0x00,0x07,0xff,0xf8,0x00,0x00,
0x00,0x03,0xff,0xf8,0x00,0x00,0x00,0x00,0x01,0xff,0xf8,0x00,0x00,
0x00,0x07,0xff,0xfc,0x00,0x00,0x00,0x00,0x03,0xff,0xfc,0x00,0x00,
0x00,0x0f,0xff,0xfe,0x00,0x00,0x00,0x00,0x07,0xff,0xfe,0x00,0x00,
0x00,0x0f,0xff,0xff,0x00,0x00,0x00,0x00,0x0f,0xff,0xfe,0x00,0x00,
0x00,0x1f,0xff,0xff,0x80,0x00,0x00,0x00,0x1f,0xff,0xff,0x00,0x00,
0x00,0x1f,0xff,0xff,0x80,0x00,0x00,0x00,0x1f,0xff,0xff,0x00,0x00,
0x00,0x3f,0xfe,0xff,0xc0,0x00,0x00,0x00,0x3f,0xff,0xff,0x80,0x00,
0x00,0x7f,0xfc,0x7f,0xe0,0x00,0x00,0x00,0x7f,0xe7,0xff,0xc0,0x00,
0x00,0x7f,0xf8,0x3f,0xf0,0x00,0x00,0x00,0xff,0xc3,0xff,0xc0,0x00,
0x00,0xff,0xf8,0x1f,0xf8,0x00,0x00,0x01,0xff,0x83,0xff,0xe0,0x00,
0x00,0xff,0xf0,0x07,0xf8,0x00,0x00,0x01,0xfe,0x01,0xff,0xe0,0x00,
0x00,0xff,0xf0,0x03,0xfc,0x00,0x00,0x03,0xfc,0x01,0xff,0xe0,0x00,
0x01,0xff,0xe0,0x01,0xfe,0x00,0x00,0x07,0xf8,0x00,0xff,0xf0,0x00,
0x01,0xff,0xe0,0x00,0xff,0x00,0x00,0x0f,0xf0,0x00,0xff,0xf0,0x00,
0x01,0xff,0xc0,0x00,0x3f,0x80,0x00,0x1f,0xc0,0x00,0x7f,0xf0,0x00,
0x01,0xff,0xc0,0x00,0x1f,0x80,0x00,0x1f,0x80,0x00,0x7f,0xf0,0x00,
0x03,0xff,0xc0,0x00,0x0f,0xc0,0x00,0x3f,0x00,0x00,0x7f,0xf8,0x00,
0x03,0xff,0x80,0x00,0x07,0xe0,0x00,0x7e,0x00,0x00,0x3f,0xf8,0x00,
0x03,0xff,0x80,0x00,0x01,0xf0,0x00,0xf8,0x00,0x00,0x3f,0xf8,0x00,
0x03,0xff,0x80,0x00,0x00,0xf8,0x01,0xf0,0x00,0x00,0x3f,0xf8,0x00,
0x03,0xff,0x80,0x00,0x00,0x78,0x01,0xe0,0x00,0x00,0x3f,0xf8,0x00,
0x07,0xff,0x00,0x00,0x00,0x3c,0x03,0xc0,0x00,0x00,0x3f,0xfc,0x00,
0x07,0xff,0x00,0x00,0x00,0x0e,0x07,0x00,0x00,0x00,0x1f,0xfc,0x00,
0x07,0xff,0x00,0x00,0x00,0x07,0x0e,0x00,0x00,0x00,0x1f,0xfc,0x00,
0x07,0xff,0x00,0x00,0x00,0x03,0x9c,0x00,0x00,0x00,0x1f,0xfc,0x00,
0x07,0xff,0x00,0x00,0x00,0x01,0x98,0x00,0x00,0x00,0x1f,0xfc,0x00,
0x07,0xff,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x1f,0xfc,0x00
0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,
0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x00,
0x00,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xf0,0x00,
0x01,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xf8,0x00,
0x03,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xfc,0x00,
0x07,0xfe,0x00,0x00,0x00,0x0f,0xfe,0x00,0x00,0x00,0x07,0xfe,0x00,
0x0f,0xff,0x00,0x00,0x01,0xff,0xff,0xf0,0x00,0x00,0x0f,0xff,0x00,
0x1f,0xff,0x80,0x00,0x1f,0xff,0xff,0xff,0x00,0x00,0x1f,0xff,0x80,
0x3f,0xff,0x80,0x00,0xff,0xff,0xff,0xff,0xe0,0x00,0x1f,0xff,0xc0,
0x7f,0xff,0xc0,0x03,0xff,0xff,0xff,0xff,0xf8,0x00,0x3f,0xff,0xe0,
0xff,0xff,0xe0,0x07,0xff,0xff,0xff,0xff,0xfc,0x00,0x7f,0xff,0xf0,
0x7f,0xff,0xf0,0x1f,0xff,0xff,0xff,0xff,0xff,0x00,0xff,0xff,0xe0,
0x3f,0xff,0xf8,0x7f,0xff,0xff,0xff,0xff,0xff,0xc1,0xff,0xff,0xc0,
0x0f,0xff,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,0xe1,0xff,0xff,0x00,
0x07,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfb,0xff,0xfe,0x00,
0x03,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfc,0x00,
0x01,0xff,0xff,0xff,0xff,0xf0,0x01,0xff,0xff,0xff,0xff,0xf8,0x00,
0x00,0x7f,0xff,0xff,0xff,0x00,0x00,0x1f,0xff,0xff,0xff,0xe0,0x00,
0x00,0x3f,0xff,0xff,0xf8,0x00,0x00,0x03,0xff,0xff,0xff,0xc0,0x00,
0x00,0x1f,0xff,0xff,0xe0,0x00,0x00,0x00,0xff,0xff,0xff,0x80,0x00,
0x00,0x0f,0xff,0xff,0x80,0x00,0x00,0x00,0x3f,0xff,0xff,0x00,0x00,
0x00,0x03,0xff,0xfe,0x00,0x00,0x00,0x00,0x0f,0xff,0xfc,0x00,0x00,
0x00,0x01,0xff,0xfc,0x00,0x00,0x00,0x00,0x07,0xff,0xf8,0x00,0x00,
0x00,0x03,0xff,0xf8,0x00,0x00,0x00,0x00,0x01,0xff,0xf8,0x00,0x00,
0x00,0x07,0xff,0xfc,0x00,0x00,0x00,0x00,0x03,0xff,0xfc,0x00,0x00,
0x00,0x0f,0xff,0xfe,0x00,0x00,0x00,0x00,0x07,0xff,0xfe,0x00,0x00,
0x00,0x0f,0xff,0xff,0x00,0x00,0x00,0x00,0x0f,0xff,0xfe,0x00,0x00,
0x00,0x1f,0xff,0xff,0x80,0x00,0x00,0x00,0x1f,0xff,0xff,0x00,0x00,
0x00,0x1f,0xff,0xff,0x80,0x00,0x00,0x00,0x1f,0xff,0xff,0x00,0x00,
0x00,0x3f,0xfe,0xff,0xc0,0x00,0x00,0x00,0x3f,0xff,0xff,0x80,0x00,
0x00,0x7f,0xfc,0x7f,0xe0,0x00,0x00,0x00,0x7f,0xe7,0xff,0xc0,0x00,
0x00,0x7f,0xf8,0x3f,0xf0,0x00,0x00,0x00,0xff,0xc3,0xff,0xc0,0x00,
0x00,0xff,0xf8,0x1f,0xf8,0x00,0x00,0x01,0xff,0x83,0xff,0xe0,0x00,
0x00,0xff,0xf0,0x07,0xf8,0x00,0x00,0x01,0xfe,0x01,0xff,0xe0,0x00,
0x00,0xff,0xf0,0x03,0xfc,0x00,0x00,0x03,0xfc,0x01,0xff,0xe0,0x00,
0x01,0xff,0xe0,0x01,0xfe,0x00,0x00,0x07,0xf8,0x00,0xff,0xf0,0x00,
0x01,0xff,0xe0,0x00,0xff,0x00,0x00,0x0f,0xf0,0x00,0xff,0xf0,0x00,
0x01,0xff,0xc0,0x00,0x3f,0x80,0x00,0x1f,0xc0,0x00,0x7f,0xf0,0x00,
0x01,0xff,0xc0,0x00,0x1f,0x80,0x00,0x1f,0x80,0x00,0x7f,0xf0,0x00,
0x03,0xff,0xc0,0x00,0x0f,0xc0,0x00,0x3f,0x00,0x00,0x7f,0xf8,0x00,
0x03,0xff,0x80,0x00,0x07,0xe0,0x00,0x7e,0x00,0x00,0x3f,0xf8,0x00,
0x03,0xff,0x80,0x00,0x01,0xf0,0x00,0xf8,0x00,0x00,0x3f,0xf8,0x00,
0x03,0xff,0x80,0x00,0x00,0xf8,0x01,0xf0,0x00,0x00,0x3f,0xf8,0x00,
0x03,0xff,0x80,0x00,0x00,0x78,0x01,0xe0,0x00,0x00,0x3f,0xf8,0x00,
0x07,0xff,0x00,0x00,0x00,0x3c,0x03,0xc0,0x00,0x00,0x3f,0xfc,0x00,
0x07,0xff,0x00,0x00,0x00,0x0e,0x07,0x00,0x00,0x00,0x1f,0xfc,0x00,
0x07,0xff,0x00,0x00,0x00,0x07,0x0e,0x00,0x00,0x00,0x1f,0xfc,0x00,
0x07,0xff,0x00,0x00,0x00,0x03,0x9c,0x00,0x00,0x00,0x1f,0xfc,0x00,
0x07,0xff,0x00,0x00,0x00,0x01,0x98,0x00,0x00,0x00,0x1f,0xfc,0x00,
0x07,0xff,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x1f,0xfc,0x00
};
public static uint[] crosshair_colors =new uint[]
public static uint[] crosshair_colors = new uint[]
{
0x4040ff,
0xff4040,
0x40ff40,
0xffff40,
0xff40ff,
0x40ffff,
0xffffff
0x4040ff,
0xff4040,
0x40ff40,
0xffff40,
0xff40ff,
0x40ffff,
0xffffff
};
public static void crosshair_init()
{

View File

@ -1,16 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace mame
namespace mame
{
public partial class Drawgfx
{
public static int[] gfx_drawmode_table=new int[256];
public static int[] gfx_drawmode_table = new int[256];
}
}

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.IO;
namespace mame
{
@ -52,7 +48,7 @@ namespace mame
public static LineState reset_line, clock_line;
public static int locked;
public static int enable_multi_read;
public static int reset_delay,reset_delay1;
public static int reset_delay, reset_delay1;
private static bool eeprom_command_match(byte[] buf, byte[] cmd, int len)
{
int ibuf = 0, idx = 0;
@ -64,7 +60,7 @@ namespace mame
{
return false;
}
for (; len > 0; )
for (; len > 0;)
{
byte b = buf[ibuf];
byte c = cmd[idx];
@ -128,7 +124,7 @@ namespace mame
for (int i = 0; i < 0x80; i++)
{
eeprom_data[i] = 0xff;
}
}
locked = 0;
address_bits = 7;
data_bits = 8;
@ -151,8 +147,8 @@ namespace mame
cmd_read = new byte[] { (byte)'0', (byte)'1', (byte)'1', (byte)'0' };
cmd_write = new byte[] { (byte)'0', (byte)'1', (byte)'0', (byte)'1' };
cmd_erase = new byte[] { (byte)'0', (byte)'1', (byte)'1', (byte)'1' };
cmd_lock = new byte[] { (byte)'0',(byte)'1',(byte)'0',(byte)'0',(byte)'0',(byte)'0',(byte)'0',(byte)'0',(byte)'0',(byte)'0' };
cmd_unlock = new byte[] {(byte)'0',(byte)'1',(byte)'0',(byte)'0',(byte)'1',(byte)'1',(byte)'0',(byte)'0',(byte)'0',(byte)'0' };
cmd_lock = new byte[] { (byte)'0', (byte)'1', (byte)'0', (byte)'0', (byte)'0', (byte)'0', (byte)'0', (byte)'0', (byte)'0', (byte)'0' };
cmd_unlock = new byte[] { (byte)'0', (byte)'1', (byte)'0', (byte)'0', (byte)'1', (byte)'1', (byte)'0', (byte)'0', (byte)'0', (byte)'0' };
for (int i = 0; i < 0x80; i++)
{
eeprom_data[i] = 0xff;
@ -161,7 +157,7 @@ namespace mame
address_bits = 6;
data_bits = 16;
break;
case "Konami 68000":
case "Konami 68000":
cmd_read = new byte[] { (byte)'0', (byte)'1', (byte)'1', (byte)'0', (byte)'0', (byte)'0' };
cmd_write = new byte[] { (byte)'0', (byte)'1', (byte)'1', (byte)'1', (byte)'0', (byte)'0' };
cmd_erase = new byte[] { };
@ -358,7 +354,7 @@ namespace mame
{
if (sending == 1)
{
if (eeprom_clock_count == data_bits && enable_multi_read!=0)
if (eeprom_clock_count == data_bits && enable_multi_read != 0)
{
eeprom_read_address = (eeprom_read_address + 1) & ((1 << address_bits) - 1);
if (data_bits == 16)

View File

@ -1,27 +1,59 @@
using System.Drawing;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;
using MAME.Core.AxiBitmap;
using System;
using Bitmap = MAME.Core.AxiBitmap.AxiBitmap;
using Color = MAME.Core.AxiBitmap.AxiColor;
using Rectangle = MAME.Core.AxiBitmap.Rectangle;
namespace mame
{
partial class Video
{
public delegate Bitmap drawcrosshairdelegate(Bitmap bm1);
//public delegate Bitmap drawcrosshairdelegate(Bitmap bm1);
//public static drawcrosshairdelegate drawcrosshair;
public delegate int[] drawcrosshairdelegate(int[] bm1);
public static drawcrosshairdelegate drawcrosshair;
public static Bitmap drawcrosshair_null(Bitmap bm1)
//public static Bitmap drawcrosshair_null(Bitmap bm1)
//{
// Bitmap bm2 = bm1;
// return bm2;
//}
public static int[] drawcrosshair_null(int[] bm1)
{
Bitmap bm2 = bm1;
return bm2;
return bm1;
}
//public static Bitmap drawcrosshair_opwolf(Bitmap bm1)
//{
// Bitmap bm2 = bm1;
// Graphics g = Graphics.FromImage(bm2);
// g.DrawImage(MultiplyAlpha(Crosshair.global.bitmap[0], (float)Crosshair.global.fade / 0xff), new Rectangle(Crosshair.global.x[0] - 10, Crosshair.global.y[0] - 10, 20, 20), new Rectangle(0, 0, 100, 100), GraphicsUnit.Pixel);
// g.Dispose();
// return bm2;
//}
public static Bitmap drawcrosshair_opwolf(Bitmap bm1)
{
Bitmap bm2 = bm1;
Graphics g = Graphics.FromImage(bm2);
g.DrawImage(MultiplyAlpha(Crosshair.global.bitmap[0], (float)Crosshair.global.fade / 0xff), new Rectangle(Crosshair.global.x[0] - 10, Crosshair.global.y[0] - 10, 20, 20), new Rectangle(0, 0, 100, 100), GraphicsUnit.Pixel);
g.Dispose();
bm2.DrawImage(
MultiplyAlpha(Crosshair.global.bitmap[0], (float)Crosshair.global.fade / 0xff),
new Rectangle(Crosshair.global.x[0] - 10,
Crosshair.global.y[0] - 10, 20, 20),
new Rectangle(0, 0, 100, 100));
return bm2;
}
public static Bitmap MultiplyAlpha(Bitmap bitmap, float factor)
public static int[] drawcrosshair_opwolf(int[] bm1)
{
int[] bm2 = bm1;
//TODO
return bm2;
}
/*
* public static Bitmap MultiplyAlpha(Bitmap bitmap, float factor)
{
Bitmap result = new Bitmap(bitmap.Width, bitmap.Height);
using (Graphics graphics = Graphics.FromImage(result))
@ -33,42 +65,128 @@ namespace mame
graphics.DrawImage(bitmap, new Rectangle(0, 0, bitmap.Width, bitmap.Height), 0, 0, bitmap.Width, bitmap.Height, GraphicsUnit.Pixel, imageAttributes);
}
return result;
}*/
/// <summary>
///
/// </summary>
/// <param name="bitmap"></param>
/// <param name="factor"></param>
/// <returns></returns>
public static Bitmap MultiplyAlpha(Bitmap bitmap, float factor)
{
Bitmap result = new Bitmap(bitmap.Width, bitmap.Height);
for (int y = 0; y < bitmap.Height; y++)
{
for (int x = 0; x < bitmap.Width; x++)
{
Color originalColor = bitmap.GetPixel(x, y);
byte newAlpha = (byte)Math.Min(255, (int)(originalColor.a * factor));
Color newColor = new Color
{
r = originalColor.r,
g = originalColor.g,
b = originalColor.b,
a = newAlpha
};
result.SetPixel(x, y, newColor);
}
}
return result;
}
/// <summary>
///
/// </summary>
/// <param name="bitmap"></param>
/// <param name="factor"></param>
/// <returns></returns>
public static int[] MultiplyAlpha(int[] bitmap, float factor)
{
int[] result = (int[])bitmap.Clone();
for (int i = 0; i < result.Length; i++)
{
Color originalColor = AxiColor.FromArgb(result[i]);
byte newAlpha = (byte)Math.Min(255, (int)(originalColor.a * factor));
Color newColor = new Color
{
r = originalColor.r,
g = originalColor.g,
b = originalColor.b,
a = newAlpha
};
result[i] = AxiColor.ToArgb(newColor);
}
return result;
}
//public static void GDIDraw()
//{
// try
// {
// bitmapData = bitmapGDI.LockBits(new Rectangle(0, 0, Video.fullwidth, Video.fullheight), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
// Marshal.Copy(Video.bitmapcolor, 0, bitmapData.Scan0, Video.fullwidth * Video.fullheight);
// bitmapGDI.UnlockBits(bitmapData);
// if (Wintime.osd_ticks() < popup_text_end)
// {
// Machine.FORM.tsslStatus = sDrawText;
// }
// else
// {
// popup_text_end = 0;
// if (Mame.paused)
// {
// Machine.FORM.tsslStatus = "pause";
// }
// else
// {
// switch (Mame.playState)
// {
// case Mame.PlayState.PLAY_RECORDRUNNING:
// Machine.FORM.tsslStatus = "record";
// break;
// case Mame.PlayState.PLAY_REPLAYRUNNING:
// Machine.FORM.tsslStatus = "replay";
// break;
// default:
// Machine.FORM.tsslStatus = "run";
// break;
// }
// }
// }
// //bbmp[iMode] = drawcrosshair((Bitmap)bitmapGDI.Clone(new Rectangle(offsetx, offsety, width, height), PixelFormat.Format32bppArgb));
// bbmp[iMode] = drawcrosshair(bitmapGDI.Clone(new Rectangle(offsetx, offsety, width, height)));
// switch (Machine.sDirection)
// {
// case "":
// break;
// case "90":
// bbmp[iMode].RotateFlip(RotateFlipType.Rotate90FlipNone);
// break;
// case "180":
// bbmp[iMode].RotateFlip(RotateFlipType.Rotate180FlipNone);
// break;
// case "270":
// bbmp[iMode].RotateFlip(RotateFlipType.Rotate270FlipNone);
// break;
// }
// //Machine.FORM.pictureBox1.Image = bbmp[iMode];
// SubmitVideo(bbmp[iMode]);
// }
// catch
// {
// }
//}
public static void GDIDraw()
{
try
{
bitmapData = bitmapGDI.LockBits(new Rectangle(0, 0, Video.fullwidth, Video.fullheight), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
Marshal.Copy(Video.bitmapcolor, 0, bitmapData.Scan0, Video.fullwidth * Video.fullheight);
bitmapGDI.UnlockBits(bitmapData);
if (Wintime.osd_ticks() < popup_text_end)
{
Machine.FORM.tsslStatus = sDrawText;
}
else
{
popup_text_end = 0;
if (Mame.paused)
{
Machine.FORM.tsslStatus = "pause";
}
else
{
switch (Mame.playState)
{
case Mame.PlayState.PLAY_RECORDRUNNING:
Machine.FORM.tsslStatus = "record";
break;
case Mame.PlayState.PLAY_REPLAYRUNNING:
Machine.FORM.tsslStatus = "replay";
break;
default:
Machine.FORM.tsslStatus = "run";
break;
}
}
}
bbmp[iMode] = drawcrosshair((Bitmap)bitmapGDI.Clone(new Rectangle(offsetx, offsety, width, height), PixelFormat.Format32bppArgb));
int[] TempData = AxiBitmapEx.CloneIntColorArr(Video.bitmapcolor, Video.fullwidth, Video.fullheight, new Rectangle(offsetx, offsety, width, height));
drawcrosshair(TempData);
//bbmp[iMode] = drawcrosshair(bitmapGDI.Clone(new Rectangle(offsetx, offsety, width, height)));
switch (Machine.sDirection)
{
case "":
@ -84,12 +202,45 @@ namespace mame
break;
}
//Machine.FORM.pictureBox1.Image = bbmp[iMode];
SubmitVideo(bbmp[iMode]);
SubmitVideo(Video.bitmapcolor);
}
catch
catch (Exception ex)
{
}
}
public static void CopyDataFrom(AxiBitmap destBitmap, byte[] sourceData, int sourceStride)
{
int pixelCount = destBitmap.Width * destBitmap.Height;
if (sourceData.Length < pixelCount * 4) // 假设每个AxiColor是4字节
throw new ArgumentException("Source data is too small.");
// 注意这里我们假设sourceStride是源数据的每行字节数它可能包含额外的填充字节
// 以确保每行的开始都是4的倍数。但是对于紧密打包的AxiColor数组我们可以忽略它。
for (int y = 0; y < destBitmap.Height; y++)
{
int sourceOffset = y * sourceStride; // 但对于紧密打包的AxiColor这将是 y * (destBitmap.Width * 4)
// 然而由于我们知道sourceData是直接对应于AxiColor的我们可以简化为
sourceOffset = y * destBitmap.Width * 4; // 假设没有行填充
for (int x = 0; x < destBitmap.Width; x++)
{
int index = y * destBitmap.Width + x;
int sourceIndex = sourceOffset + x * 4;
byte r = sourceData[sourceIndex];
byte g = sourceData[sourceIndex + 1];
byte b = sourceData[sourceIndex + 2];
byte a = sourceData[sourceIndex + 3];
destBitmap.mData[index] = new AxiColor { r = r, g = g, b = b, a = a };
}
}
}
}
}

View File

@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using cpu.m68000;
using cpu.m68000;
using System;
namespace mame
{
@ -54,7 +50,7 @@ namespace mame
{
return;
}
coinlockedout[num] =(uint) on;
coinlockedout[num] = (uint)on;
}
public static void coin_lockout_global_w(int on)
{
@ -71,9 +67,9 @@ namespace mame
case "Neo Geo":
Neogeo.nvram_handler_load_neogeo();
break;
/*case "Namco System 1":
Namcos1.nvram_handler_load_namcos1();
break;*/
/*case "Namco System 1":
Namcos1.nvram_handler_load_namcos1();
break;*/
}
}
public static void nvram_save()
@ -83,9 +79,9 @@ namespace mame
case "Neo Geo":
Neogeo.nvram_handler_save_neogeo();
break;
/*case "Namco System 1":
Namcos1.nvram_handler_save_namcos1();
break;*/
/*case "Namco System 1":
Namcos1.nvram_handler_save_namcos1();
break;*/
}
}
public static void watchdog_reset16_w()
@ -124,11 +120,11 @@ namespace mame
public static void irq_2_0_line_hold()
{
Cpuint.cpunum_set_input_line(2, 0, LineState.HOLD_LINE);
}
}
public static void watchdog_reset_w()
{
Watchdog.watchdog_reset();
}
}
public static void interrupt_reset()
{
int cpunum;
@ -139,7 +135,7 @@ namespace mame
}
public static void clear_all_lines()
{
int inputcount=0;
int inputcount = 0;
int line;
if (objcpunum == 0 && Cpuexec.cpu[0] == MC68000.m1)
{
@ -221,7 +217,7 @@ namespace mame
}
public static ushort paletteram16_be(int offset)
{
return (ushort)(paletteram[offset | 1] | (paletteram[offset & ~1] << 8));
return (ushort)(paletteram[offset | 1] | (paletteram[offset & ~1] << 8));
}
public static void set_color_444(int color, int rshift, int gshift, int bshift, ushort data)
{
@ -238,14 +234,14 @@ namespace mame
long period = Video.screenstate.frame_period;
RECT visarea = Video.screenstate.visarea;
Tmap.tilemap_set_flip(null, (byte)((Tilemap.TILEMAP_FLIPX & flip_screen_x) | (Tilemap.TILEMAP_FLIPY & flip_screen_y)));
if (flip_screen_x!=0)
if (flip_screen_x != 0)
{
int temp;
temp = width - visarea.min_x - 1;
visarea.min_x = width - visarea.max_x - 1;
visarea.max_x = temp;
}
if (flip_screen_y!=0)
if (flip_screen_y != 0)
{
int temp;
temp = height - visarea.min_y - 1;
@ -323,7 +319,7 @@ namespace mame
set_color_444(offset, 12, 8, 4, paletteram16_split(offset));
}
public static void paletteram16_xBBBBBGGGGGRRRRR_word_w(int offset,ushort data)
public static void paletteram16_xBBBBBGGGGGRRRRR_word_w(int offset, ushort data)
{
paletteram16[offset] = data;
set_color_555(offset, 0, 5, 10, paletteram16[offset]);
@ -359,6 +355,6 @@ namespace mame
paletteram16[offset] = (ushort)((paletteram16[offset] & 0xff00) | data);
ushort data1 = paletteram16[offset];
Palette.palette_set_callback(offset, (uint)((Palette.pal5bit((byte)(((data1 >> 11) & 0x1e) | ((data1 >> 3) & 0x01))) << 16) | (Palette.pal5bit((byte)(((data >> 7) & 0x1e) | ((data >> 2) & 0x01))) << 8) | Palette.pal5bit((byte)(((data >> 3) & 0x1e) | ((data >> 1) & 0x01)))));
}
}
}
}

View File

@ -42,11 +42,11 @@ namespace mame
public long last_delta_nsec;
}
public partial class Inptport
{
{
public static bool bReplayRead;
public delegate void loop_delegate();
public static loop_delegate loop_inputports_callback, record_port_callback, replay_port_callback;
public static analog_field_state analog_p0, analog_p1,analog_p1x,analog_p1y;
public static analog_field_state analog_p0, analog_p1, analog_p1x, analog_p1y;
public static input_port_private portdata;
public static void input_port_init()
{
@ -388,7 +388,7 @@ namespace mame
case "dland":
case "bbredux":
case "bublboblb":
case "boblcave":
case "boblcave":
loop_inputports_callback = Taito.loop_inputports_taito_boblbobl;
break;
case "opwolf":
@ -570,21 +570,21 @@ namespace mame
result = (uint)apply_analog_settings(value, analog);
return result;
}
public static int apply_analog_settings(int value,analog_field_state analog)
public static int apply_analog_settings(int value, analog_field_state analog)
{
value = apply_analog_min_max(analog, value);
value = (int)((long)value * analog.sensitivity / 100);
value = (int)((long)value * analog.sensitivity / 100);
if (analog.reverse)
{
value = analog.reverse_val - value;
}
if (value >= 0)
{
value = (int)((long)(value * analog.scalepos)>>24);
value = (int)((long)(value * analog.scalepos) >> 24);
}
else
{
value = (int)((long)(value * analog.scaleneg)>>24);
value = (int)((long)(value * analog.scaleneg) >> 24);
}
value += analog.adjdefvalue;
return value;

View File

@ -19,7 +19,7 @@ namespace mame
}
public static char getcharbykey(Key key1)
{
char c1=' ';
char c1 = ' ';
foreach (KeyStruct ks in lks)
{
if (ks.key == key1)

View File

@ -1,5 +1,4 @@
using MAME.Core;
using MAME.Core.Common;
using MAME.Core.Common;
using MAME.Core.run_interface;
namespace mame
@ -10,7 +9,7 @@ namespace mame
static IKeyboard mKeyboard;
public static void InitializeInput(mainForm form1,IKeyboard ikb)
public static void InitializeInput(mainMotion form1, IKeyboard ikb)
{
mKeyboard = ikb;
}

View File

@ -8,7 +8,7 @@ namespace mame
{
public static string sName, sParent, sBoard, sDirection, sDescription, sManufacturer;
public static List<string> lsParents;
public static mainForm FORM;
public static mainMotion FORM;
public static RomInfo rom;
public static bool bRom;
public delegate void machine_delegate();
@ -141,7 +141,7 @@ namespace mame
Taito.video_start_opwolf();
machine_reset_callback = Taito.machine_reset_null;
break;
}
}
break;
case "Taito B":
Eeprom.eeprom_init();
@ -256,7 +256,7 @@ namespace mame
case "sfp":
Capcom.video_start_sf();
break;
}
}
machine_reset_callback = Capcom.machine_reset_capcom;
break;
}
@ -264,16 +264,20 @@ namespace mame
public static byte[] GetNeogeoRom(string sFile)
{
byte[] bb1;
if (File.Exists("roms\\neogeo\\" + sFile))
string path = System.IO.Path.Combine(Mame.RomRoot + "/" + "roms/neogeo/", sFile);
if (File.Exists(path))
{
FileStream fs1 = new FileStream("roms\\neogeo\\" + sFile, FileMode.Open);
int n1 = (int)fs1.Length;
bb1 = new byte[n1];
fs1.Read(bb1, 0, n1);
fs1.Close();
EmuLogger.Log($"Had File => {path}");
return File.ReadAllBytes(path);
//FileStream fs1 = new FileStream(path, FileMode.Open);
//int n1 = (int)fs1.Length;
//bb1 = new byte[n1];
//fs1.Read(bb1, 0, n1);
//fs1.Close();
}
else
{
EmuLogger.Log($"Miss File => {path}");
bb1 = null;
}
return bb1;
@ -284,15 +288,22 @@ namespace mame
int n1;
foreach (string s1 in lsParents)
{
if (File.Exists("roms\\" + s1 + "\\" + sFile))
string path = System.IO.Path.Combine(Mame.RomRoot + "/" + "roms/" + s1 + "/", sFile);
if (File.Exists(path))
{
FileStream fs1 = new FileStream("roms\\" + s1 + "\\" + sFile, FileMode.Open);
n1 = (int)fs1.Length;
bb1 = new byte[n1];
fs1.Read(bb1, 0, n1);
fs1.Close();
EmuLogger.Log($"Had File => {path}");
return File.ReadAllBytes(path);
//FileStream fs1 = new FileStream(path, FileMode.Open);
//n1 = (int)fs1.Length;
//bb1 = new byte[n1];
//fs1.Read(bb1, 0, n1);
//fs1.Close();
break;
}
else
{
EmuLogger.Log($"Miss File => {path}");
}
}
return bb1;
}

View File

@ -1,8 +1,6 @@
using MAME.Core.Common;
using MAME.Core.run_interface;
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading;
namespace mame
@ -29,6 +27,7 @@ namespace mame
public static BinaryReader brRecord = null;
public static BinaryWriter bwRecord = null;
public static bool bPP = true;
public static string RomRoot = string.Empty;
public class AA
{
public int fr;
@ -98,12 +97,12 @@ namespace mame
if (playState == PlayState.PLAY_SAVE)
{
mame_pause(true);
UI.ui_handler_callback = handle_save;
Motion.motion_handler_callback = handle_save;
}
else if (playState == PlayState.PLAY_LOAD)
{
mame_pause(true);
UI.ui_handler_callback = handle_load;
Motion.motion_handler_callback = handle_load;
}
else if (playState == PlayState.PLAY_RESET)
{
@ -113,7 +112,7 @@ namespace mame
else if (playState == PlayState.PLAY_RECORDSTART)
{
mame_pause(true);
UI.ui_handler_callback = handle_record;
Motion.motion_handler_callback = handle_record;
}
else if (playState == PlayState.PLAY_RECORDEND)
{
@ -122,14 +121,14 @@ namespace mame
else if (playState == PlayState.PLAY_REPLAYSTART)
{
mame_pause(true);
UI.ui_handler_callback = handle_replay;
Motion.motion_handler_callback = handle_replay;
}
else if (playState == PlayState.PLAY_REPLAYEND)
{
handle_replay();
}
}
public static void init_machine(mainForm form)
public static void init_machine(mainMotion form)
{
Inptport.input_init();
Palette.palette_init();
@ -153,6 +152,7 @@ namespace mame
{
if (paused == pause)
return;
EmuLogger.Log($"mame_pause->{pause}");
paused = pause;
Window.wininput_pause(paused);
Sound.sound_pause(paused);
@ -187,7 +187,7 @@ namespace mame
Video.popup_text_end = Wintime.osd_ticks() + Wintime.ticks_per_second * 2;
playState = PlayState.PLAY_RUNNING;
mame_pause(false);
UI.ui_handler_callback = UI.handler_ingame;
Motion.motion_handler_callback = Motion.handler_ingame;
return;
}
char file;
@ -208,7 +208,7 @@ namespace mame
Video.sDrawText = "Save to position " + file;
Video.popup_text_end = Wintime.osd_ticks() + Wintime.ticks_per_second * 2;
playState = PlayState.PLAY_RUNNING;
UI.ui_handler_callback = UI.handler_ingame;
Motion.motion_handler_callback = Motion.handler_ingame;
Thread.Sleep(500);
mame_pause(false);
return;
@ -230,7 +230,7 @@ namespace mame
Video.popup_text_end = Wintime.osd_ticks() + Wintime.ticks_per_second * 2;
playState = PlayState.PLAY_RUNNING;
mame_pause(false);
UI.ui_handler_callback = UI.handler_ingame;
Motion.motion_handler_callback = Motion.handler_ingame;
return;
}
char file;
@ -246,7 +246,7 @@ namespace mame
playState = PlayState.PLAY_RUNNING;
Thread.Sleep(500);
mame_pause(false);
UI.ui_handler_callback = UI.handler_ingame;
Motion.motion_handler_callback = Motion.handler_ingame;
return;
}
FileStream fs1 = new FileStream("sta\\" + Machine.sName + "\\" + file + ".sta", FileMode.Open);
@ -264,7 +264,7 @@ namespace mame
fs2.Close();
return;*/
playState = PlayState.PLAY_RUNNING;
UI.ui_handler_callback = UI.handler_ingame;
Motion.motion_handler_callback = Motion.handler_ingame;
Thread.Sleep(500);
mame_pause(false);
return;
@ -288,7 +288,7 @@ namespace mame
Video.popup_text_end = Wintime.osd_ticks() + Wintime.ticks_per_second * 2;
playState = PlayState.PLAY_RUNNING;
mame_pause(false);
UI.ui_handler_callback = UI.handler_ingame;
Motion.motion_handler_callback = Motion.handler_ingame;
return;
}
char file;
@ -318,7 +318,7 @@ namespace mame
Video.sDrawText = "Record to position " + file;
Video.popup_text_end = Wintime.osd_ticks() + Wintime.ticks_per_second * 2;
playState = PlayState.PLAY_RECORDRUNNING;
UI.ui_handler_callback = UI.handler_ingame;
Motion.motion_handler_callback = Motion.handler_ingame;
Thread.Sleep(500);
mame_pause(false);
return;
@ -351,7 +351,7 @@ namespace mame
Video.popup_text_end = Wintime.osd_ticks() + Wintime.ticks_per_second * 2;
playState = PlayState.PLAY_RUNNING;
mame_pause(false);
UI.ui_handler_callback = UI.handler_ingame;
Motion.motion_handler_callback = Motion.handler_ingame;
return;
}
char file;
@ -367,7 +367,7 @@ namespace mame
playState = PlayState.PLAY_RUNNING;
Thread.Sleep(500);
mame_pause(false);
UI.ui_handler_callback = UI.handler_ingame;
Motion.motion_handler_callback = Motion.handler_ingame;
return;
}
if (bwRecord != null)
@ -405,7 +405,7 @@ namespace mame
Video.sDrawText = "Replay from position " + file;
Video.popup_text_end = Wintime.osd_ticks() + Wintime.ticks_per_second * 2;
playState = PlayState.PLAY_REPLAYRUNNING;
UI.ui_handler_callback = UI.handler_ingame;
Motion.motion_handler_callback = Motion.handler_ingame;
Thread.Sleep(500);
mame_pause(false);
return;
@ -484,7 +484,7 @@ namespace mame
case "tokio":
case "tokioo":
case "tokiou":
case "tokiob":
case "tokiob":
case "bublbobl":
case "bublbobl1":
case "bublboblr":

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mame
namespace mame
{
public class Memory
{
@ -116,7 +111,7 @@ namespace mame
case "sboblbobl":
Taito.sbyte0 = unchecked((sbyte)0x73);
break;
case"opwolf":
case "opwolf":
Taito.sbyte0 = unchecked((sbyte)0xfc);
break;
case "opwolfp":
@ -190,7 +185,7 @@ namespace mame
Capcom.sbyte1 = 0;
Capcom.sbyte2 = 0;
Capcom.sbyte3 = 0;
Capcom.sbyte4 = 0;
Capcom.sbyte4 = 0;
break;
}
break;
@ -321,7 +316,7 @@ namespace mame
Capcom.sbyte1_old = 0;
Capcom.sbyte2_old = 0;
Capcom.sbyte3_old = 0;
Capcom.sbyte4_old = 0;
Capcom.sbyte4_old = 0;
break;
}
break;

View File

@ -1,27 +1,26 @@
using MAME.Core.Common;
using MAME.Core.run_interface;
using System;
using System.Runtime.InteropServices;
namespace mame
{
public class UI
/// <summary>
/// 原依赖Form的内容
/// </summary>
public class Motion
{
[DllImport("user32.dll")]
private static extern IntPtr GetForegroundWindow();
private static uint UI_FILLCOLOR = Palette.make_argb(0xe0, 0x10, 0x10, 0x30);
public delegate void ui_delegate();
public static ui_delegate ui_handler_callback, ui_update_callback;
public delegate void motion_delegate();
public static motion_delegate motion_handler_callback, motion_update_callback;
public static bool single_step;
public static mainForm mainform;
public static void ui_init(mainForm form1)
//public static mainMotion mainmotion;
public static void init()
{
mainform = form1;
//mainmotion = motion;
}
public static void ui_update_and_render()
{
ui_update_callback();
ui_handler_callback();
motion_update_callback();
motion_handler_callback();
}
public static void ui_updateC()
{
@ -195,7 +194,7 @@ namespace mame
}
if (Mame.is_foreground)
{
if(Keyboard.IsPressed(Key.F3))
if (Keyboard.IsPressed(Key.F3))
{
cpurun();
Mame.playState = Mame.PlayState.PLAY_RESET;
@ -209,7 +208,7 @@ namespace mame
}
else
{
Mame.playState = Mame.PlayState.PLAY_LOAD;
Mame.playState = Mame.PlayState.PLAY_LOAD;
}
return;
}
@ -238,12 +237,12 @@ namespace mame
if (is_paused && (Keyboard.IsPressed(Key.LeftShift) || Keyboard.IsPressed(Key.RightShift)))
{
single_step = true;
Mame.mame_pause(false);
Mame.mame_pause(false);
}
else
{
Mame.mame_pause(!Mame.mame_is_paused());
}
}
}
if (Keyboard.IsTriggered(Key.F10))
{
@ -255,10 +254,10 @@ namespace mame
}
public static void cpurun()
{
m68000Form.m68000State = m68000Form.M68000State.M68000_RUN;
Machine.FORM.m68000form.mTx_tsslStatus = "run";
z80Form.z80State = z80Form.Z80AState.Z80A_RUN;
Machine.FORM.z80form.mTx_tsslStatus = "run";
m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN;
Machine.FORM.m68000motion.mTx_tsslStatus = "run";
z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN;
Machine.FORM.z80motion.mTx_tsslStatus = "run";
}
private static double ui_get_line_height()
{
@ -269,6 +268,6 @@ namespace mame
one_to_one_line_height = (double)raw_font_pixel_height / (double)target_pixel_height;
scale_factor = 1.0;
return scale_factor * one_to_one_line_height;
}
}
}
}

View File

@ -8,14 +8,15 @@ namespace mame
public static int deltaX, deltaY, oldX, oldY;
public static byte[] buttons;
static IMouse iMouse;
public static void InitialMouse(mainForm form1,IMouse im)
public static void InitialMouse(mainMotion form1, IMouse im)
{
iMouse = im;
}
public static void Update()
{
iMouse.MouseXY(out int X, out int Y);
int X, Y;
iMouse.MouseXY(out X, out Y);
deltaX = X - oldX;
deltaY = Y - oldY;
oldX = X;

View File

@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using MAME.Core.AxiBitmap;
using Color = MAME.Core.AxiBitmap.AxiColor;
namespace mame
{
@ -11,13 +8,13 @@ namespace mame
public static uint[] entry_color;
public static float[] entry_contrast;
private static uint trans_uint;
private static int numcolors,numgroups;
private static int numcolors, numgroups;
public static Color trans_color;
public delegate void palette_delegate(int index,uint rgb);
public delegate void palette_delegate(int index, uint rgb);
public static palette_delegate palette_set_callback;
public static void palette_init()
{
int index;
int index;
switch (Machine.sBoard)
{
case "CPS-1":
@ -76,7 +73,7 @@ namespace mame
numcolors = 0x801;
palette_set_callback = palette_entry_set_color2;
break;
case "Taito":
case "Taito":
switch (Machine.sName)
{
case "tokio":
@ -159,7 +156,7 @@ namespace mame
numcolors = 0x400;
palette_set_callback = palette_entry_set_color3;
break;
}
}
break;
}
entry_color = new uint[numcolors];
@ -309,7 +306,7 @@ namespace mame
}
public static byte pal1bit(byte bits)
{
return (byte)(((bits & 1)!=0) ? 0xff : 0x00);
return (byte)(((bits & 1) != 0) ? 0xff : 0x00);
}
public static byte pal4bit(byte bits)
{

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.IO;
namespace mame
{
@ -108,7 +104,7 @@ namespace mame
break;
case 2:
real_year = (pd4990a.year >> 4) * 10 + (pd4990a.year & 0xf);
if ((real_year % 4)!=0 && ((real_year % 100)==0 || (real_year % 400)!=0))
if ((real_year % 4) != 0 && ((real_year % 100) == 0 || (real_year % 400) != 0))
{
if (pd4990a.days == 0x29)
{
@ -243,9 +239,9 @@ namespace mame
private static void pd4990a_nextbit()
{
++bitno;
if (reading!=0)
if (reading != 0)
pd4990a_readbit();
if (reading!=0 && bitno == 0x34)
if (reading != 0 && bitno == 0x34)
{
reading = 0;
pd4990a_resetbitstream();
@ -276,7 +272,7 @@ namespace mame
{
case 0x1: //load output register
bitno = 0;
if (reading!=0)
if (reading != 0)
pd4990a_readbit(); //prepare first bit
shiftlo = 0;
shifthi = 0;
@ -300,7 +296,7 @@ namespace mame
private static void pd4990a_serial_control(byte data)
{
//Check for command end
if (command_line!=0 && (data & 4)==0) //end of command
if (command_line != 0 && (data & 4) == 0) //end of command
{
pd4990a_process_command();
}

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using System.Collections.Generic;
namespace mame
{

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using cpu.m68000;
using System.IO;
namespace mame
{
@ -93,7 +88,7 @@ namespace mame
case "bublbobl":
case "bublbobl1":
case "bublboblr":
case "bublboblr1":
case "bublboblr1":
case "bublcave":
case "bublcave11":
case "bublcave10":
@ -164,7 +159,7 @@ namespace mame
case "punkshotj"://ym k053260 K052109 K051960
savestate_callback = Konami68000.SaveStateBinary_punkshot;
loadstate_callback = Konami68000.LoadStateBinary_punkshot;
break;
break;
case "lgtnfght":
case "lgtnfghta":
case "lgtnfghtu":
@ -207,7 +202,7 @@ namespace mame
case "ssridersjbd"://ym k053260 K052109 K053245 eeprom
savestate_callback = Konami68000.SaveStateBinary_ssriders;
loadstate_callback = Konami68000.LoadStateBinary_ssriders;
break;
break;
case "thndrx2":
case "thndrx2a":
case "thndrx2j"://ym k053260 K052109 K051960 eeprom

View File

@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mame
{
@ -49,7 +47,7 @@ namespace mame
public int mask, value;
public int total_elements;
public Action<int, int> tile_update3;
public Action<RECT, int, int> tilemap_draw_instance3;
public Action<RECT, int, int> tilemap_draw_instance3;
public int effective_rowscroll(int index)
{
int value;
@ -104,7 +102,7 @@ namespace mame
{
palette_offset = offset;
}
public static void tilemap_set_flip(Tmap tmap,byte _attributes)
public static void tilemap_set_flip(Tmap tmap, byte _attributes)
{
if (tmap == null)
{
@ -153,12 +151,12 @@ namespace mame
{
scrollcols = scroll_cols;
}
public void tilemap_set_scrolldx(int _dx,int _dx2)
public void tilemap_set_scrolldx(int _dx, int _dx2)
{
dx = _dx;
dx_flipped = _dx2;
}
public void tilemap_set_scrolldy(int _dy,int _dy2)
public void tilemap_set_scrolldy(int _dy, int _dy2)
{
dy = _dy;
dy_flipped = _dy2;
@ -269,7 +267,7 @@ namespace mame
{
public static List<Tmap> lsTmap = new List<Tmap>();
public static byte[,] priority_bitmap;
public static byte[,] bb00,bbFF;
public static byte[,] bb00, bbFF;
public static byte[] bb0F;
public static int screen_width, screen_height;
private static int INVALID_LOGICAL_INDEX = -1;
@ -352,7 +350,7 @@ namespace mame
priority_bitmap = new byte[0x200, 0x200];
Capcom.tilemap_init();
break;
}
}
switch (Machine.sBoard)
{
case "CPS-1":

View File

@ -1,9 +1,7 @@
using System;
using cpu.m6800;
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using cpu.m6800;
namespace mame
{

View File

@ -1,8 +1,7 @@
using MAME.Core.run_interface;
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using Bitmap = MAME.Core.AxiBitmap.AxiBitmap;
namespace mame
{
@ -27,12 +26,12 @@ namespace mame
public static Atime frame_update_time;
public static screen_state screenstate;
public static int video_attributes;
private static int PAUSED_REFRESH_RATE = 30, VIDEO_UPDATE_AFTER_VBLANK=4;
public static Timer.emu_timer vblank_begin_timer,vblank_end_timer;
private static int PAUSED_REFRESH_RATE = 30, VIDEO_UPDATE_AFTER_VBLANK = 4;
public static Timer.emu_timer vblank_begin_timer, vblank_end_timer;
public static Timer.emu_timer scanline0_timer, scanline_timer;
private static Atime throttle_emutime, throttle_realtime, speed_last_emutime, overall_emutime;
private static long throttle_last_ticks;
private static long average_oversleep;
private static long average_oversleep;
private static long speed_last_realtime, overall_real_ticks;
private static double speed_percent;
private static uint throttle_history, overall_valid_counter, overall_real_seconds;
@ -50,7 +49,7 @@ namespace mame
public static string sDrawText;
public static long popup_text_end;
public static int iMode, nMode;
private static BitmapData bitmapData;
//private static BitmapData bitmapData;
public static int offsetx, offsety, width, height;
public delegate void video_delegate();
public static video_delegate video_update_callback, video_eof_callback;
@ -63,7 +62,7 @@ namespace mame
#region
static Action<Bitmap> Act_SubmitVideo;
static Action<int[]> Act_SubmitVideo;
public static void BindFunc(IVideoPlayer Ivp)
{
@ -72,7 +71,7 @@ namespace mame
Act_SubmitVideo += Ivp.SubmitVideo;
}
static void SubmitVideo(Bitmap Bitmap)
static void SubmitVideo(int[] Bitmap)
{
Act_SubmitVideo?.Invoke(Bitmap);
}
@ -82,18 +81,18 @@ namespace mame
{
Wintime.wintime_init();
global_throttle = true;
UI.ui_handler_callback = UI.handler_ingame;
Motion.motion_handler_callback = Motion.handler_ingame;
sDrawText = "";
popup_text_end = 0;
popcount = new int[256]{
0,1,1,2,1,2,2,3, 1,2,2,3,2,3,3,4, 1,2,2,3,2,3,3,4, 2,3,3,4,3,4,4,5,
1,2,2,3,2,3,3,4, 2,3,3,4,3,4,4,5, 2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6,
1,2,2,3,2,3,3,4, 2,3,3,4,3,4,4,5, 2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6,
2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6, 3,4,4,5,4,5,5,6, 4,5,5,6,5,6,6,7,
1,2,2,3,2,3,3,4, 2,3,3,4,3,4,4,5, 2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6,
2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6, 3,4,4,5,4,5,5,6, 4,5,5,6,5,6,6,7,
2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6, 3,4,4,5,4,5,5,6, 4,5,5,6,5,6,6,7,
3,4,4,5,4,5,5,6, 4,5,5,6,5,6,6,7, 4,5,5,6,5,6,6,7, 5,6,6,7,6,7,7,8
0,1,1,2,1,2,2,3, 1,2,2,3,2,3,3,4, 1,2,2,3,2,3,3,4, 2,3,3,4,3,4,4,5,
1,2,2,3,2,3,3,4, 2,3,3,4,3,4,4,5, 2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6,
1,2,2,3,2,3,3,4, 2,3,3,4,3,4,4,5, 2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6,
2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6, 3,4,4,5,4,5,5,6, 4,5,5,6,5,6,6,7,
1,2,2,3,2,3,3,4, 2,3,3,4,3,4,4,5, 2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6,
2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6, 3,4,4,5,4,5,5,6, 4,5,5,6,5,6,6,7,
2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6, 3,4,4,5,4,5,5,6, 4,5,5,6,5,6,6,7,
3,4,4,5,4,5,5,6, 4,5,5,6,5,6,6,7, 4,5,5,6,5,6,6,7, 5,6,6,7,6,7,7,8
};
switch (Machine.sBoard)
{
@ -111,7 +110,7 @@ namespace mame
screenstate.vblank_period = 0;
video_attributes = 0;
bitmapGDI = new Bitmap(Video.fullwidth, Video.fullheight);
UI.ui_update_callback = UI.ui_updateC;
Motion.motion_update_callback = Motion.ui_updateC;
bitmapbase = new ushort[2][];
bitmapbase[0] = new ushort[0x200 * 0x200];
bitmapbase[1] = new ushort[0x200 * 0x200];
@ -135,7 +134,7 @@ namespace mame
screenstate.vblank_period = 0;
video_attributes = 0;
bitmapGDI = new Bitmap(Video.fullwidth, Video.fullheight);
UI.ui_update_callback = UI.ui_updateC;
Motion.motion_update_callback = Motion.ui_updateC;
bitmapbase = new ushort[2][];
bitmapbase[0] = new ushort[0x200 * 0x200];
bitmapbase[1] = new ushort[0x200 * 0x200];
@ -159,7 +158,7 @@ namespace mame
screenstate.vblank_period = 0;
video_attributes = 0;
bitmapGDI = new Bitmap(Video.fullwidth, Video.fullheight);
UI.ui_update_callback = UI.ui_updateC;
Motion.motion_update_callback = Motion.ui_updateC;
bitmapbase = new ushort[2][];
bitmapbase[0] = new ushort[0x100 * 0x100];
bitmapbase[1] = new ushort[0x100 * 0x100];
@ -192,7 +191,7 @@ namespace mame
screenstate.vblank_period = 0;
video_attributes = 0;
bitmapGDI = new Bitmap(Video.fullwidth, Video.fullheight);
UI.ui_update_callback = UI.ui_updateTehkan;
Motion.motion_update_callback = Motion.ui_updateTehkan;
bitmapbase = new ushort[2][];
bitmapbase[0] = new ushort[0x100 * 0x100];
bitmapbase[1] = new ushort[0x100 * 0x100];
@ -213,7 +212,7 @@ namespace mame
frame_update_time = new Atime(0, (long)(1e18 / 6000000) * screenstate.width * screenstate.height);//59.1856060608428Hz
screenstate.vblank_period = (long)(1e18 / 6000000) * 384 * (264 - 224);
video_attributes = 0;
UI.ui_update_callback = UI.ui_updateN;
Motion.motion_update_callback = Motion.ui_updateN;
bitmapbaseN = new int[2][];
bitmapbaseN[0] = new int[384 * 264];
bitmapbaseN[1] = new int[384 * 264];
@ -234,7 +233,7 @@ namespace mame
frame_update_time = new Atime(0, (long)(1e18 / 60));
screenstate.vblank_period = (long)(1e12 * 2500);
video_attributes = 0;
UI.ui_update_callback = UI.ui_updatePGM;
Motion.motion_update_callback = Motion.ui_updatePGM;
bitmapbase = new ushort[2][];
bitmapbase[0] = new ushort[0x100 * 0x100];
bitmapbase[1] = new ushort[0x100 * 0x100];
@ -255,7 +254,7 @@ namespace mame
frame_update_time = new Atime(0, (long)(1e18 / 60.606060));
screenstate.vblank_period = 0;
video_attributes = 0;
UI.ui_update_callback = UI.ui_updateNa;
Motion.motion_update_callback = Motion.ui_updateNa;
bitmapGDI = new Bitmap(Video.fullwidth, Video.fullheight);
bitmapbase = new ushort[2][];
bitmapbase[0] = new ushort[0x200 * 0x200];
@ -278,7 +277,7 @@ namespace mame
frame_update_time = new Atime(0, (long)(1e18 / 60));
screenstate.vblank_period = 0;
video_attributes = 0;
UI.ui_update_callback = UI.ui_updateIGS011;
Motion.motion_update_callback = Motion.ui_updateIGS011;
bitmapGDI = new Bitmap(Video.fullwidth, Video.fullheight);
bitmapbase = new ushort[2][];
bitmapbase[0] = new ushort[0x200 * 0x200];
@ -300,7 +299,7 @@ namespace mame
frame_update_time = new Atime(0, (long)(1e18 / 60));
screenstate.vblank_period = 0;
video_attributes = 0;
UI.ui_update_callback = UI.ui_updatePGM;
Motion.motion_update_callback = Motion.ui_updatePGM;
bitmapGDI = new Bitmap(Video.fullwidth, Video.fullheight);
bitmapbase = new ushort[2][];
bitmapbase[0] = new ushort[0x200 * 0x200];
@ -322,7 +321,7 @@ namespace mame
frame_update_time = new Atime(0, (long)(1e18 / 8000000) * screenstate.width * screenstate.height);
screenstate.vblank_period = (long)(1e18 / 8000000) * 512 * (284 - 256);
video_attributes = 0;
UI.ui_update_callback = UI.ui_updatePGM;
Motion.motion_update_callback = Motion.ui_updatePGM;
bitmapbase = new ushort[2][];
bitmapbase[0] = new ushort[0x200 * 0x200];//0x11c
bitmapbase[1] = new ushort[0x200 * 0x200];//0x11c
@ -343,7 +342,7 @@ namespace mame
frame_update_time = new Atime(0, (long)(1e18 / 60));
screenstate.vblank_period = 0;
video_attributes = 0;
UI.ui_update_callback = UI.ui_updatePGM;
Motion.motion_update_callback = Motion.ui_updatePGM;
bitmapbase = new ushort[2][];
bitmapbase[0] = new ushort[0x200 * 0x200];
bitmapbase[1] = new ushort[0x200 * 0x200];
@ -352,9 +351,9 @@ namespace mame
video_update_callback = M92.video_update_m92;
video_eof_callback = M92.video_eof_m92;
break;
case "Taito":
case "Taito":
video_attributes = 0;
UI.ui_update_callback = UI.ui_updatePGM;
Motion.motion_update_callback = Motion.ui_updatePGM;
switch (Machine.sName)
{
case "tokio":
@ -435,7 +434,7 @@ namespace mame
frame_update_time = new Atime(0, (long)(1e18 / 60));
screenstate.vblank_period = 0;
video_attributes = 0;
UI.ui_update_callback = UI.ui_updatePGM;
Motion.motion_update_callback = Motion.ui_updatePGM;
bitmapbase = new ushort[2][];
bitmapbase[0] = new ushort[0x200 * 0x100];
bitmapbase[1] = new ushort[0x200 * 0x100];
@ -452,7 +451,7 @@ namespace mame
frame_update_time = new Atime(0, (long)(1e18 / 60));
screenstate.vblank_period = (long)(1e12 * 2500);
video_attributes = 0x34;
UI.ui_update_callback = UI.ui_updatePGM;
Motion.motion_update_callback = Motion.ui_updatePGM;
bitmapbase = new ushort[2][];
bitmapbase[0] = new ushort[0x200 * 0x100];
bitmapbase[1] = new ushort[0x200 * 0x100];
@ -604,7 +603,7 @@ namespace mame
frame_update_time = new Atime(0, (long)(1e18 / 60));
screenstate.vblank_period = 0;
video_attributes = 0;
UI.ui_update_callback = UI.ui_updatePGM;
Motion.motion_update_callback = Motion.ui_updatePGM;
bitmapbase = new ushort[2][];
bitmapbase[0] = new ushort[0x100 * 0x100];
bitmapbase[1] = new ushort[0x100 * 0x100];
@ -630,7 +629,7 @@ namespace mame
frame_update_time = new Atime(0, (long)(1e18 / 60));
screenstate.vblank_period = 0;
video_attributes = 0;
UI.ui_update_callback = UI.ui_updatePGM;
Motion.motion_update_callback = Motion.ui_updatePGM;
bitmapbase = new ushort[2][];
bitmapbase[0] = new ushort[0x200 * 0x100];
bitmapbase[1] = new ushort[0x200 * 0x100];
@ -659,7 +658,7 @@ namespace mame
case "CPS-1(QSound)":
case "Namco System 1":
case "M92":
case "Taito B":
case "Taito B":
break;
case "CPS2":
Cpuexec.cpu[0].partial_frame_period = Attotime.attotime_div(Video.frame_update_time, 262);
@ -699,7 +698,7 @@ namespace mame
Cpuexec.cpu[0].partial_frame_period = Attotime.attotime_div(Video.frame_update_time, 4);
Cpuexec.cpu[0].partial_frame_timer = Timer.timer_alloc_common(Cpuexec.trigger_partial_frame_interrupt, "trigger_partial_frame_interrupt", false);
break;
}
}
break;
case "M72":
Cpuexec.cpu[1].partial_frame_period = Attotime.attotime_div(Video.frame_update_time, 128);
@ -752,7 +751,7 @@ namespace mame
screenstate.height = height;
screenstate.visarea = visarea;
//realloc_screen_bitmaps(screen);
screenstate.frame_period=frame_period;
screenstate.frame_period = frame_period;
screenstate.scantime = frame_period / height;
screenstate.pixeltime = frame_period / (height * width);
/*if (config->vblank == 0 && !config->oldstyle_vblank_supplied)
@ -779,7 +778,7 @@ namespace mame
new_clip.max_y = scanline;
}
if (new_clip.min_y <= new_clip.max_y)
{
{
video_update_callback();
result = true;
}
@ -853,7 +852,7 @@ namespace mame
}
else
{
Timer.timer_adjust_periodic(vblank_end_timer, video_screen_get_time_until_vblank_end(),Attotime.ATTOTIME_NEVER);
Timer.timer_adjust_periodic(vblank_end_timer, video_screen_get_time_until_vblank_end(), Attotime.ATTOTIME_NEVER);
}
}
public static void vblank_end_callback()
@ -878,7 +877,7 @@ namespace mame
{
scanline = screenstate.visarea.min_y;
}
scanline_param=scanline;
scanline_param = scanline;
Timer.timer_adjust_periodic(scanline_timer, video_screen_get_time_until_pos(scanline, 0), Attotime.ATTOTIME_NEVER);
}
public static void video_frame_update()
@ -891,10 +890,10 @@ namespace mame
Keyboard.Update();
Mouse.Update();
Inptport.frame_update_callback();
UI.ui_update_and_render();
if(Machine.FORM.cheatform.lockState == MAME.Core.Common.cheatForm.LockState.LOCK_FRAME)
Motion.ui_update_and_render();
if (Machine.FORM.cheatmotion.lockState == MAME.Core.Common.cheatMotion.LockState.LOCK_FRAME)
{
Machine.FORM.cheatform.ApplyCheat();
Machine.FORM.cheatmotion.ApplyCheat();
}
GDIDraw();
if (effective_throttle())

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mame
namespace mame
{
public class Watchdog
{
@ -33,7 +28,7 @@ namespace mame
break;
case "Neo Geo":
watchdog_time = new Atime(0, (long)128762e12);
break;
break;
}
}
public static void watchdog_internal_reset()

View File

@ -1,17 +1,19 @@
using MAME.Core.Common;
using System;
using System.Drawing;
using System.Runtime.InteropServices;
namespace mame
{
public class Window
{
private static mainForm _myParentForm;
[DllImport("kernel32.dll ")]
private static extern uint GetTickCount();
public static bool input_enabled,input_paused, mouse_enabled, lightgun_enabled;
private static mainMotion _myParentForm;
//[DllImport("kernel32.dll ")]
//private static extern uint GetTickCount();
private static uint GetTickCount()
{
return (uint)Wintime._stopwatch.ElapsedMilliseconds;
}
public static bool input_enabled, input_paused, mouse_enabled, lightgun_enabled;
public static uint last_poll, last_event_check;
private static bool _CursorShown = true;
public static void osd_update(bool skip_redraw)
@ -45,7 +47,7 @@ namespace mame
}
winwindow_process_events(true);
}
public static void osd_init(mainForm form)
public static void osd_init(mainMotion form)
{
_myParentForm = form;
wininput_init();
@ -70,7 +72,7 @@ namespace mame
break;
}
wininput_poll();
}
}
public static void wininput_pause(bool paused)
{
input_paused = paused;

View File

@ -1,18 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Threading;
namespace mame
{
public class Wintime
{
[DllImport("kernel32.dll ")]
public static extern bool QueryPerformanceCounter(ref long lpPerformanceCount);
[DllImport("kernel32.dll")]
private static extern bool QueryPerformanceFrequency(ref long PerformanceFrequency);
//[DllImport("kernel32.dll ")]
//public static extern bool QueryPerformanceCounter(ref long lpPerformanceCount);
//[DllImport("kernel32.dll")]
//private static extern bool QueryPerformanceFrequency(ref long PerformanceFrequency);
#region
public static Stopwatch _stopwatch = Stopwatch.StartNew();
private static long _lastReportedCount = 0;
public static bool QueryPerformanceCounter(ref long lpPerformanceCount)
{
lpPerformanceCount = _stopwatch.ElapsedTicks;
return true;
}
public static bool QueryPerformanceFrequency(ref long PerformanceFrequency)
{
PerformanceFrequency = Stopwatch.Frequency;
return true;
}
#endregion
public static long ticks_per_second;
public static void wintime_init()
{

View File

@ -1,36 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cpu.m68000;
using cpu.m68000;
namespace mame
{
public partial class Capcom
{
public static byte[] audiorom2;
public static int basebankmain,basebanksnd1;
public static byte[] gfx1rom, gfx2rom, gfx3rom,gfx4rom,gfx5rom,gfx12rom,gfx22rom,gfx32rom,gfx42rom;
public static int basebankmain, basebanksnd1;
public static byte[] gfx1rom, gfx2rom, gfx3rom, gfx4rom, gfx5rom, gfx12rom, gfx22rom, gfx32rom, gfx42rom;
public static ushort dsw1, dsw2;
public static byte bytedsw1, bytedsw2;
public static ushort[] sf_objectram, sf_videoram;
public static int[] scale = new int[8] { 0x00, 0x40, 0xe0, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe };
public static void CapcomInit()
{
int i,n;
int i, n;
Machine.bRom = true;
switch (Machine.sName)
{
case "gng":
case "gnga":
case "gngbl":
case "gngprot":
case "gngblita":
case "gngc":
case "gngt":
case "makaimur":
case "makaimurc":
case "makaimurg":
case "gngbl":
case "gngprot":
case "gngblita":
case "gngc":
case "gngt":
case "makaimur":
case "makaimurc":
case "makaimurg":
case "diamond":
Generic.spriteram = new byte[0x200];
Generic.buffered_spriteram = new byte[0x200];
@ -149,7 +145,7 @@ namespace mame
dsw1 = 0xdfff;
dsw2 = 0xfbff;
shorts = unchecked((short)0xff7f);
break;
break;
case "sfjan":
case "sfan":
case "sfp":
@ -200,11 +196,11 @@ namespace mame
public static void protection_w(ushort data)
{
int[,] maplist = new int[4, 10] {
{ 1, 0, 3, 2, 4, 5, 6, 7, 8, 9 },
{ 4, 5, 6, 7, 1, 0, 3, 2, 8, 9 },
{ 3, 2, 1, 0, 6, 7, 4, 5, 8, 9 },
{ 6, 7, 4, 5, 3, 2, 1, 0, 8, 9 }
};
{ 1, 0, 3, 2, 4, 5, 6, 7, 8, 9 },
{ 4, 5, 6, 7, 1, 0, 3, 2, 8, 9 },
{ 3, 2, 1, 0, 6, 7, 4, 5, 8, 9 },
{ 6, 7, 4, 5, 3, 2, 1, 0, 8, 9 }
};
int map;
map = maplist[MC68000.m1.ReadByte(0xffc006), (MC68000.m1.ReadByte(0xffc003) << 1) + (MC68000.m1.ReadWord(0xffc004) >> 8)];
switch (MC68000.m1.ReadByte(0xffc684))
@ -233,11 +229,11 @@ namespace mame
case 2:
{
int[] delta1 = new int[10]{
0x1f80, 0x1c80, 0x2700, 0x2400, 0x2b80, 0x2e80, 0x3300, 0x3600, 0x3a80, 0x3d80
};
int[] delta2 = new int[10]{
0x2180, 0x1800, 0x3480, 0x2b00, 0x3e00, 0x4780, 0x5100, 0x5a80, 0x6400, 0x6d80
};
0x1f80, 0x1c80, 0x2700, 0x2400, 0x2b80, 0x2e80, 0x3300, 0x3600, 0x3a80, 0x3d80
};
int[] delta2 = new int[10]{
0x2180, 0x1800, 0x3480, 0x2b00, 0x3e00, 0x4780, 0x5100, 0x5a80, 0x6400, 0x6d80
};
int d1 = delta1[map] + 0xc0;
int d2 = delta2[map];
MC68000.m1.WriteWord(0xffc680, (short)d1);
@ -282,11 +278,11 @@ namespace mame
public static void protection_w1(byte data)
{
int[,] maplist = new int[4, 10] {
{ 1, 0, 3, 2, 4, 5, 6, 7, 8, 9 },
{ 4, 5, 6, 7, 1, 0, 3, 2, 8, 9 },
{ 3, 2, 1, 0, 6, 7, 4, 5, 8, 9 },
{ 6, 7, 4, 5, 3, 2, 1, 0, 8, 9 }
};
{ 1, 0, 3, 2, 4, 5, 6, 7, 8, 9 },
{ 4, 5, 6, 7, 1, 0, 3, 2, 8, 9 },
{ 3, 2, 1, 0, 6, 7, 4, 5, 8, 9 },
{ 6, 7, 4, 5, 3, 2, 1, 0, 8, 9 }
};
int map;
map = maplist[MC68000.m1.ReadByte(0xffc006), (MC68000.m1.ReadByte(0xffc003) << 1) + (MC68000.m1.ReadWord(0xffc004) >> 8)];
switch (MC68000.m1.ReadByte(0xffc684))
@ -315,11 +311,11 @@ namespace mame
case 2:
{
int[] delta1 = new int[10]{
0x1f80, 0x1c80, 0x2700, 0x2400, 0x2b80, 0x2e80, 0x3300, 0x3600, 0x3a80, 0x3d80
};
0x1f80, 0x1c80, 0x2700, 0x2400, 0x2b80, 0x2e80, 0x3300, 0x3600, 0x3a80, 0x3d80
};
int[] delta2 = new int[10]{
0x2180, 0x1800, 0x3480, 0x2b00, 0x3e00, 0x4780, 0x5100, 0x5a80, 0x6400, 0x6d80
};
0x2180, 0x1800, 0x3480, 0x2b00, 0x3e00, 0x4780, 0x5100, 0x5a80, 0x6400, 0x6d80
};
int d1 = delta1[map] + 0xc0;
int d2 = delta2[map];
MC68000.m1.WriteWord(0xffc680, (short)d1);
@ -351,7 +347,7 @@ namespace mame
}
MC68000.m1.WriteWord(0xffc682, (short)d1);
MC68000.m1.WriteWord(0xffc00e, (short)off);
sf_bg_scroll_w((byte)(d1>>8));
sf_bg_scroll_w((byte)(d1 >> 8));
}
break;
}
@ -364,11 +360,11 @@ namespace mame
public static void protection_w2(byte data)
{
int[,] maplist = new int[4, 10] {
{ 1, 0, 3, 2, 4, 5, 6, 7, 8, 9 },
{ 4, 5, 6, 7, 1, 0, 3, 2, 8, 9 },
{ 3, 2, 1, 0, 6, 7, 4, 5, 8, 9 },
{ 6, 7, 4, 5, 3, 2, 1, 0, 8, 9 }
};
{ 1, 0, 3, 2, 4, 5, 6, 7, 8, 9 },
{ 4, 5, 6, 7, 1, 0, 3, 2, 8, 9 },
{ 3, 2, 1, 0, 6, 7, 4, 5, 8, 9 },
{ 6, 7, 4, 5, 3, 2, 1, 0, 8, 9 }
};
int map;
map = maplist[MC68000.m1.ReadByte(0xffc006), (MC68000.m1.ReadByte(0xffc003) << 1) + (MC68000.m1.ReadWord(0xffc004) >> 8)];
switch (MC68000.m1.ReadByte(0xffc684))
@ -397,11 +393,11 @@ namespace mame
case 2:
{
int[] delta1 = new int[10]{
0x1f80, 0x1c80, 0x2700, 0x2400, 0x2b80, 0x2e80, 0x3300, 0x3600, 0x3a80, 0x3d80
};
0x1f80, 0x1c80, 0x2700, 0x2400, 0x2b80, 0x2e80, 0x3300, 0x3600, 0x3a80, 0x3d80
};
int[] delta2 = new int[10]{
0x2180, 0x1800, 0x3480, 0x2b00, 0x3e00, 0x4780, 0x5100, 0x5a80, 0x6400, 0x6d80
};
0x2180, 0x1800, 0x3480, 0x2b00, 0x3e00, 0x4780, 0x5100, 0x5a80, 0x6400, 0x6d80
};
int d1 = delta1[map] + 0xc0;
int d2 = delta2[map];
MC68000.m1.WriteWord(0xffc680, (short)d1);

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mame
namespace mame
{
public partial class Drawgfx
{
@ -163,7 +158,7 @@ namespace mame
int colorbase = 0x200 + 0x10 * color;
blockmove_8toN_transpen16_sf(bb1, code, sw, sh, 0x10, ls, ts, flipx, flipy, dw, dh, colorbase, sy, sx);
}
public static void blockmove_8toN_transpen16_sf(byte[] bb1, int code, int srcwidth, int srcheight, int srcmodulo,int leftskip, int topskip, int flipx, int flipy,int dstwidth, int dstheight, int colorbase, int offsety, int offsetx)
public static void blockmove_8toN_transpen16_sf(byte[] bb1, int code, int srcwidth, int srcheight, int srcmodulo, int leftskip, int topskip, int flipx, int flipy, int dstwidth, int dstheight, int colorbase, int offsety, int offsetx)
{
int ydir, xdir, col, i, j;
int srcdata_offset = code * 0x100;

View File

@ -1,6 +1,4 @@
using System.Drawing;
using System.Drawing.Imaging;

namespace mame
{
public partial class Capcom
@ -10,731 +8,5 @@ namespace mame
{
}
public static Bitmap GetBg_gng()
{
int i1, i2, iOffset, i3, i4;
int rows, cols, width, height;
int tilewidth, tileheight;
int tile_index;
tilewidth = 0x10;
tileheight = tilewidth;
rows = 0x20;
cols = 0x20;
width = tilewidth * cols;
height = tileheight * rows;
int iByte;
int code, color;
int group, flags, attributes = 0;
int pen_data_offset, palette_base;
int x0 = 0, y0 = 0, dx0 = 0, dy0 = 0;
Color c1 = new Color();
Bitmap bm1;
bm1 = new Bitmap(width, height);
BitmapData bmData;
bmData = bm1.LockBits(new Rectangle(0, 0, bm1.Width, bm1.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
unsafe
{
byte* ptr = (byte*)(bmData.Scan0);
byte* ptr2 = (byte*)0;
for (i3 = 0; i3 < cols; i3++)
{
for (i4 = 0; i4 < rows; i4++)
{
tile_index = i3 * rows + i4;
int base_offset = 2 * tile_index;
int attr = gng_bgvideoram[tile_index + 0x400];
color = attr & 0x07;
code = gng_bgvideoram[tile_index] + ((attr & 0xc0) << 2);
code = code % bg_tilemap.total_elements;
pen_data_offset = code * 0x100;
palette_base = color * 8;
flags = (((attr & 0x30) >> 4) & 0x03) ^ (attributes & 0x03);
group = (attr & 0x08) >> 3;
if (flags == 0)
{
x0 = tilewidth * i3;
y0 = tileheight * i4;
dx0 = 1;
dy0 = 1;
}
else if (flags == 1)
{
x0 = tilewidth * i3 + tilewidth - 1;
y0 = tileheight * i4;
dx0 = -1;
dy0 = 1;
}
else if (flags == 2)
{
x0 = tilewidth * i3;
y0 = tileheight * i4 + tileheight - 1;
dx0 = 1;
dy0 = -1;
}
else if (flags == 3)
{
x0 = tilewidth * i3 + tilewidth - 1;
y0 = tileheight * i4 + tileheight - 1;
dx0 = -1;
dy0 = -1;
}
for (i1 = 0; i1 < tilewidth; i1++)
{
for (i2 = 0; i2 < tileheight; i2++)
{
iOffset = pen_data_offset + i2 * 0x10 + i1;
iByte = gfx2rom[iOffset];
c1 = Color.FromArgb((int)Palette.entry_color[palette_base + iByte]);
ptr2 = ptr + ((y0 + dy0 * i2) * width + x0 + dx0 * i1) * 4;
*ptr2 = c1.B;
*(ptr2 + 1) = c1.G;
*(ptr2 + 2) = c1.R;
*(ptr2 + 3) = c1.A;
}
}
}
}
}
bm1.UnlockBits(bmData);
return bm1;
}
public static Bitmap GetFg_gng()
{
int i1, i2, iOffset, i3, i4;
int rows, cols, width, height;
int tilewidth, tileheight;
int tile_index;
tilewidth = 8;
tileheight = tilewidth;
rows = 0x20;
cols = 0x20;
width = tilewidth * cols;
height = tileheight * rows;
int iByte;
int code, color;
int group, flags, attributes = 0;
int pen_data_offset, palette_base;
int x0 = 0, y0 = 0, dx0 = 0, dy0 = 0;
Color c1 = new Color();
Bitmap bm1;
bm1 = new Bitmap(width, height);
BitmapData bmData;
bmData = bm1.LockBits(new Rectangle(0, 0, bm1.Width, bm1.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
unsafe
{
byte* ptr = (byte*)(bmData.Scan0);
byte* ptr2 = (byte*)0;
for (i3 = 0; i3 < cols; i3++)
{
for (i4 = 0; i4 < rows; i4++)
{
tile_index = i4 * cols + i3;
int base_offset = 2 * tile_index;
int attr = Capcom.gng_fgvideoram[tile_index + 0x400];
color = attr & 0x0f;
code = Capcom.gng_fgvideoram[tile_index] + ((attr & 0xc0) << 2);
code = code % fg_tilemap.total_elements;
pen_data_offset = code * 0x40;
palette_base = 0x80 + color * 4;
flags = (((attr & 0x30) >> 4) & 0x03) ^ (attributes & 0x03);
group = 0;
if (flags == 0)
{
x0 = tilewidth * i3;
y0 = tileheight * i4;
dx0 = 1;
dy0 = 1;
}
else if (flags == 1)
{
x0 = tilewidth * i3 + tilewidth - 1;
y0 = tileheight * i4;
dx0 = -1;
dy0 = 1;
}
else if (flags == 2)
{
x0 = tilewidth * i3;
y0 = tileheight * i4 + tileheight - 1;
dx0 = 1;
dy0 = -1;
}
else if (flags == 3)
{
x0 = tilewidth * i3 + tilewidth - 1;
y0 = tileheight * i4 + tileheight - 1;
dx0 = -1;
dy0 = -1;
}
for (i1 = 0; i1 < tilewidth; i1++)
{
for (i2 = 0; i2 < tileheight; i2++)
{
iOffset = pen_data_offset + i2 * 8 + i1;
iByte = gfx1rom[iOffset];
if (iByte != 3)
{
c1 = Color.FromArgb((int)Palette.entry_color[palette_base + iByte]);
ptr2 = ptr + ((y0 + dy0 * i2) * width + x0 + dx0 * i1) * 4;
*ptr2 = c1.B;
*(ptr2 + 1) = c1.G;
*(ptr2 + 2) = c1.R;
*(ptr2 + 3) = c1.A;
}
}
}
}
}
}
bm1.UnlockBits(bmData);
return bm1;
}
public static Bitmap GetSprite_gng()
{
Bitmap bm1;
int offs;
int i5, i6;
int xdir, ydir, offx, offy,color;
int iByte;
Color c1 = new Color();
bm1 = new Bitmap(256, 256);
for (offs = 0x200 - 4; offs >= 0; offs -= 4)
{
byte attributes = Generic.buffered_spriteram[offs + 1];
int sx = Generic.buffered_spriteram[offs + 3] - 0x100 * (attributes & 0x01);
int sy = Generic.buffered_spriteram[offs + 2];
int flipx = attributes & 0x04;
int flipy = attributes & 0x08;
if (Generic.buffered_spriteram[offs] == 0 && Generic.buffered_spriteram[offs + 1] == 0 && Generic.buffered_spriteram[offs + 2] == 0 && Generic.buffered_spriteram[offs + 3] == 0)
{
continue;
}
color=(attributes >> 4) & 3;
if (Generic.flip_screen_get() != 0)
{
sx = 240 - sx;
sy = 240 - sy;
flipx = (flipx == 0 ? 1 : 0);
flipy = (flipy == 0 ? 1 : 0);
}
if (flipx != 0)
{
offx = 0x0f;
xdir = -1;
}
else
{
offx = 0;
xdir = 1;
}
if (flipy != 0)
{
offy = 0x0f;
ydir = -1;
}
else
{
offy = 0;
ydir = 1;
}
for (i5 = 0; i5 < 0x10; i5++)
{
for (i6 = 0; i6 < 0x10; i6++)
{
if (sx + offx + xdir * i5 >= 0 && sx + offx + xdir * i5 < 0x100 && sy + offy + ydir * i6 >= 0 && sy + offy + ydir * i6 < 0x100)
{
iByte = gfx3rom[(Generic.buffered_spriteram[offs] + ((attributes << 2) & 0x300)) * 0x100 + i5 + i6 * 0x10];
if (iByte != 0x0f)
{
c1 = Color.FromArgb((int)Palette.entry_color[0x40 + 0x10 * color + iByte]);
bm1.SetPixel(sx + offx + xdir * i5, sy + offy + ydir * i6, c1);
}
}
}
}
}
return bm1;
}
public static Bitmap GetAllGDI_gng()
{
Bitmap bm1 = new Bitmap(0x200, 0x100), bm2;
Graphics g = Graphics.FromImage(bm1);
g.Clear(Color.Transparent);
if (bBg)
{
bm2 = GetBg_gng();
g.DrawImage(bm2, -(scrollx[0] + 256 * scrollx[1]), 0);
}
if (bSprite)
{
bm2 = GetSprite_gng();
g.DrawImage(bm2, 0, 0);
}
if (bFg)
{
bm2 = GetFg_gng();
g.DrawImage(bm2, -(scrolly[0] + 256 * scrolly[1]), 0);
}
return bm1;
}
public static Bitmap GetBg_sf()
{
int i1, i2, iOffset, i3, i4;
int rows, cols, width, height;
int tilewidth, tileheight;
int tile_index;
tilewidth = 0x10;
tileheight = tilewidth;
rows = 0x10;
cols = 0x800;
width = tilewidth * cols;
height = tileheight * rows;
int iByte;
int code, color;
int group, flags, attributes = 0;
int pen_data_offset, palette_base;
int x0 = 0, y0 = 0, dx0 = 0, dy0 = 0;
Color c1 = new Color();
Bitmap bm1;
bm1 = new Bitmap(width, height);
BitmapData bmData;
bmData = bm1.LockBits(new Rectangle(0, 0, bm1.Width, bm1.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
unsafe
{
byte* ptr = (byte*)(bmData.Scan0);
byte* ptr2 = (byte*)0;
for (i3 = 0; i3 < cols; i3++)
{
for (i4 = 0; i4 < rows; i4++)
{
tile_index = i3 * rows + i4;
int base_offset = 2 * tile_index;
int attr = gfx5rom[base_offset + 0x10000];
color = gfx5rom[base_offset];
code = (gfx5rom[base_offset + 0x10000 + 1] << 8) | gfx5rom[base_offset + 1];
code = code % bg_tilemap.total_elements;
pen_data_offset = code * 0x100;
palette_base = color * 0x10;
group = 0;
flags = (attr & 0x03) ^ (attributes & 0x03);
pen_data_offset = code * 0x100;
if (flags == 0)
{
x0 = tilewidth * i3;
y0 = tileheight * i4;
dx0 = 1;
dy0 = 1;
}
else if (flags == 1)
{
x0 = tilewidth * i3 + tilewidth - 1;
y0 = tileheight * i4;
dx0 = -1;
dy0 = 1;
}
else if (flags == 2)
{
x0 = tilewidth * i3;
y0 = tileheight * i4 + tileheight - 1;
dx0 = 1;
dy0 = -1;
}
else if (flags == 3)
{
x0 = tilewidth * i3 + tilewidth - 1;
y0 = tileheight * i4 + tileheight - 1;
dx0 = -1;
dy0 = -1;
}
for (i1 = 0; i1 < tilewidth; i1++)
{
for (i2 = 0; i2 < tileheight; i2++)
{
iOffset = pen_data_offset + i2 * 0x10 + i1;
iByte = gfx1rom[iOffset];
if (iByte == 0)
{
c1 = Color.Transparent;
}
else
{
if (palette_base + iByte >= 0x400)
{
c1 = Color.Transparent;
}
else
{
c1 = Color.FromArgb((int)Palette.entry_color[palette_base + iByte]);
}
}
ptr2 = ptr + ((y0 + dy0 * i2) * width + x0 + dx0 * i1) * 4;
*ptr2 = c1.B;
*(ptr2 + 1) = c1.G;
*(ptr2 + 2) = c1.R;
*(ptr2 + 3) = c1.A;
}
}
}
}
}
bm1.UnlockBits(bmData);
return bm1;
}
public static Bitmap GetFg_sf()
{
int i1, i2, iOffset, i3, i4;
int rows, cols, width, height;
int tilewidth, tileheight;
int tile_index;
tilewidth = 0x10;
tileheight = tilewidth;
rows = 0x10;
cols = 0x800;
width = tilewidth * cols;
height = tileheight * rows;
int iByte;
int code,color;
int group, flags,attributes=0;
int pen_data_offset, palette_base;
int x0 = 0, y0 = 0, dx0 = 0, dy0 = 0;
Color c1 = new Color();
Bitmap bm1;
bm1 = new Bitmap(width, height);
BitmapData bmData;
bmData = bm1.LockBits(new Rectangle(0, 0, bm1.Width, bm1.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
unsafe
{
byte* ptr = (byte*)(bmData.Scan0);
byte* ptr2 = (byte*)0;
for (i3 = 0; i3 < cols; i3++)
{
for (i4 = 0; i4 < rows; i4++)
{
tile_index = i3 * rows + i4;
int base_offset = 0x20000 + 2 * tile_index;
int attr = gfx5rom[base_offset + 0x10000];
color = gfx5rom[base_offset];
code = (gfx5rom[base_offset + 0x10000 + 1] << 8) | gfx5rom[base_offset + 1];
code = code % fg_tilemap.total_elements;
pen_data_offset = code * 0x100;
palette_base = 0x100 + color * 0x10;
group = 0;
flags = (attr & 0x03) ^ (attributes & 0x03);
pen_data_offset = code * 0x100;
palette_base = 0x100+ 0x10 * color;
if (flags == 0)
{
x0 = tilewidth * i3;
y0 = tileheight * i4;
dx0 = 1;
dy0 = 1;
}
else if (flags == 1)
{
x0 = tilewidth * i3 + tilewidth - 1;
y0 = tileheight * i4;
dx0 = -1;
dy0 = 1;
}
else if (flags == 2)
{
x0 = tilewidth * i3;
y0 = tileheight * i4 + tileheight - 1;
dx0 = 1;
dy0 = -1;
}
else if (flags == 3)
{
x0 = tilewidth * i3 + tilewidth - 1;
y0 = tileheight * i4 + tileheight - 1;
dx0 = -1;
dy0 = -1;
}
for (i1 = 0; i1 < tilewidth; i1++)
{
for (i2 = 0; i2 < tileheight; i2++)
{
iOffset = pen_data_offset + i2 * 0x10 + i1;
iByte = gfx2rom[iOffset];
if (iByte == 15)
{
c1 = Color.Transparent;
}
else
{
c1 = Color.FromArgb((int)Palette.entry_color[palette_base + iByte]);
}
ptr2 = ptr + ((y0 + dy0 * i2) * width + x0 + dx0 * i1) * 4;
*ptr2 = c1.B;
*(ptr2 + 1) = c1.G;
*(ptr2 + 2) = c1.R;
*(ptr2 + 3) = c1.A;
}
}
}
}
}
bm1.UnlockBits(bmData);
return bm1;
}
public static Bitmap GetTx_sf()
{
int i1, i2, iOffset, i3, i4;
int rows, cols, width, height;
int tilewidth, tileheight;
int tile_index;
tilewidth = 0x8;
tileheight = tilewidth;
rows = 0x20;
cols = 0x40;
width = tilewidth * cols;
height = tileheight * rows;
int iByte;
int code, color;
int group, flags, attributes = 0;
int pen_data_offset, palette_base;
int x0 = 0, y0 = 0, dx0 = 0, dy0 = 0;
Color c1 = new Color();
Bitmap bm1;
bm1 = new Bitmap(width, height);
BitmapData bmData;
bmData = bm1.LockBits(new Rectangle(0, 0, bm1.Width, bm1.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
unsafe
{
byte* ptr = (byte*)(bmData.Scan0);
byte* ptr2 = (byte*)0;
for (i3 = 0; i3 < cols; i3++)
{
for (i4 = 0; i4 < rows; i4++)
{
tile_index = i4 * cols + i3;
int base_offset = 0x20000 + 2 * tile_index;
code = Capcom.sf_videoram[tile_index];
color = code >> 12;
flags = (((code & 0xc00) >> 10) & 0x03) ^ (attributes & 0x03);
code = (code & 0x3ff) % tx_tilemap.total_elements;
pen_data_offset = code * 0x40;
palette_base = 0x300 + color * 4;
group = 0;
if (flags == 0)
{
x0 = tilewidth * i3;
y0 = tileheight * i4;
dx0 = 1;
dy0 = 1;
}
else if (flags == 1)
{
x0 = tilewidth * i3 + tilewidth - 1;
y0 = tileheight * i4;
dx0 = -1;
dy0 = 1;
}
else if (flags == 2)
{
x0 = tilewidth * i3;
y0 = tileheight * i4 + tileheight - 1;
dx0 = 1;
dy0 = -1;
}
else if (flags == 3)
{
x0 = tilewidth * i3 + tilewidth - 1;
y0 = tileheight * i4 + tileheight - 1;
dx0 = -1;
dy0 = -1;
}
for (i1 = 0; i1 < tilewidth; i1++)
{
for (i2 = 0; i2 < tileheight; i2++)
{
iOffset = pen_data_offset + i2 * 0x8 + i1;
iByte = gfx4rom[iOffset];
if (iByte == 3)
{
c1 = Color.Transparent;
}
else
{
c1 = Color.FromArgb((int)Palette.entry_color[palette_base + iByte]);
}
ptr2 = ptr + ((y0 + dy0 * i2) * width + x0 + dx0 * i1) * 4;
*ptr2 = c1.B;
*(ptr2 + 1) = c1.G;
*(ptr2 + 2) = c1.R;
*(ptr2 + 3) = c1.A;
}
}
}
}
}
bm1.UnlockBits(bmData);
return bm1;
}
public static Bitmap GetSprite_sf()
{
Bitmap bm1;
int offs;
int i5, i6;
int xdir, ydir, offx, offy;
int iByte1,iByte2,iByte3,iByte4;
Color c11 = new Color(),c12=new Color(),c13=new Color(),c14=new Color();
bm1 = new Bitmap(512,256);
for (offs = 0x1000 - 0x20; offs >= 0; offs -= 0x20)
{
int c = sf_objectram[offs];
int attr = sf_objectram[offs + 1];
int sy = sf_objectram[offs + 2];
int sx = sf_objectram[offs + 3];
int color = attr & 0x000f;
int flipx = attr & 0x0100;
int flipy = attr & 0x0200;
if ((attr & 0x400) != 0)
{
int c1, c2, c3, c4, t;
if (Generic.flip_screen_get() != 0)
{
sx = 480 - sx;
sy = 224 - sy;
flipx = (flipx == 0) ? 1 : 0;
flipy = (flipy == 0) ? 1 : 0;
}
c1 = c;
c2 = c + 1;
c3 = c + 16;
c4 = c + 17;
if (flipx != 0)
{
t = c1; c1 = c2; c2 = t;
t = c3; c3 = c4; c4 = t;
}
if (flipy != 0)
{
t = c1; c1 = c3; c3 = t;
t = c2; c2 = c4; c4 = t;
}
if (flipx != 0)
{
offx = 0x0f;
xdir = -1;
}
else
{
offx = 0;
xdir = 1;
}
if (flipy != 0)
{
offy = 0x0f;
ydir = -1;
}
else
{
offy = 0;
ydir = 1;
}
for (i5 = 0; i5 < 0x10; i5++)
{
for (i6 = 0; i6 < 0x10; i6++)
{
iByte1 = gfx3rom[(sf_invert(c1)) * 0x100 + i5 + i6 * 0x10];
iByte2 = gfx3rom[(sf_invert(c2)) * 0x100 + i5 + i6 * 0x10];
iByte3 = gfx3rom[(sf_invert(c3)) * 0x100 + i5 + i6 * 0x10];
iByte4 = gfx3rom[(sf_invert(c4)) * 0x100 + i5 + i6 * 0x10];
if (iByte1 != 0x0f)
{
c11 = Color.FromArgb((int)Palette.entry_color[0x200 + 0x10 * color + iByte1]);
bm1.SetPixel(sx + offx + xdir * i5, sy + offy + ydir * i6, c11);
}
if (iByte2 != 0x0f)
{
c12 = Color.FromArgb((int)Palette.entry_color[0x200 + 0x10 * color + iByte2]);
bm1.SetPixel(sx + 16 + offx + xdir * i5, sy + offy + ydir * i6, c12);
}
if (iByte3 != 0x0f)
{
bm1.SetPixel(sx + offx + xdir * i5, sy + 16 + offy + ydir * i6, c13);
c13 = Color.FromArgb((int)Palette.entry_color[0x200 + 0x10 * color + iByte3]);
}
if (iByte4 != 0x0f)
{
c14 = Color.FromArgb((int)Palette.entry_color[0x200 + 0x10 * color + iByte4]);
bm1.SetPixel(sx + 16 + offx + xdir * i5, sy + 16 + offy + ydir * i6, c14);
}
}
}
}
else
{
if (Generic.flip_screen_get() != 0)
{
sx = 496 - sx;
sy = 240 - sy;
flipx = (flipx == 0) ? 1 : 0;
flipy = (flipy == 0) ? 1 : 0;
}
if (flipx != 0)
{
offx = 0x0f;
xdir = -1;
}
else
{
offx = 0;
xdir = 1;
}
if (flipy != 0)
{
offy = 0x0f;
ydir = -1;
}
else
{
offy = 0;
ydir = 1;
}
for (i5 = 0; i5 < 0x10; i5++)
{
for (i6 = 0; i6 < 0x10; i6++)
{
iByte1 = gfx3rom[(sf_invert(c)) * 0x100 + i5 + i6 * 0x10];
if (iByte1 != 0x0f)
{
c11 = Color.FromArgb((int)Palette.entry_color[0x200 + 0x10 * color + iByte1]);
bm1.SetPixel(sx + offx + xdir * i5, sy + offy + ydir * i6, c11);
}
}
}
}
}
return bm1;
}
public static Bitmap GetAllGDI_sf()
{
Bitmap bm1 = new Bitmap(0x200, 0x100), bm2;
Graphics g = Graphics.FromImage(bm1);
g.Clear(Color.Transparent);
if (bBg)
{
bm2 = GetBg_sf();
g.DrawImage(bm2, -bg_scrollx, 0);
}
if(bFg)
{
bm2 = GetFg_sf();
g.DrawImage(bm2, -fg_scrollx, 0);
}
if(bTx)
{
bm2 = GetTx_sf();
g.DrawImage(bm2, 0,0);
}
if(bSprite)
{
bm2 = GetSprite_sf();
g.DrawImage(bm2, 0,0);
}
return bm1;
}
}
}

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mame
namespace mame
{
public partial class Capcom
{

View File

@ -85,7 +85,7 @@ namespace mame
else
{
byte1 |= 0x20;
}
}
if (Keyboard.IsPressed(Key.Right))
{
byte2 &= unchecked((byte)~0x01);
@ -216,7 +216,7 @@ namespace mame
else
{
byte1 |= 0x10;
}
}
}
public static void loop_inputports_sfus()
{
@ -720,11 +720,11 @@ namespace mame
}
else
{
sbyte1 &= ~0x02;
sbyte1 &= ~0x02;
}
if (Keyboard.IsPressed(Key.L))
{
sbyte1 |= 0x04;
sbyte1 |= 0x04;
}
else
{
@ -736,10 +736,10 @@ namespace mame
}
else
{
sbyte2 &= ~0x01;
sbyte2 &= ~0x01;
}
if (Keyboard.IsPressed(Key.I))
{
{
sbyte2 |= 0x02;
}
else
@ -748,7 +748,7 @@ namespace mame
}
if (Keyboard.IsPressed(Key.O))
{
sbyte2 |= 0x04;
sbyte2 |= 0x04;
}
else
{
@ -787,7 +787,7 @@ namespace mame
short0 |= 0x0800;
}
if (Keyboard.IsPressed(Key.NumPad1))
{
{
sbyte3 |= 0x01;
}
else
@ -795,7 +795,7 @@ namespace mame
sbyte3 &= ~0x01;
}
if (Keyboard.IsPressed(Key.NumPad2))
{
{
sbyte3 |= 0x02;
}
else
@ -803,7 +803,7 @@ namespace mame
sbyte3 &= ~0x02;
}
if (Keyboard.IsPressed(Key.NumPad3))
{
{
sbyte3 |= 0x04;
}
else
@ -832,7 +832,7 @@ namespace mame
}
else
{
sbyte4 &= ~0x04;
sbyte4 &= ~0x04;
}
if (Keyboard.IsPressed(Key.R))
{
@ -895,7 +895,7 @@ namespace mame
}
public static void record_port_sf()
{
if (short0 != short0_old || short1!=short1_old|| short2!=short2_old||shorts!=shorts_old||shortc!=shortc_old|| sbyte1 != sbyte1_old || sbyte2 != sbyte2_old || sbyte3 != sbyte3_old || sbyte4 != sbyte4_old)
if (short0 != short0_old || short1 != short1_old || short2 != short2_old || shorts != shorts_old || shortc != shortc_old || sbyte1 != sbyte1_old || sbyte2 != sbyte2_old || sbyte3 != sbyte3_old || sbyte4 != sbyte4_old)
{
short0_old = short0;
short1_old = short1;

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cpu.z80;
using cpu.z80;
namespace mame
{
@ -10,8 +6,8 @@ namespace mame
{
public static sbyte sbyte1, sbyte2, sbyte3, sbyte4;
public static sbyte sbyte1_old, sbyte2_old, sbyte3_old, sbyte4_old;
public static short short0, short1,short2,shorts,shortc;
public static short short0_old, short1_old,short2_old,shorts_old,shortc_old;
public static short short0, short1, short2, shorts, shortc;
public static short short0_old, short1_old, short2_old, shorts_old, shortc_old;
public static byte bytes, byte1, byte2;
public static byte bytes_old, byte1_old, byte2_old;
public static byte MReadOpByte_gng(ushort address)
@ -83,7 +79,7 @@ namespace mame
result = bytedsw2;
}
else if (address == 0x3c00)
{
{
result = 0;
}
else if (address >= 0x4000 && address <= 0x5fff)
@ -852,11 +848,11 @@ namespace mame
else if (address >= 0xff8000 && address + 1 <= 0xffdfff)
{
int offset = address - 0xff8000;
result = (short)(Memory.mainram[offset]*0x100+Memory.mainram[offset+1]);
result = (short)(Memory.mainram[offset] * 0x100 + Memory.mainram[offset + 1]);
}
else if (address >= 0xffe000 && address + 1 <= 0xffffff)
{
int offset = (address - 0xffe000)/2;
int offset = (address - 0xffe000) / 2;
result = (short)sf_objectram[offset];
}
return result;
@ -960,7 +956,7 @@ namespace mame
else if (address >= 0x800000 && address + 3 <= 0x800fff)
{
int offset = (address - 0x800000) / 2;
result = (int)(sf_videoram[offset]*0x10000+sf_videoram[offset+1]);
result = (int)(sf_videoram[offset] * 0x10000 + sf_videoram[offset + 1]);
}
else if (address >= 0xff8000 && address + 3 <= 0xffdfff)
{
@ -1045,7 +1041,7 @@ namespace mame
{
if (address % 2 == 0)
{
}
else if (address % 2 == 1)
{
@ -1056,7 +1052,7 @@ namespace mame
{
if (address % 2 == 0)
{
}
else if (address % 2 == 1)
{
@ -1140,7 +1136,7 @@ namespace mame
else if (address >= 0xff8000 && address + 1 <= 0xffdfff)
{
int offset = address - 0xff8000;
Memory.mainram[offset] = (byte)(value>>8);
Memory.mainram[offset] = (byte)(value >> 8);
Memory.mainram[offset + 1] = (byte)value;
}
else if (address >= 0xffe000 && address + 1 <= 0xffffff)
@ -1165,7 +1161,7 @@ namespace mame
else if (address >= 0x800000 && address + 3 <= 0x800fff)
{
int offset = (address - 0x800000) / 2;
sf_videoram_w(offset, (ushort)(value>>16));
sf_videoram_w(offset, (ushort)(value >> 16));
sf_videoram_w(offset + 1, (ushort)value);
}
else if (address >= 0xb00000 && address + 3 <= 0xb007ff)

View File

@ -1,11 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using cpu.m68000;
using cpu.m68000;
using cpu.m6809;
using cpu.z80;
using System.IO;
namespace mame
{
@ -23,7 +19,7 @@ namespace mame
writer.Write(scrolly, 0, 2);
writer.Write(Generic.paletteram, 0, 0x100);
writer.Write(Generic.paletteram_2, 0, 0x100);
writer.Write(Generic.spriteram,0,0x200);
writer.Write(Generic.spriteram, 0, 0x200);
writer.Write(Generic.buffered_spriteram, 0, 0x200);
for (i = 0; i < 0x100; i++)
{
@ -97,7 +93,7 @@ namespace mame
AY8910.AA8910[1].stream.output_sampindex = reader.ReadInt32();
AY8910.AA8910[1].stream.output_base_sampindex = reader.ReadInt32();
YM2203.FF2203[0].stream.output_sampindex = reader.ReadInt32();
YM2203.FF2203[0].stream.output_base_sampindex = reader.ReadInt32();
YM2203.FF2203[0].stream.output_base_sampindex = reader.ReadInt32();
YM2203.FF2203[1].stream.output_sampindex = reader.ReadInt32();
YM2203.FF2203[1].stream.output_base_sampindex = reader.ReadInt32();
Sound.mixerstream.output_sampindex = reader.ReadInt32();

View File

@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace mame
{
@ -426,7 +423,7 @@ namespace mame
int pen_data_offset, palette_base, group;
tile_index = col * rows + row;
int base_offset = 0x20000 + 2 * tile_index;
int attr = Capcom.gfx5rom[base_offset+0x10000];
int attr = Capcom.gfx5rom[base_offset + 0x10000];
color = Capcom.gfx5rom[base_offset];
code = (Capcom.gfx5rom[base_offset + 0x10000 + 1] << 8) | Capcom.gfx5rom[base_offset + 1];
code = code % total_elements;
@ -451,7 +448,7 @@ namespace mame
code = (code & 0x3ff) % total_elements;
pen_data_offset = code * 0x40;
palette_base = 0x300 + (color * 0x4);
group = 0;
group = 0;
tileflags[row, col] = tile_drawCapcomtx(Capcom.gfx4rom, pen_data_offset, x0, y0, palette_base, group, flags);
}
public void tile_updateCapcombg_gng(int col, int row)

View File

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mame
{

View File

@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
namespace mame
{
@ -2455,8 +2453,8 @@ namespace mame
/* EEPROM */
Eeprom.eeprom_write_bit(data & 0x1000);
Eeprom.eeprom_set_clock_line(((data & 0x2000)!=0) ? LineState.ASSERT_LINE : LineState.CLEAR_LINE);
Eeprom.eeprom_set_cs_line(((data & 0x4000)!=0) ? LineState.CLEAR_LINE : LineState.ASSERT_LINE);
Eeprom.eeprom_set_clock_line(((data & 0x2000) != 0) ? LineState.ASSERT_LINE : LineState.CLEAR_LINE);
Eeprom.eeprom_set_cs_line(((data & 0x4000) != 0) ? LineState.CLEAR_LINE : LineState.ASSERT_LINE);
}
//low 8 bits
{
@ -2472,9 +2470,9 @@ namespace mame
/* Z80 Reset */
Cpuint.cpunum_set_input_line(1, (int)LineState.INPUT_LINE_RESET, ((data & 0x0008) != 0) ? LineState.CLEAR_LINE : LineState.ASSERT_LINE);
Generic.coin_counter_w(0, data & 0x0001);
Generic.coin_counter_w(0, data & 0x0001);
Generic.coin_counter_w(1, data & 0x0002);
Generic.coin_lockout_w(0, ~data & 0x0010);
Generic.coin_lockout_w(1, ~data & 0x0020);
Generic.coin_lockout_w(2, ~data & 0x0040);

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mame
namespace mame
{
public partial class Drawgfx
{

File diff suppressed because it is too large Load Diff

View File

@ -288,7 +288,7 @@ namespace mame
else
{
short1 |= 0x10;
}
}
if (Keyboard.IsPressed(Key.Right))
{
short1 &= ~0x0100;
@ -592,7 +592,7 @@ namespace mame
else
{
sbyte0 |= 0x20;
}
}
if (Keyboard.IsPressed(Key.J))
{
short1 &= ~0x10;
@ -624,7 +624,7 @@ namespace mame
else
{
short1 |= 0x80;
}
}
if (Keyboard.IsPressed(Key.NumPad1))
{
short1 &= ~0x1000;
@ -1201,7 +1201,7 @@ namespace mame
else
{
short0 |= 0x0040;
}
}
if (Keyboard.IsPressed(Key.Right))
{
short0 &= ~0x0100;
@ -1310,7 +1310,7 @@ namespace mame
else
{
short2 |= 0x0200;
}
}
if (Keyboard.IsPressed(Key.J))
{
short0 &= ~0x0008;
@ -1399,7 +1399,7 @@ namespace mame
sbyte0_old = sbyte0;
short1_old = short1;
short2_old = short2;
sbyte3_old = sbyte3;
sbyte3_old = sbyte3;
Mame.bwRecord.Write(Video.screenstate.frame_number);
Mame.bwRecord.Write(sbyte0);
Mame.bwRecord.Write(short1);

View File

@ -929,7 +929,7 @@ namespace mame
else
{
result = 0;
}
}
else
@ -1594,7 +1594,7 @@ namespace mame
else if (address >= 0x618000 && address <= 0x619fff)
{
int offset = (address - 0x618000) / 2;
qsound_sharedram1_w(offset, (byte)(value>>16));
qsound_sharedram1_w(offset, (byte)(value >> 16));
qsound_sharedram1_w(offset + 1, (byte)value);
}
else if (address >= 0x662000 && address <= 0x662001)
@ -1632,7 +1632,7 @@ namespace mame
else if (address >= 0x70a000 && address <= 0x70bfff)
{
int offset = (address - 0x70a000) / 2;
cps2_objram2_w(offset, (ushort)(value>>16));
cps2_objram2_w(offset, (ushort)(value >> 16));
cps2_objram2_w(offset + 1, (ushort)value);
}
else if (address >= 0x70c000 && address <= 0x70dfff)

View File

@ -8,7 +8,7 @@
sbyte result = 0;
if (address >= 0x800052 && address <= 0x800055)
{
int offset=(address-0x800052)/2;
int offset = (address - 0x800052) / 2;
result = (sbyte)((Inptport.input_port_read_direct(Inptport.analog_p0) - dial0) >> (8 * offset));
}
else if (address >= 0x80005a && address <= 0x80005d)
@ -184,7 +184,7 @@
}
else
{
MCWriteWord(address,value);
MCWriteWord(address, value);
}
}
public static sbyte MCReadByte_sf2m3(int address)
@ -628,7 +628,7 @@
{
int offset = (address - 0x800140) / 2;
result = cps1_cps_b_r(offset) * 0x10000 + cps1_cps_b_r(offset + 1);
}
}
else if (address >= 0x900000 && address + 3 <= 0x92ffff)
{
result = (int)(gfxram[(address & 0x3ffff)] * 0x1000000 + gfxram[(address & 0x3ffff) + 1] * 0x10000 + gfxram[(address & 0x3ffff) + 2] * 0x100 + gfxram[(address & 0x3ffff) + 3]);
@ -921,7 +921,7 @@
}
else
{
MCWriteWord(address,value);
MCWriteWord(address, value);
}
}
public static sbyte MC2ReadByte_ecofghtr(int address)
@ -942,7 +942,7 @@
{
address &= 0xffffff;
short result = 0;
if (address >= 0x804000 && address+1 <= 0x804001)
if (address >= 0x804000 && address + 1 <= 0x804001)
{
result = 0;
}
@ -1670,7 +1670,7 @@
else if (address >= 0x70a000 && address + 3 <= 0x70bfff)
{
int offset = (address - 0x70a000) / 2;
cps2_objram2_w(offset, (ushort)(value>>16));
cps2_objram2_w(offset, (ushort)(value >> 16));
cps2_objram2_w(offset + 1, (ushort)value);
}
else if (address >= 0x70c000 && address <= 0x70dfff)
@ -1740,7 +1740,7 @@
else if (address >= 0xfffff0 && address + 3 <= 0xfffffb)
{
int offset = (address - 0xfffff0) / 2;
cps2_output[offset] = (ushort)(value>>16);
cps2_output[offset] = (ushort)(value >> 16);
cps2_output[offset + 1] = (ushort)value;
}
else if (address >= 0xfffffc && address + 3 <= 0xffffff)

View File

@ -1,10 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using cpu.m68000;
using cpu.m68000;
using cpu.z80;
using System.IO;
namespace mame
{
@ -157,7 +153,7 @@ namespace mame
writer.Write(scancount);
writer.Write(cps1_scanline1);
writer.Write(cps1_scanline2);
writer.Write(cps1_scancalls);
writer.Write(cps1_scancalls);
for (i = 0; i < 0xc00; i++)
{
writer.Write(Palette.entry_color[i]);
@ -334,11 +330,11 @@ namespace mame
cps2_output[i] = reader.ReadUInt16();
}
cps2networkpresent = reader.ReadInt32();
cps2_objram_bank= reader.ReadInt32();
scancount= reader.ReadInt32();
cps1_scanline1= reader.ReadInt32();
cps1_scanline2= reader.ReadInt32();
cps1_scancalls= reader.ReadInt32();
cps2_objram_bank = reader.ReadInt32();
scancount = reader.ReadInt32();
cps1_scanline1 = reader.ReadInt32();
cps1_scanline2 = reader.ReadInt32();
cps1_scancalls = reader.ReadInt32();
for (i = 0; i < 0xc00; i++)
{
Palette.entry_color[i] = reader.ReadUInt32();

View File

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mame
{
@ -55,8 +52,8 @@ namespace mame
ttmap[i].rowscroll = new int[ttmap[i].scrollrows];
ttmap[i].colscroll = new int[ttmap[i].scrollcols];
ttmap[i].tilemap_draw_instance3 = ttmap[i].tilemap_draw_instanceC;
ttmap[i].tilemap_set_scrolldx(0,0);
ttmap[i].tilemap_set_scrolldy(0x100,0);
ttmap[i].tilemap_set_scrolldx(0, 0);
ttmap[i].tilemap_set_scrolldy(0x100, 0);
}
ttmap[0].tile_update3 = ttmap[0].tile_updateC0;
ttmap[1].tile_update3 = ttmap[1].tile_updateC1;
@ -375,7 +372,7 @@ namespace mame
{
for (cury = y; cury < nexty; cury++)
{
for (i = xpos + x_start; i < xpos+x_end; i++)
for (i = xpos + x_start; i < xpos + x_end; i++)
{
if ((flagsmap[offsety2, i - xpos] & mask) == value)
{

View File

@ -1,20 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
namespace mame
{
public partial class CPS
{
{
private static int iXAll, iYAll, nBitmap;
private static Bitmap bmAll=new Bitmap(512,512);
//private static Bitmap bmAll=new Bitmap(512,512);
private static List<string> lBitmapHash = new List<string>();
private static int cpsb_addr, cpsb_value, mult_factor1, mult_factor2, mult_result_lo, mult_result_hi;
public static int layercontrol, layer_control, palette_control, in2_addr, in3_addr, out2_addr, bootleg_kludge;
public static int layercontrol, layer_control, palette_control, in2_addr, in3_addr, out2_addr, bootleg_kludge;
public static int[] priority, layer_enable_mask;
public static int total_elements;
public static uint[] primasks;
@ -49,9 +44,9 @@ namespace mame
public static int scroll1x, scroll1y;
public static int scroll2x, scroll2y;
public static int scroll3x, scroll3y;
private static int stars1x, stars1y, stars2x, stars2y;
private static int stars1x, stars1y, stars2x, stars2y;
public static int pri_ctrl;
public static bool bRecord;
private static int cps1_base(int offset, int boundary)
@ -80,7 +75,7 @@ namespace mame
}
private static void cps1_cps_a_w(int offset, ushort data)
{
cps_a_regs[offset] =data;
cps_a_regs[offset] = data;
if (offset == CPS1_PALETTE_BASE)
{
cps1_build_palette(cps1_base(CPS1_PALETTE_BASE, 0x0400));
@ -279,10 +274,10 @@ namespace mame
}
public static void video_start_cps()
{
bmAll = new Bitmap(512, 512);
Graphics g = Graphics.FromImage(bmAll);
g.Clear(Color.Magenta);
g.Dispose();
//bmAll = new Bitmap(512, 512);
//Graphics g = Graphics.FromImage(bmAll);
//g.Clear(Color.Magenta);
//g.Dispose();
int i;
ttmap[0].enable = true;
ttmap[1].enable = true;
@ -302,9 +297,9 @@ namespace mame
cps1_stars_enabled = new int[2];
cps1_buffered_obj = new ushort[0x400];
cps2_buffered_obj = new ushort[0x1000];
cps2_objram1=new ushort[0x1000];
cps2_objram2=new ushort[0x1000];
cps2_objram1 = new ushort[0x1000];
cps2_objram2 = new ushort[0x1000];
uuBFF = new ushort[0x200 * 0x200];
for (i = 0; i < 0x40000; i++)
{
@ -554,13 +549,13 @@ namespace mame
code = cps2_buffered_obj[i * 4 + 2] + ((y & 0x6000) << 3);
colour = cps2_buffered_obj[i * 4 + 3];
col = colour & 0x1f;
if ((colour & 0x80)!=0)
if ((colour & 0x80) != 0)
{
x += cps2_port(0x08); /* fix the offset of some games */
y += cps2_port(0x0a); /* like Marvel vs. Capcom ending credits */
}
y += 0x100;
if ((colour & 0xff00)!=0)
if ((colour & 0xff00) != 0)
{
/* handle blocked sprites */
int nx = (colour & 0x0f00) >> 8;
@ -568,10 +563,10 @@ namespace mame
int nxs, nys, sx, sy;
nx++;
ny++;
if ((colour & 0x40)!=0)
if ((colour & 0x40) != 0)
{
/* Y flip */
if ((colour & 0x20)!=0)
if ((colour & 0x20) != 0)
{
for (nys = 0; nys < ny; nys++)
{
@ -598,7 +593,7 @@ namespace mame
}
else
{
if ((colour & 0x20)!=0)
if ((colour & 0x20) != 0)
{
for (nys = 0; nys < ny; nys++)
{
@ -635,7 +630,7 @@ namespace mame
{
int offs;
if (starsrom == null && (cps1_stars_enabled[0] != 0 || cps1_stars_enabled[1] != 0))
{
{
return;//stars enabled but no stars ROM
}
if (cps1_stars_enabled[0] != 0)
@ -719,7 +714,7 @@ namespace mame
cps1_update_transmasks();
ttmap[0].tilemap_set_scrollx(0, scroll1x);
ttmap[0].tilemap_set_scrolly(0, scroll1y);
if ((videocontrol & 0x01)!=0) /* linescroll enable */
if ((videocontrol & 0x01) != 0) /* linescroll enable */
{
int scrly = -scroll2y;
int otheroffs;
@ -732,7 +727,7 @@ namespace mame
}
else
{
ttmap[1].scrollrows = 1;
ttmap[1].scrollrows = 1;
ttmap[1].tilemap_set_scrollx(0, scroll2x);
}
ttmap[1].tilemap_set_scrolly(0, scroll2y);
@ -852,7 +847,7 @@ namespace mame
//memcpy(cps2_buffered_obj, cps2_objbase(), cps2_obj_size);
int baseptr;
baseptr = 0x7000;
if ((cps2_objram_bank & 1)!=0)
if ((cps2_objram_bank & 1) != 0)
{
baseptr ^= 0x0080;
}
@ -864,6 +859,6 @@ namespace mame
{
Array.Copy(cps2_objram2, cps2_buffered_obj, 0x1000);
}
}
}
}
}

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mame
namespace mame
{
public partial class Drawgfx
{

View File

@ -1,11 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Drawing.Imaging;
namespace mame
namespace mame
{
public partial class Dataeast
{
@ -14,206 +7,5 @@ namespace mame
{
}
public static Bitmap GetBg()
{
int i1, i2, iOffset, i3, i4;
int rows, cols, width, height;
int tilewidth, tileheight;
tilewidth = 0x8;
tileheight = tilewidth;
rows = 0x20;
cols = rows;
width = tilewidth * cols;
height = width;
int iByte;
int tile_index, attr, color, flipyx, code, flags;
int pen_data_offset, palette_base;
int x0 = 0, y0 = 0, dx0 = 0, dy0 = 0;
Color c1 = new Color();
Bitmap bm1;
bm1 = new Bitmap(width, height);
BitmapData bmData;
bmData = bm1.LockBits(new Rectangle(0, 0, bm1.Width, bm1.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
unsafe
{
byte* ptr = (byte*)(bmData.Scan0);
byte* ptr2 = (byte*)0;
for (i3 = 0; i3 < cols; i3++)
{
for (i4 = 0; i4 < rows; i4++)
{
tile_index = i4 * cols + i3;
code = Generic.videoram[tile_index * 2 + 1] + ((Generic.videoram[tile_index * 2] & 0x0f) << 8);
color = Generic.videoram[tile_index * 2] >> 4;
flags = 0;
palette_base = 0x100 + 0x10 * color;
pen_data_offset = code * 0x40;
if (flags == 0)
{
x0 = tilewidth * i3;
y0 = tileheight * i4;
dx0 = 1;
dy0 = 1;
}
else if (flags == 1)
{
x0 = tilewidth * i3 + tilewidth - 1;
y0 = tileheight * i4;
dx0 = -1;
dy0 = 1;
}
else if (flags == 2)
{
x0 = tilewidth * i3;
y0 = tileheight * i4 + tileheight - 1;
dx0 = 1;
dy0 = -1;
}
else if (flags == 3)
{
x0 = tilewidth * i3 + tilewidth - 1;
y0 = tileheight * i4 + tileheight - 1;
dx0 = -1;
dy0 = -1;
}
for (i1 = 0; i1 < tilewidth; i1++)
{
for (i2 = 0; i2 < tileheight; i2++)
{
iOffset = pen_data_offset + i2 * 8 + i1;
iByte = Dataeast.gfx1rom[iOffset];
if (palette_base + iByte < 0x200)
{
c1 = Color.FromArgb((int)Palette.entry_color[palette_base + iByte]);
}
ptr2 = ptr + ((y0 + dy0 * i2) * width + (x0 + dx0 * i1)) * 4;
*ptr2 = c1.B;
*(ptr2 + 1) = c1.G;
*(ptr2 + 2) = c1.R;
*(ptr2 + 3) = c1.A;
}
}
}
}
}
bm1.UnlockBits(bmData);
return bm1;
}
public static Bitmap GetSprite()
{
int i, j, offsetx, offsety, xdir, ydir, sx1, code = 0, color = 0;
Bitmap bm1;
Color c1 = new Color();
bm1 = new Bitmap(0x100, 0x100);
int offs;
BitmapData bmData;
bmData = bm1.LockBits(new Rectangle(0, 0, bm1.Width, bm1.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
unsafe
{
byte* ptr = (byte*)(bmData.Scan0);
byte* ptr2 = (byte*)0;
for (offs = 0; offs < 0x200; offs += 4)
{
if (Generic.spriteram[offs] != 0xf8)
{
int sx, sy, flipx, flipy;
sx = 240 - Generic.spriteram[offs + 2];
sy = 240 - Generic.spriteram[offs];
flipx = Generic.spriteram[offs + 1] & 0x04;
flipy = Generic.spriteram[offs + 1] & 0x02;
if (Generic.flip_screen_get() != 0)
{
sx = 240 - sx;
sy = 240 - sy;
if (flipx != 0)
{
flipx = 0;
}
else
{
flipx = 1;
}
if (flipy != 0)
{
flipy = 0;
}
else
{
flipy = 1;
}
}
if (flipx != 0)
{
offsetx = 0x0f;
xdir = -1;
}
else
{
offsetx = 0;
xdir = 1;
}
if (flipy != 0)
{
offsety = 0x0f;
ydir = -1;
}
else
{
offsety = 0;
ydir = 1;
}
sx1 = sx;
code = Generic.spriteram[offs + 3] + ((Generic.spriteram[offs + 1] & 1) << 8);
color = (Generic.spriteram[offs + 1] & 0x70) >> 4;
for (i = 0; i < 0x10; i++)
{
for (j = 0; j < 0x10; j++)
{
if (sx1 + offsetx + xdir * j >= 0 && sx1 + offsetx + xdir * j < 0x100 && sy + offsety + ydir * i >= 0 && sy + offsety + ydir * i < 0x100)
{
ushort c = gfx2rom[code * 0x100 + 0x10 * i + j];
if (c != 0)
{
c1 = Color.FromArgb((int)Palette.entry_color[color * 4 + c]);
ptr2 = ptr + ((sy + offsety + ydir * i) * 0x100 + (sx1 + offsetx + xdir * j)) * 4;
*ptr2 = c1.B;
*(ptr2 + 1) = c1.G;
*(ptr2 + 2) = c1.R;
*(ptr2 + 3) = c1.A;
}
}
}
}
}
}
}
bm1.UnlockBits(bmData);
return bm1;
}
public static Bitmap GetAllGDI()
{
Bitmap bm1 = new Bitmap(0x100, 0x100), bm2;
Graphics g = Graphics.FromImage(bm1);
g.Clear(Color.Transparent);
if (bBg)
{
bm2 = GetBg();
g.DrawImage(bm2, 0, 0);
}
if (bSprite)
{
bm2 = GetSprite();
g.DrawImage(bm2, 0, 0);
}
switch (Machine.sDirection)
{
case "":
break;
case "90":
bm1.RotateFlip(RotateFlipType.Rotate90FlipNone);
break;
}
return bm1;
}
}
}

View File

@ -152,8 +152,8 @@ namespace mame
lfr = new List<fr1>();
lfr.Add(new fr1((int)(Video.screenstate.frame_number + 1), 0x7f));
lfr.Add(new fr1((int)(Video.screenstate.frame_number + 2), 0xff));
lfr.Add(new fr1((int)(Video.screenstate.frame_number + 2+i3), 0x7f));
lfr.Add(new fr1((int)(Video.screenstate.frame_number + 2+i3+1), 0xff));
lfr.Add(new fr1((int)(Video.screenstate.frame_number + 2 + i3), 0x7f));
lfr.Add(new fr1((int)(Video.screenstate.frame_number + 2 + i3 + 1), 0xff));
}
if (Keyboard.IsTriggered(Key.U))
{

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mame
namespace mame
{
public partial class Dataeast
{

View File

@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace mame
namespace mame
{
public partial class Dataeast
{
@ -13,7 +7,7 @@ namespace mame
public static int basebankmain1, basebankmain2, basebanksnd, msm5205next, toggle;
public static void DataeastInit()
{
int i,n;
int i, n;
Machine.bRom = true;
Memory.mainram = new byte[0x800];
Memory.audioram = new byte[0x800];
@ -48,7 +42,7 @@ namespace mame
Machine.bRom = false;
}
break;
}
}
if (Machine.bRom)
{
dsw = 0xbf;

View File

@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using cpu.m6502;
using System.IO;
using cpu.m6502;
namespace mame
{

View File

@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mame
{

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mame
namespace mame
{
public partial class Dataeast
{

View File

@ -1,12 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
namespace mame
namespace mame
{
public partial class IGS011
{
@ -14,82 +6,5 @@ namespace mame
{
}
public static Bitmap GetBmp(string layer1)
{
int width = 0x200, height = 0xf0;
int x, y, l, scr_addr, pri_addr;
int pri_ram_offset;
pri_ram_offset = (priority & 7) * 0x100;
Color c1 = new Color();
Bitmap bm1;
bm1 = new Bitmap(width, height);
BitmapData bmData;
bmData = bm1.LockBits(new Rectangle(0, 0, bm1.Width, bm1.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
unsafe
{
byte* ptr = (byte*)(bmData.Scan0);
byte* ptr2 = (byte*)0;
for (y = 0; y < 0xef; y++)
{
for (x = 0; x < 0x1ff; x++)
{
scr_addr = x + y * 0x200;
pri_addr = 0xff;
for (l = 0; l < 8; l++)
{
if (layer[l][scr_addr] != 0xff)
{
pri_addr &= ~(1 << l);
}
}
if (layer1 == "normal")
{
l = priority_ram[pri_ram_offset + pri_addr] & 7;
}
else
{
l = int.Parse(layer1);
}
c1 = Color.FromArgb((int)Palette.entry_color[layer[l][scr_addr] | (l << 8)]);
ptr2 = ptr + (y * width + x) * 4;
*ptr2 = c1.B;
*(ptr2 + 1) = c1.G;
*(ptr2 + 2) = c1.R;
*(ptr2 + 3) = c1.A;
}
}
}
bm1.UnlockBits(bmData);
return bm1;
}
public static Bitmap GetAllGDI(string layer)
{
Bitmap bm1 = new Bitmap(0x200, 0xf0), bm2;
Graphics g = Graphics.FromImage(bm1);
g.Clear(Color.Transparent);
bm2 = GetBmp(layer);
g.DrawImage(bm2, 0, 0);
/*if (bBg)
{
bm2 = GetBg_sf();
g.DrawImage(bm2, -bg_scrollx, 0);
}
if (bFg)
{
bm2 = GetFg_sf();
g.DrawImage(bm2, -fg_scrollx, 0);
}
if (bTx)
{
bm2 = GetTx_sf();
g.DrawImage(bm2, 0, 0);
}
if (bSprite)
{
bm2 = GetSprite_sf();
g.DrawImage(bm2, 0, 0);
}*/
return bm1;
}
}
}

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mame
namespace mame
{
public partial class IGS011
{
@ -11,7 +6,7 @@ namespace mame
public static byte prot1, prot2, prot1_swap;
public static uint prot1_addr;
public static ushort[] igs003_reg, vbowl_trackball;
public static ushort priority, igs_dips_sel,igs_input_sel, lhb_irq_enable;
public static ushort priority, igs_dips_sel, igs_input_sel, lhb_irq_enable;
public static byte igs012_prot, igs012_prot_swap;
private static bool igs012_prot_mode;
public static byte[] gfx1rom, gfx2rom;
@ -62,13 +57,13 @@ namespace mame
Machine.bRom = false;
}
break;
case "lhb2":
case "lhb2":
Memory.mainrom = Machine.GetRom("maincpu.rom");
gfx1rom = Machine.GetRom("gfx1.rom");
gfx2rom = Machine.GetRom("gfx2.rom");
break;
}
}
}
public static void machine_reset_igs011()
{
@ -476,7 +471,7 @@ namespace mame
}
return 0;
}
private static void lhb_inputs_w(int offset,byte data)
private static void lhb_inputs_w(int offset, byte data)
{
if (offset == 0)
{
@ -840,7 +835,7 @@ namespace mame
//if (ACCESSING_BITS_0_7)
YM3812.ym3812_write_port_0_w(data);
}
private static void lhb_irq_enable_w(int offset,byte data)
private static void lhb_irq_enable_w(int offset, byte data)
{
if ((offset & 1) == 0)
{

View File

@ -96,7 +96,7 @@ namespace mame
}
if (Keyboard.IsPressed(Key.U))
{
}
else
{

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mame
namespace mame
{
public partial class IGS011
{

View File

@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mame
namespace mame
{
public partial class IGS011
{
@ -17,7 +12,7 @@ namespace mame
sbyte result = 0;
if (address >= prot1_addr + 8 && address <= prot1_addr + 9)
{
if (address %2==0)
if (address % 2 == 0)
{
result = (sbyte)(igs011_prot1_r() >> 8);
}
@ -71,11 +66,11 @@ namespace mame
else if (address >= 0x400000 && address <= 0x401fff)
{
int offset = (address - 0x400000) / 2;
if (address %2 == 0)
if (address % 2 == 0)
{
result = (sbyte)(paletteram16[offset] >> 8);
}
else if (address %2 == 1)
else if (address % 2 == 1)
{
result = (sbyte)paletteram16[offset];
}
@ -100,7 +95,8 @@ namespace mame
{
int i1 = 1;
}
else*/ if(address == 0x800003)
else*/
if (address == 0x800003)
{
result = (sbyte)drgnwrld_igs003_r();
}
@ -328,7 +324,7 @@ namespace mame
{
int offset = address - 0xa5c000;
igs011_blit_depth_w(offset, (byte)value);
}
}
}
public static void MWriteWord_drgnwrld(int address, short value)
{
@ -338,7 +334,7 @@ namespace mame
int offset = (int)(address - prot1_addr);
igs011_prot1_w(offset, (ushort)value);
}
else if (address >= 0x100000 && address+1 <= 0x103fff)
else if (address >= 0x100000 && address + 1 <= 0x103fff)
{
int offset = address - 0x100000;
Generic.generic_nvram[offset] = (byte)(value >> 8);
@ -351,9 +347,9 @@ namespace mame
}
else if (address >= 0x400000 && address + 1 <= 0x401fff)
{
int offset = (address - 0x400000)/2;
igs011_palette(offset,(ushort)value);
}
int offset = (address - 0x400000) / 2;
igs011_palette(offset, (ushort)value);
}
else if (address >= 0x600000 && address + 1 <= 0x600001)
{
OKI6295.okim6295_data_0_lsb_w((byte)value);
@ -368,7 +364,7 @@ namespace mame
}
else if (address >= 0x800000 && address + 1 <= 0x800003)
{
int offset = (address - 0x800000)/2;
int offset = (address - 0x800000) / 2;
drgnwrld_igs003_w(offset, (ushort)value);
}
else if (address >= 0xa20000 && address + 1 <= 0xa20001)

Some files were not shown because too many files have changed in this diff Show More