脱离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> <AllowUnsafeBlocks>True</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="ImageProcessor.Core" Version="1.1.0" />
<PackageReference Include="LamarCodeGeneration" Version="6.3.0" />
</ItemGroup>
</Project> </Project>

View File

@ -3,11 +3,10 @@ using cpu.nec;
using mame; using mame;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text;
namespace MAME.Core.Common namespace MAME.Core.Common
{ {
public partial class cheatForm public partial class cheatMotion
{ {
public enum LockState public enum LockState
{ {
@ -15,7 +14,6 @@ namespace MAME.Core.Common
LOCK_SECOND, LOCK_SECOND,
LOCK_FRAME, LOCK_FRAME,
} }
private mainForm _myParentForm;
public LockState lockState = LockState.LOCK_NONE; public LockState lockState = LockState.LOCK_NONE;
public List<int[]> lsCheatdata1; public List<int[]> lsCheatdata1;
public List<int[]> lsCheatdata2; public List<int[]> lsCheatdata2;
@ -27,9 +25,8 @@ namespace MAME.Core.Common
#region #region
List<string> mTxList_tbResult = new List<string>(); List<string> mTxList_tbResult = new List<string>();
#endregion #endregion
public cheatForm(mainForm form) public cheatMotion()
{ {
this._myParentForm = form;
cheatForm_Load(); cheatForm_Load();
} }
private void cheatForm_Load() private void cheatForm_Load()
@ -69,45 +66,45 @@ namespace MAME.Core.Common
} }
private void GetCheatdata() private void GetCheatdata()
{ {
// lsCheatdata1 = new List<int[]>(); // lsCheatdata1 = new List<int[]>();
// lsCheatdata2 = new List<int[]>(); // lsCheatdata2 = new List<int[]>();
// int i1, i2, i3, iAddress, iOffsetAddress1, iOffsetAddress2, iValue2, n3; // int i1, i2, i3, iAddress, iOffsetAddress1, iOffsetAddress2, iValue2, n3;
// string[] ss1, ss2, ss3; // string[] ss1, ss2, ss3;
// foreach (ListViewItem item1 in listViewControl1.myListView.Items) // foreach (ListViewItem item1 in listViewControl1.myListView.Items)
// { // {
// if (item1.Checked) // if (item1.Checked)
// { // {
// i1 = listViewControl1.myListView.Items.IndexOf(item1); // i1 = listViewControl1.myListView.Items.IndexOf(item1);
// i2 = Array.IndexOf(listViewControl1.ssCItem[i1], item1.SubItems[1].Text); // i2 = Array.IndexOf(listViewControl1.ssCItem[i1], item1.SubItems[1].Text);
// ss1 = listViewControl1.ssCValue[i1][i2].Split(sde7, StringSplitOptions.RemoveEmptyEntries); // ss1 = listViewControl1.ssCValue[i1][i2].Split(sde7, StringSplitOptions.RemoveEmptyEntries);
// n3 = ss1.Length; // n3 = ss1.Length;
// for (i3 = 0; i3 < n3; i3++) // for (i3 = 0; i3 < n3; i3++)
// { // {
// ss3 = ss1[i3].Split(sde6, StringSplitOptions.RemoveEmptyEntries); // ss3 = ss1[i3].Split(sde6, StringSplitOptions.RemoveEmptyEntries);
// iValue2 = Convert.ToInt32(ss3[1], 16); // iValue2 = Convert.ToInt32(ss3[1], 16);
// if (ss3[0].IndexOf("$") >= 0) // if (ss3[0].IndexOf("$") >= 0)
// { // {
// ss2 = ss3[0].Split(sde9, StringSplitOptions.RemoveEmptyEntries); // ss2 = ss3[0].Split(sde9, StringSplitOptions.RemoveEmptyEntries);
// iOffsetAddress1 = Convert.ToInt32(ss2[0], 16); // iOffsetAddress1 = Convert.ToInt32(ss2[0], 16);
// iOffsetAddress2 = Convert.ToInt32(ss2[1], 16); // iOffsetAddress2 = Convert.ToInt32(ss2[1], 16);
// lsCheatdata1.Add(new int[] { iOffsetAddress1, iOffsetAddress2, iValue2 }); // lsCheatdata1.Add(new int[] { iOffsetAddress1, iOffsetAddress2, iValue2 });
// } // }
// else if (ss3[0].IndexOf("+") >= 0) // else if (ss3[0].IndexOf("+") >= 0)
// { // {
// ss2 = ss3[0].Split(sde10, StringSplitOptions.RemoveEmptyEntries); // ss2 = ss3[0].Split(sde10, StringSplitOptions.RemoveEmptyEntries);
// iOffsetAddress1 = Convert.ToInt32(ss2[0], 16); // iOffsetAddress1 = Convert.ToInt32(ss2[0], 16);
// iOffsetAddress2 = Convert.ToInt32(ss2[1], 16); // iOffsetAddress2 = Convert.ToInt32(ss2[1], 16);
// iAddress = iOffsetAddress1 + iOffsetAddress2; // iAddress = iOffsetAddress1 + iOffsetAddress2;
// lsCheatdata2.Add(new int[] { iAddress, iValue2 }); // lsCheatdata2.Add(new int[] { iAddress, iValue2 });
// } // }
// else // else
// { // {
// iAddress = Convert.ToInt32(ss3[0], 16); // iAddress = Convert.ToInt32(ss3[0], 16);
// lsCheatdata2.Add(new int[] { iAddress, iValue2 }); // lsCheatdata2.Add(new int[] { iAddress, iValue2 });
// } // }
// } // }
// } // }
// } // }
} }
public void ApplyCheat() 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 cpu.m68000;
using mame;
using System; using System;
using System.Collections.Generic; 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 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 string[] sde6 = new string[1] { "," }, sde7 = new string[1] { ";" }, sde9 = new string[1] { "$" }, sde10 = new string[] { "+" };
private bool bLogNew, bNew; private bool bLogNew, bNew;
public static int iStatus, iRAddress, iWAddress, iROp, iWOp, iValue; public static int iStatus, iRAddress, iWAddress, iROp, iWOp, iValue;
@ -41,8 +34,8 @@ namespace MAME.Core.Common
Boolean b_cbPC = false; Boolean b_cbPC = false;
Boolean b_cbTotal = false; Boolean b_cbTotal = false;
Boolean b_cbLog = false; Boolean b_cbLog = false;
string mTx_tbIML = string.Empty; string mTx_tbIML = string.Empty;
string mTx_tbUSP = string.Empty; string mTx_tbUSP = string.Empty;
string mTx_tbSSP = string.Empty; string mTx_tbSSP = string.Empty;
string mTx_tbCycles = string.Empty; string mTx_tbCycles = string.Empty;
string mTx_tbPC = string.Empty; string mTx_tbPC = string.Empty;
@ -61,9 +54,8 @@ namespace MAME.Core.Common
M68000_STOP, M68000_STOP,
} }
public static M68000State m68000State, m68000FState; public static M68000State m68000State, m68000FState;
public m68000Form(mainForm form) public m68000Motion()
{ {
this._myParentForm = form;
int i; int i;
mTxList_tbDs = new string[8]; mTxList_tbDs = new string[8];
mTxList_tbAs = new string[8]; mTxList_tbAs = new string[8];

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,19 +1,16 @@
using System; using mame;
using System.Collections.Generic; using System;
using System.Linq;
using System.Text;
using System.IO; using System.IO;
using mame;
namespace cpu.m6502 namespace cpu.m6502
{ {
public partial class M6502 : cpuexec_data public partial class M6502 : cpuexec_data
{ {
public static M6502[] mm1; public static M6502[] mm1;
public Action[] insn,insn6502; public Action[] insn, insn6502;
public byte subtype; public byte subtype;
public Register ppc,pc,sp,zp,ea; public Register ppc, pc, sp, zp, ea;
public byte p,a,x,y,pending_irq,after_cli,nmi_state,irq_state,so_state; public byte p, a, x, y, pending_irq, after_cli, nmi_state, irq_state, so_state;
public delegate int irq_delegate(int i); public delegate int irq_delegate(int i);
public irq_delegate irq_callback; public irq_delegate irq_callback;
public delegate byte read8handler(ushort offset); public delegate byte read8handler(ushort offset);
@ -21,7 +18,7 @@ namespace cpu.m6502
public read8handler rdmem_id; public read8handler rdmem_id;
public write8handler wrmem_id; public write8handler wrmem_id;
private ushort M6502_NMI_VEC = 0xfffa, M6502_RST_VEC = 0xfffc, M6502_IRQ_VEC = 0xfffe; 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; private int m6502_IntOccured;
protected ulong totalExecutedCycles; protected ulong totalExecutedCycles;
protected int pendingCycles; protected int pendingCycles;
@ -54,7 +51,7 @@ namespace cpu.m6502
{ {
return ReadMemory(offset); return ReadMemory(offset);
} }
private void default_wdmem_id(ushort offset,byte data ) private void default_wdmem_id(ushort offset, byte data)
{ {
WriteMemory(offset, data); WriteMemory(offset, data);
} }
@ -62,37 +59,37 @@ namespace cpu.m6502
{ {
insn6502 = new Action[]{ insn6502 = new Action[]{
m6502_00,m6502_01,m6502_02,m6502_03,m6502_04,m6502_05,m6502_06,m6502_07, 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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_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_f8,m6502_f9,m6502_fa,m6502_fb,m6502_fc,m6502_fd,m6502_fe,m6502_ff
}; };
insn = insn6502; insn = insn6502;
} }
@ -158,18 +155,18 @@ namespace cpu.m6502
byte op; byte op;
ppc.d = pc.d; ppc.d = pc.d;
//debugger_instruction_hook(Machine, PCD); //debugger_instruction_hook(Machine, PCD);
if (pending_irq!=0) if (pending_irq != 0)
{ {
m6502_take_irq(); m6502_take_irq();
} }
op=ReadOp(pc.LowWord); op = ReadOp(pc.LowWord);
pc.LowWord++; pc.LowWord++;
pendingCycles -= 1; pendingCycles -= 1;
insn[op](); insn[op]();
if (after_cli!=0) if (after_cli != 0)
{ {
after_cli = 0; after_cli = 0;
if (irq_state !=(byte)LineState.CLEAR_LINE) if (irq_state != (byte)LineState.CLEAR_LINE)
{ {
pending_irq = 1; pending_irq = 1;
} }

View File

@ -1,10 +1,4 @@
using System; namespace cpu.m6502
using System.Collections.Generic;
using System.Linq;
using System.Text;
using mame;
namespace cpu.m6502
{ {
public partial class 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_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_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_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_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_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); } 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_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_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_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_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_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); } 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_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_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_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_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_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); } 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_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_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_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_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_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); } 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_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_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_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_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_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); } 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_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_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_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_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_d4() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); }
protected void m6502_f4() { 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_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_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_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_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_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); } 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_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_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_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_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_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); } 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_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_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_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_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_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); } 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_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_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_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_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_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); } 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_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_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_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_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_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); } 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_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_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_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_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_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); } 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_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_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_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_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_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); } 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_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_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_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_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_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); } 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_2c() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); BIT(tmp); }
protected void m6502_4c() { EA_ABS(); JMP(); } protected void m6502_4c() { EA_ABS(); JMP(); }
protected void m6502_6c() { int tmp; EA_IND(); 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_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_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); } 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_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_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_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_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_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); } 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_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_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_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_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_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); } 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_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_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_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_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_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); } 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_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_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_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_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_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); } 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_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_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_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_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_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); } 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_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_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_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_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_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); } 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_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_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_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_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_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); } 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 mame;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using mame;
namespace cpu.m6502 namespace cpu.m6502
{ {
@ -468,7 +464,7 @@ namespace cpu.m6502
PULL(ref p); PULL(ref p);
PULL(ref pc.LowByte); PULL(ref pc.LowByte);
PULL(ref pc.HighByte); 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)) if ((irq_state != (byte)LineState.CLEAR_LINE) && ((p & F_I) == 0))
{ {
after_cli = 1; after_cli = 1;
@ -491,7 +487,7 @@ namespace cpu.m6502
int sum = a - tmp - c; int sum = a - tmp - c;
int lo = (a & 0x0f) - (tmp & 0x0f) - c; int lo = (a & 0x0f) - (tmp & 0x0f) - c;
int hi = (a & 0xf0) - (tmp & 0xf0); int hi = (a & 0xf0) - (tmp & 0xf0);
if ((lo & 0x10)!=0) if ((lo & 0x10) != 0)
{ {
lo -= 6; lo -= 6;
hi--; hi--;

View File

@ -1,10 +1,6 @@
using System; using mame;
using System.Collections.Generic; using System;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.IO; using System.IO;
using mame;
namespace cpu.m6800 namespace cpu.m6800
{ {
@ -178,24 +174,24 @@ namespace cpu.m6800
{ {
m6800_insn = new Action[256] m6800_insn = new Action[256]
{ {
illegal,nop, illegal,illegal,illegal,illegal,tap, tpa, illegal,nop, illegal,illegal,illegal,illegal,tap, tpa,
inx, dex, clv, sev, clc, sec, cli, sei, inx, dex, clv, sev, clc, sec, cli, sei,
sba, cba, illegal,illegal,illegal,illegal,tab, tba, sba, cba, illegal,illegal,illegal,illegal,tab, tba,
illegal,daa, illegal,aba, illegal,illegal,illegal,illegal, illegal,daa, illegal,aba, illegal,illegal,illegal,illegal,
bra, brn, bhi, bls, bcc, bcs, bne, beq, bra, brn, bhi, bls, bcc, bcs, bne, beq,
bvc, bvs, bpl, bmi, bge, blt, bgt, ble, bvc, bvs, bpl, bmi, bge, blt, bgt, ble,
tsx, ins, pula, pulb, des, txs, psha, pshb, tsx, ins, pula, pulb, des, txs, psha, pshb,
illegal,rts, illegal,rti, illegal,illegal,wai, swi, illegal,rts, illegal,rti, illegal,illegal,wai, swi,
nega, illegal,illegal,coma, lsra, illegal,rora, asra, nega, illegal,illegal,coma, lsra, illegal,rora, asra,
asla, rola, deca, illegal,inca, tsta, illegal,clra, asla, rola, deca, illegal,inca, tsta, illegal,clra,
negb, illegal,illegal,comb, lsrb, illegal,rorb, asrb, negb, illegal,illegal,comb, lsrb, illegal,rorb, asrb,
aslb, rolb, decb, illegal,incb, tstb, illegal,clrb, aslb, rolb, decb, illegal,incb, tstb, illegal,clrb,
neg_ix, illegal,illegal,com_ix, lsr_ix, illegal,ror_ix, asr_ix, 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, 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, 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, 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, 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, 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, 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, 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, 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 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, trap, nop, trap ,trap ,lsrd, asld, tap, tpa,
inx, dex, clv, sev, clc, sec, cli, sei, inx, dex, clv, sev, clc, sec, cli, sei,
sba, cba, undoc1, undoc2, trap ,trap ,tab, tba, sba, cba, undoc1, undoc2, trap ,trap ,tab, tba,
xgdx, daa, slp ,aba, trap ,trap ,trap ,trap , xgdx, daa, slp ,aba, trap ,trap ,trap ,trap ,
bra, brn, bhi, bls, bcc, bcs, bne, beq, bra, brn, bhi, bls, bcc, bcs, bne, beq,
bvc, bvs, bpl, bmi, bge, blt, bgt, ble, bvc, bvs, bpl, bmi, bge, blt, bgt, ble,
tsx, ins, pula, pulb, des, txs, psha, pshb, tsx, ins, pula, pulb, des, txs, psha, pshb,
pulx, rts, abx, rti, pshx, mul, wai, swi, pulx, rts, abx, rti, pshx, mul, wai, swi,
nega, trap ,trap ,coma, lsra, trap ,rora, asra, nega, trap ,trap ,coma, lsra, trap ,rora, asra,
asla, rola, deca, trap ,inca, tsta, trap ,clra, asla, rola, deca, trap ,inca, tsta, trap ,clra,
negb, trap ,trap ,comb, lsrb, trap ,rorb, asrb, negb, trap ,trap ,comb, lsrb, trap ,rorb, asrb,
aslb, rolb, decb, trap ,incb, tstb, trap ,clrb, aslb, rolb, decb, trap ,incb, tstb, trap ,clrb,
neg_ix, aim_ix, oim_ix, com_ix, lsr_ix, eim_ix, ror_ix, asr_ix, 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, 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, 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, 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, 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, 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, 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, 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) if (irq_state[0] != (byte)LineState.CLEAR_LINE)
{ {
ENTER_INTERRUPT(0xfff8); ENTER_INTERRUPT(0xfff8);
if( irq_callback!=null ) if (irq_callback != null)
{ {
irq_callback(0); irq_callback(0);
} }
} }
else else
@ -921,7 +917,7 @@ namespace cpu.m6800
do do
{ {
int prevCycles = pendingCycles; int prevCycles = pendingCycles;
if ((wai_state & (M6800_WAI | M6800_SLP))!=0) if ((wai_state & (M6800_WAI | M6800_SLP)) != 0)
{ {
EAT_CYCLES(); EAT_CYCLES();
} }
@ -1042,7 +1038,7 @@ namespace cpu.m6800
} }
private void m6803_internal_registers_w(int offset, byte data) private void m6803_internal_registers_w(int offset, byte data)
{ {
int latch09=0; int latch09 = 0;
switch (offset) switch (offset)
{ {
case 0x00: case 0x00:

View File

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

View File

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

View File

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

View File

@ -1,9 +1,8 @@
using System; using mame;
using System.Runtime.InteropServices; using System;
using System.IO;
using System.Globalization; using System.Globalization;
using System.Collections.Generic; using System.IO;
using mame; using System.Runtime.InteropServices;
namespace cpu.m68000 namespace cpu.m68000
{ {
@ -72,14 +71,14 @@ namespace cpu.m68000
return; return;
if (value == true) // entering supervisor mode if (value == true) // entering supervisor mode
{ {
//Console.WriteLine("&^&^&^&^& ENTER SUPERVISOR MODE"); //EmuLogger.Log("&^&^&^&^& ENTER SUPERVISOR MODE");
usp = A[7].s32; usp = A[7].s32;
A[7].s32 = ssp; A[7].s32 = ssp;
s = true; s = true;
} }
else else
{ // exiting supervisor mode { // exiting supervisor mode
//Console.WriteLine("&^&^&^&^& LEAVE SUPERVISOR MODE"); //EmuLogger.Log("&^&^&^&^& LEAVE SUPERVISOR MODE");
ssp = A[7].s32; ssp = A[7].s32;
A[7].s32 = usp; A[7].s32 = usp;
s = false; s = false;
@ -176,7 +175,7 @@ namespace cpu.m68000
} }
public override void set_irq_line(int irqline, LineState state) 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; irqline = 7;
switch (state) switch (state)
{ {
@ -212,9 +211,9 @@ namespace cpu.m68000
public void Step() 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](); Opcodes[op]();
} }
@ -410,7 +409,7 @@ namespace cpu.m68000
else 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() int GetIndex()
{ {
//Console.WriteLine("IN INDEX PORTION - NOT VERIFIED!!!"); //EmuLogger.Log("IN INDEX PORTION - NOT VERIFIED!!!");
// TODO kid chameleon triggers this in startup sequence // TODO kid chameleon triggers this in startup sequence
short extension = ReadOpWord(PC); PC += 2; short extension = ReadOpWord(PC); PC += 2;
@ -571,7 +571,7 @@ namespace cpu.m68000
int PeekIndex() int PeekIndex()
{ {
//Console.WriteLine("IN INDEX PORTION - NOT VERIFIED!!!"); //EmuLogger.Log("IN INDEX PORTION - NOT VERIFIED!!!");
short extension = ReadOpWord(PC); short extension = ReadOpWord(PC);

View File

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

View File

@ -1,17 +1,13 @@
using System; using mame;
using System.Collections.Generic; using System;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.IO; using System.IO;
using mame;
namespace cpu.m6805 namespace cpu.m6805
{ {
public partial class M6805 : cpuexec_data public partial class M6805 : cpuexec_data
{ {
public static M6805 m1; public static M6805 m1;
public Register ea,pc,s; public Register ea, pc, s;
public int subtype; public int subtype;
public ushort sp_mask; public ushort sp_mask;
public ushort sp_low; public ushort sp_low;
@ -23,7 +19,7 @@ namespace cpu.m6805
public int nmi_state; public int nmi_state;
public byte CFLAG = 0x01, ZFLAG = 0x02, NFLAG = 0x04, IFLAG = 0x08, HFLAG = 0x10; public byte CFLAG = 0x01, ZFLAG = 0x02, NFLAG = 0x04, IFLAG = 0x08, HFLAG = 0x10;
public int SUBTYPE_M6805 = 0, SUBTYPE_M68705 = 1, SUBTYPE_HD63705 = 2; 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, 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, 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,
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, 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, 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,
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 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, /*0*/ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
@ -165,19 +161,19 @@ namespace cpu.m6805
} }
private void CLR_NZ() private void CLR_NZ()
{ {
cc&=(byte)~(NFLAG|ZFLAG); cc &= (byte)~(NFLAG | ZFLAG);
} }
private void CLR_HNZC() private void CLR_HNZC()
{ {
cc&=(byte)~(HFLAG|NFLAG|ZFLAG|CFLAG); cc &= (byte)~(HFLAG | NFLAG | ZFLAG | CFLAG);
} }
private void CLR_Z() private void CLR_Z()
{ {
cc&=(byte)~(ZFLAG); cc &= (byte)~(ZFLAG);
} }
private void CLR_NZC() private void CLR_NZC()
{ {
cc&=(byte)~(NFLAG|ZFLAG|CFLAG); cc &= (byte)~(NFLAG | ZFLAG | CFLAG);
} }
private void CLR_ZC() private void CLR_ZC()
{ {
@ -185,7 +181,7 @@ namespace cpu.m6805
} }
private void SET_Z(byte b) private void SET_Z(byte b)
{ {
if(b==0) if (b == 0)
{ {
SEZ(); SEZ();
} }
@ -196,30 +192,30 @@ namespace cpu.m6805
} }
private void SET_N8(byte b) 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) private void SET_C8(ushort b)
{ {
cc|=(byte)((b&0x100)>>8); cc |= (byte)((b & 0x100) >> 8);
} }
private void SET_FLAGS8I(byte b) private void SET_FLAGS8I(byte b)
{ {
cc|=flags8i[b&0xff]; cc |= flags8i[b & 0xff];
} }
private void SET_FLAGS8D(byte b) private void SET_FLAGS8D(byte b)
{ {
cc|=flags8d[b&0xff]; cc |= flags8d[b & 0xff];
} }
private void SET_NZ8(byte b) private void SET_NZ8(byte b)
{ {
SET_N8(b); SET_N8(b);
SET_Z(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_N8((byte)r);
SET_Z8((byte)r); SET_Z8((byte)r);
@ -236,7 +232,7 @@ namespace cpu.m6805
} }
private void IMM8() private void IMM8()
{ {
ea.LowWord= pc.LowWord++; ea.LowWord = pc.LowWord++;
} }
private void EXTENDED() private void EXTENDED()
{ {
@ -244,54 +240,54 @@ namespace cpu.m6805
} }
private void INDEXED() private void INDEXED()
{ {
ea.LowWord=x; ea.LowWord = x;
} }
private void INDEXED1() private void INDEXED1()
{ {
ea.d=0; ea.d = 0;
IMMBYTE(ref ea.LowByte); IMMBYTE(ref ea.LowByte);
ea.LowWord+=x; ea.LowWord += x;
} }
private void INDEXED2() private void INDEXED2()
{ {
IMMWORD(ref ea); IMMWORD(ref ea);
ea.LowWord+=x; ea.LowWord += x;
} }
private void SEC() private void SEC()
{ {
cc|=CFLAG; cc |= CFLAG;
} }
private void CLC() private void CLC()
{ {
cc&=(byte)~CFLAG; cc &= (byte)~CFLAG;
} }
private void SEZ() private void SEZ()
{ {
cc|=ZFLAG; cc |= ZFLAG;
} }
private void CLZ() private void CLZ()
{ {
cc&=(byte)~ZFLAG; cc &= (byte)~ZFLAG;
} }
private void SEN() private void SEN()
{ {
cc|=NFLAG; cc |= NFLAG;
} }
private void CLN() private void CLN()
{ {
cc&=(byte)~NFLAG; cc &= (byte)~NFLAG;
} }
private void SEH() private void SEH()
{ {
cc|=HFLAG; cc |= HFLAG;
} }
private void CLH() private void CLH()
{ {
cc&=(byte)~HFLAG; cc &= (byte)~HFLAG;
} }
private void SEI() private void SEI()
{ {
cc|=IFLAG; cc |= IFLAG;
} }
private void CLI() private void CLI()
{ {
@ -300,31 +296,31 @@ namespace cpu.m6805
private void DIRBYTE(ref byte b) private void DIRBYTE(ref byte b)
{ {
DIRECT(); DIRECT();
b=ReadMemory((ushort)ea.d); b = ReadMemory((ushort)ea.d);
} }
private void EXTBYTE(ref byte b) private void EXTBYTE(ref byte b)
{ {
EXTENDED(); EXTENDED();
b=ReadMemory((ushort)ea.d); b = ReadMemory((ushort)ea.d);
} }
private void IDXBYTE(ref byte b) private void IDXBYTE(ref byte b)
{ {
INDEXED(); INDEXED();
b=ReadMemory((ushort)ea.d); b = ReadMemory((ushort)ea.d);
} }
private void IDX1BYTE(ref byte b) private void IDX1BYTE(ref byte b)
{ {
INDEXED1(); INDEXED1();
b=ReadMemory((ushort)ea.d); b = ReadMemory((ushort)ea.d);
} }
private void IDX2BYTE(ref byte b) private void IDX2BYTE(ref byte b)
{ {
INDEXED2(); INDEXED2();
b=ReadMemory((ushort)ea.d); b = ReadMemory((ushort)ea.d);
} }
private void BRANCH(bool f) private void BRANCH(bool f)
{ {
byte t=0; byte t = 0;
IMMBYTE(ref t); IMMBYTE(ref t);
if (f) if (f)
{ {

View File

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

View File

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

View File

@ -1,10 +1,6 @@
using System; using mame;
using System.Collections.Generic; using System;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.IO; using System.IO;
using mame;
namespace cpu.m6809 namespace cpu.m6809
{ {
@ -498,7 +494,7 @@ namespace cpu.m6809
private ushort RM16(ushort Addr) private ushort RM16(ushort Addr)
{ {
ushort result = (ushort)(RM(Addr) << 8); 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) private void WM16(ushort Addr, Register p)
{ {

View File

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

View File

@ -1,10 +1,6 @@
using System; using mame;
using System.Collections.Generic; using System;
using System.Linq;
using System.Text;
using System.IO; using System.IO;
using System.Runtime.InteropServices;
using mame;
namespace cpu.nec namespace cpu.nec
{ {
@ -208,7 +204,7 @@ namespace cpu.nec
ushort var = ReadWord((I.sregs[2] << 4) + I.regs.b[8] + I.regs.b[9] * 0x100); 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] = (byte)(var % 0x100);
I.regs.b[i * 2 + 1] = (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[8] = (byte)(w4 % 0x100);
I.regs.b[9] = (byte)(w4 / 0x100); I.regs.b[9] = (byte)(w4 / 0x100);
} }
@ -636,7 +632,7 @@ namespace cpu.nec
{ {
int result, result2; int result, result2;
b1 = false; 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); result2 = result % (short)((sbyte)tmp);
if ((result /= (short)((sbyte)tmp)) > 0xff) if ((result /= (short)((sbyte)tmp)) > 0xff)
{ {
@ -813,7 +809,7 @@ namespace cpu.nec
i_or_ald8, i_or_ald8,
i_or_axd16, i_or_axd16,
i_push_cs, i_push_cs,
i_pre_nec, i_pre_nec,
i_adc_br8, i_adc_br8,
i_adc_wr16, i_adc_wr16,
i_adc_r8b, i_adc_r8b,
@ -928,7 +924,7 @@ namespace cpu.nec
i_jnle, i_jnle,
i_80pre, i_80pre,
i_81pre, i_81pre,
i_82pre, i_82pre,
i_83pre, i_83pre,
i_test_br8, i_test_br8,
i_test_wr16, i_test_wr16,
@ -1056,32 +1052,32 @@ namespace cpu.nec
i_ffpre i_ffpre
}; };
GetEA = new getea_delegate[192]{ 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() public override void Reset()
@ -1194,7 +1190,7 @@ namespace cpu.nec
public void SaveStateBinary(BinaryWriter writer) public void SaveStateBinary(BinaryWriter writer)
{ {
int i; int i;
writer.Write(I.regs.b,0,16); writer.Write(I.regs.b, 0, 16);
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
writer.Write(I.sregs[i]); writer.Write(I.sregs[i]);

View File

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

View File

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

View File

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

View File

@ -6,7 +6,7 @@
//VgMuseum.Z80.Disassembler disasm = new Disassembler(); //VgMuseum.Z80.Disassembler disasm = new Disassembler();
//ushort pc = RegPC.Word; //ushort pc = RegPC.Word;
//string str = disasm.Disassemble(() => ReadMemory(pc++)); //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 //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[] 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 "INC B", "DEC B", "LD B, n", "RLCA", //0x08
"EX AF, AF'", "ADD HL, BC", "LD A, (BC)", "DEC BC", //0x0C "EX AF, AF'", "ADD HL, BC", "LD A, (BC)", "DEC BC", //0x0C
"INC C", "DEC C", "LD C, n", "RRCA", //0x10 "INC C", "DEC C", "LD C, n", "RRCA", //0x10
@ -208,8 +208,8 @@ namespace cpu.z80
}; };
readonly static string[] mnemonicsDD = new string[] 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 "INC B", "DEC B", "LD B, n", "RLCA", //0x08
"EX AF, AF'", "ADD IX, BC", "LD A, (BC)", "DEC BC", //0x0C "EX AF, AF'", "ADD IX, BC", "LD A, (BC)", "DEC BC", //0x0C
"INC C", "DEC C", "LD C, n", "RRCA", //0x10 "INC C", "DEC C", "LD C, n", "RRCA", //0x10
@ -276,8 +276,8 @@ namespace cpu.z80
}; };
readonly static string[] mnemonicsFD = new string[] 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 "INC B", "DEC B", "LD B, n", "RLCA", //0x08
"EX AF, AF'", "ADD IY, BC", "LD A, (BC)", "DEC BC", //0x0C "EX AF, AF'", "ADD IY, BC", "LD A, (BC)", "DEC BC", //0x0C
"INC C", "DEC C", "LD C, n", "RRCA", //0x10 "INC C", "DEC C", "LD C, n", "RRCA", //0x10
@ -344,121 +344,121 @@ namespace cpu.z80
}; };
readonly static string[] mnemonicsDDCB = new string[] 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", "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", "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", "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", "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", "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", "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", "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", "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 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 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 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 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 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 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 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)", "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 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 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 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 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 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 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 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", "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 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 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 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 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 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 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 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", "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[] 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", "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", "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", "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", "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", "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", "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", "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", "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 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 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 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 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 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 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 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)", "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 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 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 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 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 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 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 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", "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 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 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 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 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 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 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 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", "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[] readonly static string[] mnemonicsCB = new string[]
{ {
"RLC B", "RLC C", "RLC D", "RLC E", "RLC H", "RLC L", "RLC (HL)", "RLC 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", "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", "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", "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", "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", "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", "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", "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 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 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 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 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 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 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 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", "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 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 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 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 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 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 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 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", "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 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 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 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 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 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 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 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", "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[] 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",
"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 "IN B, C", "OUT C, B", "SBC HL, BC", "LD (nn), BC", //0x44
"NEG", "RETN", "IM $0", "LD I, A", //0x48 "NEG", "RETN", "IM $0", "LD I, A", //0x48
"IN C, C", "OUT C, C", "ADC HL, BC", "LD BC, (nn)", //0x4C "IN C, C", "OUT C, C", "ADC HL, BC", "LD BC, (nn)", //0x4C
"NEG", "RETI", "IM $0", "LD R, A", //0x50 "NEG", "RETI", "IM $0", "LD R, A", //0x50
@ -601,7 +601,7 @@ namespace cpu.z80
return format; return format;
} }
public string Disassemble2(byte[] code,int offset) public string Disassemble2(byte[] code, int offset)
{ {
return Result2(DisassembleInternal2(code), code, offset); return Result2(DisassembleInternal2(code), code, offset);
} }

View File

@ -1,7 +1,4 @@
using System.IO; namespace cpu.z80
using mame;
namespace cpu.z80
{ {
public partial class Z80A public partial class Z80A
{ {

View File

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

View File

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

View File

@ -47,7 +47,7 @@
} }
} }
private ushort[, , ,] TableALU; private ushort[,,,] TableALU;
private void InitTableALU() private void InitTableALU()
{ {
TableALU = new ushort[8, 256, 256, 2]; // Class, OP1, OP2, Carry TableALU = new ushort[8, 256, 256, 2]; // Class, OP1, OP2, Carry
@ -191,7 +191,7 @@
} }
} }
private ushort[, ,] TableRotShift; private ushort[,,] TableRotShift;
private void InitTableRotShift() private void InitTableRotShift()
{ {
TableRotShift = new ushort[2, 8, 65536]; // All, operation, AF 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 int[] cc_op, cc_cb, cc_ed, cc_xy, cc_xycb, cc_ex;
private void InitTableCc() 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, 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, 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, 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.Globalization;
using System.Collections.Generic;
using System.IO; using System.IO;
using mame;
// This Z80 emulator is a modified version of Ben Ryves 'Brazil' emulator. // This Z80 emulator is a modified version of Ben Ryves 'Brazil' emulator.
// It is MIT licensed. // It is MIT licensed.
@ -279,7 +278,7 @@ namespace cpu.z80
pendingCycles = int.Parse(args[1]); pendingCycles = int.Parse(args[1]);
else else
Console.WriteLine("Skipping unrecognized identifier " + args[0]); EmuLogger.Log("Skipping unrecognized identifier " + args[0]);
} }
} }
} }

View File

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

View File

@ -38,7 +38,7 @@ namespace mame
public class Cpuexec 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 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 bLog02, bLog12, bLog22, bLog32;
public static bool b11 = true, b12 = true, b13 = true, b14 = true; public static bool b11 = true, b12 = true, b13 = true, b14 = true;
public static int iloops, activecpu, icpu, ncpu, iloops2; public static int iloops, activecpu, icpu, ncpu, iloops2;
@ -1373,14 +1373,14 @@ namespace mame
MC68000.m1.WriteByte = PGM.MPWriteByte_orlegend; MC68000.m1.WriteByte = PGM.MPWriteByte_orlegend;
MC68000.m1.WriteWord = PGM.MPWriteWord_orlegend; MC68000.m1.WriteWord = PGM.MPWriteWord_orlegend;
break; break;
/*case "drgw2": /*case "drgw2":
MC68000.m1.ReadByte = PGM.MPReadByte_drgw2; MC68000.m1.ReadByte = PGM.MPReadByte_drgw2;
MC68000.m1.ReadWord = MC68000.m1.ReadPcrelWord= PGM.MPReadWord_drgw2; MC68000.m1.ReadWord = MC68000.m1.ReadPcrelWord= PGM.MPReadWord_drgw2;
MC68000.m1.ReadLong = MC68000.m1.ReadPcrelLong= PGM.MPReadLong_drgw2; MC68000.m1.ReadLong = MC68000.m1.ReadPcrelLong= PGM.MPReadLong_drgw2;
MC68000.m1.WriteByte = PGM.MPWriteByte_drgw2; MC68000.m1.WriteByte = PGM.MPWriteByte_drgw2;
MC68000.m1.WriteWord = PGM.MPWriteWord_drgw2; MC68000.m1.WriteWord = PGM.MPWriteWord_drgw2;
MC68000.m1.WriteLong = PGM.MPWriteLong_drgw2; MC68000.m1.WriteLong = PGM.MPWriteLong_drgw2;
break;*/ break;*/
} }
break; break;
case "M72": case "M72":
@ -2118,46 +2118,46 @@ namespace mame
case "Neo Geo": case "Neo Geo":
case "PGM": case "PGM":
case "Taito B": case "Taito B":
m68000Form.m68000State = m68000Form.M68000State.M68000_RUN; m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000form.m68000_start_debug; MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000form.m68000_stop_debug; MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug;
z80Form.z80State = z80Form.Z80AState.Z80A_RUN; z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug; Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug; Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug;
break; break;
case "Tehkan": case "Tehkan":
z80Form.z80State = z80Form.Z80AState.Z80A_RUN; z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug; Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_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_start_cpu_hook_callback = null_callback;
Z80A.zz1[1].debugger_stop_cpu_hook_callback = null_callback; Z80A.zz1[1].debugger_stop_cpu_hook_callback = null_callback;
break; break;
case "IGS011": case "IGS011":
m68000Form.m68000State = m68000Form.M68000State.M68000_RUN; m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000form.m68000_start_debug; MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000form.m68000_stop_debug; MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug;
break; break;
case "SunA8": case "SunA8":
z80Form.z80State = z80Form.Z80AState.Z80A_RUN; z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug; Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_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_start_cpu_hook_callback = null_callback;
Z80A.zz1[1].debugger_stop_cpu_hook_callback = null_callback; Z80A.zz1[1].debugger_stop_cpu_hook_callback = null_callback;
break; break;
case "Namco System 1": case "Namco System 1":
m6809Form.m6809State = CPUState.RUN; m6809Motion.m6809State = CPUState.RUN;
M6809.mm1[0].DisassemblerInit(); M6809.mm1[0].DisassemblerInit();
M6809.mm1[0].debugger_start_cpu_hook_callback = Machine.FORM.m6809form.m6809_start_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.m6809form.m6809_stop_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_start_cpu_hook_callback = null_callback;
M6809.mm1[1].debugger_stop_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_start_cpu_hook_callback = null_callback;
M6809.mm1[2].debugger_stop_cpu_hook_callback = null_callback; M6809.mm1[2].debugger_stop_cpu_hook_callback = null_callback;
break; break;
case "M72": case "M72":
z80Form.z80State = z80Form.Z80AState.Z80A_RUN; z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug; Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug; Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug;
break; break;
case "M92": case "M92":
break; break;
@ -2186,35 +2186,35 @@ namespace mame
case "boblcave": case "boblcave":
case "bublcave11": case "bublcave11":
case "bublcave10": case "bublcave10":
z80Form.z80State = z80Form.Z80AState.Z80A_RUN; z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug; Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_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.z80form.z80_start_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.z80form.z80_stop_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.z80form.z80_start_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.z80form.z80_stop_debug; Z80A.zz1[2].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug;
break; break;
case "opwolf": case "opwolf":
case "opwolfa": case "opwolfa":
case "opwolfj": case "opwolfj":
case "opwolfu": case "opwolfu":
case "opwolfp": case "opwolfp":
m68000Form.m68000State = m68000Form.M68000State.M68000_RUN; m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000form.m68000_start_debug; MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000form.m68000_stop_debug; MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug;
z80Form.z80State = z80Form.Z80AState.Z80A_RUN; z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug; Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug; Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug;
break; break;
case "opwolfb": case "opwolfb":
m68000Form.m68000State = m68000Form.M68000State.M68000_RUN; m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000form.m68000_start_debug; MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000form.m68000_stop_debug; MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug;
z80Form.z80State = z80Form.Z80AState.Z80A_RUN; z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug; Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_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.z80form.z80_start_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.z80form.z80_stop_debug; Z80A.zz1[1].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug;
break; break;
} }
break; break;
@ -2222,17 +2222,17 @@ namespace mame
switch (Machine.sName) switch (Machine.sName)
{ {
case "cuebrick": case "cuebrick":
m68000Form.m68000State = m68000Form.M68000State.M68000_RUN; m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000form.m68000_start_debug; MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000form.m68000_stop_debug; MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug;
break; break;
default: default:
m68000Form.m68000State = m68000Form.M68000State.M68000_RUN; m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000form.m68000_start_debug; MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000form.m68000_stop_debug; MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug;
z80Form.z80State = z80Form.Z80AState.Z80A_RUN; z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug; Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug; Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug;
break; break;
} }
break; break;
@ -2250,13 +2250,13 @@ namespace mame
case "makaimurc": case "makaimurc":
case "makaimurg": case "makaimurg":
case "diamond": case "diamond":
m6809Form.m6809State = CPUState.RUN; m6809Motion.m6809State = CPUState.RUN;
M6809.mm1[0].DisassemblerInit(); M6809.mm1[0].DisassemblerInit();
M6809.mm1[0].debugger_start_cpu_hook_callback = Machine.FORM.m6809form.m6809_start_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.m6809form.m6809_stop_debug; M6809.mm1[0].debugger_stop_cpu_hook_callback = Machine.FORM.m6809motion.m6809_stop_debug;
z80Form.z80State = z80Form.Z80AState.Z80A_RUN; z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug; Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug; Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug;
break; break;
case "sf": case "sf":
case "sfua": case "sfua":
@ -2264,14 +2264,14 @@ namespace mame
case "sfjan": case "sfjan":
case "sfan": case "sfan":
case "sfp": case "sfp":
m68000Form.m68000State = m68000Form.M68000State.M68000_RUN; m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN;
MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000form.m68000_start_debug; MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug;
MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000form.m68000_stop_debug; MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug;
z80Form.z80State = z80Form.Z80AState.Z80A_RUN; z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN;
Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug; Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug;
Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_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.z80form.z80_start_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.z80form.z80_stop_debug; Z80A.zz1[1].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug;
break; break;
} }
break; break;
@ -2428,7 +2428,7 @@ namespace mame
Atime tbase = Timer.global_basetime; Atime tbase = Timer.global_basetime;
int ran; int ran;
Atime at; Atime at;
int i,j; int i, j;
for (icpu = 0; icpu < ncpu; icpu++) for (icpu = 0; icpu < ncpu; icpu++)
{ {
cpu[icpu].suspend = cpu[icpu].nextsuspend; cpu[icpu].suspend = cpu[icpu].nextsuspend;
@ -2472,9 +2472,9 @@ namespace mame
cpu[icpu].eatcycles = cpu[icpu].nexteatcycles; cpu[icpu].eatcycles = cpu[icpu].nexteatcycles;
} }
Timer.timer_set_global_time(target); 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) public static void cpu_boost_interleave(Atime timeslice_time, Atime boost_duration)

View File

@ -1,8 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.IO; using System.IO;
using System.Text;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace mame namespace mame
@ -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; cpunum = _cpunum;
line = _line; line = _line;
@ -143,7 +141,7 @@ namespace mame
{ {
if (cpunum < Cpuexec.ncpu && line >= 0 && line < (int)LineState.MAX_INPUT_LINES) if (cpunum < Cpuexec.ncpu && line >= 0 && line < (int)LineState.MAX_INPUT_LINES)
{ {
interrupt_vector[cpunum,line] = vector; interrupt_vector[cpunum, line] = vector;
return; return;
} }
} }
@ -162,12 +160,12 @@ namespace mame
{ {
int i1 = 1; int i1 = 1;
} }
foreach(irq irq1 in lirq) foreach (irq irq1 in lirq)
{ {
if (Attotime.attotime_compare(irq1.time, Timer.global_basetime) <= 0) if (Attotime.attotime_compare(irq1.time, Timer.global_basetime) <= 0)
{ {
input_line_state[irq1.cpunum,irq1.line] = (byte)irq1.state; input_line_state[irq1.cpunum, irq1.line] = (byte)irq1.state;
input_line_vector[irq1.cpunum,irq1.line] = irq1.vector; input_line_vector[irq1.cpunum, irq1.line] = irq1.vector;
if (irq1.line == (int)LineState.INPUT_LINE_RESET) if (irq1.line == (int)LineState.INPUT_LINE_RESET)
{ {
if (irq1.state == LineState.ASSERT_LINE) if (irq1.state == LineState.ASSERT_LINE)
@ -293,7 +291,7 @@ namespace mame
} }
public static void SaveStateBinary(BinaryWriter writer) public static void SaveStateBinary(BinaryWriter writer)
{ {
int i,j, n; int i, j, n;
n = lirq.Count; n = lirq.Count;
writer.Write(n); writer.Write(n);
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
@ -345,7 +343,7 @@ namespace mame
} }
public static void LoadStateBinary(BinaryReader reader) public static void LoadStateBinary(BinaryReader reader)
{ {
int i,j, n; int i, j, n;
n = reader.ReadInt32(); n = reader.ReadInt32();
lirq = new List<irq>(); lirq = new List<irq>();
for (i = 0; i < n; i++) for (i = 0; i < n; i++)

View File

@ -1,10 +1,5 @@
using System; using Bitmap = MAME.Core.AxiBitmap.AxiBitmap;
using System.Collections.Generic; using Color = MAME.Core.AxiBitmap.AxiColor;
using System.Linq;
using System.Drawing;
using System.IO;
using System.Text;
using System.Runtime.InteropServices;
namespace mame namespace mame
{ {
@ -24,68 +19,68 @@ namespace mame
public byte animation_counter; public byte animation_counter;
} }
public static crosshair_global global; 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,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,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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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, 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,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,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,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,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,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,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,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,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,0xfe,0x00,0x00,0x00,0x00,0x07,0xff,0xfe,0x00,0x00,
0x00,0x0f,0xff,0xff,0x00,0x00,0x00,0x00,0x0f,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,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,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,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,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,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,0x07,0xf8,0x00,0x00,0x01,0xfe,0x01,0xff,0xe0,0x00,
0x00,0xff,0xf0,0x03,0xfc,0x00,0x00,0x03,0xfc,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,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,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,0x3f,0x80,0x00,0x1f,0xc0,0x00,0x7f,0xf0,0x00,
0x01,0xff,0xc0,0x00,0x1f,0x80,0x00,0x1f,0x80,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,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,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,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,0xf8,0x01,0xf0,0x00,0x00,0x3f,0xf8,0x00,
0x03,0xff,0x80,0x00,0x00,0x78,0x01,0xe0,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,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,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,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,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,0x01,0x98,0x00,0x00,0x00,0x1f,0xfc,0x00,
0x07,0xff,0x00,0x00,0x00,0x00,0x60,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, 0x4040ff,
0xff4040, 0xff4040,
0x40ff40, 0x40ff40,
0xffff40, 0xffff40,
0xff40ff, 0xff40ff,
0x40ffff, 0x40ffff,
0xffffff 0xffffff
}; };
public static void crosshair_init() public static void crosshair_init()
{ {

View File

@ -1,14 +1,8 @@
using System; namespace mame
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace mame
{ {
public partial class Drawgfx 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.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace mame namespace mame
{ {
@ -52,7 +48,7 @@ namespace mame
public static LineState reset_line, clock_line; public static LineState reset_line, clock_line;
public static int locked; public static int locked;
public static int enable_multi_read; 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) private static bool eeprom_command_match(byte[] buf, byte[] cmd, int len)
{ {
int ibuf = 0, idx = 0; int ibuf = 0, idx = 0;
@ -64,7 +60,7 @@ namespace mame
{ {
return false; return false;
} }
for (; len > 0; ) for (; len > 0;)
{ {
byte b = buf[ibuf]; byte b = buf[ibuf];
byte c = cmd[idx]; byte c = cmd[idx];
@ -151,8 +147,8 @@ namespace mame
cmd_read = new byte[] { (byte)'0', (byte)'1', (byte)'1', (byte)'0' }; 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_write = new byte[] { (byte)'0', (byte)'1', (byte)'0', (byte)'1' };
cmd_erase = new byte[] { (byte)'0', (byte)'1', (byte)'1', (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_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_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++) for (int i = 0; i < 0x80; i++)
{ {
eeprom_data[i] = 0xff; eeprom_data[i] = 0xff;
@ -358,7 +354,7 @@ namespace mame
{ {
if (sending == 1) 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); eeprom_read_address = (eeprom_read_address + 1) & ((1 << address_bits) - 1);
if (data_bits == 16) if (data_bits == 16)

View File

@ -1,27 +1,59 @@
using System.Drawing; using MAME.Core.AxiBitmap;
using System.Drawing.Imaging; using System;
using System.Runtime.InteropServices; using Bitmap = MAME.Core.AxiBitmap.AxiBitmap;
using Color = MAME.Core.AxiBitmap.AxiColor;
using Rectangle = MAME.Core.AxiBitmap.Rectangle;
namespace mame namespace mame
{ {
partial class Video 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 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 bm1;
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();
// return bm2;
//}
public static Bitmap drawcrosshair_opwolf(Bitmap bm1) public static Bitmap drawcrosshair_opwolf(Bitmap bm1)
{ {
Bitmap bm2 = bm1; Bitmap bm2 = bm1;
Graphics g = Graphics.FromImage(bm2); bm2.DrawImage(
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); MultiplyAlpha(Crosshair.global.bitmap[0], (float)Crosshair.global.fade / 0xff),
g.Dispose(); new Rectangle(Crosshair.global.x[0] - 10,
Crosshair.global.y[0] - 10, 20, 20),
new Rectangle(0, 0, 100, 100));
return bm2; 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); Bitmap result = new Bitmap(bitmap.Width, bitmap.Height);
using (Graphics graphics = Graphics.FromImage(result)) 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); graphics.DrawImage(bitmap, new Rectangle(0, 0, bitmap.Width, bitmap.Height), 0, 0, bitmap.Width, bitmap.Height, GraphicsUnit.Pixel, imageAttributes);
} }
return result; 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() public static void GDIDraw()
{ {
try try
{ {
bitmapData = bitmapGDI.LockBits(new Rectangle(0, 0, Video.fullwidth, Video.fullheight), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); int[] TempData = AxiBitmapEx.CloneIntColorArr(Video.bitmapcolor, Video.fullwidth, Video.fullheight, new Rectangle(offsetx, offsety, width, height));
Marshal.Copy(Video.bitmapcolor, 0, bitmapData.Scan0, Video.fullwidth * Video.fullheight); drawcrosshair(TempData);
bitmapGDI.UnlockBits(bitmapData); //bbmp[iMode] = drawcrosshair(bitmapGDI.Clone(new Rectangle(offsetx, offsety, width, height)));
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));
switch (Machine.sDirection) switch (Machine.sDirection)
{ {
case "": case "":
@ -84,12 +202,45 @@ namespace mame
break; break;
} }
//Machine.FORM.pictureBox1.Image = bbmp[iMode]; //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 cpu.m68000;
using System.Collections.Generic; using System;
using System.Linq;
using System.Text;
using System.IO;
using cpu.m68000;
namespace mame namespace mame
{ {
@ -54,7 +50,7 @@ namespace mame
{ {
return; return;
} }
coinlockedout[num] =(uint) on; coinlockedout[num] = (uint)on;
} }
public static void coin_lockout_global_w(int on) public static void coin_lockout_global_w(int on)
{ {
@ -71,9 +67,9 @@ namespace mame
case "Neo Geo": case "Neo Geo":
Neogeo.nvram_handler_load_neogeo(); Neogeo.nvram_handler_load_neogeo();
break; break;
/*case "Namco System 1": /*case "Namco System 1":
Namcos1.nvram_handler_load_namcos1(); Namcos1.nvram_handler_load_namcos1();
break;*/ break;*/
} }
} }
public static void nvram_save() public static void nvram_save()
@ -83,9 +79,9 @@ namespace mame
case "Neo Geo": case "Neo Geo":
Neogeo.nvram_handler_save_neogeo(); Neogeo.nvram_handler_save_neogeo();
break; break;
/*case "Namco System 1": /*case "Namco System 1":
Namcos1.nvram_handler_save_namcos1(); Namcos1.nvram_handler_save_namcos1();
break;*/ break;*/
} }
} }
public static void watchdog_reset16_w() public static void watchdog_reset16_w()
@ -139,7 +135,7 @@ namespace mame
} }
public static void clear_all_lines() public static void clear_all_lines()
{ {
int inputcount=0; int inputcount = 0;
int line; int line;
if (objcpunum == 0 && Cpuexec.cpu[0] == MC68000.m1) if (objcpunum == 0 && Cpuexec.cpu[0] == MC68000.m1)
{ {
@ -221,7 +217,7 @@ namespace mame
} }
public static ushort paletteram16_be(int offset) 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) 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; long period = Video.screenstate.frame_period;
RECT visarea = Video.screenstate.visarea; RECT visarea = Video.screenstate.visarea;
Tmap.tilemap_set_flip(null, (byte)((Tilemap.TILEMAP_FLIPX & flip_screen_x) | (Tilemap.TILEMAP_FLIPY & flip_screen_y))); 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; int temp;
temp = width - visarea.min_x - 1; temp = width - visarea.min_x - 1;
visarea.min_x = width - visarea.max_x - 1; visarea.min_x = width - visarea.max_x - 1;
visarea.max_x = temp; visarea.max_x = temp;
} }
if (flip_screen_y!=0) if (flip_screen_y != 0)
{ {
int temp; int temp;
temp = height - visarea.min_y - 1; temp = height - visarea.min_y - 1;
@ -323,7 +319,7 @@ namespace mame
set_color_444(offset, 12, 8, 4, paletteram16_split(offset)); 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; paletteram16[offset] = data;
set_color_555(offset, 0, 5, 10, paletteram16[offset]); set_color_555(offset, 0, 5, 10, paletteram16[offset]);

View File

@ -46,7 +46,7 @@ namespace mame
public static bool bReplayRead; public static bool bReplayRead;
public delegate void loop_delegate(); public delegate void loop_delegate();
public static loop_delegate loop_inputports_callback, record_port_callback, replay_port_callback; 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 input_port_private portdata;
public static void input_port_init() public static void input_port_init()
{ {
@ -570,7 +570,7 @@ namespace mame
result = (uint)apply_analog_settings(value, analog); result = (uint)apply_analog_settings(value, analog);
return result; 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 = apply_analog_min_max(analog, value);
value = (int)((long)value * analog.sensitivity / 100); value = (int)((long)value * analog.sensitivity / 100);
@ -580,11 +580,11 @@ namespace mame
} }
if (value >= 0) if (value >= 0)
{ {
value = (int)((long)(value * analog.scalepos)>>24); value = (int)((long)(value * analog.scalepos) >> 24);
} }
else else
{ {
value = (int)((long)(value * analog.scaleneg)>>24); value = (int)((long)(value * analog.scaleneg) >> 24);
} }
value += analog.adjdefvalue; value += analog.adjdefvalue;
return value; return value;

View File

@ -19,7 +19,7 @@ namespace mame
} }
public static char getcharbykey(Key key1) public static char getcharbykey(Key key1)
{ {
char c1=' '; char c1 = ' ';
foreach (KeyStruct ks in lks) foreach (KeyStruct ks in lks)
{ {
if (ks.key == key1) 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; using MAME.Core.run_interface;
namespace mame namespace mame
@ -10,7 +9,7 @@ namespace mame
static IKeyboard mKeyboard; static IKeyboard mKeyboard;
public static void InitializeInput(mainForm form1,IKeyboard ikb) public static void InitializeInput(mainMotion form1, IKeyboard ikb)
{ {
mKeyboard = ikb; mKeyboard = ikb;
} }

View File

@ -8,7 +8,7 @@ namespace mame
{ {
public static string sName, sParent, sBoard, sDirection, sDescription, sManufacturer; public static string sName, sParent, sBoard, sDirection, sDescription, sManufacturer;
public static List<string> lsParents; public static List<string> lsParents;
public static mainForm FORM; public static mainMotion FORM;
public static RomInfo rom; public static RomInfo rom;
public static bool bRom; public static bool bRom;
public delegate void machine_delegate(); public delegate void machine_delegate();
@ -264,16 +264,20 @@ namespace mame
public static byte[] GetNeogeoRom(string sFile) public static byte[] GetNeogeoRom(string sFile)
{ {
byte[] bb1; 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); EmuLogger.Log($"Had File => {path}");
int n1 = (int)fs1.Length; return File.ReadAllBytes(path);
bb1 = new byte[n1]; //FileStream fs1 = new FileStream(path, FileMode.Open);
fs1.Read(bb1, 0, n1); //int n1 = (int)fs1.Length;
fs1.Close(); //bb1 = new byte[n1];
//fs1.Read(bb1, 0, n1);
//fs1.Close();
} }
else else
{ {
EmuLogger.Log($"Miss File => {path}");
bb1 = null; bb1 = null;
} }
return bb1; return bb1;
@ -284,15 +288,22 @@ namespace mame
int n1; int n1;
foreach (string s1 in lsParents) 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); EmuLogger.Log($"Had File => {path}");
n1 = (int)fs1.Length; return File.ReadAllBytes(path);
bb1 = new byte[n1]; //FileStream fs1 = new FileStream(path, FileMode.Open);
fs1.Read(bb1, 0, n1); //n1 = (int)fs1.Length;
fs1.Close(); //bb1 = new byte[n1];
//fs1.Read(bb1, 0, n1);
//fs1.Close();
break; break;
} }
else
{
EmuLogger.Log($"Miss File => {path}");
}
} }
return bb1; return bb1;
} }

View File

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

View File

@ -1,9 +1,4 @@
using System; namespace mame
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mame
{ {
public class Memory public class Memory
{ {
@ -116,7 +111,7 @@ namespace mame
case "sboblbobl": case "sboblbobl":
Taito.sbyte0 = unchecked((sbyte)0x73); Taito.sbyte0 = unchecked((sbyte)0x73);
break; break;
case"opwolf": case "opwolf":
Taito.sbyte0 = unchecked((sbyte)0xfc); Taito.sbyte0 = unchecked((sbyte)0xfc);
break; break;
case "opwolfp": case "opwolfp":

View File

@ -1,27 +1,26 @@
using MAME.Core.Common; using MAME.Core.Common;
using MAME.Core.run_interface; using MAME.Core.run_interface;
using System;
using System.Runtime.InteropServices;
namespace mame 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); private static uint UI_FILLCOLOR = Palette.make_argb(0xe0, 0x10, 0x10, 0x30);
public delegate void ui_delegate(); public delegate void motion_delegate();
public static ui_delegate ui_handler_callback, ui_update_callback; public static motion_delegate motion_handler_callback, motion_update_callback;
public static bool single_step; public static bool single_step;
public static mainForm mainform; //public static mainMotion mainmotion;
public static void ui_init(mainForm form1) public static void init()
{ {
mainform = form1; //mainmotion = motion;
} }
public static void ui_update_and_render() public static void ui_update_and_render()
{ {
ui_update_callback(); motion_update_callback();
ui_handler_callback(); motion_handler_callback();
} }
public static void ui_updateC() public static void ui_updateC()
{ {
@ -195,7 +194,7 @@ namespace mame
} }
if (Mame.is_foreground) if (Mame.is_foreground)
{ {
if(Keyboard.IsPressed(Key.F3)) if (Keyboard.IsPressed(Key.F3))
{ {
cpurun(); cpurun();
Mame.playState = Mame.PlayState.PLAY_RESET; Mame.playState = Mame.PlayState.PLAY_RESET;
@ -255,10 +254,10 @@ namespace mame
} }
public static void cpurun() public static void cpurun()
{ {
m68000Form.m68000State = m68000Form.M68000State.M68000_RUN; m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN;
Machine.FORM.m68000form.mTx_tsslStatus = "run"; Machine.FORM.m68000motion.mTx_tsslStatus = "run";
z80Form.z80State = z80Form.Z80AState.Z80A_RUN; z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN;
Machine.FORM.z80form.mTx_tsslStatus = "run"; Machine.FORM.z80motion.mTx_tsslStatus = "run";
} }
private static double ui_get_line_height() private static double ui_get_line_height()
{ {

View File

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

View File

@ -1,8 +1,5 @@
using System; using MAME.Core.AxiBitmap;
using System.Collections.Generic; using Color = MAME.Core.AxiBitmap.AxiColor;
using System.Linq;
using System.Text;
using System.Drawing;
namespace mame namespace mame
{ {
@ -11,9 +8,9 @@ namespace mame
public static uint[] entry_color; public static uint[] entry_color;
public static float[] entry_contrast; public static float[] entry_contrast;
private static uint trans_uint; private static uint trans_uint;
private static int numcolors,numgroups; private static int numcolors, numgroups;
public static Color trans_color; 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 palette_delegate palette_set_callback;
public static void palette_init() public static void palette_init()
{ {
@ -309,7 +306,7 @@ namespace mame
} }
public static byte pal1bit(byte bits) 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) public static byte pal4bit(byte bits)
{ {

View File

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

View File

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

View File

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

View File

@ -1,7 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mame namespace mame
{ {
@ -104,7 +102,7 @@ namespace mame
{ {
palette_offset = offset; 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) if (tmap == null)
{ {
@ -153,12 +151,12 @@ namespace mame
{ {
scrollcols = scroll_cols; scrollcols = scroll_cols;
} }
public void tilemap_set_scrolldx(int _dx,int _dx2) public void tilemap_set_scrolldx(int _dx, int _dx2)
{ {
dx = _dx; dx = _dx;
dx_flipped = _dx2; dx_flipped = _dx2;
} }
public void tilemap_set_scrolldy(int _dy,int _dy2) public void tilemap_set_scrolldy(int _dy, int _dy2)
{ {
dy = _dy; dy = _dy;
dy_flipped = _dy2; dy_flipped = _dy2;
@ -269,7 +267,7 @@ namespace mame
{ {
public static List<Tmap> lsTmap = new List<Tmap>(); public static List<Tmap> lsTmap = new List<Tmap>();
public static byte[,] priority_bitmap; public static byte[,] priority_bitmap;
public static byte[,] bb00,bbFF; public static byte[,] bb00, bbFF;
public static byte[] bb0F; public static byte[] bb0F;
public static int screen_width, screen_height; public static int screen_width, screen_height;
private static int INVALID_LOGICAL_INDEX = -1; private static int INVALID_LOGICAL_INDEX = -1;

View File

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

View File

@ -1,8 +1,7 @@
using MAME.Core.run_interface; using MAME.Core.run_interface;
using System; using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO; using System.IO;
using Bitmap = MAME.Core.AxiBitmap.AxiBitmap;
namespace mame namespace mame
{ {
@ -27,8 +26,8 @@ namespace mame
public static Atime frame_update_time; public static Atime frame_update_time;
public static screen_state screenstate; public static screen_state screenstate;
public static int video_attributes; public static int video_attributes;
private static int PAUSED_REFRESH_RATE = 30, VIDEO_UPDATE_AFTER_VBLANK=4; 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 vblank_begin_timer, vblank_end_timer;
public static Timer.emu_timer scanline0_timer, scanline_timer; public static Timer.emu_timer scanline0_timer, scanline_timer;
private static Atime throttle_emutime, throttle_realtime, speed_last_emutime, overall_emutime; private static Atime throttle_emutime, throttle_realtime, speed_last_emutime, overall_emutime;
private static long throttle_last_ticks; private static long throttle_last_ticks;
@ -50,7 +49,7 @@ namespace mame
public static string sDrawText; public static string sDrawText;
public static long popup_text_end; public static long popup_text_end;
public static int iMode, nMode; public static int iMode, nMode;
private static BitmapData bitmapData; //private static BitmapData bitmapData;
public static int offsetx, offsety, width, height; public static int offsetx, offsety, width, height;
public delegate void video_delegate(); public delegate void video_delegate();
public static video_delegate video_update_callback, video_eof_callback; public static video_delegate video_update_callback, video_eof_callback;
@ -63,7 +62,7 @@ namespace mame
#region #region
static Action<Bitmap> Act_SubmitVideo; static Action<int[]> Act_SubmitVideo;
public static void BindFunc(IVideoPlayer Ivp) public static void BindFunc(IVideoPlayer Ivp)
{ {
@ -72,7 +71,7 @@ namespace mame
Act_SubmitVideo += Ivp.SubmitVideo; Act_SubmitVideo += Ivp.SubmitVideo;
} }
static void SubmitVideo(Bitmap Bitmap) static void SubmitVideo(int[] Bitmap)
{ {
Act_SubmitVideo?.Invoke(Bitmap); Act_SubmitVideo?.Invoke(Bitmap);
} }
@ -82,18 +81,18 @@ namespace mame
{ {
Wintime.wintime_init(); Wintime.wintime_init();
global_throttle = true; global_throttle = true;
UI.ui_handler_callback = UI.handler_ingame; Motion.motion_handler_callback = Motion.handler_ingame;
sDrawText = ""; sDrawText = "";
popup_text_end = 0; popup_text_end = 0;
popcount = new int[256]{ 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, 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,
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, 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, 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,
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 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) switch (Machine.sBoard)
{ {
@ -111,7 +110,7 @@ namespace mame
screenstate.vblank_period = 0; screenstate.vblank_period = 0;
video_attributes = 0; video_attributes = 0;
bitmapGDI = new Bitmap(Video.fullwidth, Video.fullheight); 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 = new ushort[2][];
bitmapbase[0] = new ushort[0x200 * 0x200]; bitmapbase[0] = new ushort[0x200 * 0x200];
bitmapbase[1] = new ushort[0x200 * 0x200]; bitmapbase[1] = new ushort[0x200 * 0x200];
@ -135,7 +134,7 @@ namespace mame
screenstate.vblank_period = 0; screenstate.vblank_period = 0;
video_attributes = 0; video_attributes = 0;
bitmapGDI = new Bitmap(Video.fullwidth, Video.fullheight); 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 = new ushort[2][];
bitmapbase[0] = new ushort[0x200 * 0x200]; bitmapbase[0] = new ushort[0x200 * 0x200];
bitmapbase[1] = new ushort[0x200 * 0x200]; bitmapbase[1] = new ushort[0x200 * 0x200];
@ -159,7 +158,7 @@ namespace mame
screenstate.vblank_period = 0; screenstate.vblank_period = 0;
video_attributes = 0; video_attributes = 0;
bitmapGDI = new Bitmap(Video.fullwidth, Video.fullheight); 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 = new ushort[2][];
bitmapbase[0] = new ushort[0x100 * 0x100]; bitmapbase[0] = new ushort[0x100 * 0x100];
bitmapbase[1] = new ushort[0x100 * 0x100]; bitmapbase[1] = new ushort[0x100 * 0x100];
@ -192,7 +191,7 @@ namespace mame
screenstate.vblank_period = 0; screenstate.vblank_period = 0;
video_attributes = 0; video_attributes = 0;
bitmapGDI = new Bitmap(Video.fullwidth, Video.fullheight); 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 = new ushort[2][];
bitmapbase[0] = new ushort[0x100 * 0x100]; bitmapbase[0] = new ushort[0x100 * 0x100];
bitmapbase[1] = 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 frame_update_time = new Atime(0, (long)(1e18 / 6000000) * screenstate.width * screenstate.height);//59.1856060608428Hz
screenstate.vblank_period = (long)(1e18 / 6000000) * 384 * (264 - 224); screenstate.vblank_period = (long)(1e18 / 6000000) * 384 * (264 - 224);
video_attributes = 0; video_attributes = 0;
UI.ui_update_callback = UI.ui_updateN; Motion.motion_update_callback = Motion.ui_updateN;
bitmapbaseN = new int[2][]; bitmapbaseN = new int[2][];
bitmapbaseN[0] = new int[384 * 264]; bitmapbaseN[0] = new int[384 * 264];
bitmapbaseN[1] = 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)); frame_update_time = new Atime(0, (long)(1e18 / 60));
screenstate.vblank_period = (long)(1e12 * 2500); screenstate.vblank_period = (long)(1e12 * 2500);
video_attributes = 0; video_attributes = 0;
UI.ui_update_callback = UI.ui_updatePGM; Motion.motion_update_callback = Motion.ui_updatePGM;
bitmapbase = new ushort[2][]; bitmapbase = new ushort[2][];
bitmapbase[0] = new ushort[0x100 * 0x100]; bitmapbase[0] = new ushort[0x100 * 0x100];
bitmapbase[1] = 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)); frame_update_time = new Atime(0, (long)(1e18 / 60.606060));
screenstate.vblank_period = 0; screenstate.vblank_period = 0;
video_attributes = 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); bitmapGDI = new Bitmap(Video.fullwidth, Video.fullheight);
bitmapbase = new ushort[2][]; bitmapbase = new ushort[2][];
bitmapbase[0] = new ushort[0x200 * 0x200]; bitmapbase[0] = new ushort[0x200 * 0x200];
@ -278,7 +277,7 @@ namespace mame
frame_update_time = new Atime(0, (long)(1e18 / 60)); frame_update_time = new Atime(0, (long)(1e18 / 60));
screenstate.vblank_period = 0; screenstate.vblank_period = 0;
video_attributes = 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); bitmapGDI = new Bitmap(Video.fullwidth, Video.fullheight);
bitmapbase = new ushort[2][]; bitmapbase = new ushort[2][];
bitmapbase[0] = new ushort[0x200 * 0x200]; bitmapbase[0] = new ushort[0x200 * 0x200];
@ -300,7 +299,7 @@ namespace mame
frame_update_time = new Atime(0, (long)(1e18 / 60)); frame_update_time = new Atime(0, (long)(1e18 / 60));
screenstate.vblank_period = 0; screenstate.vblank_period = 0;
video_attributes = 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); bitmapGDI = new Bitmap(Video.fullwidth, Video.fullheight);
bitmapbase = new ushort[2][]; bitmapbase = new ushort[2][];
bitmapbase[0] = new ushort[0x200 * 0x200]; 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); frame_update_time = new Atime(0, (long)(1e18 / 8000000) * screenstate.width * screenstate.height);
screenstate.vblank_period = (long)(1e18 / 8000000) * 512 * (284 - 256); screenstate.vblank_period = (long)(1e18 / 8000000) * 512 * (284 - 256);
video_attributes = 0; video_attributes = 0;
UI.ui_update_callback = UI.ui_updatePGM; Motion.motion_update_callback = Motion.ui_updatePGM;
bitmapbase = new ushort[2][]; bitmapbase = new ushort[2][];
bitmapbase[0] = new ushort[0x200 * 0x200];//0x11c bitmapbase[0] = new ushort[0x200 * 0x200];//0x11c
bitmapbase[1] = 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)); frame_update_time = new Atime(0, (long)(1e18 / 60));
screenstate.vblank_period = 0; screenstate.vblank_period = 0;
video_attributes = 0; video_attributes = 0;
UI.ui_update_callback = UI.ui_updatePGM; Motion.motion_update_callback = Motion.ui_updatePGM;
bitmapbase = new ushort[2][]; bitmapbase = new ushort[2][];
bitmapbase[0] = new ushort[0x200 * 0x200]; bitmapbase[0] = new ushort[0x200 * 0x200];
bitmapbase[1] = new ushort[0x200 * 0x200]; bitmapbase[1] = new ushort[0x200 * 0x200];
@ -354,7 +353,7 @@ namespace mame
break; break;
case "Taito": case "Taito":
video_attributes = 0; video_attributes = 0;
UI.ui_update_callback = UI.ui_updatePGM; Motion.motion_update_callback = Motion.ui_updatePGM;
switch (Machine.sName) switch (Machine.sName)
{ {
case "tokio": case "tokio":
@ -435,7 +434,7 @@ namespace mame
frame_update_time = new Atime(0, (long)(1e18 / 60)); frame_update_time = new Atime(0, (long)(1e18 / 60));
screenstate.vblank_period = 0; screenstate.vblank_period = 0;
video_attributes = 0; video_attributes = 0;
UI.ui_update_callback = UI.ui_updatePGM; Motion.motion_update_callback = Motion.ui_updatePGM;
bitmapbase = new ushort[2][]; bitmapbase = new ushort[2][];
bitmapbase[0] = new ushort[0x200 * 0x100]; bitmapbase[0] = new ushort[0x200 * 0x100];
bitmapbase[1] = 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)); frame_update_time = new Atime(0, (long)(1e18 / 60));
screenstate.vblank_period = (long)(1e12 * 2500); screenstate.vblank_period = (long)(1e12 * 2500);
video_attributes = 0x34; video_attributes = 0x34;
UI.ui_update_callback = UI.ui_updatePGM; Motion.motion_update_callback = Motion.ui_updatePGM;
bitmapbase = new ushort[2][]; bitmapbase = new ushort[2][];
bitmapbase[0] = new ushort[0x200 * 0x100]; bitmapbase[0] = new ushort[0x200 * 0x100];
bitmapbase[1] = 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)); frame_update_time = new Atime(0, (long)(1e18 / 60));
screenstate.vblank_period = 0; screenstate.vblank_period = 0;
video_attributes = 0; video_attributes = 0;
UI.ui_update_callback = UI.ui_updatePGM; Motion.motion_update_callback = Motion.ui_updatePGM;
bitmapbase = new ushort[2][]; bitmapbase = new ushort[2][];
bitmapbase[0] = new ushort[0x100 * 0x100]; bitmapbase[0] = new ushort[0x100 * 0x100];
bitmapbase[1] = 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)); frame_update_time = new Atime(0, (long)(1e18 / 60));
screenstate.vblank_period = 0; screenstate.vblank_period = 0;
video_attributes = 0; video_attributes = 0;
UI.ui_update_callback = UI.ui_updatePGM; Motion.motion_update_callback = Motion.ui_updatePGM;
bitmapbase = new ushort[2][]; bitmapbase = new ushort[2][];
bitmapbase[0] = new ushort[0x200 * 0x100]; bitmapbase[0] = new ushort[0x200 * 0x100];
bitmapbase[1] = new ushort[0x200 * 0x100]; bitmapbase[1] = new ushort[0x200 * 0x100];
@ -752,7 +751,7 @@ namespace mame
screenstate.height = height; screenstate.height = height;
screenstate.visarea = visarea; screenstate.visarea = visarea;
//realloc_screen_bitmaps(screen); //realloc_screen_bitmaps(screen);
screenstate.frame_period=frame_period; screenstate.frame_period = frame_period;
screenstate.scantime = frame_period / height; screenstate.scantime = frame_period / height;
screenstate.pixeltime = frame_period / (height * width); screenstate.pixeltime = frame_period / (height * width);
/*if (config->vblank == 0 && !config->oldstyle_vblank_supplied) /*if (config->vblank == 0 && !config->oldstyle_vblank_supplied)
@ -853,7 +852,7 @@ namespace mame
} }
else 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() public static void vblank_end_callback()
@ -878,7 +877,7 @@ namespace mame
{ {
scanline = screenstate.visarea.min_y; 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); Timer.timer_adjust_periodic(scanline_timer, video_screen_get_time_until_pos(scanline, 0), Attotime.ATTOTIME_NEVER);
} }
public static void video_frame_update() public static void video_frame_update()
@ -891,10 +890,10 @@ namespace mame
Keyboard.Update(); Keyboard.Update();
Mouse.Update(); Mouse.Update();
Inptport.frame_update_callback(); Inptport.frame_update_callback();
UI.ui_update_and_render(); Motion.ui_update_and_render();
if(Machine.FORM.cheatform.lockState == MAME.Core.Common.cheatForm.LockState.LOCK_FRAME) if (Machine.FORM.cheatmotion.lockState == MAME.Core.Common.cheatMotion.LockState.LOCK_FRAME)
{ {
Machine.FORM.cheatform.ApplyCheat(); Machine.FORM.cheatmotion.ApplyCheat();
} }
GDIDraw(); GDIDraw();
if (effective_throttle()) if (effective_throttle())

View File

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

View File

@ -1,17 +1,19 @@
using MAME.Core.Common; using MAME.Core.Common;
using System;
using System.Drawing;
using System.Runtime.InteropServices;
namespace mame namespace mame
{ {
public class Window public class Window
{ {
private static mainForm _myParentForm; private static mainMotion _myParentForm;
[DllImport("kernel32.dll ")] //[DllImport("kernel32.dll ")]
private static extern uint GetTickCount(); //private static extern uint GetTickCount();
public static bool input_enabled,input_paused, mouse_enabled, lightgun_enabled; 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; public static uint last_poll, last_event_check;
private static bool _CursorShown = true; private static bool _CursorShown = true;
public static void osd_update(bool skip_redraw) public static void osd_update(bool skip_redraw)
@ -45,7 +47,7 @@ namespace mame
} }
winwindow_process_events(true); winwindow_process_events(true);
} }
public static void osd_init(mainForm form) public static void osd_init(mainMotion form)
{ {
_myParentForm = form; _myParentForm = form;
wininput_init(); wininput_init();

View File

@ -1,18 +1,33 @@
using System; using System.Diagnostics;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using System.Threading; using System.Threading;
namespace mame namespace mame
{ {
public class Wintime public class Wintime
{ {
[DllImport("kernel32.dll ")] //[DllImport("kernel32.dll ")]
public static extern bool QueryPerformanceCounter(ref long lpPerformanceCount); //public static extern bool QueryPerformanceCounter(ref long lpPerformanceCount);
[DllImport("kernel32.dll")] //[DllImport("kernel32.dll")]
private static extern bool QueryPerformanceFrequency(ref long PerformanceFrequency); //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 long ticks_per_second;
public static void wintime_init() public static void wintime_init()
{ {

View File

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

View File

@ -1,9 +1,4 @@
using System; namespace mame
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mame
{ {
public partial class Drawgfx public partial class Drawgfx
{ {
@ -163,7 +158,7 @@ namespace mame
int colorbase = 0x200 + 0x10 * color; int colorbase = 0x200 + 0x10 * color;
blockmove_8toN_transpen16_sf(bb1, code, sw, sh, 0x10, ls, ts, flipx, flipy, dw, dh, colorbase, sy, sx); 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 ydir, xdir, col, i, j;
int srcdata_offset = code * 0x100; int srcdata_offset = code * 0x100;

View File

@ -1,6 +1,4 @@
using System.Drawing; 
using System.Drawing.Imaging;
namespace mame namespace mame
{ {
public partial class Capcom 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; namespace mame
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mame
{ {
public partial class Capcom public partial class Capcom
{ {

View File

@ -895,7 +895,7 @@ namespace mame
} }
public static void record_port_sf() 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; short0_old = short0;
short1_old = short1; short1_old = short1;

View File

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

View File

@ -1,11 +1,7 @@
using System; using cpu.m68000;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using cpu.m68000;
using cpu.m6809; using cpu.m6809;
using cpu.z80; using cpu.z80;
using System.IO;
namespace mame namespace mame
{ {
@ -23,7 +19,7 @@ namespace mame
writer.Write(scrolly, 0, 2); writer.Write(scrolly, 0, 2);
writer.Write(Generic.paletteram, 0, 0x100); writer.Write(Generic.paletteram, 0, 0x100);
writer.Write(Generic.paletteram_2, 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); writer.Write(Generic.buffered_spriteram, 0, 0x200);
for (i = 0; i < 0x100; i++) for (i = 0; i < 0x100; i++)
{ {

View File

@ -1,8 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace mame namespace mame
{ {
@ -426,7 +423,7 @@ namespace mame
int pen_data_offset, palette_base, group; int pen_data_offset, palette_base, group;
tile_index = col * rows + row; tile_index = col * rows + row;
int base_offset = 0x20000 + 2 * tile_index; 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]; color = Capcom.gfx5rom[base_offset];
code = (Capcom.gfx5rom[base_offset + 0x10000 + 1] << 8) | Capcom.gfx5rom[base_offset + 1]; code = (Capcom.gfx5rom[base_offset + 0x10000 + 1] << 8) | Capcom.gfx5rom[base_offset + 1];
code = code % total_elements; code = code % total_elements;

View File

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

View File

@ -1,7 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.IO;
namespace mame namespace mame
{ {
@ -2455,8 +2453,8 @@ namespace mame
/* EEPROM */ /* EEPROM */
Eeprom.eeprom_write_bit(data & 0x1000); Eeprom.eeprom_write_bit(data & 0x1000);
Eeprom.eeprom_set_clock_line(((data & 0x2000)!=0) ? LineState.ASSERT_LINE : LineState.CLEAR_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); Eeprom.eeprom_set_cs_line(((data & 0x4000) != 0) ? LineState.CLEAR_LINE : LineState.ASSERT_LINE);
} }
//low 8 bits //low 8 bits
{ {

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

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

View File

@ -1,17 +1,12 @@
using System; using System;
using System.Collections.Generic; 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 CPS public partial class CPS
{ {
private static int iXAll, iYAll, nBitmap; 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 List<string> lBitmapHash = new List<string>();
private static int cpsb_addr, cpsb_value, mult_factor1, mult_factor2, mult_result_lo, mult_result_hi; 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;
@ -80,7 +75,7 @@ namespace mame
} }
private static void cps1_cps_a_w(int offset, ushort data) 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) if (offset == CPS1_PALETTE_BASE)
{ {
cps1_build_palette(cps1_base(CPS1_PALETTE_BASE, 0x0400)); cps1_build_palette(cps1_base(CPS1_PALETTE_BASE, 0x0400));
@ -279,10 +274,10 @@ namespace mame
} }
public static void video_start_cps() public static void video_start_cps()
{ {
bmAll = new Bitmap(512, 512); //bmAll = new Bitmap(512, 512);
Graphics g = Graphics.FromImage(bmAll); //Graphics g = Graphics.FromImage(bmAll);
g.Clear(Color.Magenta); //g.Clear(Color.Magenta);
g.Dispose(); //g.Dispose();
int i; int i;
ttmap[0].enable = true; ttmap[0].enable = true;
ttmap[1].enable = true; ttmap[1].enable = true;
@ -302,8 +297,8 @@ namespace mame
cps1_stars_enabled = new int[2]; cps1_stars_enabled = new int[2];
cps1_buffered_obj = new ushort[0x400]; cps1_buffered_obj = new ushort[0x400];
cps2_buffered_obj = new ushort[0x1000]; cps2_buffered_obj = new ushort[0x1000];
cps2_objram1=new ushort[0x1000]; cps2_objram1 = new ushort[0x1000];
cps2_objram2=new ushort[0x1000]; cps2_objram2 = new ushort[0x1000];
uuBFF = new ushort[0x200 * 0x200]; uuBFF = new ushort[0x200 * 0x200];
for (i = 0; i < 0x40000; i++) for (i = 0; i < 0x40000; i++)
@ -554,13 +549,13 @@ namespace mame
code = cps2_buffered_obj[i * 4 + 2] + ((y & 0x6000) << 3); code = cps2_buffered_obj[i * 4 + 2] + ((y & 0x6000) << 3);
colour = cps2_buffered_obj[i * 4 + 3]; colour = cps2_buffered_obj[i * 4 + 3];
col = colour & 0x1f; col = colour & 0x1f;
if ((colour & 0x80)!=0) if ((colour & 0x80) != 0)
{ {
x += cps2_port(0x08); /* fix the offset of some games */ x += cps2_port(0x08); /* fix the offset of some games */
y += cps2_port(0x0a); /* like Marvel vs. Capcom ending credits */ y += cps2_port(0x0a); /* like Marvel vs. Capcom ending credits */
} }
y += 0x100; y += 0x100;
if ((colour & 0xff00)!=0) if ((colour & 0xff00) != 0)
{ {
/* handle blocked sprites */ /* handle blocked sprites */
int nx = (colour & 0x0f00) >> 8; int nx = (colour & 0x0f00) >> 8;
@ -568,10 +563,10 @@ namespace mame
int nxs, nys, sx, sy; int nxs, nys, sx, sy;
nx++; nx++;
ny++; ny++;
if ((colour & 0x40)!=0) if ((colour & 0x40) != 0)
{ {
/* Y flip */ /* Y flip */
if ((colour & 0x20)!=0) if ((colour & 0x20) != 0)
{ {
for (nys = 0; nys < ny; nys++) for (nys = 0; nys < ny; nys++)
{ {
@ -598,7 +593,7 @@ namespace mame
} }
else else
{ {
if ((colour & 0x20)!=0) if ((colour & 0x20) != 0)
{ {
for (nys = 0; nys < ny; nys++) for (nys = 0; nys < ny; nys++)
{ {
@ -719,7 +714,7 @@ namespace mame
cps1_update_transmasks(); cps1_update_transmasks();
ttmap[0].tilemap_set_scrollx(0, scroll1x); ttmap[0].tilemap_set_scrollx(0, scroll1x);
ttmap[0].tilemap_set_scrolly(0, scroll1y); ttmap[0].tilemap_set_scrolly(0, scroll1y);
if ((videocontrol & 0x01)!=0) /* linescroll enable */ if ((videocontrol & 0x01) != 0) /* linescroll enable */
{ {
int scrly = -scroll2y; int scrly = -scroll2y;
int otheroffs; int otheroffs;
@ -852,7 +847,7 @@ namespace mame
//memcpy(cps2_buffered_obj, cps2_objbase(), cps2_obj_size); //memcpy(cps2_buffered_obj, cps2_objbase(), cps2_obj_size);
int baseptr; int baseptr;
baseptr = 0x7000; baseptr = 0x7000;
if ((cps2_objram_bank & 1)!=0) if ((cps2_objram_bank & 1) != 0)
{ {
baseptr ^= 0x0080; baseptr ^= 0x0080;
} }

View File

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

View File

@ -1,11 +1,4 @@
using System; namespace mame
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Drawing.Imaging;
namespace mame
{ {
public partial class Dataeast 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 = new List<fr1>();
lfr.Add(new fr1((int)(Video.screenstate.frame_number + 1), 0x7f)); 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), 0xff));
lfr.Add(new fr1((int)(Video.screenstate.frame_number + 2+i3), 0x7f)); 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 + 1), 0xff));
} }
if (Keyboard.IsTriggered(Key.U)) if (Keyboard.IsTriggered(Key.U))
{ {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,12 +1,4 @@
using System; namespace mame
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 IGS011 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; namespace mame
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mame
{ {
public partial class IGS011 public partial class IGS011
{ {
@ -11,7 +6,7 @@ namespace mame
public static byte prot1, prot2, prot1_swap; public static byte prot1, prot2, prot1_swap;
public static uint prot1_addr; public static uint prot1_addr;
public static ushort[] igs003_reg, vbowl_trackball; 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; public static byte igs012_prot, igs012_prot_swap;
private static bool igs012_prot_mode; private static bool igs012_prot_mode;
public static byte[] gfx1rom, gfx2rom; public static byte[] gfx1rom, gfx2rom;
@ -476,7 +471,7 @@ namespace mame
} }
return 0; 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) if (offset == 0)
{ {
@ -840,7 +835,7 @@ namespace mame
//if (ACCESSING_BITS_0_7) //if (ACCESSING_BITS_0_7)
YM3812.ym3812_write_port_0_w(data); 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) if ((offset & 1) == 0)
{ {

View File

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

View File

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

View File

@ -1,9 +1,4 @@
using System; namespace mame
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mame
{ {
public partial class IGS011 public partial class IGS011
{ {
@ -750,7 +745,7 @@ namespace mame
public static void MWriteLong_lhb(int address, int value) public static void MWriteLong_lhb(int address, int value)
{ {
address &= 0xffffff; address &= 0xffffff;
if (address >= prot1_addr && address+3 <= prot1_addr + 7) if (address >= prot1_addr && address + 3 <= prot1_addr + 7)
{ {
int i1 = 1; int i1 = 1;
} }
@ -3141,7 +3136,7 @@ namespace mame
} }
else if (address >= 0x600000 && address + 1 <= 0x600007) else if (address >= 0x600000 && address + 1 <= 0x600007)
{ {
int offset=(address-0x600000)/2; int offset = (address - 0x600000) / 2;
ics2115_0_word_w(offset, (ushort)value); ics2115_0_word_w(offset, (ushort)value);
} }
else if (address >= 0x700000 && address + 1 <= 0x700003) else if (address >= 0x700000 && address + 1 <= 0x700003)

View File

@ -1,9 +1,5 @@
using System; using cpu.m68000;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO; using System.IO;
using cpu.m68000;
namespace mame namespace mame
{ {
@ -120,15 +116,15 @@ namespace mame
layer[i][j] = reader.ReadByte(); layer[i][j] = reader.ReadByte();
} }
} }
lhb2_pen_hi= reader.ReadByte(); lhb2_pen_hi = reader.ReadByte();
blitter.x= reader.ReadUInt16(); blitter.x = reader.ReadUInt16();
blitter.y= reader.ReadUInt16(); blitter.y = reader.ReadUInt16();
blitter.w= reader.ReadUInt16(); blitter.w = reader.ReadUInt16();
blitter.h= reader.ReadUInt16(); blitter.h = reader.ReadUInt16();
blitter.gfx_lo= reader.ReadUInt16(); blitter.gfx_lo = reader.ReadUInt16();
blitter.gfx_hi= reader.ReadUInt16(); blitter.gfx_hi = reader.ReadUInt16();
blitter.depth= reader.ReadUInt16(); blitter.depth = reader.ReadUInt16();
blitter.pen= reader.ReadUInt16(); blitter.pen = reader.ReadUInt16();
blitter.flags = reader.ReadUInt16(); blitter.flags = reader.ReadUInt16();
MC68000.m1.LoadStateBinary(reader); MC68000.m1.LoadStateBinary(reader);
Cpuint.LoadStateBinary(reader); Cpuint.LoadStateBinary(reader);

View File

@ -1,9 +1,4 @@
using System; namespace mame
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mame
{ {
public partial class IGS011 public partial class IGS011
{ {
@ -143,7 +138,7 @@ namespace mame
} }
private static void igs011_blit_x_w(ushort data) private static void igs011_blit_x_w(ushort data)
{ {
blitter.x=data; blitter.x = data;
} }
private static void igs011_blit_y_w(int offset, byte data) private static void igs011_blit_y_w(int offset, byte data)
{ {
@ -258,7 +253,7 @@ namespace mame
int clear, opaque, z; int clear, opaque, z;
byte trans_pen, clear_pen, pen_hi, pen = 0; byte trans_pen, clear_pen, pen_hi, pen = 0;
int gfx_size = gfx1rom.Length; int gfx_size = gfx1rom.Length;
int gfx2_size=0; int gfx2_size = 0;
if (gfx2rom != null) if (gfx2rom != null)
{ {
gfx2_size = gfx2rom.Length; gfx2_size = gfx2rom.Length;
@ -287,7 +282,7 @@ namespace mame
{ {
trans_pen = 0x0f; trans_pen = 0x0f;
} }
clear_pen =(byte)(blitter.pen | 0xf0); clear_pen = (byte)(blitter.pen | 0xf0);
} }
else else
{ {
@ -303,7 +298,7 @@ namespace mame
} }
xstart = (blitter.x & 0x1ff) - (blitter.x & 0x200); xstart = (blitter.x & 0x1ff) - (blitter.x & 0x200);
ystart = (blitter.y & 0x0ff) - (blitter.y & 0x100); ystart = (blitter.y & 0x0ff) - (blitter.y & 0x100);
if (flipx!=0) if (flipx != 0)
{ {
xend = xstart - (blitter.w & 0x1ff) - 1; xend = xstart - (blitter.w & 0x1ff) - 1;
xinc = -1; xinc = -1;
@ -327,7 +322,7 @@ namespace mame
{ {
for (x = xstart; x != xend; x += xinc) for (x = xstart; x != xend; x += xinc)
{ {
if (clear==0) if (clear == 0)
{ {
if (depth4) if (depth4)
{ {
@ -337,7 +332,7 @@ namespace mame
{ {
pen = gfx1rom[z % gfx_size]; pen = gfx1rom[z % gfx_size];
} }
if (gfx2rom!=null) if (gfx2rom != null)
{ {
pen &= 0x0f; pen &= 0x0f;
if ((gfx2rom[(z / 8) % gfx2_size] & (1 << (z & 7))) != 0) if ((gfx2rom[(z / 8) % gfx2_size] & (1 << (z & 7))) != 0)

View File

@ -1,9 +1,4 @@
using System; namespace mame
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mame
{ {
public partial class Konami68000 public partial class Konami68000
{ {
@ -105,7 +100,7 @@ namespace mame
} }
} }
} }
public static void common_drawgfxzoom_konami68000(byte[] bb1, int code, int color, int flipx, int flipy, int sx, int sy, RECT clip, int transparent_color, int scalex, int scaley,uint pri_mask) public static void common_drawgfxzoom_konami68000(byte[] bb1, int code, int color, int flipx, int flipy, int sx, int sy, RECT clip, int transparent_color, int scalex, int scaley, uint pri_mask)
{ {
if ((scalex == 0) || (scaley == 0)) if ((scalex == 0) || (scaley == 0))
{ {
@ -272,7 +267,7 @@ namespace mame
} }
public static void blockmove_8toN_transpen_pri16_konami68000(byte[] bb1, int code, int srcwidth, int srcheight, int srcmodulo, public static void blockmove_8toN_transpen_pri16_konami68000(byte[] bb1, int code, int srcwidth, int srcheight, int srcmodulo,
int leftskip, int topskip, int flipx, int flipy, int leftskip, int topskip, int flipx, int flipy,
int dstwidth, int dstheight, int colorbase,uint pmask, int sx, int sy) int dstwidth, int dstheight, int colorbase, uint pmask, int sx, int sy)
{ {
int ydir, xdir, col, i, j, offsetx, offsety; int ydir, xdir, col, i, j, offsetx, offsety;
int srcdata_offset = code * 0x100; int srcdata_offset = code * 0x100;
@ -307,9 +302,9 @@ namespace mame
col = bb1[srcdata_offset + srcmodulo * i + j]; col = bb1[srcdata_offset + srcmodulo * i + j];
if (col != 0) if (col != 0)
{ {
if (((1 << (Tilemap.priority_bitmap[offsety+ydir*i,offsetx+xdir*j] & 0x1f)) & pmask) == 0) if (((1 << (Tilemap.priority_bitmap[offsety + ydir * i, offsetx + xdir * j] & 0x1f)) & pmask) == 0)
{ {
if ((Tilemap.priority_bitmap[offsety + ydir * i, offsetx + xdir * j] & 0x80)!=0) if ((Tilemap.priority_bitmap[offsety + ydir * i, offsetx + xdir * j] & 0x80) != 0)
{ {
Video.bitmapbase[Video.curbitmap][(offsety + ydir * i) * 0x200 + offsetx + xdir * j] = (ushort)(colorbase + col);//palette_shadow_table[paldata[col]]; Video.bitmapbase[Video.curbitmap][(offsety + ydir * i) * 0x200 + offsetx + xdir * j] = (ushort)(colorbase + col);//palette_shadow_table[paldata[col]];
} }

File diff suppressed because it is too large Load Diff

View File

@ -336,7 +336,7 @@ namespace mame
{ {
sbyte0 |= 0x02; sbyte0 |= 0x02;
} }
if(Keyboard.IsPressed(Key.D1)) if (Keyboard.IsPressed(Key.D1))
{ {
sbyte0 &= ~0x10; sbyte0 &= ~0x10;
} }
@ -635,7 +635,7 @@ namespace mame
{ {
sbyte2 |= 0x40; sbyte2 |= 0x40;
} }
if(Keyboard.IsPressed(Key.NumPad4)) if (Keyboard.IsPressed(Key.NumPad4))
{ {
sbyte2 &= unchecked((sbyte)~0x80); sbyte2 &= unchecked((sbyte)~0x80);
} }
@ -1380,7 +1380,7 @@ namespace mame
} }
public static void record_port_prmrsocr() public static void record_port_prmrsocr()
{ {
if (sbyte0 != sbyte0_old || sbyte1 != sbyte1_old || sbyte2 != sbyte2_old || sbyte3 != sbyte3_old || sbyte4 != sbyte4_old||bytee!=bytee_old) if (sbyte0 != sbyte0_old || sbyte1 != sbyte1_old || sbyte2 != sbyte2_old || sbyte3 != sbyte3_old || sbyte4 != sbyte4_old || bytee != bytee_old)
{ {
sbyte0_old = sbyte0; sbyte0_old = sbyte0;
sbyte1_old = sbyte1; sbyte1_old = sbyte1;

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