diff --git a/MAME.Core/AxiBitmap/AxiBitmap.cs b/MAME.Core/AxiBitmap/AxiBitmap.cs new file mode 100644 index 0000000..fdb4275 --- /dev/null +++ b/MAME.Core/AxiBitmap/AxiBitmap.cs @@ -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; + } + } +} diff --git a/MAME.Core/Common/cpsForm.cs b/MAME.Core/Common/cpsForm.cs deleted file mode 100644 index 740cfd3..0000000 --- a/MAME.Core/Common/cpsForm.cs +++ /dev/null @@ -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 tbResult = new List(); - #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); - } - } - } -} diff --git a/MAME.Core/Common/konami68000Form.cs b/MAME.Core/Common/konami68000Form.cs deleted file mode 100644 index c9fc5ed..0000000 --- a/MAME.Core/Common/konami68000Form.cs +++ /dev/null @@ -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"; - } - } -} diff --git a/MAME.Core/Log/EmuLogger.cs b/MAME.Core/Log/EmuLogger.cs new file mode 100644 index 0000000..cd6b43a --- /dev/null +++ b/MAME.Core/Log/EmuLogger.cs @@ -0,0 +1,25 @@ +using MAME.Core.run_interface; +using System; + +namespace mame +{ + public static class EmuLogger + { + + #region 抽象出去 + static Action 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 + } +} diff --git a/MAME.Core/MAME.Core.csproj b/MAME.Core/MAME.Core.csproj index 3cff39f..3cdfdb5 100644 --- a/MAME.Core/MAME.Core.csproj +++ b/MAME.Core/MAME.Core.csproj @@ -5,9 +5,4 @@ True - - - - - diff --git a/MAME.Core/Common/cheatForm.cs b/MAME.Core/Motion/cheatMotion.cs similarity index 61% rename from MAME.Core/Common/cheatForm.cs rename to MAME.Core/Motion/cheatMotion.cs index 65c9e5d..036e0df 100644 --- a/MAME.Core/Common/cheatForm.cs +++ b/MAME.Core/Motion/cheatMotion.cs @@ -3,11 +3,10 @@ using cpu.nec; using mame; using System; using System.Collections.Generic; -using System.Text; namespace MAME.Core.Common { - public partial class cheatForm + public partial class cheatMotion { public enum LockState { @@ -15,7 +14,6 @@ namespace MAME.Core.Common LOCK_SECOND, LOCK_FRAME, } - private mainForm _myParentForm; public LockState lockState = LockState.LOCK_NONE; public List lsCheatdata1; public List lsCheatdata2; @@ -27,9 +25,8 @@ namespace MAME.Core.Common #region List mTxList_tbResult = new List(); #endregion - public cheatForm(mainForm form) + public cheatMotion() { - this._myParentForm = form; cheatForm_Load(); } private void cheatForm_Load() @@ -69,45 +66,45 @@ namespace MAME.Core.Common } private void GetCheatdata() { - // lsCheatdata1 = new List(); - // lsCheatdata2 = new List(); - // int i1, i2, i3, iAddress, iOffsetAddress1, iOffsetAddress2, iValue2, n3; - // string[] ss1, ss2, ss3; - // foreach (ListViewItem item1 in listViewControl1.myListView.Items) - // { - // if (item1.Checked) - // { - // i1 = listViewControl1.myListView.Items.IndexOf(item1); - // i2 = Array.IndexOf(listViewControl1.ssCItem[i1], item1.SubItems[1].Text); - // ss1 = listViewControl1.ssCValue[i1][i2].Split(sde7, StringSplitOptions.RemoveEmptyEntries); - // n3 = ss1.Length; - // for (i3 = 0; i3 < n3; i3++) - // { - // ss3 = ss1[i3].Split(sde6, StringSplitOptions.RemoveEmptyEntries); - // iValue2 = Convert.ToInt32(ss3[1], 16); - // if (ss3[0].IndexOf("$") >= 0) - // { - // ss2 = ss3[0].Split(sde9, StringSplitOptions.RemoveEmptyEntries); - // iOffsetAddress1 = Convert.ToInt32(ss2[0], 16); - // iOffsetAddress2 = Convert.ToInt32(ss2[1], 16); - // lsCheatdata1.Add(new int[] { iOffsetAddress1, iOffsetAddress2, iValue2 }); - // } - // else if (ss3[0].IndexOf("+") >= 0) - // { - // ss2 = ss3[0].Split(sde10, StringSplitOptions.RemoveEmptyEntries); - // iOffsetAddress1 = Convert.ToInt32(ss2[0], 16); - // iOffsetAddress2 = Convert.ToInt32(ss2[1], 16); - // iAddress = iOffsetAddress1 + iOffsetAddress2; - // lsCheatdata2.Add(new int[] { iAddress, iValue2 }); - // } - // else - // { - // iAddress = Convert.ToInt32(ss3[0], 16); - // lsCheatdata2.Add(new int[] { iAddress, iValue2 }); - // } - // } - // } - // } + // lsCheatdata1 = new List(); + // lsCheatdata2 = new List(); + // int i1, i2, i3, iAddress, iOffsetAddress1, iOffsetAddress2, iValue2, n3; + // string[] ss1, ss2, ss3; + // foreach (ListViewItem item1 in listViewControl1.myListView.Items) + // { + // if (item1.Checked) + // { + // i1 = listViewControl1.myListView.Items.IndexOf(item1); + // i2 = Array.IndexOf(listViewControl1.ssCItem[i1], item1.SubItems[1].Text); + // ss1 = listViewControl1.ssCValue[i1][i2].Split(sde7, StringSplitOptions.RemoveEmptyEntries); + // n3 = ss1.Length; + // for (i3 = 0; i3 < n3; i3++) + // { + // ss3 = ss1[i3].Split(sde6, StringSplitOptions.RemoveEmptyEntries); + // iValue2 = Convert.ToInt32(ss3[1], 16); + // if (ss3[0].IndexOf("$") >= 0) + // { + // ss2 = ss3[0].Split(sde9, StringSplitOptions.RemoveEmptyEntries); + // iOffsetAddress1 = Convert.ToInt32(ss2[0], 16); + // iOffsetAddress2 = Convert.ToInt32(ss2[1], 16); + // lsCheatdata1.Add(new int[] { iOffsetAddress1, iOffsetAddress2, iValue2 }); + // } + // else if (ss3[0].IndexOf("+") >= 0) + // { + // ss2 = ss3[0].Split(sde10, StringSplitOptions.RemoveEmptyEntries); + // iOffsetAddress1 = Convert.ToInt32(ss2[0], 16); + // iOffsetAddress2 = Convert.ToInt32(ss2[1], 16); + // iAddress = iOffsetAddress1 + iOffsetAddress2; + // lsCheatdata2.Add(new int[] { iAddress, iValue2 }); + // } + // else + // { + // iAddress = Convert.ToInt32(ss3[0], 16); + // lsCheatdata2.Add(new int[] { iAddress, iValue2 }); + // } + // } + // } + // } } public void ApplyCheat() { diff --git a/MAME.Core/Motion/cpsMotion.cs b/MAME.Core/Motion/cpsMotion.cs new file mode 100644 index 0000000..529e678 --- /dev/null +++ b/MAME.Core/Motion/cpsMotion.cs @@ -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 tbResult = new List(); + #endregion + public cpsMotion() + { + } + } +} diff --git a/MAME.Core/Motion/konami68000Motion.cs b/MAME.Core/Motion/konami68000Motion.cs new file mode 100644 index 0000000..04b8f59 --- /dev/null +++ b/MAME.Core/Motion/konami68000Motion.cs @@ -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"; + } + } +} diff --git a/MAME.Core/Common/m68000Form.cs b/MAME.Core/Motion/m68000Motion.cs similarity index 94% rename from MAME.Core/Common/m68000Form.cs rename to MAME.Core/Motion/m68000Motion.cs index ca79b0d..51c6f93 100644 --- a/MAME.Core/Common/m68000Form.cs +++ b/MAME.Core/Motion/m68000Motion.cs @@ -1,18 +1,11 @@ using cpu.m68000; -using mame; using System; using System.Collections.Generic; -using System.Drawing; -using System.Globalization; -using System.Text; -using System.Threading.Tasks; -using static System.Net.Mime.MediaTypeNames; namespace MAME.Core.Common { - public class m68000Form + public class m68000Motion { - private mainForm _myParentForm; private string[] sde6 = new string[1] { "," }, sde7 = new string[1] { ";" }, sde9 = new string[1] { "$" }, sde10 = new string[] { "+" }; private bool bLogNew, bNew; public static int iStatus, iRAddress, iWAddress, iROp, iWOp, iValue; @@ -41,8 +34,8 @@ namespace MAME.Core.Common Boolean b_cbPC = false; Boolean b_cbTotal = false; Boolean b_cbLog = false; - string mTx_tbIML = string.Empty; - string mTx_tbUSP = string.Empty; + string mTx_tbIML = string.Empty; + string mTx_tbUSP = string.Empty; string mTx_tbSSP = string.Empty; string mTx_tbCycles = string.Empty; string mTx_tbPC = string.Empty; @@ -61,9 +54,8 @@ namespace MAME.Core.Common M68000_STOP, } public static M68000State m68000State, m68000FState; - public m68000Form(mainForm form) + public m68000Motion() { - this._myParentForm = form; int i; mTxList_tbDs = new string[8]; mTxList_tbAs = new string[8]; diff --git a/MAME.Core/Common/m6809Form.cs b/MAME.Core/Motion/m6809Motion.cs similarity index 70% rename from MAME.Core/Common/m6809Form.cs rename to MAME.Core/Motion/m6809Motion.cs index 7a30600..7910a20 100644 --- a/MAME.Core/Common/m6809Form.cs +++ b/MAME.Core/Motion/m6809Motion.cs @@ -1,16 +1,12 @@ using cpu.m6809; using mame; -using System; using System.Collections.Generic; -using System.Globalization; -using static System.Net.Mime.MediaTypeNames; namespace MAME.Core.Common { - public partial class m6809Form + public partial class m6809Motion { - private mainForm _myParentForm; //private Disassembler disassembler; private bool bLogNew; public static int iStatus; @@ -38,29 +34,28 @@ namespace MAME.Core.Common public string tbDisassemble = string.Empty; #endregion - public m6809Form(mainForm form) + public m6809Motion() { - this._myParentForm = form; } public void GetData() { int reg, offset; reg = M6809.mm1[0].PPC.LowWord / 0x2000; offset = M6809.mm1[0].PPC.LowWord & 0x1fff; - tbD = M6809.mm1[0].D.LowWord.ToString("X4"); - tbDp = M6809.mm1[0].DP.LowWord.ToString("X4"); - tbU = M6809.mm1[0].U.LowWord.ToString("X4"); - tbS = M6809.mm1[0].S.LowWord.ToString("X4"); - tbX = M6809.mm1[0].X.LowWord.ToString("X4"); - tbY = M6809.mm1[0].Y.LowWord.ToString("X4"); - tbCc = M6809.mm1[0].CC.ToString("X2"); - tbIrqstate0 = M6809.mm1[0].irq_state[0].ToString("X2"); - tbIrqstate1 = M6809.mm1[0].irq_state[1].ToString("X2"); - tbIntstate = M6809.mm1[0].int_state.ToString("X2"); - tbNmistate = M6809.mm1[0].nmi_state.ToString("X2"); - tbPPC = (Namcos1.user1rom_offset[0, reg] + offset).ToString("X6"); - tbCycles = M6809.mm1[0].TotalExecutedCycles.ToString("X16"); - tbDisassemble = M6809.mm1[0].m6809_dasm(M6809.mm1[0].PPC.LowWord); + tbD = M6809.mm1[0].D.LowWord.ToString("X4"); + tbDp = M6809.mm1[0].DP.LowWord.ToString("X4"); + tbU = M6809.mm1[0].U.LowWord.ToString("X4"); + tbS = M6809.mm1[0].S.LowWord.ToString("X4"); + tbX = M6809.mm1[0].X.LowWord.ToString("X4"); + tbY = M6809.mm1[0].Y.LowWord.ToString("X4"); + tbCc = M6809.mm1[0].CC.ToString("X2"); + tbIrqstate0 = M6809.mm1[0].irq_state[0].ToString("X2"); + tbIrqstate1 = M6809.mm1[0].irq_state[1].ToString("X2"); + tbIntstate = M6809.mm1[0].int_state.ToString("X2"); + tbNmistate = M6809.mm1[0].nmi_state.ToString("X2"); + tbPPC = (Namcos1.user1rom_offset[0, reg] + offset).ToString("X6"); + tbCycles = M6809.mm1[0].TotalExecutedCycles.ToString("X16"); + tbDisassemble = M6809.mm1[0].m6809_dasm(M6809.mm1[0].PPC.LowWord); } public void m6809_start_debug() diff --git a/MAME.Core/Common/mainForm.cs b/MAME.Core/Motion/mainMotion.cs similarity index 93% rename from MAME.Core/Common/mainForm.cs rename to MAME.Core/Motion/mainMotion.cs index 7b22a6a..265cb27 100644 --- a/MAME.Core/Common/mainForm.cs +++ b/MAME.Core/Motion/mainMotion.cs @@ -1,52 +1,60 @@ using mame; using MAME.Core.run_interface; -using System; using System.Collections.Generic; -using System.IO; using System.Linq; +using System.Threading; using System.Xml.Linq; namespace MAME.Core.Common { - public class mainForm + public class mainMotion { public string tsslStatus; - public cheatForm cheatform; - public m68000Form m68000form; - public z80Form z80form; - public m6809Form m6809form; - public cpsForm cpsform; - public neogeoForm neogeoform; - public konami68000Form konami68000form; + public cheatMotion cheatmotion; + public m68000Motion m68000motion; + public z80Motion z80motion; + public m6809Motion m6809motion; + public cpsMotion cpsmotion; + public neogeoMotion neogeomotion; + public konami68000Motion konami68000motion; public string sSelect; + public static Thread t1; public static IResources resource; - public mainForm() + public mainMotion() { - neogeoform = new neogeoForm(this); - cheatform = new cheatForm(this); - m68000form = new m68000Form(this); - m6809form = new m6809Form(this); - z80form = new z80Form(this); - cpsform = new cpsForm(this); - konami68000form = new konami68000Form(this); + neogeomotion = new neogeoMotion(); + cheatmotion = new cheatMotion(); + m68000motion = new m68000Motion(); + m6809motion = new m6809Motion(); + z80motion = new z80Motion(); + cpsmotion = new cpsMotion(); + konami68000motion = new konami68000Motion(); } - public void Init(IResources iRes, + public void Init( + string RomDir, + ILog ilog, + IResources iRes, IVideoPlayer ivp, ISoundPlayer isp, IKeyboard ikb, IMouse imou) { + Mame.RomRoot = RomDir; + EmuLogger.BindFunc(ilog); Video.BindFunc(ivp); Sound.BindFunc(isp); resource = iRes; - StreamReader sr1 = new StreamReader("mame.ini"); - sr1.ReadLine(); - sSelect = sr1.ReadLine(); - sr1.Close(); + //StreamReader sr1 = new StreamReader("mame.ini"); + //sr1.ReadLine(); + //sSelect = sr1.ReadLine(); + //sr1.Close(); + + //TODO 上次选择 + sSelect = "samsho2"; RomInfo.Rom = new RomInfo(); @@ -87,7 +95,7 @@ namespace MAME.Core.Common RomInfo.Rom = RomInfo.GetRomByName(Name); if (RomInfo.Rom == null) { - Console.WriteLine("Not Found"); + EmuLogger.Log("Not Found"); return; } @@ -207,13 +215,13 @@ namespace MAME.Core.Common } if (Machine.bRom) { - Console.Write("MAME.NET: " + Machine.sDescription + " [" + Machine.sName + "]"); + EmuLogger.Log("MAME.NET: " + Machine.sDescription + " [" + Machine.sName + "]"); Mame.init_machine(this); Generic.nvram_load(); } else { - Console.Write("error rom"); + EmuLogger.Log("error rom"); } } diff --git a/MAME.Core/Common/neogeoForm.cs b/MAME.Core/Motion/neogeoMotion.cs similarity index 91% rename from MAME.Core/Common/neogeoForm.cs rename to MAME.Core/Motion/neogeoMotion.cs index 6438439..0a55ffd 100644 --- a/MAME.Core/Common/neogeoForm.cs +++ b/MAME.Core/Motion/neogeoMotion.cs @@ -1,17 +1,12 @@ using mame; using System; using System.Collections.Generic; -using System.Drawing; -using System.Drawing.Imaging; -using System.Globalization; using System.IO; -using static System.Net.Mime.MediaTypeNames; namespace MAME.Core.Common { - public partial class neogeoForm + public partial class neogeoMotion { - private mainForm _myParentForm; private string[] sde2 = new string[] { "," }; private int locationX, locationY; public List tbResult; @@ -20,15 +15,13 @@ namespace MAME.Core.Common public string tbFile = string.Empty; public string tbSOffset = string.Empty; public string tbPensoffset = string.Empty; - public Bitmap pictureBox1; #region bool cbL0 = false; bool cbL1 = false; #endregion - public neogeoForm(mainForm form) + public neogeoMotion() { - this._myParentForm = form; tbResult = new List(); neogeoForm_Load(); } diff --git a/MAME.Core/Common/z80Form.cs b/MAME.Core/Motion/z80Motion.cs similarity index 89% rename from MAME.Core/Common/z80Form.cs rename to MAME.Core/Motion/z80Motion.cs index 42af127..ea0d21f 100644 --- a/MAME.Core/Common/z80Form.cs +++ b/MAME.Core/Motion/z80Motion.cs @@ -1,8 +1,5 @@ using cpu.z80; -using System; using System.Collections.Generic; -using System.Globalization; -using static System.Net.Mime.MediaTypeNames; namespace MAME.Core.Common { @@ -15,9 +12,8 @@ namespace MAME.Core.Common STEP3, STOP, } - public partial class z80Form + public partial class z80Motion { - private mainForm _myParentForm; private Disassembler disassembler; private bool bLogNew; public static int iStatus; @@ -34,15 +30,15 @@ namespace MAME.Core.Common string mTx_tbShadowBC = string.Empty; string mTx_tbShadowDE = string.Empty; string mTx_tbShadowHL = string.Empty; - string mTx_tbI = string.Empty; - string mTx_tbR = string.Empty; - string mTx_tbIX = string.Empty; - string mTx_tbIY = string.Empty; - string mTx_tbSP = string.Empty; + string mTx_tbI = string.Empty; + string mTx_tbR = string.Empty; + string mTx_tbIX = string.Empty; + string mTx_tbIY = string.Empty; + string mTx_tbSP = string.Empty; string mTx_tbRPC = string.Empty; string mTx_tbPPC = string.Empty; - string mTx_tbR2 = string.Empty; - string mTx_tbWZ = string.Empty; + string mTx_tbR2 = string.Empty; + string mTx_tbWZ = string.Empty; string mTx_tbCycles = string.Empty; string mTx_tbDisassemble = string.Empty; @@ -59,9 +55,8 @@ namespace MAME.Core.Common Z80A_STOP, } public static Z80AState z80State, z80FState; - public z80Form(mainForm form) + public z80Motion() { - this._myParentForm = form; disassembler = new Disassembler(); Disassembler.GenerateOpcodeSizes(); } diff --git a/MAME.Core/cpu/m6502/Ill02.cs b/MAME.Core/cpu/m6502/Ill02.cs index e4613e7..5065c35 100644 --- a/MAME.Core/cpu/m6502/Ill02.cs +++ b/MAME.Core/cpu/m6502/Ill02.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace cpu.m6502 +namespace cpu.m6502 { public partial class M6502 { diff --git a/MAME.Core/cpu/m6502/M6502.cs b/MAME.Core/cpu/m6502/M6502.cs index 159544b..33a1a2a 100644 --- a/MAME.Core/cpu/m6502/M6502.cs +++ b/MAME.Core/cpu/m6502/M6502.cs @@ -1,19 +1,16 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using mame; +using System; using System.IO; -using mame; namespace cpu.m6502 { public partial class M6502 : cpuexec_data - { + { public static M6502[] mm1; - public Action[] insn,insn6502; + public Action[] insn, insn6502; public byte subtype; - public Register ppc,pc,sp,zp,ea; - public byte p,a,x,y,pending_irq,after_cli,nmi_state,irq_state,so_state; + public Register ppc, pc, sp, zp, ea; + public byte p, a, x, y, pending_irq, after_cli, nmi_state, irq_state, so_state; public delegate int irq_delegate(int i); public irq_delegate irq_callback; public delegate byte read8handler(ushort offset); @@ -21,7 +18,7 @@ namespace cpu.m6502 public read8handler rdmem_id; public write8handler wrmem_id; private ushort M6502_NMI_VEC = 0xfffa, M6502_RST_VEC = 0xfffc, M6502_IRQ_VEC = 0xfffe; - private int M6502_SET_OVERFLOW=1; + private int M6502_SET_OVERFLOW = 1; private int m6502_IntOccured; protected ulong totalExecutedCycles; protected int pendingCycles; @@ -54,7 +51,7 @@ namespace cpu.m6502 { return ReadMemory(offset); } - private void default_wdmem_id(ushort offset,byte data ) + private void default_wdmem_id(ushort offset, byte data) { WriteMemory(offset, data); } @@ -62,37 +59,37 @@ namespace cpu.m6502 { insn6502 = new Action[]{ m6502_00,m6502_01,m6502_02,m6502_03,m6502_04,m6502_05,m6502_06,m6502_07, - m6502_08,m6502_09,m6502_0a,m6502_0b,m6502_0c,m6502_0d,m6502_0e,m6502_0f, - m6502_10,m6502_11,m6502_12,m6502_13,m6502_14,m6502_15,m6502_16,m6502_17, - m6502_18,m6502_19,m6502_1a,m6502_1b,m6502_1c,m6502_1d,m6502_1e,m6502_1f, - m6502_20,m6502_21,m6502_22,m6502_23,m6502_24,m6502_25,m6502_26,m6502_27, - m6502_28,m6502_29,m6502_2a,m6502_2b,m6502_2c,m6502_2d,m6502_2e,m6502_2f, - m6502_30,m6502_31,m6502_32,m6502_33,m6502_34,m6502_35,m6502_36,m6502_37, - m6502_38,m6502_39,m6502_3a,m6502_3b,m6502_3c,m6502_3d,m6502_3e,m6502_3f, - m6502_40,m6502_41,m6502_42,m6502_43,m6502_44,m6502_45,m6502_46,m6502_47, - m6502_48,m6502_49,m6502_4a,m6502_4b,m6502_4c,m6502_4d,m6502_4e,m6502_4f, - m6502_50,m6502_51,m6502_52,m6502_53,m6502_54,m6502_55,m6502_56,m6502_57, - m6502_58,m6502_59,m6502_5a,m6502_5b,m6502_5c,m6502_5d,m6502_5e,m6502_5f, - m6502_60,m6502_61,m6502_62,m6502_63,m6502_64,m6502_65,m6502_66,m6502_67, - m6502_68,m6502_69,m6502_6a,m6502_6b,m6502_6c,m6502_6d,m6502_6e,m6502_6f, - m6502_70,m6502_71,m6502_72,m6502_73,m6502_74,m6502_75,m6502_76,m6502_77, - m6502_78,m6502_79,m6502_7a,m6502_7b,m6502_7c,m6502_7d,m6502_7e,m6502_7f, - m6502_80,m6502_81,m6502_82,m6502_83,m6502_84,m6502_85,m6502_86,m6502_87, - m6502_88,m6502_89,m6502_8a,m6502_8b,m6502_8c,m6502_8d,m6502_8e,m6502_8f, - m6502_90,m6502_91,m6502_92,m6502_93,m6502_94,m6502_95,m6502_96,m6502_97, - m6502_98,m6502_99,m6502_9a,m6502_9b,m6502_9c,m6502_9d,m6502_9e,m6502_9f, - m6502_a0,m6502_a1,m6502_a2,m6502_a3,m6502_a4,m6502_a5,m6502_a6,m6502_a7, - m6502_a8,m6502_a9,m6502_aa,m6502_ab,m6502_ac,m6502_ad,m6502_ae,m6502_af, - m6502_b0,m6502_b1,m6502_b2,m6502_b3,m6502_b4,m6502_b5,m6502_b6,m6502_b7, - m6502_b8,m6502_b9,m6502_ba,m6502_bb,m6502_bc,m6502_bd,m6502_be,m6502_bf, - m6502_c0,m6502_c1,m6502_c2,m6502_c3,m6502_c4,m6502_c5,m6502_c6,m6502_c7, - m6502_c8,m6502_c9,m6502_ca,m6502_cb,m6502_cc,m6502_cd,m6502_ce,m6502_cf, - m6502_d0,m6502_d1,m6502_d2,m6502_d3,m6502_d4,m6502_d5,m6502_d6,m6502_d7, - m6502_d8,m6502_d9,m6502_da,m6502_db,m6502_dc,m6502_dd,m6502_de,m6502_df, - m6502_e0,m6502_e1,m6502_e2,m6502_e3,m6502_e4,m6502_e5,m6502_e6,m6502_e7, - m6502_e8,m6502_e9,m6502_ea,m6502_eb,m6502_ec,m6502_ed,m6502_ee,m6502_ef, - m6502_f0,m6502_f1,m6502_f2,m6502_f3,m6502_f4,m6502_f5,m6502_f6,m6502_f7, - m6502_f8,m6502_f9,m6502_fa,m6502_fb,m6502_fc,m6502_fd,m6502_fe,m6502_ff + m6502_08,m6502_09,m6502_0a,m6502_0b,m6502_0c,m6502_0d,m6502_0e,m6502_0f, + m6502_10,m6502_11,m6502_12,m6502_13,m6502_14,m6502_15,m6502_16,m6502_17, + m6502_18,m6502_19,m6502_1a,m6502_1b,m6502_1c,m6502_1d,m6502_1e,m6502_1f, + m6502_20,m6502_21,m6502_22,m6502_23,m6502_24,m6502_25,m6502_26,m6502_27, + m6502_28,m6502_29,m6502_2a,m6502_2b,m6502_2c,m6502_2d,m6502_2e,m6502_2f, + m6502_30,m6502_31,m6502_32,m6502_33,m6502_34,m6502_35,m6502_36,m6502_37, + m6502_38,m6502_39,m6502_3a,m6502_3b,m6502_3c,m6502_3d,m6502_3e,m6502_3f, + m6502_40,m6502_41,m6502_42,m6502_43,m6502_44,m6502_45,m6502_46,m6502_47, + m6502_48,m6502_49,m6502_4a,m6502_4b,m6502_4c,m6502_4d,m6502_4e,m6502_4f, + m6502_50,m6502_51,m6502_52,m6502_53,m6502_54,m6502_55,m6502_56,m6502_57, + m6502_58,m6502_59,m6502_5a,m6502_5b,m6502_5c,m6502_5d,m6502_5e,m6502_5f, + m6502_60,m6502_61,m6502_62,m6502_63,m6502_64,m6502_65,m6502_66,m6502_67, + m6502_68,m6502_69,m6502_6a,m6502_6b,m6502_6c,m6502_6d,m6502_6e,m6502_6f, + m6502_70,m6502_71,m6502_72,m6502_73,m6502_74,m6502_75,m6502_76,m6502_77, + m6502_78,m6502_79,m6502_7a,m6502_7b,m6502_7c,m6502_7d,m6502_7e,m6502_7f, + m6502_80,m6502_81,m6502_82,m6502_83,m6502_84,m6502_85,m6502_86,m6502_87, + m6502_88,m6502_89,m6502_8a,m6502_8b,m6502_8c,m6502_8d,m6502_8e,m6502_8f, + m6502_90,m6502_91,m6502_92,m6502_93,m6502_94,m6502_95,m6502_96,m6502_97, + m6502_98,m6502_99,m6502_9a,m6502_9b,m6502_9c,m6502_9d,m6502_9e,m6502_9f, + m6502_a0,m6502_a1,m6502_a2,m6502_a3,m6502_a4,m6502_a5,m6502_a6,m6502_a7, + m6502_a8,m6502_a9,m6502_aa,m6502_ab,m6502_ac,m6502_ad,m6502_ae,m6502_af, + m6502_b0,m6502_b1,m6502_b2,m6502_b3,m6502_b4,m6502_b5,m6502_b6,m6502_b7, + m6502_b8,m6502_b9,m6502_ba,m6502_bb,m6502_bc,m6502_bd,m6502_be,m6502_bf, + m6502_c0,m6502_c1,m6502_c2,m6502_c3,m6502_c4,m6502_c5,m6502_c6,m6502_c7, + m6502_c8,m6502_c9,m6502_ca,m6502_cb,m6502_cc,m6502_cd,m6502_ce,m6502_cf, + m6502_d0,m6502_d1,m6502_d2,m6502_d3,m6502_d4,m6502_d5,m6502_d6,m6502_d7, + m6502_d8,m6502_d9,m6502_da,m6502_db,m6502_dc,m6502_dd,m6502_de,m6502_df, + m6502_e0,m6502_e1,m6502_e2,m6502_e3,m6502_e4,m6502_e5,m6502_e6,m6502_e7, + m6502_e8,m6502_e9,m6502_ea,m6502_eb,m6502_ec,m6502_ed,m6502_ee,m6502_ef, + m6502_f0,m6502_f1,m6502_f2,m6502_f3,m6502_f4,m6502_f5,m6502_f6,m6502_f7, + m6502_f8,m6502_f9,m6502_fa,m6502_fb,m6502_fc,m6502_fd,m6502_fe,m6502_ff }; insn = insn6502; } @@ -158,18 +155,18 @@ namespace cpu.m6502 byte op; ppc.d = pc.d; //debugger_instruction_hook(Machine, PCD); - if (pending_irq!=0) + if (pending_irq != 0) { m6502_take_irq(); } - op=ReadOp(pc.LowWord); + op = ReadOp(pc.LowWord); pc.LowWord++; pendingCycles -= 1; insn[op](); - if (after_cli!=0) + if (after_cli != 0) { after_cli = 0; - if (irq_state !=(byte)LineState.CLEAR_LINE) + if (irq_state != (byte)LineState.CLEAR_LINE) { pending_irq = 1; } diff --git a/MAME.Core/cpu/m6502/M6502op.cs b/MAME.Core/cpu/m6502/M6502op.cs index f2fd185..b7885a8 100644 --- a/MAME.Core/cpu/m6502/M6502op.cs +++ b/MAME.Core/cpu/m6502/M6502op.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using mame; - -namespace cpu.m6502 +namespace cpu.m6502 { public partial class M6502 { @@ -30,7 +24,7 @@ namespace cpu.m6502 protected void m6502_21() { int tmp; EA_IDX(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; AND(tmp); } protected void m6502_41() { int tmp; EA_IDX(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; EOR(tmp); } protected void m6502_61() { int tmp; EA_IDX(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; ADC(tmp); } - protected void m6502_81() { int tmp=0; STA(ref tmp); EA_IDX(); wrmem_id((ushort)ea.d, (byte)tmp); pendingCycles -= 1; } + protected void m6502_81() { int tmp = 0; STA(ref tmp); EA_IDX(); wrmem_id((ushort)ea.d, (byte)tmp); pendingCycles -= 1; } protected void m6502_a1() { int tmp; EA_IDX(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; LDA(tmp); } protected void m6502_c1() { int tmp; EA_IDX(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; CMP(tmp); } protected void m6502_e1() { int tmp; EA_IDX(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; SBC(tmp); } @@ -39,7 +33,7 @@ namespace cpu.m6502 protected void m6502_31() { int tmp; EA_IDY_P(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; AND(tmp); } protected void m6502_51() { int tmp; EA_IDY_P(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; EOR(tmp); } protected void m6502_71() { int tmp; EA_IDY_P(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; ADC(tmp); } - protected void m6502_91() { int tmp=0; STA(ref tmp); EA_IDY_NP(); wrmem_id((ushort)ea.d, (byte)tmp); pendingCycles -= 1; } + protected void m6502_91() { int tmp = 0; STA(ref tmp); EA_IDY_NP(); wrmem_id((ushort)ea.d, (byte)tmp); pendingCycles -= 1; } protected void m6502_b1() { int tmp; EA_IDY_P(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; LDA(tmp); } protected void m6502_d1() { int tmp; EA_IDY_P(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; CMP(tmp); } protected void m6502_f1() { int tmp; EA_IDY_P(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; SBC(tmp); } @@ -66,7 +60,7 @@ namespace cpu.m6502 protected void m6502_23() { int tmp; EA_IDX(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; WRMEM((ushort)ea.d, (byte)tmp); RLA(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_43() { int tmp; EA_IDX(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; WRMEM((ushort)ea.d, (byte)tmp); SRE(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_63() { int tmp; EA_IDX(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; WRMEM((ushort)ea.d, (byte)tmp); RRA(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } - protected void m6502_83() { int tmp=0; SAX(ref tmp); EA_IDX(); wrmem_id((ushort)ea.d, (byte)tmp); pendingCycles -= 1; } + protected void m6502_83() { int tmp = 0; SAX(ref tmp); EA_IDX(); wrmem_id((ushort)ea.d, (byte)tmp); pendingCycles -= 1; } protected void m6502_a3() { int tmp; EA_IDX(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; LAX(tmp); } protected void m6502_c3() { int tmp; EA_IDX(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; WRMEM((ushort)ea.d, (byte)tmp); DCP(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_e3() { int tmp; EA_IDX(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; WRMEM((ushort)ea.d, (byte)tmp); ISB(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } @@ -75,7 +69,7 @@ namespace cpu.m6502 protected void m6502_33() { int tmp; EA_IDY_NP(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; WRMEM((ushort)ea.d, (byte)tmp); RLA(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_53() { int tmp; EA_IDY_NP(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; WRMEM((ushort)ea.d, (byte)tmp); SRE(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_73() { int tmp; EA_IDY_NP(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; WRMEM((ushort)ea.d, (byte)tmp); RRA(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } - protected void m6502_93() { int tmp=0; EA_IDY_NP(); SAH(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } + protected void m6502_93() { int tmp = 0; EA_IDY_NP(); SAH(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_b3() { int tmp; EA_IDY_P(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; LAX(tmp); } protected void m6502_d3() { int tmp; EA_IDY_NP(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; WRMEM((ushort)ea.d, (byte)tmp); DCP(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_f3() { int tmp; EA_IDY_NP(); tmp = rdmem_id((ushort)ea.d); pendingCycles -= 1; WRMEM((ushort)ea.d, (byte)tmp); ISB(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } @@ -84,7 +78,7 @@ namespace cpu.m6502 protected void m6502_24() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); BIT(tmp); } protected void m6502_44() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); } protected void m6502_64() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); } - protected void m6502_84() { int tmp=0; STY(ref tmp); EA_ZPG(); WRMEM((ushort)ea.d, (byte)tmp); } + protected void m6502_84() { int tmp = 0; STY(ref tmp); EA_ZPG(); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_a4() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); LDY(tmp); } protected void m6502_c4() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); CPY(tmp); } protected void m6502_e4() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); CPX(tmp); } @@ -93,7 +87,7 @@ namespace cpu.m6502 protected void m6502_34() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); } protected void m6502_54() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); } protected void m6502_74() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); } - protected void m6502_94() { int tmp=0; STY(ref tmp); EA_ZPX(); WRMEM((ushort)ea.d, (byte)tmp); } + protected void m6502_94() { int tmp = 0; STY(ref tmp); EA_ZPX(); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_b4() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); LDY(tmp); } protected void m6502_d4() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); } protected void m6502_f4() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); } @@ -102,7 +96,7 @@ namespace cpu.m6502 protected void m6502_25() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); AND(tmp); } protected void m6502_45() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); EOR(tmp); } protected void m6502_65() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); ADC(tmp); } - protected void m6502_85() { int tmp=0; STA(ref tmp); EA_ZPG(); WRMEM((ushort)ea.d, (byte)tmp); } + protected void m6502_85() { int tmp = 0; STA(ref tmp); EA_ZPG(); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_a5() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); LDA(tmp); } protected void m6502_c5() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); CMP(tmp); } protected void m6502_e5() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); SBC(tmp); } @@ -111,7 +105,7 @@ namespace cpu.m6502 protected void m6502_35() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); AND(tmp); } protected void m6502_55() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); EOR(tmp); } protected void m6502_75() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); ADC(tmp); } - protected void m6502_95() { int tmp=0; STA(ref tmp); EA_ZPX(); WRMEM((ushort)ea.d, (byte)tmp); } + protected void m6502_95() { int tmp = 0; STA(ref tmp); EA_ZPX(); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_b5() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); LDA(tmp); } protected void m6502_d5() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); CMP(tmp); } protected void m6502_f5() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); SBC(tmp); } @@ -120,7 +114,7 @@ namespace cpu.m6502 protected void m6502_26() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); ROL(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_46() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); LSR(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_66() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); ROR(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } - protected void m6502_86() { int tmp=0; STX(ref tmp); EA_ZPG(); WRMEM((ushort)ea.d, (byte)tmp); } + protected void m6502_86() { int tmp = 0; STX(ref tmp); EA_ZPG(); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_a6() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); LDX(tmp); } protected void m6502_c6() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); DEC(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_e6() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); INC(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } @@ -129,7 +123,7 @@ namespace cpu.m6502 protected void m6502_36() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); ROL(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_56() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); LSR(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_76() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); ROR(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } - protected void m6502_96() { int tmp=0; STX(ref tmp); EA_ZPY(); WRMEM((ushort)ea.d, (byte)tmp); } + protected void m6502_96() { int tmp = 0; STX(ref tmp); EA_ZPY(); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_b6() { int tmp; EA_ZPY(); tmp = RDMEM((ushort)ea.d); LDX(tmp); } protected void m6502_d6() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); DEC(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_f6() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); INC(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } @@ -138,7 +132,7 @@ namespace cpu.m6502 protected void m6502_27() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); RLA(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_47() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); SRE(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_67() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); RRA(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } - protected void m6502_87() { int tmp=0; SAX(ref tmp); EA_ZPG(); WRMEM((ushort)ea.d, (byte)tmp); } + protected void m6502_87() { int tmp = 0; SAX(ref tmp); EA_ZPG(); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_a7() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); LAX(tmp); } protected void m6502_c7() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); DCP(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_e7() { int tmp; EA_ZPG(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); ISB(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } @@ -147,7 +141,7 @@ namespace cpu.m6502 protected void m6502_37() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); RLA(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_57() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); SRE(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_77() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); RRA(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } - protected void m6502_97() { int tmp=0; SAX(ref tmp); EA_ZPY(); WRMEM((ushort)ea.d, (byte)tmp); } + protected void m6502_97() { int tmp = 0; SAX(ref tmp); EA_ZPY(); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_b7() { int tmp; EA_ZPY(); tmp = RDMEM((ushort)ea.d); LAX(tmp); } protected void m6502_d7() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); DCP(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_f7() { int tmp; EA_ZPX(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); ISB(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } @@ -183,7 +177,7 @@ namespace cpu.m6502 protected void m6502_39() { int tmp; EA_ABY_P(); tmp = RDMEM((ushort)ea.d); AND(tmp); } protected void m6502_59() { int tmp; EA_ABY_P(); tmp = RDMEM((ushort)ea.d); EOR(tmp); } protected void m6502_79() { int tmp; EA_ABY_P(); tmp = RDMEM((ushort)ea.d); ADC(tmp); } - protected void m6502_99() { int tmp=0; STA(ref tmp); EA_ABY_NP(); WRMEM((ushort)ea.d, (byte)tmp); } + protected void m6502_99() { int tmp = 0; STA(ref tmp); EA_ABY_NP(); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_b9() { int tmp; EA_ABY_P(); tmp = RDMEM((ushort)ea.d); LDA(tmp); } protected void m6502_d9() { int tmp; EA_ABY_P(); tmp = RDMEM((ushort)ea.d); CMP(tmp); } protected void m6502_f9() { int tmp; EA_ABY_P(); tmp = RDMEM((ushort)ea.d); SBC(tmp); } @@ -219,7 +213,7 @@ namespace cpu.m6502 protected void m6502_3b() { int tmp; EA_ABY_NP(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); RLA(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_5b() { int tmp; EA_ABY_NP(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); SRE(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_7b() { int tmp; EA_ABY_NP(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); RRA(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } - protected void m6502_9b() { int tmp=0; EA_ABY_NP(); SSH(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } + protected void m6502_9b() { int tmp = 0; EA_ABY_NP(); SSH(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_bb() { int tmp; EA_ABY_P(); tmp = RDMEM((ushort)ea.d); AST(tmp); } protected void m6502_db() { int tmp; EA_ABY_NP(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); DCP(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_fb() { int tmp; EA_ABY_NP(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); ISB(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } @@ -228,7 +222,7 @@ namespace cpu.m6502 protected void m6502_2c() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); BIT(tmp); } protected void m6502_4c() { EA_ABS(); JMP(); } protected void m6502_6c() { int tmp; EA_IND(); JMP(); } - protected void m6502_8c() { int tmp=0; STY(ref tmp); EA_ABS(); WRMEM((ushort)ea.d, (byte)tmp); } + protected void m6502_8c() { int tmp = 0; STY(ref tmp); EA_ABS(); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_ac() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); LDY(tmp); } protected void m6502_cc() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); CPY(tmp); } protected void m6502_ec() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); CPX(tmp); } @@ -237,7 +231,7 @@ namespace cpu.m6502 protected void m6502_3c() { int tmp; EA_ABX_P(); tmp = RDMEM((ushort)ea.d); } protected void m6502_5c() { int tmp; EA_ABX_P(); tmp = RDMEM((ushort)ea.d); } protected void m6502_7c() { int tmp; EA_ABX_P(); tmp = RDMEM((ushort)ea.d); } - protected void m6502_9c() { int tmp=0; EA_ABX_NP(); SYH(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } + protected void m6502_9c() { int tmp = 0; EA_ABX_NP(); SYH(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_bc() { int tmp; EA_ABX_P(); tmp = RDMEM((ushort)ea.d); LDY(tmp); } protected void m6502_dc() { int tmp; EA_ABX_P(); tmp = RDMEM((ushort)ea.d); } protected void m6502_fc() { int tmp; EA_ABX_P(); tmp = RDMEM((ushort)ea.d); } @@ -246,7 +240,7 @@ namespace cpu.m6502 protected void m6502_2d() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); AND(tmp); } protected void m6502_4d() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); EOR(tmp); } protected void m6502_6d() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); ADC(tmp); } - protected void m6502_8d() { int tmp=0; STA(ref tmp); EA_ABS(); WRMEM((ushort)ea.d, (byte)tmp); } + protected void m6502_8d() { int tmp = 0; STA(ref tmp); EA_ABS(); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_ad() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); LDA(tmp); } protected void m6502_cd() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); CMP(tmp); } protected void m6502_ed() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); SBC(tmp); } @@ -255,7 +249,7 @@ namespace cpu.m6502 protected void m6502_3d() { int tmp; EA_ABX_P(); tmp = RDMEM((ushort)ea.d); AND(tmp); } protected void m6502_5d() { int tmp; EA_ABX_P(); tmp = RDMEM((ushort)ea.d); EOR(tmp); } protected void m6502_7d() { int tmp; EA_ABX_P(); tmp = RDMEM((ushort)ea.d); ADC(tmp); } - protected void m6502_9d() { int tmp=0; STA(ref tmp); EA_ABX_NP(); WRMEM((ushort)ea.d, (byte)tmp); } + protected void m6502_9d() { int tmp = 0; STA(ref tmp); EA_ABX_NP(); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_bd() { int tmp; EA_ABX_P(); tmp = RDMEM((ushort)ea.d); LDA(tmp); } protected void m6502_dd() { int tmp; EA_ABX_P(); tmp = RDMEM((ushort)ea.d); CMP(tmp); } protected void m6502_fd() { int tmp; EA_ABX_P(); tmp = RDMEM((ushort)ea.d); SBC(tmp); } @@ -264,7 +258,7 @@ namespace cpu.m6502 protected void m6502_2e() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); ROL(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_4e() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); LSR(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_6e() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); ROR(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } - protected void m6502_8e() { int tmp=0; STX(ref tmp); EA_ABS(); WRMEM((ushort)ea.d, (byte)tmp); } + protected void m6502_8e() { int tmp = 0; STX(ref tmp); EA_ABS(); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_ae() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); LDX(tmp); } protected void m6502_ce() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); DEC(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_ee() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); INC(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } @@ -273,7 +267,7 @@ namespace cpu.m6502 protected void m6502_3e() { int tmp; EA_ABX_NP(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); ROL(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_5e() { int tmp; EA_ABX_NP(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); LSR(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_7e() { int tmp; EA_ABX_NP(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); ROR(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } - protected void m6502_9e() { int tmp=0; EA_ABY_NP(); SXH(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } + protected void m6502_9e() { int tmp = 0; EA_ABY_NP(); SXH(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_be() { int tmp; EA_ABY_P(); tmp = RDMEM((ushort)ea.d); LDX(tmp); } protected void m6502_de() { int tmp; EA_ABX_NP(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); DEC(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_fe() { int tmp; EA_ABX_NP(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); INC(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } @@ -282,7 +276,7 @@ namespace cpu.m6502 protected void m6502_2f() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); RLA(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_4f() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); SRE(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_6f() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); RRA(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } - protected void m6502_8f() { int tmp=0; SAX(ref tmp); EA_ABS(); WRMEM((ushort)ea.d, (byte)tmp); } + protected void m6502_8f() { int tmp = 0; SAX(ref tmp); EA_ABS(); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_af() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); LAX(tmp); } protected void m6502_cf() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); DCP(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_ef() { int tmp; EA_ABS(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); ISB(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } @@ -291,7 +285,7 @@ namespace cpu.m6502 protected void m6502_3f() { int tmp; EA_ABX_NP(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); RLA(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_5f() { int tmp; EA_ABX_NP(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); SRE(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_7f() { int tmp; EA_ABX_NP(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); RRA(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } - protected void m6502_9f() { int tmp=0; EA_ABY_NP(); SAH(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } + protected void m6502_9f() { int tmp = 0; EA_ABY_NP(); SAH(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_bf() { int tmp; EA_ABY_P(); tmp = RDMEM((ushort)ea.d); LAX(tmp); } protected void m6502_df() { int tmp; EA_ABX_NP(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); DCP(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } protected void m6502_ff() { int tmp; EA_ABX_NP(); tmp = RDMEM((ushort)ea.d); WRMEM((ushort)ea.d, (byte)tmp); ISB(ref tmp); WRMEM((ushort)ea.d, (byte)tmp); } diff --git a/MAME.Core/cpu/m6502/Ops02.cs b/MAME.Core/cpu/m6502/Ops02.cs index b60c171..d0ec0d7 100644 --- a/MAME.Core/cpu/m6502/Ops02.cs +++ b/MAME.Core/cpu/m6502/Ops02.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using mame; +using mame; namespace cpu.m6502 { @@ -468,7 +464,7 @@ namespace cpu.m6502 PULL(ref p); PULL(ref pc.LowByte); PULL(ref pc.HighByte); - p |=(byte)(F_T | F_B); + p |= (byte)(F_T | F_B); if ((irq_state != (byte)LineState.CLEAR_LINE) && ((p & F_I) == 0)) { after_cli = 1; @@ -491,7 +487,7 @@ namespace cpu.m6502 int sum = a - tmp - c; int lo = (a & 0x0f) - (tmp & 0x0f) - c; int hi = (a & 0xf0) - (tmp & 0xf0); - if ((lo & 0x10)!=0) + if ((lo & 0x10) != 0) { lo -= 6; hi--; diff --git a/MAME.Core/cpu/m6800/M6800.cs b/MAME.Core/cpu/m6800/M6800.cs index 771ac3f..dfb455f 100644 --- a/MAME.Core/cpu/m6800/M6800.cs +++ b/MAME.Core/cpu/m6800/M6800.cs @@ -1,10 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Runtime.InteropServices; +using mame; +using System; using System.IO; -using mame; namespace cpu.m6800 { @@ -178,24 +174,24 @@ namespace cpu.m6800 { m6800_insn = new Action[256] { - illegal,nop, illegal,illegal,illegal,illegal,tap, tpa, - inx, dex, clv, sev, clc, sec, cli, sei, - sba, cba, illegal,illegal,illegal,illegal,tab, tba, - illegal,daa, illegal,aba, illegal,illegal,illegal,illegal, - bra, brn, bhi, bls, bcc, bcs, bne, beq, - bvc, bvs, bpl, bmi, bge, blt, bgt, ble, - tsx, ins, pula, pulb, des, txs, psha, pshb, - illegal,rts, illegal,rti, illegal,illegal,wai, swi, - nega, illegal,illegal,coma, lsra, illegal,rora, asra, - asla, rola, deca, illegal,inca, tsta, illegal,clra, - negb, illegal,illegal,comb, lsrb, illegal,rorb, asrb, - aslb, rolb, decb, illegal,incb, tstb, illegal,clrb, + illegal,nop, illegal,illegal,illegal,illegal,tap, tpa, + inx, dex, clv, sev, clc, sec, cli, sei, + sba, cba, illegal,illegal,illegal,illegal,tab, tba, + illegal,daa, illegal,aba, illegal,illegal,illegal,illegal, + bra, brn, bhi, bls, bcc, bcs, bne, beq, + bvc, bvs, bpl, bmi, bge, blt, bgt, ble, + tsx, ins, pula, pulb, des, txs, psha, pshb, + illegal,rts, illegal,rti, illegal,illegal,wai, swi, + nega, illegal,illegal,coma, lsra, illegal,rora, asra, + asla, rola, deca, illegal,inca, tsta, illegal,clra, + negb, illegal,illegal,comb, lsrb, illegal,rorb, asrb, + aslb, rolb, decb, illegal,incb, tstb, illegal,clrb, neg_ix, illegal,illegal,com_ix, lsr_ix, illegal,ror_ix, asr_ix, asl_ix, rol_ix, dec_ix, illegal,inc_ix, tst_ix, jmp_ix, clr_ix, neg_ex, illegal,illegal,com_ex, lsr_ex, illegal,ror_ex, asr_ex, asl_ex, rol_ex, dec_ex, illegal,inc_ex, tst_ex, jmp_ex, clr_ex, suba_im,cmpa_im,sbca_im,illegal,anda_im,bita_im,lda_im, sta_im, - eora_im,adca_im,ora_im, adda_im,cmpx_im,bsr, lds_im, sts_im, + eora_im,adca_im,ora_im, adda_im,cmpx_im,bsr, lds_im, sts_im, suba_di,cmpa_di,sbca_di,illegal,anda_di,bita_di,lda_di, sta_di, eora_di,adca_di,ora_di, adda_di,cmpx_di,jsr_di, lds_di, sts_di, suba_ix,cmpa_ix,sbca_ix,illegal,anda_ix,bita_ix,lda_ix, sta_ix, @@ -211,26 +207,26 @@ namespace cpu.m6800 subb_ex,cmpb_ex,sbcb_ex,illegal,andb_ex,bitb_ex,ldb_ex, stb_ex, eorb_ex,adcb_ex,orb_ex, addb_ex,illegal,illegal,ldx_ex, stx_ex }; - hd63701_insn=new Action[] + hd63701_insn = new Action[] { - trap, nop, trap ,trap ,lsrd, asld, tap, tpa, - inx, dex, clv, sev, clc, sec, cli, sei, - sba, cba, undoc1, undoc2, trap ,trap ,tab, tba, - xgdx, daa, slp ,aba, trap ,trap ,trap ,trap , - bra, brn, bhi, bls, bcc, bcs, bne, beq, - bvc, bvs, bpl, bmi, bge, blt, bgt, ble, - tsx, ins, pula, pulb, des, txs, psha, pshb, - pulx, rts, abx, rti, pshx, mul, wai, swi, - nega, trap ,trap ,coma, lsra, trap ,rora, asra, - asla, rola, deca, trap ,inca, tsta, trap ,clra, - negb, trap ,trap ,comb, lsrb, trap ,rorb, asrb, - aslb, rolb, decb, trap ,incb, tstb, trap ,clrb, + trap, nop, trap ,trap ,lsrd, asld, tap, tpa, + inx, dex, clv, sev, clc, sec, cli, sei, + sba, cba, undoc1, undoc2, trap ,trap ,tab, tba, + xgdx, daa, slp ,aba, trap ,trap ,trap ,trap , + bra, brn, bhi, bls, bcc, bcs, bne, beq, + bvc, bvs, bpl, bmi, bge, blt, bgt, ble, + tsx, ins, pula, pulb, des, txs, psha, pshb, + pulx, rts, abx, rti, pshx, mul, wai, swi, + nega, trap ,trap ,coma, lsra, trap ,rora, asra, + asla, rola, deca, trap ,inca, tsta, trap ,clra, + negb, trap ,trap ,comb, lsrb, trap ,rorb, asrb, + aslb, rolb, decb, trap ,incb, tstb, trap ,clrb, neg_ix, aim_ix, oim_ix, com_ix, lsr_ix, eim_ix, ror_ix, asr_ix, asl_ix, rol_ix, dec_ix, tim_ix, inc_ix, tst_ix, jmp_ix, clr_ix, neg_ex, aim_di, oim_di, com_ex, lsr_ex, eim_di, ror_ex, asr_ex, asl_ex, rol_ex, dec_ex, tim_di, inc_ex, tst_ex, jmp_ex, clr_ex, suba_im,cmpa_im,sbca_im,subd_im,anda_im,bita_im,lda_im, sta_im, - eora_im,adca_im,ora_im, adda_im,cpx_im ,bsr, lds_im, sts_im, + eora_im,adca_im,ora_im, adda_im,cpx_im ,bsr, lds_im, sts_im, suba_di,cmpa_di,sbca_di,subd_di,anda_di,bita_di,lda_di, sta_di, eora_di,adca_di,ora_di, adda_di,cpx_di ,jsr_di, lds_di, sts_di, suba_ix,cmpa_ix,sbca_ix,subd_ix,anda_ix,bita_ix,lda_ix, sta_ix, @@ -353,9 +349,9 @@ namespace cpu.m6800 if (irq_state[0] != (byte)LineState.CLEAR_LINE) { ENTER_INTERRUPT(0xfff8); - if( irq_callback!=null ) + if (irq_callback != null) { - irq_callback(0); + irq_callback(0); } } else @@ -921,7 +917,7 @@ namespace cpu.m6800 do { int prevCycles = pendingCycles; - if ((wai_state & (M6800_WAI | M6800_SLP))!=0) + if ((wai_state & (M6800_WAI | M6800_SLP)) != 0) { EAT_CYCLES(); } @@ -931,7 +927,7 @@ namespace cpu.m6800 //debugger_instruction_hook(Machine, PCD); ireg = ReadOp(PC.LowWord); PC.LowWord++; - insn[ireg](); + insn[ireg](); INCREMENT_COUNTER(this.cycles[ireg]); int delta = prevCycles - pendingCycles; totalExecutedCycles += (ulong)delta; @@ -1042,7 +1038,7 @@ namespace cpu.m6800 } private void m6803_internal_registers_w(int offset, byte data) { - int latch09=0; + int latch09 = 0; switch (offset) { case 0x00: @@ -1385,6 +1381,6 @@ namespace cpu.m6800 INCREMENT_COUNTER(extra_cycles); extra_cycles = 0; return cycles - pendingCycles; - } + } } } diff --git a/MAME.Core/cpu/m6800/M6800op.cs b/MAME.Core/cpu/m6800/M6800op.cs index 8409ca8..29b26fd 100644 --- a/MAME.Core/cpu/m6800/M6800op.cs +++ b/MAME.Core/cpu/m6800/M6800op.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Runtime.InteropServices; -using mame; +using mame; namespace cpu.m6800 { @@ -11,7 +6,7 @@ namespace cpu.m6800 { protected void illegal() { - + } protected void trap() { @@ -243,11 +238,11 @@ namespace cpu.m6800 } protected void pula() { - D.HighByte=PULLBYTE(); + D.HighByte = PULLBYTE(); } protected void pulb() { - D.LowByte=PULLBYTE(); + D.LowByte = PULLBYTE(); } protected void des() { @@ -267,11 +262,11 @@ namespace cpu.m6800 } protected void pulx() { - X=PULLWORD(); + X = PULLWORD(); } protected void rts() { - PC=PULLWORD(); + PC = PULLWORD(); //CHANGE_PC(); } protected void abx() @@ -280,11 +275,11 @@ namespace cpu.m6800 } protected void rti() { - cc=PULLBYTE(); - D.LowByte=PULLBYTE(); - D.HighByte=PULLBYTE(); - X=PULLWORD(); - PC=PULLWORD(); + cc = PULLBYTE(); + D.LowByte = PULLBYTE(); + D.HighByte = PULLBYTE(); + X = PULLWORD(); + PC = PULLWORD(); //CHANGE_PC(); CHECK_IRQ_LINES(); } diff --git a/MAME.Core/cpu/m68000/Disassembler.cs b/MAME.Core/cpu/m68000/Disassembler.cs index 43b9c8d..c5d49e4 100644 --- a/MAME.Core/cpu/m68000/Disassembler.cs +++ b/MAME.Core/cpu/m68000/Disassembler.cs @@ -22,7 +22,7 @@ namespace cpu.m68000 { var info = new DisassemblyInfo { Mnemonic = "UNKNOWN", PC = pc, Length = 2 }; op = (ushort)ReadOpWord(pc); - + if (Opcodes[op] == MOVE) MOVE_Disasm(info);// else if (Opcodes[op] == MOVEA) MOVEA_Disasm(info); else if (Opcodes[op] == MOVEQ) MOVEQ_Disasm(info); diff --git a/MAME.Core/cpu/m68000/Instructions/BitArithemetic.cs b/MAME.Core/cpu/m68000/Instructions/BitArithemetic.cs index 29e9b72..cd8b7d3 100644 --- a/MAME.Core/cpu/m68000/Instructions/BitArithemetic.cs +++ b/MAME.Core/cpu/m68000/Instructions/BitArithemetic.cs @@ -555,7 +555,7 @@ namespace cpu.m68000 } info.Length = pc - info.PC; - } + } void ORI() { @@ -1036,10 +1036,10 @@ namespace cpu.m68000 int mode = (op >> 3) & 0x07; int reg = op & 0x07; info.Mnemonic = "asl"; - info.Args=DisassembleValue(mode, reg, 1, ref pc); + info.Args = DisassembleValue(mode, reg, 1, ref pc); info.Length = pc - info.PC; } - + void ASRd() { int rot = (op >> 9) & 7; diff --git a/MAME.Core/cpu/m68000/Instructions/IntegerMath.cs b/MAME.Core/cpu/m68000/Instructions/IntegerMath.cs index 9972c8f..a708fdf 100644 --- a/MAME.Core/cpu/m68000/Instructions/IntegerMath.cs +++ b/MAME.Core/cpu/m68000/Instructions/IntegerMath.cs @@ -1922,7 +1922,7 @@ namespace cpu.m68000 uint dest = D[dreg].u32; if (source == 0) - { + { TrapVector(5); } else @@ -1985,7 +1985,7 @@ namespace cpu.m68000 else { V = true; - } + } } pendingCycles -= 158 + EACyclesBW[mode, reg]; } diff --git a/MAME.Core/cpu/m68000/Instructions/ProgramFlow.cs b/MAME.Core/cpu/m68000/Instructions/ProgramFlow.cs index d249f2d..357247f 100644 --- a/MAME.Core/cpu/m68000/Instructions/ProgramFlow.cs +++ b/MAME.Core/cpu/m68000/Instructions/ProgramFlow.cs @@ -284,7 +284,7 @@ namespace cpu.m68000 { //D[reg].u8 = (byte)(result | 0x80); }*/ - WriteValueB(mode, reg,(sbyte)(result | 0x80)); + WriteValueB(mode, reg, (sbyte)(result | 0x80)); pendingCycles -= (mode == 0) ? 4 : 14 + EACyclesBW[mode, reg]; } diff --git a/MAME.Core/cpu/m68000/Instructions/Supervisor.cs b/MAME.Core/cpu/m68000/Instructions/Supervisor.cs index f67a6aa..afe8425 100644 --- a/MAME.Core/cpu/m68000/Instructions/Supervisor.cs +++ b/MAME.Core/cpu/m68000/Instructions/Supervisor.cs @@ -133,7 +133,7 @@ namespace cpu.m68000 { int mode = (op >> 3) & 7; int reg = (op >> 0) & 7; - + /*ushort sr = (ushort)(SR & 0xFF00); sr |= (byte)ReadValueB(mode, reg); SR = (short)sr;*/ diff --git a/MAME.Core/cpu/m68000/MC68000.cs b/MAME.Core/cpu/m68000/MC68000.cs index 32a3fb3..599ae79 100644 --- a/MAME.Core/cpu/m68000/MC68000.cs +++ b/MAME.Core/cpu/m68000/MC68000.cs @@ -1,9 +1,8 @@ -using System; -using System.Runtime.InteropServices; -using System.IO; +using mame; +using System; using System.Globalization; -using System.Collections.Generic; -using mame; +using System.IO; +using System.Runtime.InteropServices; namespace cpu.m68000 { @@ -72,14 +71,14 @@ namespace cpu.m68000 return; if (value == true) // entering supervisor mode { - //Console.WriteLine("&^&^&^&^& ENTER SUPERVISOR MODE"); + //EmuLogger.Log("&^&^&^&^& ENTER SUPERVISOR MODE"); usp = A[7].s32; A[7].s32 = ssp; s = true; } else { // exiting supervisor mode - //Console.WriteLine("&^&^&^&^& LEAVE SUPERVISOR MODE"); + //EmuLogger.Log("&^&^&^&^& LEAVE SUPERVISOR MODE"); ssp = A[7].s32; A[7].s32 = usp; s = false; @@ -149,7 +148,7 @@ namespace cpu.m68000 N = (value & 0x0008) != 0; X = (value & 0x0010) != 0; } - } + } public int Interrupt { get; set; } // Memory Access @@ -176,7 +175,7 @@ namespace cpu.m68000 } public override void set_irq_line(int irqline, LineState state) { - if (irqline ==(int)LineState.INPUT_LINE_NMI) + if (irqline == (int)LineState.INPUT_LINE_NMI) irqline = 7; switch (state) { @@ -212,12 +211,12 @@ namespace cpu.m68000 public void Step() { - //Console.WriteLine(Disassemble(PC)); + //EmuLogger.Log(Disassemble(PC)); - op = (ushort)ReadOpWord(PC);PC += 2; + op = (ushort)ReadOpWord(PC); PC += 2; Opcodes[op](); } - + public override int ExecuteCycles(int cycles) { if (!stopped) @@ -410,7 +409,7 @@ namespace cpu.m68000 else { - //Console.WriteLine("Skipping unrecognized identifier " + args[0]); + //EmuLogger.Log("Skipping unrecognized identifier " + args[0]); } } } diff --git a/MAME.Core/cpu/m68000/Memory.cs b/MAME.Core/cpu/m68000/Memory.cs index f9aacd1..0733a70 100644 --- a/MAME.Core/cpu/m68000/Memory.cs +++ b/MAME.Core/cpu/m68000/Memory.cs @@ -542,7 +542,7 @@ namespace cpu.m68000 int GetIndex() { - //Console.WriteLine("IN INDEX PORTION - NOT VERIFIED!!!"); + //EmuLogger.Log("IN INDEX PORTION - NOT VERIFIED!!!"); // TODO kid chameleon triggers this in startup sequence short extension = ReadOpWord(PC); PC += 2; @@ -571,7 +571,7 @@ namespace cpu.m68000 int PeekIndex() { - //Console.WriteLine("IN INDEX PORTION - NOT VERIFIED!!!"); + //EmuLogger.Log("IN INDEX PORTION - NOT VERIFIED!!!"); short extension = ReadOpWord(PC); diff --git a/MAME.Core/cpu/m68000/OpcodeTable.cs b/MAME.Core/cpu/m68000/OpcodeTable.cs index 8278530..258ef43 100644 --- a/MAME.Core/cpu/m68000/OpcodeTable.cs +++ b/MAME.Core/cpu/m68000/OpcodeTable.cs @@ -150,7 +150,7 @@ namespace cpu.m68000 else if (component == "Xn") opList = AppendPermutations(opList, Xn3); else if (component == "CondMain") opList = AppendPermutations(opList, ConditionMain); else if (component == "CondAll") opList = AppendPermutations(opList, ConditionAll); - else if (component == "Data1") opList = AppendData(opList, 1); + else if (component == "Data1") opList = AppendData(opList, 1); else if (component == "Data3") opList = AppendData(opList, 3); else if (component == "Data4") opList = AppendData(opList, 4); else if (component == "Data8") opList = AppendData(opList, 8); @@ -864,7 +864,7 @@ namespace cpu.m68000 "1110", // GT Greater Than (signed) "1111" // LE Less or Equal (signed) }; - + #endregion } } \ No newline at end of file diff --git a/MAME.Core/cpu/m68000/Tables.cs b/MAME.Core/cpu/m68000/Tables.cs index 1a397ee..eb82a8a 100644 --- a/MAME.Core/cpu/m68000/Tables.cs +++ b/MAME.Core/cpu/m68000/Tables.cs @@ -5,33 +5,33 @@ static readonly int[,] MoveCyclesBW = new int[12, 9] { { 4, 4, 8, 8, 8, 12, 14, 12, 16 }, - { 4, 4, 8, 8, 8, 12, 14, 12, 16 }, - { 8, 8, 12, 12, 12, 16, 18, 16, 20 }, - { 8, 8, 12, 12, 12, 16, 18, 16, 20 }, - { 10, 10, 14, 14, 14, 18, 20, 18, 22 }, - { 12, 12, 16, 16, 16, 20, 22, 20, 24 }, - { 14, 14, 18, 18, 18, 22, 24, 22, 26 }, - { 12, 12, 16, 16, 16, 20, 22, 20, 24 }, - { 16, 16, 20, 20, 20, 24, 26, 24, 28 }, - { 12, 12, 16, 16, 16, 20, 22, 20, 24 }, - { 14, 14, 18, 18, 18, 22, 24, 22, 26 }, - { 8, 8, 12, 12, 12, 16, 18, 16, 20 } + { 4, 4, 8, 8, 8, 12, 14, 12, 16 }, + { 8, 8, 12, 12, 12, 16, 18, 16, 20 }, + { 8, 8, 12, 12, 12, 16, 18, 16, 20 }, + { 10, 10, 14, 14, 14, 18, 20, 18, 22 }, + { 12, 12, 16, 16, 16, 20, 22, 20, 24 }, + { 14, 14, 18, 18, 18, 22, 24, 22, 26 }, + { 12, 12, 16, 16, 16, 20, 22, 20, 24 }, + { 16, 16, 20, 20, 20, 24, 26, 24, 28 }, + { 12, 12, 16, 16, 16, 20, 22, 20, 24 }, + { 14, 14, 18, 18, 18, 22, 24, 22, 26 }, + { 8, 8, 12, 12, 12, 16, 18, 16, 20 } }; static readonly int[,] MoveCyclesL = new int[12, 9] { - { 4, 4, 12, 12, 12, 16, 18, 16, 20 }, - { 4, 4, 12, 12, 12, 16, 18, 16, 20 }, - { 12, 12, 20, 20, 20, 24, 26, 24, 28 }, - { 12, 12, 20, 20, 20, 24, 26, 24, 28 }, - { 14, 14, 22, 22, 22, 26, 28, 26, 30 }, - { 16, 16, 24, 24, 24, 28, 30, 28, 32 }, - { 18, 18, 26, 26, 26, 30, 32, 30, 34 }, - { 16, 16, 24, 24, 24, 28, 30, 28, 32 }, - { 20, 20, 28, 28, 28, 32, 34, 32, 36 }, - { 16, 16, 24, 24, 24, 28, 30, 28, 32 }, - { 18, 18, 26, 26, 26, 30, 32, 30, 34 }, - { 12, 12, 20, 20, 20, 24, 26, 24, 28 } + { 4, 4, 12, 12, 12, 16, 18, 16, 20 }, + { 4, 4, 12, 12, 12, 16, 18, 16, 20 }, + { 12, 12, 20, 20, 20, 24, 26, 24, 28 }, + { 12, 12, 20, 20, 20, 24, 26, 24, 28 }, + { 14, 14, 22, 22, 22, 26, 28, 26, 30 }, + { 16, 16, 24, 24, 24, 28, 30, 28, 32 }, + { 18, 18, 26, 26, 26, 30, 32, 30, 34 }, + { 16, 16, 24, 24, 24, 28, 30, 28, 32 }, + { 20, 20, 28, 28, 28, 32, 34, 32, 36 }, + { 16, 16, 24, 24, 24, 28, 30, 28, 32 }, + { 18, 18, 26, 26, 26, 30, 32, 30, 34 }, + { 12, 12, 20, 20, 20, 24, 26, 24, 28 } }; static readonly int[,] EACyclesBW = new int[8, 8] diff --git a/MAME.Core/cpu/m6805/M6805.cs b/MAME.Core/cpu/m6805/M6805.cs index b3547cd..1f0f997 100644 --- a/MAME.Core/cpu/m6805/M6805.cs +++ b/MAME.Core/cpu/m6805/M6805.cs @@ -1,17 +1,13 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Runtime.InteropServices; +using mame; +using System; using System.IO; -using mame; namespace cpu.m6805 { public partial class M6805 : cpuexec_data { public static M6805 m1; - public Register ea,pc,s; + public Register ea, pc, s; public int subtype; public ushort sp_mask; public ushort sp_low; @@ -23,7 +19,7 @@ namespace cpu.m6805 public int nmi_state; public byte CFLAG = 0x01, ZFLAG = 0x02, NFLAG = 0x04, IFLAG = 0x08, HFLAG = 0x10; public int SUBTYPE_M6805 = 0, SUBTYPE_M68705 = 1, SUBTYPE_HD63705 = 2; - public byte[] flags8i=new byte[256] /* increment */ + public byte[] flags8i = new byte[256] /* increment */ { 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, @@ -42,7 +38,7 @@ namespace cpu.m6805 0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04, 0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04 }; - public byte[] flags8d=new byte[256] /* decrement */ + public byte[] flags8d = new byte[256] /* decrement */ { 0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, @@ -61,7 +57,7 @@ namespace cpu.m6805 0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04, 0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04 }; - public byte[] cycles1 =new byte[] + public byte[] cycles1 = new byte[] { /* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ /*0*/ 10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10, @@ -108,7 +104,7 @@ namespace cpu.m6805 public Func ReadOp, ReadOpArg; public Func ReadMemory; public Action WriteMemory; - + public M6805() { irq_state = new int[9]; @@ -141,7 +137,7 @@ namespace cpu.m6805 b = ReadOpArg(pc.LowWord++); } private void IMMWORD(ref Register w) - { + { w.d = 0; w.HighByte = ReadOpArg(pc.LowWord); w.LowByte = ReadOpArg((ushort)(pc.LowWord + 1)); @@ -165,19 +161,19 @@ namespace cpu.m6805 } private void CLR_NZ() { - cc&=(byte)~(NFLAG|ZFLAG); + cc &= (byte)~(NFLAG | ZFLAG); } private void CLR_HNZC() { - cc&=(byte)~(HFLAG|NFLAG|ZFLAG|CFLAG); + cc &= (byte)~(HFLAG | NFLAG | ZFLAG | CFLAG); } private void CLR_Z() { - cc&=(byte)~(ZFLAG); + cc &= (byte)~(ZFLAG); } private void CLR_NZC() { - cc&=(byte)~(NFLAG|ZFLAG|CFLAG); + cc &= (byte)~(NFLAG | ZFLAG | CFLAG); } private void CLR_ZC() { @@ -185,7 +181,7 @@ namespace cpu.m6805 } private void SET_Z(byte b) { - if(b==0) + if (b == 0) { SEZ(); } @@ -196,30 +192,30 @@ namespace cpu.m6805 } private void SET_N8(byte b) { - cc|=(byte)((b&0x80)>>5); + cc |= (byte)((b & 0x80) >> 5); } - private void SET_H(byte a,byte b,byte r) + private void SET_H(byte a, byte b, byte r) { - cc|=(byte)((a^b^r)&0x10); + cc |= (byte)((a ^ b ^ r) & 0x10); } private void SET_C8(ushort b) { - cc|=(byte)((b&0x100)>>8); + cc |= (byte)((b & 0x100) >> 8); } private void SET_FLAGS8I(byte b) { - cc|=flags8i[b&0xff]; + cc |= flags8i[b & 0xff]; } private void SET_FLAGS8D(byte b) { - cc|=flags8d[b&0xff]; + cc |= flags8d[b & 0xff]; } private void SET_NZ8(byte b) { SET_N8(b); SET_Z(b); } - private void SET_FLAGS8(byte a,byte b,ushort r) + private void SET_FLAGS8(byte a, byte b, ushort r) { SET_N8((byte)r); SET_Z8((byte)r); @@ -236,7 +232,7 @@ namespace cpu.m6805 } private void IMM8() { - ea.LowWord= pc.LowWord++; + ea.LowWord = pc.LowWord++; } private void EXTENDED() { @@ -244,54 +240,54 @@ namespace cpu.m6805 } private void INDEXED() { - ea.LowWord=x; + ea.LowWord = x; } private void INDEXED1() { - ea.d=0; + ea.d = 0; IMMBYTE(ref ea.LowByte); - ea.LowWord+=x; + ea.LowWord += x; } private void INDEXED2() { IMMWORD(ref ea); - ea.LowWord+=x; + ea.LowWord += x; } private void SEC() { - cc|=CFLAG; + cc |= CFLAG; } private void CLC() { - cc&=(byte)~CFLAG; + cc &= (byte)~CFLAG; } private void SEZ() { - cc|=ZFLAG; + cc |= ZFLAG; } private void CLZ() { - cc&=(byte)~ZFLAG; + cc &= (byte)~ZFLAG; } private void SEN() { - cc|=NFLAG; + cc |= NFLAG; } private void CLN() { - cc&=(byte)~NFLAG; + cc &= (byte)~NFLAG; } private void SEH() { - cc|=HFLAG; + cc |= HFLAG; } private void CLH() { - cc&=(byte)~HFLAG; + cc &= (byte)~HFLAG; } private void SEI() { - cc|=IFLAG; + cc |= IFLAG; } private void CLI() { @@ -300,31 +296,31 @@ namespace cpu.m6805 private void DIRBYTE(ref byte b) { DIRECT(); - b=ReadMemory((ushort)ea.d); + b = ReadMemory((ushort)ea.d); } private void EXTBYTE(ref byte b) { EXTENDED(); - b=ReadMemory((ushort)ea.d); + b = ReadMemory((ushort)ea.d); } private void IDXBYTE(ref byte b) { INDEXED(); - b=ReadMemory((ushort)ea.d); + b = ReadMemory((ushort)ea.d); } private void IDX1BYTE(ref byte b) { INDEXED1(); - b=ReadMemory((ushort)ea.d); + b = ReadMemory((ushort)ea.d); } private void IDX2BYTE(ref byte b) { INDEXED2(); - b=ReadMemory((ushort)ea.d); + b = ReadMemory((ushort)ea.d); } private void BRANCH(bool f) { - byte t=0; + byte t = 0; IMMBYTE(ref t); if (f) { @@ -553,7 +549,7 @@ namespace cpu.m6805 public int m6805_execute(int cycles) { byte ireg; - pendingCycles = cycles; + pendingCycles = cycles; do { int prevCycles = pendingCycles; @@ -828,7 +824,7 @@ namespace cpu.m6805 case 0xfd: jsr_ix(); break; case 0xfe: ldx_ix(); break; case 0xff: stx_ix(); break; - } + } pendingCycles -= cycles1[ireg]; int delta = prevCycles - pendingCycles; totalExecutedCycles += (ulong)delta; diff --git a/MAME.Core/cpu/m6805/M6805op.cs b/MAME.Core/cpu/m6805/M6805op.cs index d40ae2c..3342818 100644 --- a/MAME.Core/cpu/m6805/M6805op.cs +++ b/MAME.Core/cpu/m6805/M6805op.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Runtime.InteropServices; -using mame; +using mame; namespace cpu.m6805 { @@ -18,7 +13,7 @@ namespace cpu.m6805 /* $00/$02/$04/$06/$08/$0A/$0C/$0E BRSET direct,relative ---- */ protected void brset(byte bit) { - byte t=0, r=0; + byte t = 0, r = 0; DIRBYTE(ref r); IMMBYTE(ref t); CLC(); @@ -1116,7 +1111,7 @@ namespace cpu.m6805 /* $b5 BITA direct -**- */ protected void bita_di() { - byte t=0, r; + byte t = 0, r; DIRBYTE(ref t); r = (byte)(a & t); CLR_NZ(); diff --git a/MAME.Core/cpu/m6809/Disassembler.cs b/MAME.Core/cpu/m6809/Disassembler.cs index 5a96bdc..a16ae75 100644 --- a/MAME.Core/cpu/m6809/Disassembler.cs +++ b/MAME.Core/cpu/m6809/Disassembler.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace cpu.m6809 +namespace cpu.m6809 { public partial class M6809 { @@ -340,8 +335,8 @@ namespace cpu.m6809 public static string[] m6809_regs = new string[] { "X", "Y", "U", "S", "PC" }; public static string[] m6809_regs_te = new string[] { - "D", "X", "Y", "U", "S", "PC", "inv", "inv", - "A", "B", "CC", "DP", "inv", "inv", "inv", "inv" + "D", "X", "Y", "U", "S", "PC", "inv", "inv", + "A", "B", "CC", "DP", "inv", "inv", "inv", "inv" }; public byte op; public void DisassemblerInit() @@ -366,7 +361,7 @@ namespace cpu.m6809 i1 = 1; } buffer = ReadOp(p).ToString("X2"); - bool indirect,opcode_found = false; + bool indirect, opcode_found = false; do { opcode = ReadOp(p); @@ -592,10 +587,10 @@ namespace cpu.m6809 } else if (numoperands == 1) - { - ea = operandarray[0]; - buffer += "#$" + ea.ToString("X2"); - } + { + ea = operandarray[0]; + buffer += "#$" + ea.ToString("X2"); + } break; case m6809_addressing_modes.IMM_RR: diff --git a/MAME.Core/cpu/m6809/M6809.cs b/MAME.Core/cpu/m6809/M6809.cs index 9adba57..2db435f 100644 --- a/MAME.Core/cpu/m6809/M6809.cs +++ b/MAME.Core/cpu/m6809/M6809.cs @@ -1,10 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Runtime.InteropServices; +using mame; +using System; using System.IO; -using mame; namespace cpu.m6809 { @@ -498,7 +494,7 @@ namespace cpu.m6809 private ushort RM16(ushort Addr) { ushort result = (ushort)(RM(Addr) << 8); - return (ushort)(result | RM((ushort)((Addr + 1) &0xffff))); + return (ushort)(result | RM((ushort)((Addr + 1) & 0xffff))); } private void WM16(ushort Addr, Register p) { @@ -544,7 +540,7 @@ namespace cpu.m6809 PUSHBYTE(D.LowByte); PUSHBYTE(D.HighByte); PUSHBYTE(CC); - extra_cycles += 19; + extra_cycles += 19; } CC |= (byte)(CC_IF | CC_II); PC.LowWord = RM16(0xfffc); diff --git a/MAME.Core/cpu/m6809/M6809op.cs b/MAME.Core/cpu/m6809/M6809op.cs index 1c9a0d4..e1010db 100644 --- a/MAME.Core/cpu/m6809/M6809op.cs +++ b/MAME.Core/cpu/m6809/M6809op.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using mame; +using mame; namespace cpu.m6809 { @@ -1713,13 +1709,13 @@ namespace cpu.m6809 } void ldx_ex() { - X=EXTWORD(); + X = EXTWORD(); CLR_NZV(); SET_NZ16(X.LowWord); } void ldy_ex() { - Y=EXTWORD(); + Y = EXTWORD(); CLR_NZV(); SET_NZ16(Y.LowWord); } @@ -1841,7 +1837,7 @@ namespace cpu.m6809 } void ldd_im() { - D=IMMWORD(); + D = IMMWORD(); CLR_NZV(); SET_NZ16(D.LowWord); } @@ -2274,7 +2270,7 @@ namespace cpu.m6809 } void ldd_ex() { - D=EXTWORD(); + D = EXTWORD(); CLR_NZV(); SET_NZ16(D.LowWord); } @@ -2287,13 +2283,13 @@ namespace cpu.m6809 } void ldu_ex() { - U=EXTWORD(); + U = EXTWORD(); CLR_NZV(); SET_NZ16(U.LowWord); } void lds_ex() { - S=EXTWORD(); + S = EXTWORD(); CLR_NZV(); SET_NZ16(S.LowWord); int_state |= M6809_LDS; diff --git a/MAME.Core/cpu/nec/Nec.cs b/MAME.Core/cpu/nec/Nec.cs index 5aea405..7b3934b 100644 --- a/MAME.Core/cpu/nec/Nec.cs +++ b/MAME.Core/cpu/nec/Nec.cs @@ -1,10 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using mame; +using System; using System.IO; -using System.Runtime.InteropServices; -using mame; namespace cpu.nec { @@ -22,7 +18,7 @@ namespace cpu.nec { totalExecutedCycles = value; } - } + } public override int PendingCycles { get @@ -82,7 +78,7 @@ namespace cpu.nec } } } - } + } public struct necbasicregs { //public ushort[] w;//[8]; @@ -116,7 +112,7 @@ namespace cpu.nec public int iNOP; public static Nec[] nn1; public Mod_RM mod_RM; - public byte[] v25v35_decryptiontable; + public byte[] v25v35_decryptiontable; public nec_Regs I; public int chip_type; public static int prefix_base; @@ -208,7 +204,7 @@ namespace cpu.nec ushort var = ReadWord((I.sregs[2] << 4) + I.regs.b[8] + I.regs.b[9] * 0x100); I.regs.b[i * 2] = (byte)(var % 0x100); I.regs.b[i * 2 + 1] = (byte)(var / 0x100); - ushort w4 =(ushort)(I.regs.b[8] + I.regs.b[9] * 0x100 + 2); + ushort w4 = (ushort)(I.regs.b[8] + I.regs.b[9] * 0x100 + 2); I.regs.b[8] = (byte)(w4 % 0x100); I.regs.b[9] = (byte)(w4 / 0x100); } @@ -636,7 +632,7 @@ namespace cpu.nec { int result, result2; b1 = false; - result = (short)(I.regs.b[0]+I.regs.b[1]*0x100); + result = (short)(I.regs.b[0] + I.regs.b[1] * 0x100); result2 = result % (short)((sbyte)tmp); if ((result /= (short)((sbyte)tmp)) > 0xff) { @@ -796,7 +792,7 @@ namespace cpu.nec mod_RM.regw = new int[256]; mod_RM.regb = new int[256]; mod_RM.RMw = new int[256]; - mod_RM.RMb = new int[256]; + mod_RM.RMb = new int[256]; nec_instruction = new nec_delegate[]{ i_add_br8, i_add_wr16, @@ -813,7 +809,7 @@ namespace cpu.nec i_or_ald8, i_or_axd16, i_push_cs, - i_pre_nec, + i_pre_nec, i_adc_br8, i_adc_wr16, i_adc_r8b, @@ -928,7 +924,7 @@ namespace cpu.nec i_jnle, i_80pre, i_81pre, - i_82pre, + i_82pre, i_83pre, i_test_br8, i_test_wr16, @@ -1056,32 +1052,32 @@ namespace cpu.nec i_ffpre }; GetEA = new getea_delegate[192]{ - EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007, - EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007, - EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007, - EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007, - EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007, - EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007, - EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007, - EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007, + EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007, + EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007, + EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007, + EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007, + EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007, + EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007, + EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007, + EA_000, EA_001, EA_002, EA_003, EA_004, EA_005, EA_006, EA_007, - EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107, - EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107, - EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107, - EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107, - EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107, - EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107, - EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107, - EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107, + EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107, + EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107, + EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107, + EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107, + EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107, + EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107, + EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107, + EA_100, EA_101, EA_102, EA_103, EA_104, EA_105, EA_106, EA_107, - EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207, - EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207, - EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207, - EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207, - EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207, - EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207, - EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207, - EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207 + EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207, + EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207, + EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207, + EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207, + EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207, + EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207, + EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207, + EA_200, EA_201, EA_202, EA_203, EA_204, EA_205, EA_206, EA_207 }; } public override void Reset() @@ -1194,7 +1190,7 @@ namespace cpu.nec public void SaveStateBinary(BinaryWriter writer) { int i; - writer.Write(I.regs.b,0,16); + writer.Write(I.regs.b, 0, 16); for (i = 0; i < 4; i++) { writer.Write(I.sregs[i]); @@ -1267,7 +1263,7 @@ namespace cpu.nec { pendingCycles = cycles; while (pendingCycles > 0) - { + { int prevCycles = pendingCycles; if (I.pending_irq != 0 && I.no_interrupt == 0) { diff --git a/MAME.Core/cpu/nec/NecEa.cs b/MAME.Core/cpu/nec/NecEa.cs index b838000..1870edb 100644 --- a/MAME.Core/cpu/nec/NecEa.cs +++ b/MAME.Core/cpu/nec/NecEa.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace cpu.nec +namespace cpu.nec { partial class Nec { @@ -13,7 +8,7 @@ namespace cpu.nec int EA_000() { EO = (ushort)(I.regs.b[6] + I.regs.b[7] * 0x100 + I.regs.b[12] + I.regs.b[13] * 0x100); - EA = DefaultBase(3,I) + EO; + EA = DefaultBase(3, I) + EO; return EA; } int EA_001() diff --git a/MAME.Core/cpu/nec/NecInstr.cs b/MAME.Core/cpu/nec/NecInstr.cs index 6f1123a..fe09362 100644 --- a/MAME.Core/cpu/nec/NecInstr.cs +++ b/MAME.Core/cpu/nec/NecInstr.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace cpu.nec +namespace cpu.nec { partial class Nec { @@ -820,7 +815,7 @@ namespace cpu.nec void i_repnc() { int next = fetchop(); - ushort c = (ushort)(I.regs.b[2]+I.regs.b[3]*0x100);// I.regs.w[1]; + ushort c = (ushort)(I.regs.b[2] + I.regs.b[3] * 0x100);// I.regs.w[1]; switch (next) { /* Segments */ case 0x26: seg_prefix = 1; prefix_base = (I.sregs[0] << 4); next = fetchop(); CLK(2); break; @@ -885,7 +880,7 @@ namespace cpu.nec tmp = FETCHWORD(); PUSH((ushort)tmp); //CLKW(12, 12, 5, 12, 8, 5, I.regs.w[4]); - CLKW(12, 12, 5, 12, 8, 5, I.regs.b[8]+I.regs.b[9]*0x100); + CLKW(12, 12, 5, 12, 8, 5, I.regs.b[8] + I.regs.b[9] * 0x100); } void i_imul_d16() { @@ -906,7 +901,7 @@ namespace cpu.nec int tmp = (ushort)((short)((sbyte)FETCH())); PUSH((ushort)tmp); //CLKW(11, 11, 5, 11, 7, 3, I.regs.w[4]); - CLKW(11, 11, 5, 11, 7, 3, I.regs.b[8]+I.regs.b[9]*0x100); + CLKW(11, 11, 5, 11, 7, 3, I.regs.b[8] + I.regs.b[9] * 0x100); } void i_imul_d8() { @@ -919,7 +914,7 @@ namespace cpu.nec I.CarryVal = I.OverVal = (uint)(((((int)dst) >> 15 != 0) && (((int)dst) >> 15 != -1)) ? 1 : 0); //I.regs.w[mod_RM.regw[ModRM]] = (ushort)dst; I.regs.b[mod_RM.regw[ModRM] * 2] = (byte)(dst % 0x100); - I.regs.b[mod_RM.regw[ModRM] * 2+1] = (byte)(dst / 0x100); + I.regs.b[mod_RM.regw[ModRM] * 2 + 1] = (byte)(dst / 0x100); pendingCycles -= (ModRM >= 0xc0) ? 31 : 39; } void i_insb() @@ -927,7 +922,7 @@ namespace cpu.nec //PutMemB(0, I.regs.w[7], ReadIOByte(I.regs.w[2])); PutMemB(0, I.regs.b[14] + I.regs.b[15] * 0x100, ReadIOByte(I.regs.b[4] + I.regs.b[5] * 0x100)); //I.regs.w[7] += (ushort)(-2 * (I.DF ? 1 : 0) + 1); - ushort w7 =(ushort)(I.regs.b[14] + I.regs.b[15] * 0x100); + ushort w7 = (ushort)(I.regs.b[14] + I.regs.b[15] * 0x100); w7 += (ushort)(-2 * (I.DF ? 1 : 0) + 1); I.regs.b[14] = (byte)(w7 % 0x100); I.regs.b[15] = (byte)(w7 / 0x100); @@ -1401,7 +1396,7 @@ namespace cpu.nec void i_cwd() { //I.regs.w[2] = (ushort)(((I.regs.b[1] & 0x80) != 0) ? 0xffff : 0); - ushort w2= (ushort)(((I.regs.b[1] & 0x80) != 0) ? 0xffff : 0); + ushort w2 = (ushort)(((I.regs.b[1] & 0x80) != 0) ? 0xffff : 0); I.regs.b[4] = (byte)(w2 % 0x100); I.regs.b[5] = (byte)(w2 / 0x100); CLK(4); @@ -1573,7 +1568,7 @@ namespace cpu.nec ushort w7 = (ushort)(I.regs.b[14] + I.regs.b[15] * 0x100 + (-4 * (I.DF ? 1 : 0) + 2)); I.regs.b[14] = (byte)(w7 % 0x100); I.regs.b[15] = (byte)(w7 / 0x100); - CLKW(8, 8, 5, 8, 4, 3, I.regs.b[14]+I.regs.b[15]*0x100); + CLKW(8, 8, 5, 8, 4, 3, I.regs.b[14] + I.regs.b[15] * 0x100); } void i_lodsb() { @@ -1609,14 +1604,14 @@ namespace cpu.nec } void i_scasw() { - ushort src = GetMemW(0, I.regs.b[14]+I.regs.b[15]*0x100); - ushort dst = (ushort)(I.regs.b[0]+I.regs.b[1]*0x100); + ushort src = GetMemW(0, I.regs.b[14] + I.regs.b[15] * 0x100); + ushort dst = (ushort)(I.regs.b[0] + I.regs.b[1] * 0x100); SUBW(ref src, ref dst); //I.regs.w[7] += (ushort)(-4 * (I.DF ? 1 : 0) + 2); ushort w7 = (ushort)(I.regs.b[14] + I.regs.b[15] * 0x100 + (-4 * (I.DF ? 1 : 0) + 2)); I.regs.b[14] = (byte)(w7 % 0x100); I.regs.b[15] = (byte)(w7 / 0x100); - CLKW(8, 8, 5, 8, 4, 3, I.regs.b[14]+I.regs.b[15]*0x100); + CLKW(8, 8, 5, 8, 4, 3, I.regs.b[14] + I.regs.b[15] * 0x100); } void i_mov_ald8() { @@ -1832,7 +1827,7 @@ namespace cpu.nec } if (level != 0) { - PUSH((ushort)(I.regs.b[10]+I.regs.b[11]*0x100)); + PUSH((ushort)(I.regs.b[10] + I.regs.b[11] * 0x100)); } } void i_leave() @@ -2010,7 +2005,7 @@ namespace cpu.nec } void i_trans() { - int dest = (I.regs.b[6]+I.regs.b[7]*0x100 + I.regs.b[0]) & 0xffff; + int dest = (I.regs.b[6] + I.regs.b[7] * 0x100 + I.regs.b[0]) & 0xffff; I.regs.b[0] = GetMemB(3, dest); CLKS(9, 9, 5); } @@ -2161,7 +2156,7 @@ namespace cpu.nec ushort w0 = ReadIOWord(I.regs.b[4] + I.regs.b[5] * 0x100); I.regs.b[0] = (byte)(w0 % 0x100); I.regs.b[1] = (byte)(w0 / 0x100); - CLKW(12, 12, 7, 12, 8, 5, I.regs.b[4]+I.regs.b[5]*0x100); + CLKW(12, 12, 7, 12, 8, 5, I.regs.b[4] + I.regs.b[5] * 0x100); } void i_outdxal() { @@ -2174,7 +2169,7 @@ namespace cpu.nec //WriteIOWord(I.regs.w[2], I.regs.w[0]); //CLKW(12, 12, 5, 12, 8, 3, I.regs.w[2]); WriteIOWord(I.regs.b[4] + I.regs.b[5] * 0x100, (ushort)(I.regs.b[0] + I.regs.b[1] * 0x100)); - CLKW(12, 12, 5, 12, 8, 3, I.regs.b[4]+I.regs.b[5]*0x100); + CLKW(12, 12, 5, 12, 8, 3, I.regs.b[4] + I.regs.b[5] * 0x100); } void i_lock() { @@ -2331,7 +2326,7 @@ namespace cpu.nec case 0x10: PutbackRMWord(ModRM, (ushort)(~tmp)); pendingCycles -= (ModRM >= 0xc0) ? 2 : 16; break; case 0x18: I.CarryVal = (uint)((tmp != 0) ? 1 : 0); tmp = (~tmp) + 1; SetSZPF_Word((int)tmp); PutbackRMWord(ModRM, (ushort)(tmp & 0xffff)); pendingCycles -= (ModRM >= 0xc0) ? 2 : 16; break; case 0x20: - uresult = (uint)((I.regs.b[0]+I.regs.b[1]*0x100) * tmp); + uresult = (uint)((I.regs.b[0] + I.regs.b[1] * 0x100) * tmp); //I.regs.w[0] = (ushort)(uresult & 0xffff); //I.regs.w[2] = (ushort)(uresult >> 16); I.regs.b[0] = (byte)((ushort)(uresult & 0xffff) % 0x100); @@ -2342,13 +2337,13 @@ namespace cpu.nec pendingCycles -= (ModRM >= 0xc0) ? 30 : 36; break; case 0x28: - result = (int)((short)(I.regs.b[0]+I.regs.b[1]*0x100)) * (int)((short)tmp); + result = (int)((short)(I.regs.b[0] + I.regs.b[1] * 0x100)) * (int)((short)tmp); //I.regs.w[0] = (ushort)(result & 0xffff); //I.regs.w[2] = (ushort)(result >> 16); I.regs.b[0] = (byte)((ushort)(result & 0xffff) % 0x100); I.regs.b[1] = (byte)((ushort)(result & 0xffff) / 0x100); - I.regs.b[4] = (byte)((ushort)(result >>16) % 0x100); - I.regs.b[5] = (byte)((ushort)(result >>16) / 0x100); + I.regs.b[4] = (byte)((ushort)(result >> 16) % 0x100); + I.regs.b[5] = (byte)((ushort)(result >> 16) / 0x100); I.CarryVal = I.OverVal = (uint)(((I.regs.b[4] + I.regs.b[5] * 0x100) != 0) ? 1 : 0); pendingCycles -= (ModRM >= 0xc0) ? 30 : 36; break; diff --git a/MAME.Core/cpu/nec/NecModrm.cs b/MAME.Core/cpu/nec/NecModrm.cs index 6d2eae8..4f4eb6e 100644 --- a/MAME.Core/cpu/nec/NecModrm.cs +++ b/MAME.Core/cpu/nec/NecModrm.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace cpu.nec +namespace cpu.nec { partial class Nec { @@ -57,7 +52,7 @@ namespace cpu.nec //I.regs.w[mod_RM.RMw[ModRM]] = FETCHWORD(); ushort w = FETCHWORD(); I.regs.b[mod_RM.RMw[ModRM] * 2] = (byte)(w % 0x100); - I.regs.b[mod_RM.RMw[ModRM] * 2+1] = (byte)(w / 0x100); + I.regs.b[mod_RM.RMw[ModRM] * 2 + 1] = (byte)(w / 0x100); } else { @@ -104,34 +99,34 @@ namespace cpu.nec WriteByte(EA, val); } } - void DEF_br8(out int ModRM,out byte src, out byte dst) + void DEF_br8(out int ModRM, out byte src, out byte dst) { ModRM = FETCH(); src = RegByte(ModRM); dst = GetRMByte(ModRM); } - void DEF_wr16(out int ModRM,out ushort src, out ushort dst) + void DEF_wr16(out int ModRM, out ushort src, out ushort dst) { ModRM = FETCH(); src = RegWord(ModRM); dst = GetRMWord(ModRM); } - void DEF_r8b(out int ModRM,out byte src, out byte dst) + void DEF_r8b(out int ModRM, out byte src, out byte dst) { ModRM = FETCH(); dst = RegByte(ModRM); src = GetRMByte(ModRM); } - void DEF_r16w(out int ModRM,out ushort src,out ushort dst) + void DEF_r16w(out int ModRM, out ushort src, out ushort dst) { - ModRM = FETCH(); - dst = RegWord(ModRM); + ModRM = FETCH(); + dst = RegWord(ModRM); src = GetRMWord(ModRM); } void DEF_ald8(out byte src, out byte dst) { - src = FETCH(); - dst = I.regs.b[0]; + src = FETCH(); + dst = I.regs.b[0]; } void DEF_axd16(out ushort src, out ushort dst) { diff --git a/MAME.Core/cpu/z80/Disassembler.cs b/MAME.Core/cpu/z80/Disassembler.cs index 99e9710..5d525c9 100644 --- a/MAME.Core/cpu/z80/Disassembler.cs +++ b/MAME.Core/cpu/z80/Disassembler.cs @@ -6,7 +6,7 @@ //VgMuseum.Z80.Disassembler disasm = new Disassembler(); //ushort pc = RegPC.Word; //string str = disasm.Disassemble(() => ReadMemory(pc++)); -//Console.WriteLine(str); +//EmuLogger.Log(str); //please note that however much youre tempted to, timings can't be put in a table here because they depend on how the instruction executes at runtime @@ -140,8 +140,8 @@ namespace cpu.z80 } readonly static string[] mnemonics = new string[] - { - "NOP", "LD BC, nn", "LD (BC), A", "INC BC", //0x04 + { + "NOP", "LD BC, nn", "LD (BC), A", "INC BC", //0x04 "INC B", "DEC B", "LD B, n", "RLCA", //0x08 "EX AF, AF'", "ADD HL, BC", "LD A, (BC)", "DEC BC", //0x0C "INC C", "DEC C", "LD C, n", "RRCA", //0x10 @@ -208,8 +208,8 @@ namespace cpu.z80 }; readonly static string[] mnemonicsDD = new string[] - { - "NOP", "LD BC, nn", "LD (BC), A", "INC BC", //0x04 + { + "NOP", "LD BC, nn", "LD (BC), A", "INC BC", //0x04 "INC B", "DEC B", "LD B, n", "RLCA", //0x08 "EX AF, AF'", "ADD IX, BC", "LD A, (BC)", "DEC BC", //0x0C "INC C", "DEC C", "LD C, n", "RRCA", //0x10 @@ -276,8 +276,8 @@ namespace cpu.z80 }; readonly static string[] mnemonicsFD = new string[] - { - "NOP", "LD BC, nn", "LD (BC), A", "INC BC", //0x04 + { + "NOP", "LD BC, nn", "LD (BC), A", "INC BC", //0x04 "INC B", "DEC B", "LD B, n", "RLCA", //0x08 "EX AF, AF'", "ADD IY, BC", "LD A, (BC)", "DEC BC", //0x0C "INC C", "DEC C", "LD C, n", "RRCA", //0x10 @@ -344,121 +344,121 @@ namespace cpu.z80 }; readonly static string[] mnemonicsDDCB = new string[] - { - "RLC (IX+d)->B", "RLC (IX+d)->C", "RLC (IX+d)->D", "RLC (IX+d)->E", "RLC (IX+d)->H", "RLC (IX+d)->L", "RLC (IX+d)", "RLC (IX+d)->A", - "RRC (IX+d)->B", "RRC (IX+d)->C", "RRC (IX+d)->D", "RRC (IX+d)->E", "RRC (IX+d)->H", "RRC (IX+d)->L", "RRC (IX+d)", "RRC (IX+d)->A", - "RL (IX+d)->B", "RL (IX+d)->C", "RL (IX+d)->D", "RL (IX+d)->E", "RL (IX+d)->H", "RL (IX+d)->L", "RL (IX+d)", "RL (IX+d)->A", - "RR (IX+d)->B", "RR (IX+d)->C", "RR (IX+d)->D", "RR (IX+d)->E", "RR (IX+d)->H", "RR (IX+d)->L", "RR (IX+d)", "RR (IX+d)->A", - "SLA (IX+d)->B", "SLA (IX+d)->C", "SLA (IX+d)->D", "SLA (IX+d)->E", "SLA (IX+d)->H", "SLA (IX+d)->L", "SLA (IX+d)", "SLA (IX+d)->A", - "SRA (IX+d)->B", "SRA (IX+d)->C", "SRA (IX+d)->D", "SRA (IX+d)->E", "SRA (IX+d)->H", "SRA (IX+d)->L", "SRA (IX+d)", "SRA (IX+d)->A", - "SL1 (IX+d)->B", "SL1 (IX+d)->C", "SL1 (IX+d)->D", "SL1 (IX+d)->E", "SL1 (IX+d)->H", "SL1 (IX+d)->L", "SL1 (IX+d)", "SL1 (IX+d)->A", - "SRL (IX+d)->B", "SRL (IX+d)->C", "SRL (IX+d)->D", "SRL (IX+d)->E", "SRL (IX+d)->H", "SRL (IX+d)->L", "SRL (IX+d)", "SRL (IX+d)->A", - "BIT 0, (IX+d)", "BIT 0, (IX+d)", "BIT 0, (IX+d)", "BIT 0, (IX+d)", "BIT 0, (IX+d)", "BIT 0, (IX+d)", "BIT 0, (IX+d)", "BIT 0, (IX+d)", - "BIT 1, (IX+d)", "BIT 1, (IX+d)", "BIT 1, (IX+d)", "BIT 1, (IX+d)", "BIT 1, (IX+d)", "BIT 1, (IX+d)", "BIT 1, (IX+d)", "BIT 1, (IX+d)", - "BIT 2, (IX+d)", "BIT 2, (IX+d)", "BIT 2, (IX+d)", "BIT 2, (IX+d)", "BIT 2, (IX+d)", "BIT 2, (IX+d)", "BIT 2, (IX+d)", "BIT 2, (IX+d)", - "BIT 3, (IX+d)", "BIT 3, (IX+d)", "BIT 3, (IX+d)", "BIT 3, (IX+d)", "BIT 3, (IX+d)", "BIT 3, (IX+d)", "BIT 3, (IX+d)", "BIT 3, (IX+d)", - "BIT 4, (IX+d)", "BIT 4, (IX+d)", "BIT 4, (IX+d)", "BIT 4, (IX+d)", "BIT 4, (IX+d)", "BIT 4, (IX+d)", "BIT 4, (IX+d)", "BIT 4, (IX+d)", - "BIT 5, (IX+d)", "BIT 5, (IX+d)", "BIT 5, (IX+d)", "BIT 5, (IX+d)", "BIT 5, (IX+d)", "BIT 5, (IX+d)", "BIT 5, (IX+d)", "BIT 5, (IX+d)", - "BIT 6, (IX+d)", "BIT 6, (IX+d)", "BIT 6, (IX+d)", "BIT 6, (IX+d)", "BIT 6, (IX+d)", "BIT 6, (IX+d)", "BIT 6, (IX+d)", "BIT 6, (IX+d)", - "BIT 7, (IX+d)", "BIT 7, (IX+d)", "BIT 7, (IX+d)", "BIT 7, (IX+d)", "BIT 7, (IX+d)", "BIT 7, (IX+d)", "BIT 7, (IX+d)", "BIT 7, (IX+d)", - "RES 0 (IX+d)->B", "RES 0 (IX+d)->C", "RES 0 (IX+d)->D", "RES 0 (IX+d)->E", "RES 0 (IX+d)->H", "RES 0 (IX+d)->L", "RES 0 (IX+d)", "RES 0 (IX+d)->A", - "RES 1 (IX+d)->B", "RES 1 (IX+d)->C", "RES 1 (IX+d)->D", "RES 1 (IX+d)->E", "RES 1 (IX+d)->H", "RES 1 (IX+d)->L", "RES 1 (IX+d)", "RES 1 (IX+d)->A", - "RES 2 (IX+d)->B", "RES 2 (IX+d)->C", "RES 2 (IX+d)->D", "RES 2 (IX+d)->E", "RES 2 (IX+d)->H", "RES 2 (IX+d)->L", "RES 2 (IX+d)", "RES 2 (IX+d)->A", - "RES 3 (IX+d)->B", "RES 3 (IX+d)->C", "RES 3 (IX+d)->D", "RES 3 (IX+d)->E", "RES 3 (IX+d)->H", "RES 3 (IX+d)->L", "RES 3 (IX+d)", "RES 3 (IX+d)->A", - "RES 4 (IX+d)->B", "RES 4 (IX+d)->C", "RES 4 (IX+d)->D", "RES 4 (IX+d)->E", "RES 4 (IX+d)->H", "RES 4 (IX+d)->L", "RES 4 (IX+d)", "RES 4 (IX+d)->A", - "RES 5 (IX+d)->B", "RES 5 (IX+d)->C", "RES 5 (IX+d)->D", "RES 5 (IX+d)->E", "RES 5 (IX+d)->H", "RES 5 (IX+d)->L", "RES 5 (IX+d)", "RES 5 (IX+d)->A", - "RES 6 (IX+d)->B", "RES 6 (IX+d)->C", "RES 6 (IX+d)->D", "RES 6 (IX+d)->E", "RES 6 (IX+d)->H", "RES 6 (IX+d)->L", "RES 6 (IX+d)", "RES 6 (IX+d)->A", - "RES 7 (IX+d)->B", "RES 7 (IX+d)->C", "RES 7 (IX+d)->D", "RES 7 (IX+d)->E", "RES 7 (IX+d)->H", "RES 7 (IX+d)->L", "RES 7 (IX+d)", "RES 7 (IX+d)->A", - "SET 0 (IX+d)->B", "SET 0 (IX+d)->C", "SET 0 (IX+d)->D", "SET 0 (IX+d)->E", "SET 0 (IX+d)->H", "SET 0 (IX+d)->L", "SET 0 (IX+d)", "SET 0 (IX+d)->A", - "SET 1 (IX+d)->B", "SET 1 (IX+d)->C", "SET 1 (IX+d)->D", "SET 1 (IX+d)->E", "SET 1 (IX+d)->H", "SET 1 (IX+d)->L", "SET 1 (IX+d)", "SET 1 (IX+d)->A", - "SET 2 (IX+d)->B", "SET 2 (IX+d)->C", "SET 2 (IX+d)->D", "SET 2 (IX+d)->E", "SET 2 (IX+d)->H", "SET 2 (IX+d)->L", "SET 2 (IX+d)", "SET 2 (IX+d)->A", - "SET 3 (IX+d)->B", "SET 3 (IX+d)->C", "SET 3 (IX+d)->D", "SET 3 (IX+d)->E", "SET 3 (IX+d)->H", "SET 3 (IX+d)->L", "SET 3 (IX+d)", "SET 3 (IX+d)->A", - "SET 4 (IX+d)->B", "SET 4 (IX+d)->C", "SET 4 (IX+d)->D", "SET 4 (IX+d)->E", "SET 4 (IX+d)->H", "SET 4 (IX+d)->L", "SET 4 (IX+d)", "SET 4 (IX+d)->A", - "SET 5 (IX+d)->B", "SET 5 (IX+d)->C", "SET 5 (IX+d)->D", "SET 5 (IX+d)->E", "SET 5 (IX+d)->H", "SET 5 (IX+d)->L", "SET 5 (IX+d)", "SET 5 (IX+d)->A", - "SET 6 (IX+d)->B", "SET 6 (IX+d)->C", "SET 6 (IX+d)->D", "SET 6 (IX+d)->E", "SET 6 (IX+d)->H", "SET 6 (IX+d)->L", "SET 6 (IX+d)", "SET 6 (IX+d)->A", - "SET 7 (IX+d)->B", "SET 7 (IX+d)->C", "SET 7 (IX+d)->D", "SET 7 (IX+d)->E", "SET 7 (IX+d)->H", "SET 7 (IX+d)->L", "SET 7 (IX+d)", "SET 7 (IX+d)->A", - }; + { + "RLC (IX+d)->B", "RLC (IX+d)->C", "RLC (IX+d)->D", "RLC (IX+d)->E", "RLC (IX+d)->H", "RLC (IX+d)->L", "RLC (IX+d)", "RLC (IX+d)->A", + "RRC (IX+d)->B", "RRC (IX+d)->C", "RRC (IX+d)->D", "RRC (IX+d)->E", "RRC (IX+d)->H", "RRC (IX+d)->L", "RRC (IX+d)", "RRC (IX+d)->A", + "RL (IX+d)->B", "RL (IX+d)->C", "RL (IX+d)->D", "RL (IX+d)->E", "RL (IX+d)->H", "RL (IX+d)->L", "RL (IX+d)", "RL (IX+d)->A", + "RR (IX+d)->B", "RR (IX+d)->C", "RR (IX+d)->D", "RR (IX+d)->E", "RR (IX+d)->H", "RR (IX+d)->L", "RR (IX+d)", "RR (IX+d)->A", + "SLA (IX+d)->B", "SLA (IX+d)->C", "SLA (IX+d)->D", "SLA (IX+d)->E", "SLA (IX+d)->H", "SLA (IX+d)->L", "SLA (IX+d)", "SLA (IX+d)->A", + "SRA (IX+d)->B", "SRA (IX+d)->C", "SRA (IX+d)->D", "SRA (IX+d)->E", "SRA (IX+d)->H", "SRA (IX+d)->L", "SRA (IX+d)", "SRA (IX+d)->A", + "SL1 (IX+d)->B", "SL1 (IX+d)->C", "SL1 (IX+d)->D", "SL1 (IX+d)->E", "SL1 (IX+d)->H", "SL1 (IX+d)->L", "SL1 (IX+d)", "SL1 (IX+d)->A", + "SRL (IX+d)->B", "SRL (IX+d)->C", "SRL (IX+d)->D", "SRL (IX+d)->E", "SRL (IX+d)->H", "SRL (IX+d)->L", "SRL (IX+d)", "SRL (IX+d)->A", + "BIT 0, (IX+d)", "BIT 0, (IX+d)", "BIT 0, (IX+d)", "BIT 0, (IX+d)", "BIT 0, (IX+d)", "BIT 0, (IX+d)", "BIT 0, (IX+d)", "BIT 0, (IX+d)", + "BIT 1, (IX+d)", "BIT 1, (IX+d)", "BIT 1, (IX+d)", "BIT 1, (IX+d)", "BIT 1, (IX+d)", "BIT 1, (IX+d)", "BIT 1, (IX+d)", "BIT 1, (IX+d)", + "BIT 2, (IX+d)", "BIT 2, (IX+d)", "BIT 2, (IX+d)", "BIT 2, (IX+d)", "BIT 2, (IX+d)", "BIT 2, (IX+d)", "BIT 2, (IX+d)", "BIT 2, (IX+d)", + "BIT 3, (IX+d)", "BIT 3, (IX+d)", "BIT 3, (IX+d)", "BIT 3, (IX+d)", "BIT 3, (IX+d)", "BIT 3, (IX+d)", "BIT 3, (IX+d)", "BIT 3, (IX+d)", + "BIT 4, (IX+d)", "BIT 4, (IX+d)", "BIT 4, (IX+d)", "BIT 4, (IX+d)", "BIT 4, (IX+d)", "BIT 4, (IX+d)", "BIT 4, (IX+d)", "BIT 4, (IX+d)", + "BIT 5, (IX+d)", "BIT 5, (IX+d)", "BIT 5, (IX+d)", "BIT 5, (IX+d)", "BIT 5, (IX+d)", "BIT 5, (IX+d)", "BIT 5, (IX+d)", "BIT 5, (IX+d)", + "BIT 6, (IX+d)", "BIT 6, (IX+d)", "BIT 6, (IX+d)", "BIT 6, (IX+d)", "BIT 6, (IX+d)", "BIT 6, (IX+d)", "BIT 6, (IX+d)", "BIT 6, (IX+d)", + "BIT 7, (IX+d)", "BIT 7, (IX+d)", "BIT 7, (IX+d)", "BIT 7, (IX+d)", "BIT 7, (IX+d)", "BIT 7, (IX+d)", "BIT 7, (IX+d)", "BIT 7, (IX+d)", + "RES 0 (IX+d)->B", "RES 0 (IX+d)->C", "RES 0 (IX+d)->D", "RES 0 (IX+d)->E", "RES 0 (IX+d)->H", "RES 0 (IX+d)->L", "RES 0 (IX+d)", "RES 0 (IX+d)->A", + "RES 1 (IX+d)->B", "RES 1 (IX+d)->C", "RES 1 (IX+d)->D", "RES 1 (IX+d)->E", "RES 1 (IX+d)->H", "RES 1 (IX+d)->L", "RES 1 (IX+d)", "RES 1 (IX+d)->A", + "RES 2 (IX+d)->B", "RES 2 (IX+d)->C", "RES 2 (IX+d)->D", "RES 2 (IX+d)->E", "RES 2 (IX+d)->H", "RES 2 (IX+d)->L", "RES 2 (IX+d)", "RES 2 (IX+d)->A", + "RES 3 (IX+d)->B", "RES 3 (IX+d)->C", "RES 3 (IX+d)->D", "RES 3 (IX+d)->E", "RES 3 (IX+d)->H", "RES 3 (IX+d)->L", "RES 3 (IX+d)", "RES 3 (IX+d)->A", + "RES 4 (IX+d)->B", "RES 4 (IX+d)->C", "RES 4 (IX+d)->D", "RES 4 (IX+d)->E", "RES 4 (IX+d)->H", "RES 4 (IX+d)->L", "RES 4 (IX+d)", "RES 4 (IX+d)->A", + "RES 5 (IX+d)->B", "RES 5 (IX+d)->C", "RES 5 (IX+d)->D", "RES 5 (IX+d)->E", "RES 5 (IX+d)->H", "RES 5 (IX+d)->L", "RES 5 (IX+d)", "RES 5 (IX+d)->A", + "RES 6 (IX+d)->B", "RES 6 (IX+d)->C", "RES 6 (IX+d)->D", "RES 6 (IX+d)->E", "RES 6 (IX+d)->H", "RES 6 (IX+d)->L", "RES 6 (IX+d)", "RES 6 (IX+d)->A", + "RES 7 (IX+d)->B", "RES 7 (IX+d)->C", "RES 7 (IX+d)->D", "RES 7 (IX+d)->E", "RES 7 (IX+d)->H", "RES 7 (IX+d)->L", "RES 7 (IX+d)", "RES 7 (IX+d)->A", + "SET 0 (IX+d)->B", "SET 0 (IX+d)->C", "SET 0 (IX+d)->D", "SET 0 (IX+d)->E", "SET 0 (IX+d)->H", "SET 0 (IX+d)->L", "SET 0 (IX+d)", "SET 0 (IX+d)->A", + "SET 1 (IX+d)->B", "SET 1 (IX+d)->C", "SET 1 (IX+d)->D", "SET 1 (IX+d)->E", "SET 1 (IX+d)->H", "SET 1 (IX+d)->L", "SET 1 (IX+d)", "SET 1 (IX+d)->A", + "SET 2 (IX+d)->B", "SET 2 (IX+d)->C", "SET 2 (IX+d)->D", "SET 2 (IX+d)->E", "SET 2 (IX+d)->H", "SET 2 (IX+d)->L", "SET 2 (IX+d)", "SET 2 (IX+d)->A", + "SET 3 (IX+d)->B", "SET 3 (IX+d)->C", "SET 3 (IX+d)->D", "SET 3 (IX+d)->E", "SET 3 (IX+d)->H", "SET 3 (IX+d)->L", "SET 3 (IX+d)", "SET 3 (IX+d)->A", + "SET 4 (IX+d)->B", "SET 4 (IX+d)->C", "SET 4 (IX+d)->D", "SET 4 (IX+d)->E", "SET 4 (IX+d)->H", "SET 4 (IX+d)->L", "SET 4 (IX+d)", "SET 4 (IX+d)->A", + "SET 5 (IX+d)->B", "SET 5 (IX+d)->C", "SET 5 (IX+d)->D", "SET 5 (IX+d)->E", "SET 5 (IX+d)->H", "SET 5 (IX+d)->L", "SET 5 (IX+d)", "SET 5 (IX+d)->A", + "SET 6 (IX+d)->B", "SET 6 (IX+d)->C", "SET 6 (IX+d)->D", "SET 6 (IX+d)->E", "SET 6 (IX+d)->H", "SET 6 (IX+d)->L", "SET 6 (IX+d)", "SET 6 (IX+d)->A", + "SET 7 (IX+d)->B", "SET 7 (IX+d)->C", "SET 7 (IX+d)->D", "SET 7 (IX+d)->E", "SET 7 (IX+d)->H", "SET 7 (IX+d)->L", "SET 7 (IX+d)", "SET 7 (IX+d)->A", + }; readonly static string[] mnemonicsFDCB = new string[] - { - "RLC (IY+d)->B", "RLC (IY+d)->C", "RLC (IY+d)->D", "RLC (IY+d)->E", "RLC (IY+d)->H", "RLC (IY+d)->L", "RLC (IY+d)", "RLC (IY+d)->A", - "RRC (IY+d)->B", "RRC (IY+d)->C", "RRC (IY+d)->D", "RRC (IY+d)->E", "RRC (IY+d)->H", "RRC (IY+d)->L", "RRC (IY+d)", "RRC (IY+d)->A", - "RL (IY+d)->B", "RL (IY+d)->C", "RL (IY+d)->D", "RL (IY+d)->E", "RL (IY+d)->H", "RL (IY+d)->L", "RL (IY+d)", "RL (IY+d)->A", - "RR (IY+d)->B", "RR (IY+d)->C", "RR (IY+d)->D", "RR (IY+d)->E", "RR (IY+d)->H", "RR (IY+d)->L", "RR (IY+d)", "RR (IY+d)->A", - "SLA (IY+d)->B", "SLA (IY+d)->C", "SLA (IY+d)->D", "SLA (IY+d)->E", "SLA (IY+d)->H", "SLA (IY+d)->L", "SLA (IY+d)", "SLA (IY+d)->A", - "SRA (IY+d)->B", "SRA (IY+d)->C", "SRA (IY+d)->D", "SRA (IY+d)->E", "SRA (IY+d)->H", "SRA (IY+d)->L", "SRA (IY+d)", "SRA (IY+d)->A", - "SL1 (IY+d)->B", "SL1 (IY+d)->C", "SL1 (IY+d)->D", "SL1 (IY+d)->E", "SL1 (IY+d)->H", "SL1 (IY+d)->L", "SL1 (IY+d)", "SL1 (IY+d)->A", - "SRL (IY+d)->B", "SRL (IY+d)->C", "SRL (IY+d)->D", "SRL (IY+d)->E", "SRL (IY+d)->H", "SRL (IY+d)->L", "SRL (IY+d)", "SRL (IY+d)->A", - "BIT 0, (IY+d)", "BIT 0, (IY+d)", "BIT 0, (IY+d)", "BIT 0, (IY+d)", "BIT 0, (IY+d)", "BIT 0, (IY+d)", "BIT 0, (IY+d)", "BIT 0, (IY+d)", - "BIT 1, (IY+d)", "BIT 1, (IY+d)", "BIT 1, (IY+d)", "BIT 1, (IY+d)", "BIT 1, (IY+d)", "BIT 1, (IY+d)", "BIT 1, (IY+d)", "BIT 1, (IY+d)", - "BIT 2, (IY+d)", "BIT 2, (IY+d)", "BIT 2, (IY+d)", "BIT 2, (IY+d)", "BIT 2, (IY+d)", "BIT 2, (IY+d)", "BIT 2, (IY+d)", "BIT 2, (IY+d)", - "BIT 3, (IY+d)", "BIT 3, (IY+d)", "BIT 3, (IY+d)", "BIT 3, (IY+d)", "BIT 3, (IY+d)", "BIT 3, (IY+d)", "BIT 3, (IY+d)", "BIT 3, (IY+d)", - "BIT 4, (IY+d)", "BIT 4, (IY+d)", "BIT 4, (IY+d)", "BIT 4, (IY+d)", "BIT 4, (IY+d)", "BIT 4, (IY+d)", "BIT 4, (IY+d)", "BIT 4, (IY+d)", - "BIT 5, (IY+d)", "BIT 5, (IY+d)", "BIT 5, (IY+d)", "BIT 5, (IY+d)", "BIT 5, (IY+d)", "BIT 5, (IY+d)", "BIT 5, (IY+d)", "BIT 5, (IY+d)", - "BIT 6, (IY+d)", "BIT 6, (IY+d)", "BIT 6, (IY+d)", "BIT 6, (IY+d)", "BIT 6, (IY+d)", "BIT 6, (IY+d)", "BIT 6, (IY+d)", "BIT 6, (IY+d)", - "BIT 7, (IY+d)", "BIT 7, (IY+d)", "BIT 7, (IY+d)", "BIT 7, (IY+d)", "BIT 7, (IY+d)", "BIT 7, (IY+d)", "BIT 7, (IY+d)", "BIT 7, (IY+d)", - "RES 0 (IY+d)->B", "RES 0 (IY+d)->C", "RES 0 (IY+d)->D", "RES 0 (IY+d)->E", "RES 0 (IY+d)->H", "RES 0 (IY+d)->L", "RES 0 (IY+d)", "RES 0 (IY+d)->A", - "RES 1 (IY+d)->B", "RES 1 (IY+d)->C", "RES 1 (IY+d)->D", "RES 1 (IY+d)->E", "RES 1 (IY+d)->H", "RES 1 (IY+d)->L", "RES 1 (IY+d)", "RES 1 (IY+d)->A", - "RES 2 (IY+d)->B", "RES 2 (IY+d)->C", "RES 2 (IY+d)->D", "RES 2 (IY+d)->E", "RES 2 (IY+d)->H", "RES 2 (IY+d)->L", "RES 2 (IY+d)", "RES 2 (IY+d)->A", - "RES 3 (IY+d)->B", "RES 3 (IY+d)->C", "RES 3 (IY+d)->D", "RES 3 (IY+d)->E", "RES 3 (IY+d)->H", "RES 3 (IY+d)->L", "RES 3 (IY+d)", "RES 3 (IY+d)->A", - "RES 4 (IY+d)->B", "RES 4 (IY+d)->C", "RES 4 (IY+d)->D", "RES 4 (IY+d)->E", "RES 4 (IY+d)->H", "RES 4 (IY+d)->L", "RES 4 (IY+d)", "RES 4 (IY+d)->A", - "RES 5 (IY+d)->B", "RES 5 (IY+d)->C", "RES 5 (IY+d)->D", "RES 5 (IY+d)->E", "RES 5 (IY+d)->H", "RES 5 (IY+d)->L", "RES 5 (IY+d)", "RES 5 (IY+d)->A", - "RES 6 (IY+d)->B", "RES 6 (IY+d)->C", "RES 6 (IY+d)->D", "RES 6 (IY+d)->E", "RES 6 (IY+d)->H", "RES 6 (IY+d)->L", "RES 6 (IY+d)", "RES 6 (IY+d)->A", - "RES 7 (IY+d)->B", "RES 7 (IY+d)->C", "RES 7 (IY+d)->D", "RES 7 (IY+d)->E", "RES 7 (IY+d)->H", "RES 7 (IY+d)->L", "RES 7 (IY+d)", "RES 7 (IY+d)->A", - "SET 0 (IY+d)->B", "SET 0 (IY+d)->C", "SET 0 (IY+d)->D", "SET 0 (IY+d)->E", "SET 0 (IY+d)->H", "SET 0 (IY+d)->L", "SET 0 (IY+d)", "SET 0 (IY+d)->A", - "SET 1 (IY+d)->B", "SET 1 (IY+d)->C", "SET 1 (IY+d)->D", "SET 1 (IY+d)->E", "SET 1 (IY+d)->H", "SET 1 (IY+d)->L", "SET 1 (IY+d)", "SET 1 (IY+d)->A", - "SET 2 (IY+d)->B", "SET 2 (IY+d)->C", "SET 2 (IY+d)->D", "SET 2 (IY+d)->E", "SET 2 (IY+d)->H", "SET 2 (IY+d)->L", "SET 2 (IY+d)", "SET 2 (IY+d)->A", - "SET 3 (IY+d)->B", "SET 3 (IY+d)->C", "SET 3 (IY+d)->D", "SET 3 (IY+d)->E", "SET 3 (IY+d)->H", "SET 3 (IY+d)->L", "SET 3 (IY+d)", "SET 3 (IY+d)->A", - "SET 4 (IY+d)->B", "SET 4 (IY+d)->C", "SET 4 (IY+d)->D", "SET 4 (IY+d)->E", "SET 4 (IY+d)->H", "SET 4 (IY+d)->L", "SET 4 (IY+d)", "SET 4 (IY+d)->A", - "SET 5 (IY+d)->B", "SET 5 (IY+d)->C", "SET 5 (IY+d)->D", "SET 5 (IY+d)->E", "SET 5 (IY+d)->H", "SET 5 (IY+d)->L", "SET 5 (IY+d)", "SET 5 (IY+d)->A", - "SET 6 (IY+d)->B", "SET 6 (IY+d)->C", "SET 6 (IY+d)->D", "SET 6 (IY+d)->E", "SET 6 (IY+d)->H", "SET 6 (IY+d)->L", "SET 6 (IY+d)", "SET 6 (IY+d)->A", - "SET 7 (IY+d)->B", "SET 7 (IY+d)->C", "SET 7 (IY+d)->D", "SET 7 (IY+d)->E", "SET 7 (IY+d)->H", "SET 7 (IY+d)->L", "SET 7 (IY+d)", "SET 7 (IY+d)->A", - }; + { + "RLC (IY+d)->B", "RLC (IY+d)->C", "RLC (IY+d)->D", "RLC (IY+d)->E", "RLC (IY+d)->H", "RLC (IY+d)->L", "RLC (IY+d)", "RLC (IY+d)->A", + "RRC (IY+d)->B", "RRC (IY+d)->C", "RRC (IY+d)->D", "RRC (IY+d)->E", "RRC (IY+d)->H", "RRC (IY+d)->L", "RRC (IY+d)", "RRC (IY+d)->A", + "RL (IY+d)->B", "RL (IY+d)->C", "RL (IY+d)->D", "RL (IY+d)->E", "RL (IY+d)->H", "RL (IY+d)->L", "RL (IY+d)", "RL (IY+d)->A", + "RR (IY+d)->B", "RR (IY+d)->C", "RR (IY+d)->D", "RR (IY+d)->E", "RR (IY+d)->H", "RR (IY+d)->L", "RR (IY+d)", "RR (IY+d)->A", + "SLA (IY+d)->B", "SLA (IY+d)->C", "SLA (IY+d)->D", "SLA (IY+d)->E", "SLA (IY+d)->H", "SLA (IY+d)->L", "SLA (IY+d)", "SLA (IY+d)->A", + "SRA (IY+d)->B", "SRA (IY+d)->C", "SRA (IY+d)->D", "SRA (IY+d)->E", "SRA (IY+d)->H", "SRA (IY+d)->L", "SRA (IY+d)", "SRA (IY+d)->A", + "SL1 (IY+d)->B", "SL1 (IY+d)->C", "SL1 (IY+d)->D", "SL1 (IY+d)->E", "SL1 (IY+d)->H", "SL1 (IY+d)->L", "SL1 (IY+d)", "SL1 (IY+d)->A", + "SRL (IY+d)->B", "SRL (IY+d)->C", "SRL (IY+d)->D", "SRL (IY+d)->E", "SRL (IY+d)->H", "SRL (IY+d)->L", "SRL (IY+d)", "SRL (IY+d)->A", + "BIT 0, (IY+d)", "BIT 0, (IY+d)", "BIT 0, (IY+d)", "BIT 0, (IY+d)", "BIT 0, (IY+d)", "BIT 0, (IY+d)", "BIT 0, (IY+d)", "BIT 0, (IY+d)", + "BIT 1, (IY+d)", "BIT 1, (IY+d)", "BIT 1, (IY+d)", "BIT 1, (IY+d)", "BIT 1, (IY+d)", "BIT 1, (IY+d)", "BIT 1, (IY+d)", "BIT 1, (IY+d)", + "BIT 2, (IY+d)", "BIT 2, (IY+d)", "BIT 2, (IY+d)", "BIT 2, (IY+d)", "BIT 2, (IY+d)", "BIT 2, (IY+d)", "BIT 2, (IY+d)", "BIT 2, (IY+d)", + "BIT 3, (IY+d)", "BIT 3, (IY+d)", "BIT 3, (IY+d)", "BIT 3, (IY+d)", "BIT 3, (IY+d)", "BIT 3, (IY+d)", "BIT 3, (IY+d)", "BIT 3, (IY+d)", + "BIT 4, (IY+d)", "BIT 4, (IY+d)", "BIT 4, (IY+d)", "BIT 4, (IY+d)", "BIT 4, (IY+d)", "BIT 4, (IY+d)", "BIT 4, (IY+d)", "BIT 4, (IY+d)", + "BIT 5, (IY+d)", "BIT 5, (IY+d)", "BIT 5, (IY+d)", "BIT 5, (IY+d)", "BIT 5, (IY+d)", "BIT 5, (IY+d)", "BIT 5, (IY+d)", "BIT 5, (IY+d)", + "BIT 6, (IY+d)", "BIT 6, (IY+d)", "BIT 6, (IY+d)", "BIT 6, (IY+d)", "BIT 6, (IY+d)", "BIT 6, (IY+d)", "BIT 6, (IY+d)", "BIT 6, (IY+d)", + "BIT 7, (IY+d)", "BIT 7, (IY+d)", "BIT 7, (IY+d)", "BIT 7, (IY+d)", "BIT 7, (IY+d)", "BIT 7, (IY+d)", "BIT 7, (IY+d)", "BIT 7, (IY+d)", + "RES 0 (IY+d)->B", "RES 0 (IY+d)->C", "RES 0 (IY+d)->D", "RES 0 (IY+d)->E", "RES 0 (IY+d)->H", "RES 0 (IY+d)->L", "RES 0 (IY+d)", "RES 0 (IY+d)->A", + "RES 1 (IY+d)->B", "RES 1 (IY+d)->C", "RES 1 (IY+d)->D", "RES 1 (IY+d)->E", "RES 1 (IY+d)->H", "RES 1 (IY+d)->L", "RES 1 (IY+d)", "RES 1 (IY+d)->A", + "RES 2 (IY+d)->B", "RES 2 (IY+d)->C", "RES 2 (IY+d)->D", "RES 2 (IY+d)->E", "RES 2 (IY+d)->H", "RES 2 (IY+d)->L", "RES 2 (IY+d)", "RES 2 (IY+d)->A", + "RES 3 (IY+d)->B", "RES 3 (IY+d)->C", "RES 3 (IY+d)->D", "RES 3 (IY+d)->E", "RES 3 (IY+d)->H", "RES 3 (IY+d)->L", "RES 3 (IY+d)", "RES 3 (IY+d)->A", + "RES 4 (IY+d)->B", "RES 4 (IY+d)->C", "RES 4 (IY+d)->D", "RES 4 (IY+d)->E", "RES 4 (IY+d)->H", "RES 4 (IY+d)->L", "RES 4 (IY+d)", "RES 4 (IY+d)->A", + "RES 5 (IY+d)->B", "RES 5 (IY+d)->C", "RES 5 (IY+d)->D", "RES 5 (IY+d)->E", "RES 5 (IY+d)->H", "RES 5 (IY+d)->L", "RES 5 (IY+d)", "RES 5 (IY+d)->A", + "RES 6 (IY+d)->B", "RES 6 (IY+d)->C", "RES 6 (IY+d)->D", "RES 6 (IY+d)->E", "RES 6 (IY+d)->H", "RES 6 (IY+d)->L", "RES 6 (IY+d)", "RES 6 (IY+d)->A", + "RES 7 (IY+d)->B", "RES 7 (IY+d)->C", "RES 7 (IY+d)->D", "RES 7 (IY+d)->E", "RES 7 (IY+d)->H", "RES 7 (IY+d)->L", "RES 7 (IY+d)", "RES 7 (IY+d)->A", + "SET 0 (IY+d)->B", "SET 0 (IY+d)->C", "SET 0 (IY+d)->D", "SET 0 (IY+d)->E", "SET 0 (IY+d)->H", "SET 0 (IY+d)->L", "SET 0 (IY+d)", "SET 0 (IY+d)->A", + "SET 1 (IY+d)->B", "SET 1 (IY+d)->C", "SET 1 (IY+d)->D", "SET 1 (IY+d)->E", "SET 1 (IY+d)->H", "SET 1 (IY+d)->L", "SET 1 (IY+d)", "SET 1 (IY+d)->A", + "SET 2 (IY+d)->B", "SET 2 (IY+d)->C", "SET 2 (IY+d)->D", "SET 2 (IY+d)->E", "SET 2 (IY+d)->H", "SET 2 (IY+d)->L", "SET 2 (IY+d)", "SET 2 (IY+d)->A", + "SET 3 (IY+d)->B", "SET 3 (IY+d)->C", "SET 3 (IY+d)->D", "SET 3 (IY+d)->E", "SET 3 (IY+d)->H", "SET 3 (IY+d)->L", "SET 3 (IY+d)", "SET 3 (IY+d)->A", + "SET 4 (IY+d)->B", "SET 4 (IY+d)->C", "SET 4 (IY+d)->D", "SET 4 (IY+d)->E", "SET 4 (IY+d)->H", "SET 4 (IY+d)->L", "SET 4 (IY+d)", "SET 4 (IY+d)->A", + "SET 5 (IY+d)->B", "SET 5 (IY+d)->C", "SET 5 (IY+d)->D", "SET 5 (IY+d)->E", "SET 5 (IY+d)->H", "SET 5 (IY+d)->L", "SET 5 (IY+d)", "SET 5 (IY+d)->A", + "SET 6 (IY+d)->B", "SET 6 (IY+d)->C", "SET 6 (IY+d)->D", "SET 6 (IY+d)->E", "SET 6 (IY+d)->H", "SET 6 (IY+d)->L", "SET 6 (IY+d)", "SET 6 (IY+d)->A", + "SET 7 (IY+d)->B", "SET 7 (IY+d)->C", "SET 7 (IY+d)->D", "SET 7 (IY+d)->E", "SET 7 (IY+d)->H", "SET 7 (IY+d)->L", "SET 7 (IY+d)", "SET 7 (IY+d)->A", + }; readonly static string[] mnemonicsCB = new string[] - { - "RLC B", "RLC C", "RLC D", "RLC E", "RLC H", "RLC L", "RLC (HL)", "RLC A", - "RRC B", "RRC C", "RRC D", "RRC E", "RRC H", "RRC L", "RRC (HL)", "RRC A", - "RL B", "RL C", "RL D", "RL E", "RL H", "RL L", "RL (HL)", "RL A", - "RR B", "RR C", "RR D", "RR E", "RR H", "RR L", "RR (HL)", "RR A", - "SLA B", "SLA C", "SLA D", "SLA E", "SLA H", "SLA L", "SLA (HL)", "SLA A", - "SRA B", "SRA C", "SRA D", "SRA E", "SRA H", "SRA L", "SRA (HL)", "SRA A", - "SL1 B", "SL1 C", "SL1 D", "SL1 E", "SL1 H", "SL1 L", "SL1 (HL)", "SL1 A", - "SRL B", "SRL C", "SRL D", "SRL E", "SRL H", "SRL L", "SRL (HL)", "SRL A", - "BIT 0, B", "BIT 0, C", "BIT 0, D", "BIT 0, E", "BIT 0, H", "BIT 0, L", "BIT 0, (HL)", "BIT 0, A", - "BIT 1, B", "BIT 1, C", "BIT 1, D", "BIT 1, E", "BIT 1, H", "BIT 1, L", "BIT 1, (HL)", "BIT 1, A", - "BIT 2, B", "BIT 2, C", "BIT 2, D", "BIT 2, E", "BIT 2, H", "BIT 2, L", "BIT 2, (HL)", "BIT 2, A", - "BIT 3, B", "BIT 3, C", "BIT 3, D", "BIT 3, E", "BIT 3, H", "BIT 3, L", "BIT 3, (HL)", "BIT 3, A", - "BIT 4, B", "BIT 4, C", "BIT 4, D", "BIT 4, E", "BIT 4, H", "BIT 4, L", "BIT 4, (HL)", "BIT 4, A", - "BIT 5, B", "BIT 5, C", "BIT 5, D", "BIT 5, E", "BIT 5, H", "BIT 5, L", "BIT 5, (HL)", "BIT 5, A", - "BIT 6, B", "BIT 6, C", "BIT 6, D", "BIT 6, E", "BIT 6, H", "BIT 6, L", "BIT 6, (HL)", "BIT 6, A", - "BIT 7, B", "BIT 7, C", "BIT 7, D", "BIT 7, E", "BIT 7, H", "BIT 7, L", "BIT 7, (HL)", "BIT 7, A", - "RES 0, B", "RES 0, C", "RES 0, D", "RES 0, E", "RES 0, H", "RES 0, L", "RES 0, (HL)", "RES 0, A", - "RES 1, B", "RES 1, C", "RES 1, D", "RES 1, E", "RES 1, H", "RES 1, L", "RES 1, (HL)", "RES 1, A", - "RES 2, B", "RES 2, C", "RES 2, D", "RES 2, E", "RES 2, H", "RES 2, L", "RES 2, (HL)", "RES 2, A", - "RES 3, B", "RES 3, C", "RES 3, D", "RES 3, E", "RES 3, H", "RES 3, L", "RES 3, (HL)", "RES 3, A", - "RES 4, B", "RES 4, C", "RES 4, D", "RES 4, E", "RES 4, H", "RES 4, L", "RES 4, (HL)", "RES 4, A", - "RES 5, B", "RES 5, C", "RES 5, D", "RES 5, E", "RES 5, H", "RES 5, L", "RES 5, (HL)", "RES 5, A", - "RES 6, B", "RES 6, C", "RES 6, D", "RES 6, E", "RES 6, H", "RES 6, L", "RES 6, (HL)", "RES 6, A", - "RES 7, B", "RES 7, C", "RES 7, D", "RES 7, E", "RES 7, H", "RES 7, L", "RES 7, (HL)", "RES 7, A", - "SET 0, B", "SET 0, C", "SET 0, D", "SET 0, E", "SET 0, H", "SET 0, L", "SET 0, (HL)", "SET 0, A", - "SET 1, B", "SET 1, C", "SET 1, D", "SET 1, E", "SET 1, H", "SET 1, L", "SET 1, (HL)", "SET 1, A", - "SET 2, B", "SET 2, C", "SET 2, D", "SET 2, E", "SET 2, H", "SET 2, L", "SET 2, (HL)", "SET 2, A", - "SET 3, B", "SET 3, C", "SET 3, D", "SET 3, E", "SET 3, H", "SET 3, L", "SET 3, (HL)", "SET 3, A", - "SET 4, B", "SET 4, C", "SET 4, D", "SET 4, E", "SET 4, H", "SET 4, L", "SET 4, (HL)", "SET 4, A", - "SET 5, B", "SET 5, C", "SET 5, D", "SET 5, E", "SET 5, H", "SET 5, L", "SET 5, (HL)", "SET 5, A", - "SET 6, B", "SET 6, C", "SET 6, D", "SET 6, E", "SET 6, H", "SET 6, L", "SET 6, (HL)", "SET 6, A", - "SET 7, B", "SET 7, C", "SET 7, D", "SET 7, E", "SET 7, H", "SET 7, L", "SET 7, (HL)", "SET 7, A", - }; + { + "RLC B", "RLC C", "RLC D", "RLC E", "RLC H", "RLC L", "RLC (HL)", "RLC A", + "RRC B", "RRC C", "RRC D", "RRC E", "RRC H", "RRC L", "RRC (HL)", "RRC A", + "RL B", "RL C", "RL D", "RL E", "RL H", "RL L", "RL (HL)", "RL A", + "RR B", "RR C", "RR D", "RR E", "RR H", "RR L", "RR (HL)", "RR A", + "SLA B", "SLA C", "SLA D", "SLA E", "SLA H", "SLA L", "SLA (HL)", "SLA A", + "SRA B", "SRA C", "SRA D", "SRA E", "SRA H", "SRA L", "SRA (HL)", "SRA A", + "SL1 B", "SL1 C", "SL1 D", "SL1 E", "SL1 H", "SL1 L", "SL1 (HL)", "SL1 A", + "SRL B", "SRL C", "SRL D", "SRL E", "SRL H", "SRL L", "SRL (HL)", "SRL A", + "BIT 0, B", "BIT 0, C", "BIT 0, D", "BIT 0, E", "BIT 0, H", "BIT 0, L", "BIT 0, (HL)", "BIT 0, A", + "BIT 1, B", "BIT 1, C", "BIT 1, D", "BIT 1, E", "BIT 1, H", "BIT 1, L", "BIT 1, (HL)", "BIT 1, A", + "BIT 2, B", "BIT 2, C", "BIT 2, D", "BIT 2, E", "BIT 2, H", "BIT 2, L", "BIT 2, (HL)", "BIT 2, A", + "BIT 3, B", "BIT 3, C", "BIT 3, D", "BIT 3, E", "BIT 3, H", "BIT 3, L", "BIT 3, (HL)", "BIT 3, A", + "BIT 4, B", "BIT 4, C", "BIT 4, D", "BIT 4, E", "BIT 4, H", "BIT 4, L", "BIT 4, (HL)", "BIT 4, A", + "BIT 5, B", "BIT 5, C", "BIT 5, D", "BIT 5, E", "BIT 5, H", "BIT 5, L", "BIT 5, (HL)", "BIT 5, A", + "BIT 6, B", "BIT 6, C", "BIT 6, D", "BIT 6, E", "BIT 6, H", "BIT 6, L", "BIT 6, (HL)", "BIT 6, A", + "BIT 7, B", "BIT 7, C", "BIT 7, D", "BIT 7, E", "BIT 7, H", "BIT 7, L", "BIT 7, (HL)", "BIT 7, A", + "RES 0, B", "RES 0, C", "RES 0, D", "RES 0, E", "RES 0, H", "RES 0, L", "RES 0, (HL)", "RES 0, A", + "RES 1, B", "RES 1, C", "RES 1, D", "RES 1, E", "RES 1, H", "RES 1, L", "RES 1, (HL)", "RES 1, A", + "RES 2, B", "RES 2, C", "RES 2, D", "RES 2, E", "RES 2, H", "RES 2, L", "RES 2, (HL)", "RES 2, A", + "RES 3, B", "RES 3, C", "RES 3, D", "RES 3, E", "RES 3, H", "RES 3, L", "RES 3, (HL)", "RES 3, A", + "RES 4, B", "RES 4, C", "RES 4, D", "RES 4, E", "RES 4, H", "RES 4, L", "RES 4, (HL)", "RES 4, A", + "RES 5, B", "RES 5, C", "RES 5, D", "RES 5, E", "RES 5, H", "RES 5, L", "RES 5, (HL)", "RES 5, A", + "RES 6, B", "RES 6, C", "RES 6, D", "RES 6, E", "RES 6, H", "RES 6, L", "RES 6, (HL)", "RES 6, A", + "RES 7, B", "RES 7, C", "RES 7, D", "RES 7, E", "RES 7, H", "RES 7, L", "RES 7, (HL)", "RES 7, A", + "SET 0, B", "SET 0, C", "SET 0, D", "SET 0, E", "SET 0, H", "SET 0, L", "SET 0, (HL)", "SET 0, A", + "SET 1, B", "SET 1, C", "SET 1, D", "SET 1, E", "SET 1, H", "SET 1, L", "SET 1, (HL)", "SET 1, A", + "SET 2, B", "SET 2, C", "SET 2, D", "SET 2, E", "SET 2, H", "SET 2, L", "SET 2, (HL)", "SET 2, A", + "SET 3, B", "SET 3, C", "SET 3, D", "SET 3, E", "SET 3, H", "SET 3, L", "SET 3, (HL)", "SET 3, A", + "SET 4, B", "SET 4, C", "SET 4, D", "SET 4, E", "SET 4, H", "SET 4, L", "SET 4, (HL)", "SET 4, A", + "SET 5, B", "SET 5, C", "SET 5, D", "SET 5, E", "SET 5, H", "SET 5, L", "SET 5, (HL)", "SET 5, A", + "SET 6, B", "SET 6, C", "SET 6, D", "SET 6, E", "SET 6, H", "SET 6, L", "SET 6, (HL)", "SET 6, A", + "SET 7, B", "SET 7, C", "SET 7, D", "SET 7, E", "SET 7, H", "SET 7, L", "SET 7, (HL)", "SET 7, A", + }; readonly static string[] mnemonicsED = new string[] - { - "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", - "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", - "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", - "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", - - "IN B, C", "OUT C, B", "SBC HL, BC", "LD (nn), BC", //0x44 + { + "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", + "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", + "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", + "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", "NOP", + + "IN B, C", "OUT C, B", "SBC HL, BC", "LD (nn), BC", //0x44 "NEG", "RETN", "IM $0", "LD I, A", //0x48 "IN C, C", "OUT C, C", "ADC HL, BC", "LD BC, (nn)", //0x4C "NEG", "RETI", "IM $0", "LD R, A", //0x50 @@ -601,7 +601,7 @@ namespace cpu.z80 return format; } - public string Disassemble2(byte[] code,int offset) + public string Disassemble2(byte[] code, int offset) { return Result2(DisassembleInternal2(code), code, offset); } diff --git a/MAME.Core/cpu/z80/Execute.cs b/MAME.Core/cpu/z80/Execute.cs index 726a877..0980dfb 100644 --- a/MAME.Core/cpu/z80/Execute.cs +++ b/MAME.Core/cpu/z80/Execute.cs @@ -1,7 +1,4 @@ -using System.IO; -using mame; - -namespace cpu.z80 +namespace cpu.z80 { public partial class Z80A { @@ -25,7 +22,7 @@ namespace cpu.z80 { halted = false; RegPC.Word++; - } + } totalExecutedCycles += 11; pendingCycles -= 11; nonMaskableInterruptPending = false; //iff2 = iff1; diff --git a/MAME.Core/cpu/z80/Interrupts.cs b/MAME.Core/cpu/z80/Interrupts.cs index 8293f4a..574ccec 100644 --- a/MAME.Core/cpu/z80/Interrupts.cs +++ b/MAME.Core/cpu/z80/Interrupts.cs @@ -33,8 +33,8 @@ namespace cpu.z80 private bool halted; public bool Halted { get { return halted; } set { halted = value; } } - public Func IRQCallback = delegate() { return 0; }; - public Action NMICallback = delegate() { }; + public Func IRQCallback = delegate () { return 0; }; + public Action NMICallback = delegate () { }; private void ResetInterrupts() { diff --git a/MAME.Core/cpu/z80/Registers.cs b/MAME.Core/cpu/z80/Registers.cs index 20a2b0f..be1cdac 100644 --- a/MAME.Core/cpu/z80/Registers.cs +++ b/MAME.Core/cpu/z80/Registers.cs @@ -1,5 +1,5 @@ -using System.Runtime.InteropServices; -using System; +using System; +using System.Runtime.InteropServices; namespace cpu.z80 { diff --git a/MAME.Core/cpu/z80/Tables.cs b/MAME.Core/cpu/z80/Tables.cs index d6075ef..4c57195 100644 --- a/MAME.Core/cpu/z80/Tables.cs +++ b/MAME.Core/cpu/z80/Tables.cs @@ -47,7 +47,7 @@ } } - private ushort[, , ,] TableALU; + private ushort[,,,] TableALU; private void InitTableALU() { TableALU = new ushort[8, 256, 256, 2]; // Class, OP1, OP2, Carry @@ -191,7 +191,7 @@ } } - private ushort[, ,] TableRotShift; + private ushort[,,] TableRotShift; private void InitTableRotShift() { TableRotShift = new ushort[2, 8, 65536]; // All, operation, AF @@ -299,7 +299,7 @@ private int[] cc_op, cc_cb, cc_ed, cc_xy, cc_xycb, cc_ex; private void InitTableCc() { - cc_op=new int[0x100]{ + cc_op = new int[0x100]{ 4,10, 7, 6, 4, 4, 7, 4, 4,11, 7, 6, 4, 4, 7, 4, 8,10, 7, 6, 4, 4, 7, 4,12,11, 7, 6, 4, 4, 7, 4, 7,10,16, 6, 4, 4, 7, 4, 7,11,16, 6, 4, 4, 7, 4, diff --git a/MAME.Core/cpu/z80/Z80A.cs b/MAME.Core/cpu/z80/Z80A.cs index ecea230..f903aae 100644 --- a/MAME.Core/cpu/z80/Z80A.cs +++ b/MAME.Core/cpu/z80/Z80A.cs @@ -1,8 +1,7 @@ -using System; +using mame; +using System; using System.Globalization; -using System.Collections.Generic; using System.IO; -using mame; // This Z80 emulator is a modified version of Ben Ryves 'Brazil' emulator. // It is MIT licensed. @@ -29,7 +28,7 @@ namespace cpu.z80 { totalExecutedCycles = value; } - } + } public override int PendingCycles { get @@ -279,7 +278,7 @@ namespace cpu.z80 pendingCycles = int.Parse(args[1]); else - Console.WriteLine("Skipping unrecognized identifier " + args[0]); + EmuLogger.Log("Skipping unrecognized identifier " + args[0]); } } } diff --git a/MAME.Core/emu/Attotime.cs b/MAME.Core/emu/Attotime.cs index be31eca..b74af92 100644 --- a/MAME.Core/emu/Attotime.cs +++ b/MAME.Core/emu/Attotime.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace mame +namespace mame { public struct Atime { @@ -21,7 +16,7 @@ namespace mame public static long ATTOSECONDS_PER_SECOND = (long)(1e18); public static Atime ATTOTIME_ZERO = new Atime(0, 0); public static Atime ATTOTIME_NEVER = new Atime(1000000000, 0); - public static long ATTOSECONDS_PER_NANOSECOND=(long)1e9; + public static long ATTOSECONDS_PER_NANOSECOND = (long)1e9; public static Atime ATTOTIME_IN_NSEC(long ns) { return new Atime((int)(ns / 1000000000), (long)((ns % 1000000000) * ATTOSECONDS_PER_NANOSECOND)); @@ -151,7 +146,7 @@ namespace mame return ATTOTIME_ZERO; /* split attoseconds into upper and lower halves which fit into 32 bits */ - attohi = divu_64x32_rem((ulong)_time1.attoseconds, 1000000000,out attolo); + attohi = divu_64x32_rem((ulong)_time1.attoseconds, 1000000000, out attolo); /* scale the lower half, then split into high/low parts */ temp = mulu_32x32(attolo, factor); @@ -200,7 +195,7 @@ namespace mame attohi = divu_64x32_rem((ulong)_time1.attoseconds, 1000000000, out attolo); /* divide the seconds and get the remainder */ - result.seconds = (int)divu_64x32_rem((ulong)_time1.seconds, factor, out remainder); + result.seconds = (int)divu_64x32_rem((ulong)_time1.seconds, factor, out remainder); /* combine the upper half of attoseconds with the remainder and divide that */ temp = (ulong)attohi + mulu_32x32(remainder, 1000000000); diff --git a/MAME.Core/emu/Cpuexec.cs b/MAME.Core/emu/Cpuexec.cs index bd23111..a9dc782 100644 --- a/MAME.Core/emu/Cpuexec.cs +++ b/MAME.Core/emu/Cpuexec.cs @@ -29,8 +29,8 @@ namespace mame public Timer.emu_timer partial_frame_timer; public Atime partial_frame_period; public virtual ulong TotalExecutedCycles { get; set; } - public virtual int PendingCycles { get; set; } - public virtual int ExecuteCycles(int cycles) { return 0; } + public virtual int PendingCycles { get; set; } + public virtual int ExecuteCycles(int cycles) { return 0; } public virtual void Reset() { } public virtual void set_irq_line(int irqline, LineState state) { } public virtual void cpunum_set_input_line_and_vector(int cpunum, int line, LineState state, int vector) { } @@ -38,7 +38,7 @@ namespace mame public class Cpuexec { public static byte SUSPEND_REASON_HALT = 0x01, SUSPEND_REASON_RESET = 0x02, SUSPEND_REASON_SPIN = 0x04, SUSPEND_REASON_TRIGGER = 0x08, SUSPEND_REASON_DISABLE = 0x10, SUSPEND_ANY_REASON = 0xff; - public static int iType, bLog, bLog0, bLog1, bLog2, bLog3,bLogS; + public static int iType, bLog, bLog0, bLog1, bLog2, bLog3, bLogS; public static bool bLog02, bLog12, bLog22, bLog32; public static bool b11 = true, b12 = true, b13 = true, b14 = true; public static int iloops, activecpu, icpu, ncpu, iloops2; @@ -488,7 +488,7 @@ namespace mame case "opwolf": case "opwolfa": case "opwolfj": - case "opwolfu": + case "opwolfu": case "opwolfp": MC68000.m1 = new MC68000(); Z80A.nZ80 = 1; @@ -741,7 +741,7 @@ namespace mame cpu[2].cycles_per_second = 3579545; cpu[0].attoseconds_per_cycle = Attotime.ATTOSECONDS_PER_SECOND / cpu[0].cycles_per_second; cpu[1].attoseconds_per_cycle = Attotime.ATTOSECONDS_PER_SECOND / cpu[1].cycles_per_second; - cpu[2].attoseconds_per_cycle = Attotime.ATTOSECONDS_PER_SECOND / cpu[2].cycles_per_second; + cpu[2].attoseconds_per_cycle = Attotime.ATTOSECONDS_PER_SECOND / cpu[2].cycles_per_second; vblank_interrupts_per_frame = 1; break; } @@ -943,7 +943,7 @@ namespace mame M6502.mm1[0].ReadOp = Dataeast.D0ReadOp; M6502.mm1[0].ReadOpArg = Dataeast.D0ReadOpArg; M6502.mm1[0].ReadMemory = Dataeast.D0ReadMemory; - M6502.mm1[0].WriteMemory = Dataeast.D0WriteMemory; + M6502.mm1[0].WriteMemory = Dataeast.D0WriteMemory; M6502.mm1[1].ReadOpArg = Dataeast.D1ReadOpArg; M6502.mm1[1].ReadMemory = Dataeast.D1ReadMemory; M6502.mm1[1].WriteMemory = Dataeast.D1WriteMemory; @@ -987,7 +987,7 @@ namespace mame Z80A.zz1[1].WriteMemory = Tehkan.Z1WriteMemory; Z80A.zz1[1].ReadHardware = Tehkan.Z1ReadHardware; Z80A.zz1[1].WriteHardware = Tehkan.Z1WriteHardware; - Z80A.zz1[1].IRQCallback = Tehkan.Z1IRQCallback; + Z80A.zz1[1].IRQCallback = Tehkan.Z1IRQCallback; break; case "Neo Geo": MC68000.m1.ReadOpByte = Neogeo.MReadOpByte; @@ -1373,14 +1373,14 @@ namespace mame MC68000.m1.WriteByte = PGM.MPWriteByte_orlegend; MC68000.m1.WriteWord = PGM.MPWriteWord_orlegend; break; - /*case "drgw2": - MC68000.m1.ReadByte = PGM.MPReadByte_drgw2; - MC68000.m1.ReadWord = MC68000.m1.ReadPcrelWord= PGM.MPReadWord_drgw2; - MC68000.m1.ReadLong = MC68000.m1.ReadPcrelLong= PGM.MPReadLong_drgw2; - MC68000.m1.WriteByte = PGM.MPWriteByte_drgw2; - MC68000.m1.WriteWord = PGM.MPWriteWord_drgw2; - MC68000.m1.WriteLong = PGM.MPWriteLong_drgw2; - break;*/ + /*case "drgw2": + MC68000.m1.ReadByte = PGM.MPReadByte_drgw2; + MC68000.m1.ReadWord = MC68000.m1.ReadPcrelWord= PGM.MPReadWord_drgw2; + MC68000.m1.ReadLong = MC68000.m1.ReadPcrelLong= PGM.MPReadLong_drgw2; + MC68000.m1.WriteByte = PGM.MPWriteByte_drgw2; + MC68000.m1.WriteWord = PGM.MPWriteWord_drgw2; + MC68000.m1.WriteLong = PGM.MPWriteLong_drgw2; + break;*/ } break; case "M72": @@ -1999,7 +1999,7 @@ namespace mame case "gngt": case "makaimur": case "makaimurc": - case "makaimurg": + case "makaimurg": M6809.mm1[0].ReadOp = Capcom.MReadOpByte_gng; M6809.mm1[0].ReadOpArg = Capcom.MReadOpByte_gng; M6809.mm1[0].RM = Capcom.MReadByte_gng; @@ -2105,7 +2105,7 @@ namespace mame Z80A.zz1[1].ReadHardware = Capcom.Z1ReadHardware; Z80A.zz1[1].WriteHardware = Capcom.Z1WriteHardware; Z80A.zz1[1].IRQCallback = Capcom.Z1IRQCallback; - break; + break; } break; } @@ -2118,46 +2118,46 @@ namespace mame case "Neo Geo": case "PGM": case "Taito B": - m68000Form.m68000State = m68000Form.M68000State.M68000_RUN; - MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000form.m68000_start_debug; - MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000form.m68000_stop_debug; - z80Form.z80State = z80Form.Z80AState.Z80A_RUN; - Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug; - Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug; + m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN; + MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug; + MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug; + z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN; + Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; + Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; break; case "Tehkan": - z80Form.z80State = z80Form.Z80AState.Z80A_RUN; - Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug; - Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug; + z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN; + Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; + Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; Z80A.zz1[1].debugger_start_cpu_hook_callback = null_callback; Z80A.zz1[1].debugger_stop_cpu_hook_callback = null_callback; break; case "IGS011": - m68000Form.m68000State = m68000Form.M68000State.M68000_RUN; - MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000form.m68000_start_debug; - MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000form.m68000_stop_debug; + m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN; + MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug; + MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug; break; case "SunA8": - z80Form.z80State = z80Form.Z80AState.Z80A_RUN; - Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug; - Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug; + z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN; + Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; + Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; Z80A.zz1[1].debugger_start_cpu_hook_callback = null_callback; Z80A.zz1[1].debugger_stop_cpu_hook_callback = null_callback; break; case "Namco System 1": - m6809Form.m6809State = CPUState.RUN; + m6809Motion.m6809State = CPUState.RUN; M6809.mm1[0].DisassemblerInit(); - M6809.mm1[0].debugger_start_cpu_hook_callback = Machine.FORM.m6809form.m6809_start_debug; - M6809.mm1[0].debugger_stop_cpu_hook_callback = Machine.FORM.m6809form.m6809_stop_debug; + M6809.mm1[0].debugger_start_cpu_hook_callback = Machine.FORM.m6809motion.m6809_start_debug; + M6809.mm1[0].debugger_stop_cpu_hook_callback = Machine.FORM.m6809motion.m6809_stop_debug; M6809.mm1[1].debugger_start_cpu_hook_callback = null_callback; M6809.mm1[1].debugger_stop_cpu_hook_callback = null_callback; M6809.mm1[2].debugger_start_cpu_hook_callback = null_callback; M6809.mm1[2].debugger_stop_cpu_hook_callback = null_callback; break; case "M72": - z80Form.z80State = z80Form.Z80AState.Z80A_RUN; - Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug; - Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug; + z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN; + Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; + Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; break; case "M92": break; @@ -2186,35 +2186,35 @@ namespace mame case "boblcave": case "bublcave11": case "bublcave10": - z80Form.z80State = z80Form.Z80AState.Z80A_RUN; - Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug; - Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug; - Z80A.zz1[1].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug; - Z80A.zz1[1].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug; - Z80A.zz1[2].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug; - Z80A.zz1[2].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug; + z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN; + Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; + Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; + Z80A.zz1[1].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; + Z80A.zz1[1].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; + Z80A.zz1[2].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; + Z80A.zz1[2].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; break; case "opwolf": case "opwolfa": case "opwolfj": - case "opwolfu": + case "opwolfu": case "opwolfp": - m68000Form.m68000State = m68000Form.M68000State.M68000_RUN; - MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000form.m68000_start_debug; - MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000form.m68000_stop_debug; - z80Form.z80State = z80Form.Z80AState.Z80A_RUN; - Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug; - Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug; + m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN; + MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug; + MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug; + z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN; + Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; + Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; break; case "opwolfb": - m68000Form.m68000State = m68000Form.M68000State.M68000_RUN; - MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000form.m68000_start_debug; - MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000form.m68000_stop_debug; - z80Form.z80State = z80Form.Z80AState.Z80A_RUN; - Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug; - Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug; - Z80A.zz1[1].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug; - Z80A.zz1[1].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug; + m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN; + MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug; + MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug; + z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN; + Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; + Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; + Z80A.zz1[1].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; + Z80A.zz1[1].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; break; } break; @@ -2222,17 +2222,17 @@ namespace mame switch (Machine.sName) { case "cuebrick": - m68000Form.m68000State = m68000Form.M68000State.M68000_RUN; - MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000form.m68000_start_debug; - MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000form.m68000_stop_debug; + m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN; + MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug; + MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug; break; default: - m68000Form.m68000State = m68000Form.M68000State.M68000_RUN; - MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000form.m68000_start_debug; - MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000form.m68000_stop_debug; - z80Form.z80State = z80Form.Z80AState.Z80A_RUN; - Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug; - Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug; + m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN; + MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug; + MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug; + z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN; + Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; + Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; break; } break; @@ -2250,13 +2250,13 @@ namespace mame case "makaimurc": case "makaimurg": case "diamond": - m6809Form.m6809State = CPUState.RUN; + m6809Motion.m6809State = CPUState.RUN; M6809.mm1[0].DisassemblerInit(); - M6809.mm1[0].debugger_start_cpu_hook_callback = Machine.FORM.m6809form.m6809_start_debug; - M6809.mm1[0].debugger_stop_cpu_hook_callback = Machine.FORM.m6809form.m6809_stop_debug; - z80Form.z80State = z80Form.Z80AState.Z80A_RUN; - Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug; - Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug; + M6809.mm1[0].debugger_start_cpu_hook_callback = Machine.FORM.m6809motion.m6809_start_debug; + M6809.mm1[0].debugger_stop_cpu_hook_callback = Machine.FORM.m6809motion.m6809_stop_debug; + z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN; + Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; + Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; break; case "sf": case "sfua": @@ -2264,14 +2264,14 @@ namespace mame case "sfjan": case "sfan": case "sfp": - m68000Form.m68000State = m68000Form.M68000State.M68000_RUN; - MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000form.m68000_start_debug; - MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000form.m68000_stop_debug; - z80Form.z80State = z80Form.Z80AState.Z80A_RUN; - Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug; - Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug; - Z80A.zz1[1].debugger_start_cpu_hook_callback = Machine.FORM.z80form.z80_start_debug; - Z80A.zz1[1].debugger_stop_cpu_hook_callback = Machine.FORM.z80form.z80_stop_debug; + m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN; + MC68000.m1.debugger_start_cpu_hook_callback = Machine.FORM.m68000motion.m68000_start_debug; + MC68000.m1.debugger_stop_cpu_hook_callback = Machine.FORM.m68000motion.m68000_stop_debug; + z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN; + Z80A.zz1[0].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; + Z80A.zz1[0].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; + Z80A.zz1[1].debugger_start_cpu_hook_callback = Machine.FORM.z80motion.z80_start_debug; + Z80A.zz1[1].debugger_stop_cpu_hook_callback = Machine.FORM.z80motion.z80_stop_debug; break; } break; @@ -2428,7 +2428,7 @@ namespace mame Atime tbase = Timer.global_basetime; int ran; Atime at; - int i,j; + int i, j; for (icpu = 0; icpu < ncpu; icpu++) { cpu[icpu].suspend = cpu[icpu].nextsuspend; @@ -2472,9 +2472,9 @@ namespace mame cpu[icpu].eatcycles = cpu[icpu].nexteatcycles; } Timer.timer_set_global_time(target); - if (Timer.global_basetime.attoseconds == 0 && Machine.FORM.cheatform.lockState == cheatForm.LockState.LOCK_SECOND) + if (Timer.global_basetime.attoseconds == 0 && Machine.FORM.cheatmotion.lockState == cheatMotion.LockState.LOCK_SECOND) { - Machine.FORM.cheatform.ApplyCheat(); + Machine.FORM.cheatmotion.ApplyCheat(); } } public static void cpu_boost_interleave(Atime timeslice_time, Atime boost_duration) @@ -2616,7 +2616,7 @@ namespace mame IGS011.lhb_interrupt(); Timer.timer_adjust_periodic(Cpuexec.cpu[0].partial_frame_timer, Cpuexec.cpu[0].partial_frame_period, Attotime.ATTOTIME_NEVER); break; - } + } break; case "PGM": PGM.drgw_interrupt(); @@ -2682,7 +2682,7 @@ namespace mame case "opwolf": case "opwolfa": case "opwolfj": - case "opwolfu": + case "opwolfu": case "opwolfp": if (!cpunum_is_suspended(0, (byte)(SUSPEND_REASON_HALT | SUSPEND_REASON_RESET | SUSPEND_REASON_DISABLE))) { @@ -2753,7 +2753,7 @@ namespace mame case "sfp": Generic.irq_0_6_line_hold(); break; - } + } break; } } @@ -2810,7 +2810,7 @@ namespace mame { Timer.timer_adjust_periodic(Cpuexec.cpu[1].partial_frame_timer, Cpuexec.cpu[1].partial_frame_period, Attotime.ATTOTIME_NEVER); } - break; + break; case "Taito": switch (Machine.sName) { diff --git a/MAME.Core/emu/Cpuint.cs b/MAME.Core/emu/Cpuint.cs index 8153760..de9d903 100644 --- a/MAME.Core/emu/Cpuint.cs +++ b/MAME.Core/emu/Cpuint.cs @@ -1,8 +1,6 @@ using System; using System.Collections.Generic; -using System.Linq; using System.IO; -using System.Text; using System.Runtime.InteropServices; namespace mame @@ -47,7 +45,7 @@ namespace mame INPUT_LINE_NMI = MAX_INPUT_LINES - 3, INPUT_LINE_RESET = MAX_INPUT_LINES - 2, INPUT_LINE_HALT = MAX_INPUT_LINES - 1, - } + } public class irq { public int cpunum; @@ -59,7 +57,7 @@ namespace mame { } - public irq(int _cpunum, int _line, LineState _state,int _vector, Atime _time) + public irq(int _cpunum, int _line, LineState _state, int _vector, Atime _time) { cpunum = _cpunum; line = _line; @@ -123,7 +121,7 @@ namespace mame interrupt_vector[i, j] = 0xff; input_event_index[i, j] = 0; } - } + } } public static void cps1_irq_handler_mus(int irq) { @@ -143,7 +141,7 @@ namespace mame { if (cpunum < Cpuexec.ncpu && line >= 0 && line < (int)LineState.MAX_INPUT_LINES) { - interrupt_vector[cpunum,line] = vector; + interrupt_vector[cpunum, line] = vector; return; } } @@ -162,12 +160,12 @@ namespace mame { int i1 = 1; } - foreach(irq irq1 in lirq) + foreach (irq irq1 in lirq) { if (Attotime.attotime_compare(irq1.time, Timer.global_basetime) <= 0) { - input_line_state[irq1.cpunum,irq1.line] = (byte)irq1.state; - input_line_vector[irq1.cpunum,irq1.line] = irq1.vector; + input_line_state[irq1.cpunum, irq1.line] = (byte)irq1.state; + input_line_vector[irq1.cpunum, irq1.line] = irq1.vector; if (irq1.line == (int)LineState.INPUT_LINE_RESET) { if (irq1.state == LineState.ASSERT_LINE) @@ -214,7 +212,7 @@ namespace mame { Cpuexec.cpu_triggerint(irq1.cpunum); } - } + } lsirq.Add(irq1); } } @@ -293,7 +291,7 @@ namespace mame } public static void SaveStateBinary(BinaryWriter writer) { - int i,j, n; + int i, j, n; n = lirq.Count; writer.Write(n); for (i = 0; i < n; i++) @@ -341,11 +339,11 @@ namespace mame { writer.Write(input_event_index[i, j]); } - } + } } public static void LoadStateBinary(BinaryReader reader) { - int i,j, n; + int i, j, n; n = reader.ReadInt32(); lirq = new List(); for (i = 0; i < n; i++) diff --git a/MAME.Core/emu/Crosshair.cs b/MAME.Core/emu/Crosshair.cs index 4f03d75..4f01b4f 100644 --- a/MAME.Core/emu/Crosshair.cs +++ b/MAME.Core/emu/Crosshair.cs @@ -1,10 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Drawing; -using System.IO; -using System.Text; -using System.Runtime.InteropServices; +using Bitmap = MAME.Core.AxiBitmap.AxiBitmap; +using Color = MAME.Core.AxiBitmap.AxiColor; namespace mame { @@ -24,68 +19,68 @@ namespace mame public byte animation_counter; } public static crosshair_global global; - public static byte[] crosshair_raw_top =new byte[] + public static byte[] crosshair_raw_top = new byte[] { - 0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00, - 0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x00, - 0x00,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xf0,0x00, - 0x01,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xf8,0x00, - 0x03,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xfc,0x00, - 0x07,0xfe,0x00,0x00,0x00,0x0f,0xfe,0x00,0x00,0x00,0x07,0xfe,0x00, - 0x0f,0xff,0x00,0x00,0x01,0xff,0xff,0xf0,0x00,0x00,0x0f,0xff,0x00, - 0x1f,0xff,0x80,0x00,0x1f,0xff,0xff,0xff,0x00,0x00,0x1f,0xff,0x80, - 0x3f,0xff,0x80,0x00,0xff,0xff,0xff,0xff,0xe0,0x00,0x1f,0xff,0xc0, - 0x7f,0xff,0xc0,0x03,0xff,0xff,0xff,0xff,0xf8,0x00,0x3f,0xff,0xe0, - 0xff,0xff,0xe0,0x07,0xff,0xff,0xff,0xff,0xfc,0x00,0x7f,0xff,0xf0, - 0x7f,0xff,0xf0,0x1f,0xff,0xff,0xff,0xff,0xff,0x00,0xff,0xff,0xe0, - 0x3f,0xff,0xf8,0x7f,0xff,0xff,0xff,0xff,0xff,0xc1,0xff,0xff,0xc0, - 0x0f,0xff,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,0xe1,0xff,0xff,0x00, - 0x07,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfb,0xff,0xfe,0x00, - 0x03,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfc,0x00, - 0x01,0xff,0xff,0xff,0xff,0xf0,0x01,0xff,0xff,0xff,0xff,0xf8,0x00, - 0x00,0x7f,0xff,0xff,0xff,0x00,0x00,0x1f,0xff,0xff,0xff,0xe0,0x00, - 0x00,0x3f,0xff,0xff,0xf8,0x00,0x00,0x03,0xff,0xff,0xff,0xc0,0x00, - 0x00,0x1f,0xff,0xff,0xe0,0x00,0x00,0x00,0xff,0xff,0xff,0x80,0x00, - 0x00,0x0f,0xff,0xff,0x80,0x00,0x00,0x00,0x3f,0xff,0xff,0x00,0x00, - 0x00,0x03,0xff,0xfe,0x00,0x00,0x00,0x00,0x0f,0xff,0xfc,0x00,0x00, - 0x00,0x01,0xff,0xfc,0x00,0x00,0x00,0x00,0x07,0xff,0xf8,0x00,0x00, - 0x00,0x03,0xff,0xf8,0x00,0x00,0x00,0x00,0x01,0xff,0xf8,0x00,0x00, - 0x00,0x07,0xff,0xfc,0x00,0x00,0x00,0x00,0x03,0xff,0xfc,0x00,0x00, - 0x00,0x0f,0xff,0xfe,0x00,0x00,0x00,0x00,0x07,0xff,0xfe,0x00,0x00, - 0x00,0x0f,0xff,0xff,0x00,0x00,0x00,0x00,0x0f,0xff,0xfe,0x00,0x00, - 0x00,0x1f,0xff,0xff,0x80,0x00,0x00,0x00,0x1f,0xff,0xff,0x00,0x00, - 0x00,0x1f,0xff,0xff,0x80,0x00,0x00,0x00,0x1f,0xff,0xff,0x00,0x00, - 0x00,0x3f,0xfe,0xff,0xc0,0x00,0x00,0x00,0x3f,0xff,0xff,0x80,0x00, - 0x00,0x7f,0xfc,0x7f,0xe0,0x00,0x00,0x00,0x7f,0xe7,0xff,0xc0,0x00, - 0x00,0x7f,0xf8,0x3f,0xf0,0x00,0x00,0x00,0xff,0xc3,0xff,0xc0,0x00, - 0x00,0xff,0xf8,0x1f,0xf8,0x00,0x00,0x01,0xff,0x83,0xff,0xe0,0x00, - 0x00,0xff,0xf0,0x07,0xf8,0x00,0x00,0x01,0xfe,0x01,0xff,0xe0,0x00, - 0x00,0xff,0xf0,0x03,0xfc,0x00,0x00,0x03,0xfc,0x01,0xff,0xe0,0x00, - 0x01,0xff,0xe0,0x01,0xfe,0x00,0x00,0x07,0xf8,0x00,0xff,0xf0,0x00, - 0x01,0xff,0xe0,0x00,0xff,0x00,0x00,0x0f,0xf0,0x00,0xff,0xf0,0x00, - 0x01,0xff,0xc0,0x00,0x3f,0x80,0x00,0x1f,0xc0,0x00,0x7f,0xf0,0x00, - 0x01,0xff,0xc0,0x00,0x1f,0x80,0x00,0x1f,0x80,0x00,0x7f,0xf0,0x00, - 0x03,0xff,0xc0,0x00,0x0f,0xc0,0x00,0x3f,0x00,0x00,0x7f,0xf8,0x00, - 0x03,0xff,0x80,0x00,0x07,0xe0,0x00,0x7e,0x00,0x00,0x3f,0xf8,0x00, - 0x03,0xff,0x80,0x00,0x01,0xf0,0x00,0xf8,0x00,0x00,0x3f,0xf8,0x00, - 0x03,0xff,0x80,0x00,0x00,0xf8,0x01,0xf0,0x00,0x00,0x3f,0xf8,0x00, - 0x03,0xff,0x80,0x00,0x00,0x78,0x01,0xe0,0x00,0x00,0x3f,0xf8,0x00, - 0x07,0xff,0x00,0x00,0x00,0x3c,0x03,0xc0,0x00,0x00,0x3f,0xfc,0x00, - 0x07,0xff,0x00,0x00,0x00,0x0e,0x07,0x00,0x00,0x00,0x1f,0xfc,0x00, - 0x07,0xff,0x00,0x00,0x00,0x07,0x0e,0x00,0x00,0x00,0x1f,0xfc,0x00, - 0x07,0xff,0x00,0x00,0x00,0x03,0x9c,0x00,0x00,0x00,0x1f,0xfc,0x00, - 0x07,0xff,0x00,0x00,0x00,0x01,0x98,0x00,0x00,0x00,0x1f,0xfc,0x00, - 0x07,0xff,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x1f,0xfc,0x00 + 0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00, + 0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x00, + 0x00,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xf0,0x00, + 0x01,0xf8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xf8,0x00, + 0x03,0xfc,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xfc,0x00, + 0x07,0xfe,0x00,0x00,0x00,0x0f,0xfe,0x00,0x00,0x00,0x07,0xfe,0x00, + 0x0f,0xff,0x00,0x00,0x01,0xff,0xff,0xf0,0x00,0x00,0x0f,0xff,0x00, + 0x1f,0xff,0x80,0x00,0x1f,0xff,0xff,0xff,0x00,0x00,0x1f,0xff,0x80, + 0x3f,0xff,0x80,0x00,0xff,0xff,0xff,0xff,0xe0,0x00,0x1f,0xff,0xc0, + 0x7f,0xff,0xc0,0x03,0xff,0xff,0xff,0xff,0xf8,0x00,0x3f,0xff,0xe0, + 0xff,0xff,0xe0,0x07,0xff,0xff,0xff,0xff,0xfc,0x00,0x7f,0xff,0xf0, + 0x7f,0xff,0xf0,0x1f,0xff,0xff,0xff,0xff,0xff,0x00,0xff,0xff,0xe0, + 0x3f,0xff,0xf8,0x7f,0xff,0xff,0xff,0xff,0xff,0xc1,0xff,0xff,0xc0, + 0x0f,0xff,0xf8,0xff,0xff,0xff,0xff,0xff,0xff,0xe1,0xff,0xff,0x00, + 0x07,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfb,0xff,0xfe,0x00, + 0x03,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xfc,0x00, + 0x01,0xff,0xff,0xff,0xff,0xf0,0x01,0xff,0xff,0xff,0xff,0xf8,0x00, + 0x00,0x7f,0xff,0xff,0xff,0x00,0x00,0x1f,0xff,0xff,0xff,0xe0,0x00, + 0x00,0x3f,0xff,0xff,0xf8,0x00,0x00,0x03,0xff,0xff,0xff,0xc0,0x00, + 0x00,0x1f,0xff,0xff,0xe0,0x00,0x00,0x00,0xff,0xff,0xff,0x80,0x00, + 0x00,0x0f,0xff,0xff,0x80,0x00,0x00,0x00,0x3f,0xff,0xff,0x00,0x00, + 0x00,0x03,0xff,0xfe,0x00,0x00,0x00,0x00,0x0f,0xff,0xfc,0x00,0x00, + 0x00,0x01,0xff,0xfc,0x00,0x00,0x00,0x00,0x07,0xff,0xf8,0x00,0x00, + 0x00,0x03,0xff,0xf8,0x00,0x00,0x00,0x00,0x01,0xff,0xf8,0x00,0x00, + 0x00,0x07,0xff,0xfc,0x00,0x00,0x00,0x00,0x03,0xff,0xfc,0x00,0x00, + 0x00,0x0f,0xff,0xfe,0x00,0x00,0x00,0x00,0x07,0xff,0xfe,0x00,0x00, + 0x00,0x0f,0xff,0xff,0x00,0x00,0x00,0x00,0x0f,0xff,0xfe,0x00,0x00, + 0x00,0x1f,0xff,0xff,0x80,0x00,0x00,0x00,0x1f,0xff,0xff,0x00,0x00, + 0x00,0x1f,0xff,0xff,0x80,0x00,0x00,0x00,0x1f,0xff,0xff,0x00,0x00, + 0x00,0x3f,0xfe,0xff,0xc0,0x00,0x00,0x00,0x3f,0xff,0xff,0x80,0x00, + 0x00,0x7f,0xfc,0x7f,0xe0,0x00,0x00,0x00,0x7f,0xe7,0xff,0xc0,0x00, + 0x00,0x7f,0xf8,0x3f,0xf0,0x00,0x00,0x00,0xff,0xc3,0xff,0xc0,0x00, + 0x00,0xff,0xf8,0x1f,0xf8,0x00,0x00,0x01,0xff,0x83,0xff,0xe0,0x00, + 0x00,0xff,0xf0,0x07,0xf8,0x00,0x00,0x01,0xfe,0x01,0xff,0xe0,0x00, + 0x00,0xff,0xf0,0x03,0xfc,0x00,0x00,0x03,0xfc,0x01,0xff,0xe0,0x00, + 0x01,0xff,0xe0,0x01,0xfe,0x00,0x00,0x07,0xf8,0x00,0xff,0xf0,0x00, + 0x01,0xff,0xe0,0x00,0xff,0x00,0x00,0x0f,0xf0,0x00,0xff,0xf0,0x00, + 0x01,0xff,0xc0,0x00,0x3f,0x80,0x00,0x1f,0xc0,0x00,0x7f,0xf0,0x00, + 0x01,0xff,0xc0,0x00,0x1f,0x80,0x00,0x1f,0x80,0x00,0x7f,0xf0,0x00, + 0x03,0xff,0xc0,0x00,0x0f,0xc0,0x00,0x3f,0x00,0x00,0x7f,0xf8,0x00, + 0x03,0xff,0x80,0x00,0x07,0xe0,0x00,0x7e,0x00,0x00,0x3f,0xf8,0x00, + 0x03,0xff,0x80,0x00,0x01,0xf0,0x00,0xf8,0x00,0x00,0x3f,0xf8,0x00, + 0x03,0xff,0x80,0x00,0x00,0xf8,0x01,0xf0,0x00,0x00,0x3f,0xf8,0x00, + 0x03,0xff,0x80,0x00,0x00,0x78,0x01,0xe0,0x00,0x00,0x3f,0xf8,0x00, + 0x07,0xff,0x00,0x00,0x00,0x3c,0x03,0xc0,0x00,0x00,0x3f,0xfc,0x00, + 0x07,0xff,0x00,0x00,0x00,0x0e,0x07,0x00,0x00,0x00,0x1f,0xfc,0x00, + 0x07,0xff,0x00,0x00,0x00,0x07,0x0e,0x00,0x00,0x00,0x1f,0xfc,0x00, + 0x07,0xff,0x00,0x00,0x00,0x03,0x9c,0x00,0x00,0x00,0x1f,0xfc,0x00, + 0x07,0xff,0x00,0x00,0x00,0x01,0x98,0x00,0x00,0x00,0x1f,0xfc,0x00, + 0x07,0xff,0x00,0x00,0x00,0x00,0x60,0x00,0x00,0x00,0x1f,0xfc,0x00 }; - public static uint[] crosshair_colors =new uint[] + public static uint[] crosshair_colors = new uint[] { - 0x4040ff, - 0xff4040, - 0x40ff40, - 0xffff40, - 0xff40ff, - 0x40ffff, - 0xffffff + 0x4040ff, + 0xff4040, + 0x40ff40, + 0xffff40, + 0xff40ff, + 0x40ffff, + 0xffffff }; public static void crosshair_init() { diff --git a/MAME.Core/emu/Drawgfx.cs b/MAME.Core/emu/Drawgfx.cs index 9fab199..bd9af78 100644 --- a/MAME.Core/emu/Drawgfx.cs +++ b/MAME.Core/emu/Drawgfx.cs @@ -1,16 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; - -namespace mame +namespace mame { public partial class Drawgfx { - public static int[] gfx_drawmode_table=new int[256]; - - - + public static int[] gfx_drawmode_table = new int[256]; + + + } } \ No newline at end of file diff --git a/MAME.Core/emu/Eeprom.cs b/MAME.Core/emu/Eeprom.cs index 8b04c14..ec77b52 100644 --- a/MAME.Core/emu/Eeprom.cs +++ b/MAME.Core/emu/Eeprom.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; +using System.IO; namespace mame { @@ -52,7 +48,7 @@ namespace mame public static LineState reset_line, clock_line; public static int locked; public static int enable_multi_read; - public static int reset_delay,reset_delay1; + public static int reset_delay, reset_delay1; private static bool eeprom_command_match(byte[] buf, byte[] cmd, int len) { int ibuf = 0, idx = 0; @@ -64,7 +60,7 @@ namespace mame { return false; } - for (; len > 0; ) + for (; len > 0;) { byte b = buf[ibuf]; byte c = cmd[idx]; @@ -128,7 +124,7 @@ namespace mame for (int i = 0; i < 0x80; i++) { eeprom_data[i] = 0xff; - } + } locked = 0; address_bits = 7; data_bits = 8; @@ -151,8 +147,8 @@ namespace mame cmd_read = new byte[] { (byte)'0', (byte)'1', (byte)'1', (byte)'0' }; cmd_write = new byte[] { (byte)'0', (byte)'1', (byte)'0', (byte)'1' }; cmd_erase = new byte[] { (byte)'0', (byte)'1', (byte)'1', (byte)'1' }; - cmd_lock = new byte[] { (byte)'0',(byte)'1',(byte)'0',(byte)'0',(byte)'0',(byte)'0',(byte)'0',(byte)'0',(byte)'0',(byte)'0' }; - cmd_unlock = new byte[] {(byte)'0',(byte)'1',(byte)'0',(byte)'0',(byte)'1',(byte)'1',(byte)'0',(byte)'0',(byte)'0',(byte)'0' }; + cmd_lock = new byte[] { (byte)'0', (byte)'1', (byte)'0', (byte)'0', (byte)'0', (byte)'0', (byte)'0', (byte)'0', (byte)'0', (byte)'0' }; + cmd_unlock = new byte[] { (byte)'0', (byte)'1', (byte)'0', (byte)'0', (byte)'1', (byte)'1', (byte)'0', (byte)'0', (byte)'0', (byte)'0' }; for (int i = 0; i < 0x80; i++) { eeprom_data[i] = 0xff; @@ -161,7 +157,7 @@ namespace mame address_bits = 6; data_bits = 16; break; - case "Konami 68000": + case "Konami 68000": cmd_read = new byte[] { (byte)'0', (byte)'1', (byte)'1', (byte)'0', (byte)'0', (byte)'0' }; cmd_write = new byte[] { (byte)'0', (byte)'1', (byte)'1', (byte)'1', (byte)'0', (byte)'0' }; cmd_erase = new byte[] { }; @@ -358,7 +354,7 @@ namespace mame { if (sending == 1) { - if (eeprom_clock_count == data_bits && enable_multi_read!=0) + if (eeprom_clock_count == data_bits && enable_multi_read != 0) { eeprom_read_address = (eeprom_read_address + 1) & ((1 << address_bits) - 1); if (data_bits == 16) diff --git a/MAME.Core/emu/Gdi.cs b/MAME.Core/emu/Gdi.cs index e343293..3dbc79a 100644 --- a/MAME.Core/emu/Gdi.cs +++ b/MAME.Core/emu/Gdi.cs @@ -1,27 +1,59 @@ -using System.Drawing; -using System.Drawing.Imaging; -using System.Runtime.InteropServices; +using MAME.Core.AxiBitmap; +using System; +using Bitmap = MAME.Core.AxiBitmap.AxiBitmap; +using Color = MAME.Core.AxiBitmap.AxiColor; +using Rectangle = MAME.Core.AxiBitmap.Rectangle; namespace mame { partial class Video { - public delegate Bitmap drawcrosshairdelegate(Bitmap bm1); + //public delegate Bitmap drawcrosshairdelegate(Bitmap bm1); + //public static drawcrosshairdelegate drawcrosshair; + + + public delegate int[] drawcrosshairdelegate(int[] bm1); public static drawcrosshairdelegate drawcrosshair; - public static Bitmap drawcrosshair_null(Bitmap bm1) + + //public static Bitmap drawcrosshair_null(Bitmap bm1) + //{ + // Bitmap bm2 = bm1; + // return bm2; + //} + + public static int[] drawcrosshair_null(int[] bm1) { - Bitmap bm2 = bm1; - return bm2; + return bm1; } + //public static Bitmap drawcrosshair_opwolf(Bitmap bm1) + //{ + // Bitmap bm2 = bm1; + // Graphics g = Graphics.FromImage(bm2); + // g.DrawImage(MultiplyAlpha(Crosshair.global.bitmap[0], (float)Crosshair.global.fade / 0xff), new Rectangle(Crosshair.global.x[0] - 10, Crosshair.global.y[0] - 10, 20, 20), new Rectangle(0, 0, 100, 100), GraphicsUnit.Pixel); + // g.Dispose(); + // return bm2; + //} + public static Bitmap drawcrosshair_opwolf(Bitmap bm1) { Bitmap bm2 = bm1; - Graphics g = Graphics.FromImage(bm2); - g.DrawImage(MultiplyAlpha(Crosshair.global.bitmap[0], (float)Crosshair.global.fade / 0xff), new Rectangle(Crosshair.global.x[0] - 10, Crosshair.global.y[0] - 10, 20, 20), new Rectangle(0, 0, 100, 100), GraphicsUnit.Pixel); - g.Dispose(); + bm2.DrawImage( + MultiplyAlpha(Crosshair.global.bitmap[0], (float)Crosshair.global.fade / 0xff), + new Rectangle(Crosshair.global.x[0] - 10, + Crosshair.global.y[0] - 10, 20, 20), + new Rectangle(0, 0, 100, 100)); return bm2; } - public static Bitmap MultiplyAlpha(Bitmap bitmap, float factor) + + public static int[] drawcrosshair_opwolf(int[] bm1) + { + int[] bm2 = bm1; + //TODO + return bm2; + } + + /* 替换代码 + * public static Bitmap MultiplyAlpha(Bitmap bitmap, float factor) { Bitmap result = new Bitmap(bitmap.Width, bitmap.Height); using (Graphics graphics = Graphics.FromImage(result)) @@ -33,42 +65,128 @@ namespace mame graphics.DrawImage(bitmap, new Rectangle(0, 0, bitmap.Width, bitmap.Height), 0, 0, bitmap.Width, bitmap.Height, GraphicsUnit.Pixel, imageAttributes); } return result; + }*/ + + /// + /// + /// + /// + /// + /// + 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; } + + /// + /// + /// + /// + /// + /// + public static int[] MultiplyAlpha(int[] bitmap, float factor) + { + int[] result = (int[])bitmap.Clone(); + for (int i = 0; i < result.Length; i++) + { + Color originalColor = AxiColor.FromArgb(result[i]); + byte newAlpha = (byte)Math.Min(255, (int)(originalColor.a * factor)); + Color newColor = new Color + { + r = originalColor.r, + g = originalColor.g, + b = originalColor.b, + a = newAlpha + }; + result[i] = AxiColor.ToArgb(newColor); + } + return result; + } + + //public static void GDIDraw() + //{ + // try + // { + // bitmapData = bitmapGDI.LockBits(new Rectangle(0, 0, Video.fullwidth, Video.fullheight), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); + // Marshal.Copy(Video.bitmapcolor, 0, bitmapData.Scan0, Video.fullwidth * Video.fullheight); + // bitmapGDI.UnlockBits(bitmapData); + // if (Wintime.osd_ticks() < popup_text_end) + // { + // Machine.FORM.tsslStatus = sDrawText; + // } + // else + // { + // popup_text_end = 0; + // if (Mame.paused) + // { + // Machine.FORM.tsslStatus = "pause"; + // } + // else + // { + // switch (Mame.playState) + // { + // case Mame.PlayState.PLAY_RECORDRUNNING: + // Machine.FORM.tsslStatus = "record"; + // break; + // case Mame.PlayState.PLAY_REPLAYRUNNING: + // Machine.FORM.tsslStatus = "replay"; + // break; + // default: + // Machine.FORM.tsslStatus = "run"; + // break; + // } + // } + // } + // //bbmp[iMode] = drawcrosshair((Bitmap)bitmapGDI.Clone(new Rectangle(offsetx, offsety, width, height), PixelFormat.Format32bppArgb)); + // bbmp[iMode] = drawcrosshair(bitmapGDI.Clone(new Rectangle(offsetx, offsety, width, height))); + // switch (Machine.sDirection) + // { + // case "": + // break; + // case "90": + // bbmp[iMode].RotateFlip(RotateFlipType.Rotate90FlipNone); + // break; + // case "180": + // bbmp[iMode].RotateFlip(RotateFlipType.Rotate180FlipNone); + // break; + // case "270": + // bbmp[iMode].RotateFlip(RotateFlipType.Rotate270FlipNone); + // break; + // } + // //Machine.FORM.pictureBox1.Image = bbmp[iMode]; + // SubmitVideo(bbmp[iMode]); + // } + // catch + // { + + // } + //} + + public static void GDIDraw() { try { - bitmapData = bitmapGDI.LockBits(new Rectangle(0, 0, Video.fullwidth, Video.fullheight), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); - Marshal.Copy(Video.bitmapcolor, 0, bitmapData.Scan0, Video.fullwidth * Video.fullheight); - bitmapGDI.UnlockBits(bitmapData); - if (Wintime.osd_ticks() < popup_text_end) - { - Machine.FORM.tsslStatus = sDrawText; - } - else - { - popup_text_end = 0; - if (Mame.paused) - { - Machine.FORM.tsslStatus = "pause"; - } - else - { - switch (Mame.playState) - { - case Mame.PlayState.PLAY_RECORDRUNNING: - Machine.FORM.tsslStatus = "record"; - break; - case Mame.PlayState.PLAY_REPLAYRUNNING: - Machine.FORM.tsslStatus = "replay"; - break; - default: - Machine.FORM.tsslStatus = "run"; - break; - } - } - } - bbmp[iMode] = drawcrosshair((Bitmap)bitmapGDI.Clone(new Rectangle(offsetx, offsety, width, height), PixelFormat.Format32bppArgb)); + int[] TempData = AxiBitmapEx.CloneIntColorArr(Video.bitmapcolor, Video.fullwidth, Video.fullheight, new Rectangle(offsetx, offsety, width, height)); + drawcrosshair(TempData); + //bbmp[iMode] = drawcrosshair(bitmapGDI.Clone(new Rectangle(offsetx, offsety, width, height))); switch (Machine.sDirection) { case "": @@ -84,12 +202,45 @@ namespace mame break; } //Machine.FORM.pictureBox1.Image = bbmp[iMode]; - SubmitVideo(bbmp[iMode]); + SubmitVideo(Video.bitmapcolor); } - catch + catch (Exception ex) { - + } } + + public static void CopyDataFrom(AxiBitmap destBitmap, byte[] sourceData, int sourceStride) + { + int pixelCount = destBitmap.Width * destBitmap.Height; + if (sourceData.Length < pixelCount * 4) // 假设每个AxiColor是4字节 + throw new ArgumentException("Source data is too small."); + + // 注意:这里我们假设sourceStride是源数据的每行字节数,它可能包含额外的填充字节 + // 以确保每行的开始都是4的倍数。但是,对于紧密打包的AxiColor数组,我们可以忽略它。 + + for (int y = 0; y < destBitmap.Height; y++) + { + int sourceOffset = y * sourceStride; // 但对于紧密打包的AxiColor,这将是 y * (destBitmap.Width * 4) + // 然而,由于我们知道sourceData是直接对应于AxiColor的,我们可以简化为: + sourceOffset = y * destBitmap.Width * 4; // 假设没有行填充 + + for (int x = 0; x < destBitmap.Width; x++) + { + int index = y * destBitmap.Width + x; + int sourceIndex = sourceOffset + x * 4; + + byte r = sourceData[sourceIndex]; + byte g = sourceData[sourceIndex + 1]; + byte b = sourceData[sourceIndex + 2]; + byte a = sourceData[sourceIndex + 3]; + + destBitmap.mData[index] = new AxiColor { r = r, g = g, b = b, a = a }; + } + } + } + + + } } \ No newline at end of file diff --git a/MAME.Core/emu/Generic.cs b/MAME.Core/emu/Generic.cs index 9dd5852..41878c7 100644 --- a/MAME.Core/emu/Generic.cs +++ b/MAME.Core/emu/Generic.cs @@ -1,9 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using cpu.m68000; +using cpu.m68000; +using System; namespace mame { @@ -54,7 +50,7 @@ namespace mame { return; } - coinlockedout[num] =(uint) on; + coinlockedout[num] = (uint)on; } public static void coin_lockout_global_w(int on) { @@ -71,9 +67,9 @@ namespace mame case "Neo Geo": Neogeo.nvram_handler_load_neogeo(); break; - /*case "Namco System 1": - Namcos1.nvram_handler_load_namcos1(); - break;*/ + /*case "Namco System 1": + Namcos1.nvram_handler_load_namcos1(); + break;*/ } } public static void nvram_save() @@ -83,9 +79,9 @@ namespace mame case "Neo Geo": Neogeo.nvram_handler_save_neogeo(); break; - /*case "Namco System 1": - Namcos1.nvram_handler_save_namcos1(); - break;*/ + /*case "Namco System 1": + Namcos1.nvram_handler_save_namcos1(); + break;*/ } } public static void watchdog_reset16_w() @@ -124,11 +120,11 @@ namespace mame public static void irq_2_0_line_hold() { Cpuint.cpunum_set_input_line(2, 0, LineState.HOLD_LINE); - } + } public static void watchdog_reset_w() { Watchdog.watchdog_reset(); - } + } public static void interrupt_reset() { int cpunum; @@ -139,7 +135,7 @@ namespace mame } public static void clear_all_lines() { - int inputcount=0; + int inputcount = 0; int line; if (objcpunum == 0 && Cpuexec.cpu[0] == MC68000.m1) { @@ -221,7 +217,7 @@ namespace mame } public static ushort paletteram16_be(int offset) { - return (ushort)(paletteram[offset | 1] | (paletteram[offset & ~1] << 8)); + return (ushort)(paletteram[offset | 1] | (paletteram[offset & ~1] << 8)); } public static void set_color_444(int color, int rshift, int gshift, int bshift, ushort data) { @@ -238,14 +234,14 @@ namespace mame long period = Video.screenstate.frame_period; RECT visarea = Video.screenstate.visarea; Tmap.tilemap_set_flip(null, (byte)((Tilemap.TILEMAP_FLIPX & flip_screen_x) | (Tilemap.TILEMAP_FLIPY & flip_screen_y))); - if (flip_screen_x!=0) + if (flip_screen_x != 0) { int temp; temp = width - visarea.min_x - 1; visarea.min_x = width - visarea.max_x - 1; visarea.max_x = temp; } - if (flip_screen_y!=0) + if (flip_screen_y != 0) { int temp; temp = height - visarea.min_y - 1; @@ -323,7 +319,7 @@ namespace mame set_color_444(offset, 12, 8, 4, paletteram16_split(offset)); } - public static void paletteram16_xBBBBBGGGGGRRRRR_word_w(int offset,ushort data) + public static void paletteram16_xBBBBBGGGGGRRRRR_word_w(int offset, ushort data) { paletteram16[offset] = data; set_color_555(offset, 0, 5, 10, paletteram16[offset]); @@ -359,6 +355,6 @@ namespace mame paletteram16[offset] = (ushort)((paletteram16[offset] & 0xff00) | data); ushort data1 = paletteram16[offset]; Palette.palette_set_callback(offset, (uint)((Palette.pal5bit((byte)(((data1 >> 11) & 0x1e) | ((data1 >> 3) & 0x01))) << 16) | (Palette.pal5bit((byte)(((data >> 7) & 0x1e) | ((data >> 2) & 0x01))) << 8) | Palette.pal5bit((byte)(((data >> 3) & 0x1e) | ((data >> 1) & 0x01))))); - } + } } } diff --git a/MAME.Core/emu/Inptport.cs b/MAME.Core/emu/Inptport.cs index 7f86596..3c42d15 100644 --- a/MAME.Core/emu/Inptport.cs +++ b/MAME.Core/emu/Inptport.cs @@ -42,11 +42,11 @@ namespace mame public long last_delta_nsec; } public partial class Inptport - { + { public static bool bReplayRead; public delegate void loop_delegate(); public static loop_delegate loop_inputports_callback, record_port_callback, replay_port_callback; - public static analog_field_state analog_p0, analog_p1,analog_p1x,analog_p1y; + public static analog_field_state analog_p0, analog_p1, analog_p1x, analog_p1y; public static input_port_private portdata; public static void input_port_init() { @@ -388,7 +388,7 @@ namespace mame case "dland": case "bbredux": case "bublboblb": - case "boblcave": + case "boblcave": loop_inputports_callback = Taito.loop_inputports_taito_boblbobl; break; case "opwolf": @@ -570,21 +570,21 @@ namespace mame result = (uint)apply_analog_settings(value, analog); return result; } - public static int apply_analog_settings(int value,analog_field_state analog) + public static int apply_analog_settings(int value, analog_field_state analog) { value = apply_analog_min_max(analog, value); - value = (int)((long)value * analog.sensitivity / 100); + value = (int)((long)value * analog.sensitivity / 100); if (analog.reverse) { value = analog.reverse_val - value; } if (value >= 0) { - value = (int)((long)(value * analog.scalepos)>>24); + value = (int)((long)(value * analog.scalepos) >> 24); } else { - value = (int)((long)(value * analog.scaleneg)>>24); + value = (int)((long)(value * analog.scaleneg) >> 24); } value += analog.adjdefvalue; return value; diff --git a/MAME.Core/emu/KeyStruct.cs b/MAME.Core/emu/KeyStruct.cs index 11e0190..8a22b01 100644 --- a/MAME.Core/emu/KeyStruct.cs +++ b/MAME.Core/emu/KeyStruct.cs @@ -19,7 +19,7 @@ namespace mame } public static char getcharbykey(Key key1) { - char c1=' '; + char c1 = ' '; foreach (KeyStruct ks in lks) { if (ks.key == key1) diff --git a/MAME.Core/emu/Keyboard.cs b/MAME.Core/emu/Keyboard.cs index 01471f6..ceb39da 100644 --- a/MAME.Core/emu/Keyboard.cs +++ b/MAME.Core/emu/Keyboard.cs @@ -1,5 +1,4 @@ -using MAME.Core; -using MAME.Core.Common; +using MAME.Core.Common; using MAME.Core.run_interface; namespace mame @@ -10,7 +9,7 @@ namespace mame static IKeyboard mKeyboard; - public static void InitializeInput(mainForm form1,IKeyboard ikb) + public static void InitializeInput(mainMotion form1, IKeyboard ikb) { mKeyboard = ikb; } diff --git a/MAME.Core/emu/Machine.cs b/MAME.Core/emu/Machine.cs index f2eea5b..b8afc60 100644 --- a/MAME.Core/emu/Machine.cs +++ b/MAME.Core/emu/Machine.cs @@ -8,7 +8,7 @@ namespace mame { public static string sName, sParent, sBoard, sDirection, sDescription, sManufacturer; public static List lsParents; - public static mainForm FORM; + public static mainMotion FORM; public static RomInfo rom; public static bool bRom; public delegate void machine_delegate(); @@ -141,7 +141,7 @@ namespace mame Taito.video_start_opwolf(); machine_reset_callback = Taito.machine_reset_null; break; - } + } break; case "Taito B": Eeprom.eeprom_init(); @@ -256,7 +256,7 @@ namespace mame case "sfp": Capcom.video_start_sf(); break; - } + } machine_reset_callback = Capcom.machine_reset_capcom; break; } @@ -264,16 +264,20 @@ namespace mame public static byte[] GetNeogeoRom(string sFile) { byte[] bb1; - if (File.Exists("roms\\neogeo\\" + sFile)) + string path = System.IO.Path.Combine(Mame.RomRoot + "/" + "roms/neogeo/", sFile); + if (File.Exists(path)) { - FileStream fs1 = new FileStream("roms\\neogeo\\" + sFile, FileMode.Open); - int n1 = (int)fs1.Length; - bb1 = new byte[n1]; - fs1.Read(bb1, 0, n1); - fs1.Close(); + EmuLogger.Log($"Had File => {path}"); + return File.ReadAllBytes(path); + //FileStream fs1 = new FileStream(path, FileMode.Open); + //int n1 = (int)fs1.Length; + //bb1 = new byte[n1]; + //fs1.Read(bb1, 0, n1); + //fs1.Close(); } else { + EmuLogger.Log($"Miss File => {path}"); bb1 = null; } return bb1; @@ -284,15 +288,22 @@ namespace mame int n1; foreach (string s1 in lsParents) { - if (File.Exists("roms\\" + s1 + "\\" + sFile)) + string path = System.IO.Path.Combine(Mame.RomRoot + "/" + "roms/" + s1 + "/", sFile); + if (File.Exists(path)) { - FileStream fs1 = new FileStream("roms\\" + s1 + "\\" + sFile, FileMode.Open); - n1 = (int)fs1.Length; - bb1 = new byte[n1]; - fs1.Read(bb1, 0, n1); - fs1.Close(); + EmuLogger.Log($"Had File => {path}"); + return File.ReadAllBytes(path); + //FileStream fs1 = new FileStream(path, FileMode.Open); + //n1 = (int)fs1.Length; + //bb1 = new byte[n1]; + //fs1.Read(bb1, 0, n1); + //fs1.Close(); break; } + else + { + EmuLogger.Log($"Miss File => {path}"); + } } return bb1; } diff --git a/MAME.Core/emu/Mame.cs b/MAME.Core/emu/Mame.cs index 8b759bf..fd1724d 100644 --- a/MAME.Core/emu/Mame.cs +++ b/MAME.Core/emu/Mame.cs @@ -1,8 +1,6 @@ using MAME.Core.Common; using MAME.Core.run_interface; -using System; using System.IO; -using System.Runtime.InteropServices; using System.Threading; namespace mame @@ -29,6 +27,7 @@ namespace mame public static BinaryReader brRecord = null; public static BinaryWriter bwRecord = null; public static bool bPP = true; + public static string RomRoot = string.Empty; public class AA { public int fr; @@ -98,12 +97,12 @@ namespace mame if (playState == PlayState.PLAY_SAVE) { mame_pause(true); - UI.ui_handler_callback = handle_save; + Motion.motion_handler_callback = handle_save; } else if (playState == PlayState.PLAY_LOAD) { mame_pause(true); - UI.ui_handler_callback = handle_load; + Motion.motion_handler_callback = handle_load; } else if (playState == PlayState.PLAY_RESET) { @@ -113,7 +112,7 @@ namespace mame else if (playState == PlayState.PLAY_RECORDSTART) { mame_pause(true); - UI.ui_handler_callback = handle_record; + Motion.motion_handler_callback = handle_record; } else if (playState == PlayState.PLAY_RECORDEND) { @@ -122,14 +121,14 @@ namespace mame else if (playState == PlayState.PLAY_REPLAYSTART) { mame_pause(true); - UI.ui_handler_callback = handle_replay; + Motion.motion_handler_callback = handle_replay; } else if (playState == PlayState.PLAY_REPLAYEND) { handle_replay(); } } - public static void init_machine(mainForm form) + public static void init_machine(mainMotion form) { Inptport.input_init(); Palette.palette_init(); @@ -153,6 +152,7 @@ namespace mame { if (paused == pause) return; + EmuLogger.Log($"mame_pause->{pause}"); paused = pause; Window.wininput_pause(paused); Sound.sound_pause(paused); @@ -187,7 +187,7 @@ namespace mame Video.popup_text_end = Wintime.osd_ticks() + Wintime.ticks_per_second * 2; playState = PlayState.PLAY_RUNNING; mame_pause(false); - UI.ui_handler_callback = UI.handler_ingame; + Motion.motion_handler_callback = Motion.handler_ingame; return; } char file; @@ -208,7 +208,7 @@ namespace mame Video.sDrawText = "Save to position " + file; Video.popup_text_end = Wintime.osd_ticks() + Wintime.ticks_per_second * 2; playState = PlayState.PLAY_RUNNING; - UI.ui_handler_callback = UI.handler_ingame; + Motion.motion_handler_callback = Motion.handler_ingame; Thread.Sleep(500); mame_pause(false); return; @@ -230,7 +230,7 @@ namespace mame Video.popup_text_end = Wintime.osd_ticks() + Wintime.ticks_per_second * 2; playState = PlayState.PLAY_RUNNING; mame_pause(false); - UI.ui_handler_callback = UI.handler_ingame; + Motion.motion_handler_callback = Motion.handler_ingame; return; } char file; @@ -246,7 +246,7 @@ namespace mame playState = PlayState.PLAY_RUNNING; Thread.Sleep(500); mame_pause(false); - UI.ui_handler_callback = UI.handler_ingame; + Motion.motion_handler_callback = Motion.handler_ingame; return; } FileStream fs1 = new FileStream("sta\\" + Machine.sName + "\\" + file + ".sta", FileMode.Open); @@ -264,7 +264,7 @@ namespace mame fs2.Close(); return;*/ playState = PlayState.PLAY_RUNNING; - UI.ui_handler_callback = UI.handler_ingame; + Motion.motion_handler_callback = Motion.handler_ingame; Thread.Sleep(500); mame_pause(false); return; @@ -288,7 +288,7 @@ namespace mame Video.popup_text_end = Wintime.osd_ticks() + Wintime.ticks_per_second * 2; playState = PlayState.PLAY_RUNNING; mame_pause(false); - UI.ui_handler_callback = UI.handler_ingame; + Motion.motion_handler_callback = Motion.handler_ingame; return; } char file; @@ -318,7 +318,7 @@ namespace mame Video.sDrawText = "Record to position " + file; Video.popup_text_end = Wintime.osd_ticks() + Wintime.ticks_per_second * 2; playState = PlayState.PLAY_RECORDRUNNING; - UI.ui_handler_callback = UI.handler_ingame; + Motion.motion_handler_callback = Motion.handler_ingame; Thread.Sleep(500); mame_pause(false); return; @@ -351,7 +351,7 @@ namespace mame Video.popup_text_end = Wintime.osd_ticks() + Wintime.ticks_per_second * 2; playState = PlayState.PLAY_RUNNING; mame_pause(false); - UI.ui_handler_callback = UI.handler_ingame; + Motion.motion_handler_callback = Motion.handler_ingame; return; } char file; @@ -367,7 +367,7 @@ namespace mame playState = PlayState.PLAY_RUNNING; Thread.Sleep(500); mame_pause(false); - UI.ui_handler_callback = UI.handler_ingame; + Motion.motion_handler_callback = Motion.handler_ingame; return; } if (bwRecord != null) @@ -405,7 +405,7 @@ namespace mame Video.sDrawText = "Replay from position " + file; Video.popup_text_end = Wintime.osd_ticks() + Wintime.ticks_per_second * 2; playState = PlayState.PLAY_REPLAYRUNNING; - UI.ui_handler_callback = UI.handler_ingame; + Motion.motion_handler_callback = Motion.handler_ingame; Thread.Sleep(500); mame_pause(false); return; @@ -484,7 +484,7 @@ namespace mame case "tokio": case "tokioo": case "tokiou": - case "tokiob": + case "tokiob": case "bublbobl": case "bublbobl1": case "bublboblr": diff --git a/MAME.Core/emu/Memory.cs b/MAME.Core/emu/Memory.cs index 8fed619..5e49334 100644 --- a/MAME.Core/emu/Memory.cs +++ b/MAME.Core/emu/Memory.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace mame +namespace mame { public class Memory { @@ -116,7 +111,7 @@ namespace mame case "sboblbobl": Taito.sbyte0 = unchecked((sbyte)0x73); break; - case"opwolf": + case "opwolf": Taito.sbyte0 = unchecked((sbyte)0xfc); break; case "opwolfp": @@ -190,7 +185,7 @@ namespace mame Capcom.sbyte1 = 0; Capcom.sbyte2 = 0; Capcom.sbyte3 = 0; - Capcom.sbyte4 = 0; + Capcom.sbyte4 = 0; break; } break; @@ -321,7 +316,7 @@ namespace mame Capcom.sbyte1_old = 0; Capcom.sbyte2_old = 0; Capcom.sbyte3_old = 0; - Capcom.sbyte4_old = 0; + Capcom.sbyte4_old = 0; break; } break; diff --git a/MAME.Core/emu/UI.cs b/MAME.Core/emu/Motion.cs similarity index 91% rename from MAME.Core/emu/UI.cs rename to MAME.Core/emu/Motion.cs index 4799c08..c0c0d07 100644 --- a/MAME.Core/emu/UI.cs +++ b/MAME.Core/emu/Motion.cs @@ -1,27 +1,26 @@ using MAME.Core.Common; using MAME.Core.run_interface; -using System; -using System.Runtime.InteropServices; namespace mame { - public class UI + /// + /// 原依赖Form的内容 + /// + public class Motion { - [DllImport("user32.dll")] - private static extern IntPtr GetForegroundWindow(); private static uint UI_FILLCOLOR = Palette.make_argb(0xe0, 0x10, 0x10, 0x30); - public delegate void ui_delegate(); - public static ui_delegate ui_handler_callback, ui_update_callback; + public delegate void motion_delegate(); + public static motion_delegate motion_handler_callback, motion_update_callback; public static bool single_step; - public static mainForm mainform; - public static void ui_init(mainForm form1) + //public static mainMotion mainmotion; + public static void init() { - mainform = form1; + //mainmotion = motion; } public static void ui_update_and_render() { - ui_update_callback(); - ui_handler_callback(); + motion_update_callback(); + motion_handler_callback(); } public static void ui_updateC() { @@ -195,7 +194,7 @@ namespace mame } if (Mame.is_foreground) { - if(Keyboard.IsPressed(Key.F3)) + if (Keyboard.IsPressed(Key.F3)) { cpurun(); Mame.playState = Mame.PlayState.PLAY_RESET; @@ -209,7 +208,7 @@ namespace mame } else { - Mame.playState = Mame.PlayState.PLAY_LOAD; + Mame.playState = Mame.PlayState.PLAY_LOAD; } return; } @@ -238,12 +237,12 @@ namespace mame if (is_paused && (Keyboard.IsPressed(Key.LeftShift) || Keyboard.IsPressed(Key.RightShift))) { single_step = true; - Mame.mame_pause(false); + Mame.mame_pause(false); } else { Mame.mame_pause(!Mame.mame_is_paused()); - } + } } if (Keyboard.IsTriggered(Key.F10)) { @@ -255,10 +254,10 @@ namespace mame } public static void cpurun() { - m68000Form.m68000State = m68000Form.M68000State.M68000_RUN; - Machine.FORM.m68000form.mTx_tsslStatus = "run"; - z80Form.z80State = z80Form.Z80AState.Z80A_RUN; - Machine.FORM.z80form.mTx_tsslStatus = "run"; + m68000Motion.m68000State = m68000Motion.M68000State.M68000_RUN; + Machine.FORM.m68000motion.mTx_tsslStatus = "run"; + z80Motion.z80State = z80Motion.Z80AState.Z80A_RUN; + Machine.FORM.z80motion.mTx_tsslStatus = "run"; } private static double ui_get_line_height() { @@ -269,6 +268,6 @@ namespace mame one_to_one_line_height = (double)raw_font_pixel_height / (double)target_pixel_height; scale_factor = 1.0; return scale_factor * one_to_one_line_height; - } + } } } diff --git a/MAME.Core/emu/Mouse.cs b/MAME.Core/emu/Mouse.cs index 0fa69ba..6c94304 100644 --- a/MAME.Core/emu/Mouse.cs +++ b/MAME.Core/emu/Mouse.cs @@ -8,14 +8,15 @@ namespace mame public static int deltaX, deltaY, oldX, oldY; public static byte[] buttons; static IMouse iMouse; - public static void InitialMouse(mainForm form1,IMouse im) + public static void InitialMouse(mainMotion form1, IMouse im) { iMouse = im; } public static void Update() { - iMouse.MouseXY(out int X, out int Y); + int X, Y; + iMouse.MouseXY(out X, out Y); deltaX = X - oldX; deltaY = Y - oldY; oldX = X; diff --git a/MAME.Core/emu/Palette.cs b/MAME.Core/emu/Palette.cs index 66d2f2c..75c7c70 100644 --- a/MAME.Core/emu/Palette.cs +++ b/MAME.Core/emu/Palette.cs @@ -1,8 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Drawing; +using MAME.Core.AxiBitmap; +using Color = MAME.Core.AxiBitmap.AxiColor; namespace mame { @@ -11,13 +8,13 @@ namespace mame public static uint[] entry_color; public static float[] entry_contrast; private static uint trans_uint; - private static int numcolors,numgroups; + private static int numcolors, numgroups; public static Color trans_color; - public delegate void palette_delegate(int index,uint rgb); + public delegate void palette_delegate(int index, uint rgb); public static palette_delegate palette_set_callback; public static void palette_init() { - int index; + int index; switch (Machine.sBoard) { case "CPS-1": @@ -76,7 +73,7 @@ namespace mame numcolors = 0x801; palette_set_callback = palette_entry_set_color2; break; - case "Taito": + case "Taito": switch (Machine.sName) { case "tokio": @@ -159,7 +156,7 @@ namespace mame numcolors = 0x400; palette_set_callback = palette_entry_set_color3; break; - } + } break; } entry_color = new uint[numcolors]; @@ -309,7 +306,7 @@ namespace mame } public static byte pal1bit(byte bits) { - return (byte)(((bits & 1)!=0) ? 0xff : 0x00); + return (byte)(((bits & 1) != 0) ? 0xff : 0x00); } public static byte pal4bit(byte bits) { diff --git a/MAME.Core/emu/Pd4900a.cs b/MAME.Core/emu/Pd4900a.cs index 6f4402e..e9051e2 100644 --- a/MAME.Core/emu/Pd4900a.cs +++ b/MAME.Core/emu/Pd4900a.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; +using System.IO; namespace mame { @@ -108,7 +104,7 @@ namespace mame break; case 2: real_year = (pd4990a.year >> 4) * 10 + (pd4990a.year & 0xf); - if ((real_year % 4)!=0 && ((real_year % 100)==0 || (real_year % 400)!=0)) + if ((real_year % 4) != 0 && ((real_year % 100) == 0 || (real_year % 400) != 0)) { if (pd4990a.days == 0x29) { @@ -243,9 +239,9 @@ namespace mame private static void pd4990a_nextbit() { ++bitno; - if (reading!=0) + if (reading != 0) pd4990a_readbit(); - if (reading!=0 && bitno == 0x34) + if (reading != 0 && bitno == 0x34) { reading = 0; pd4990a_resetbitstream(); @@ -276,7 +272,7 @@ namespace mame { case 0x1: //load output register bitno = 0; - if (reading!=0) + if (reading != 0) pd4990a_readbit(); //prepare first bit shiftlo = 0; shifthi = 0; @@ -300,7 +296,7 @@ namespace mame private static void pd4990a_serial_control(byte data) { //Check for command end - if (command_line!=0 && (data & 4)==0) //end of command + if (command_line != 0 && (data & 4) == 0) //end of command { pd4990a_process_command(); } diff --git a/MAME.Core/emu/RomInfo.cs b/MAME.Core/emu/RomInfo.cs index f1f4419..d3fb5e2 100644 --- a/MAME.Core/emu/RomInfo.cs +++ b/MAME.Core/emu/RomInfo.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Xml.Linq; +using System.Collections.Generic; namespace mame { diff --git a/MAME.Core/emu/State.cs b/MAME.Core/emu/State.cs index 8698c04..06222f2 100644 --- a/MAME.Core/emu/State.cs +++ b/MAME.Core/emu/State.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using cpu.m68000; +using System.IO; namespace mame { @@ -93,7 +88,7 @@ namespace mame case "bublbobl": case "bublbobl1": case "bublboblr": - case "bublboblr1": + case "bublboblr1": case "bublcave": case "bublcave11": case "bublcave10": @@ -164,7 +159,7 @@ namespace mame case "punkshotj"://ym k053260 K052109 K051960 savestate_callback = Konami68000.SaveStateBinary_punkshot; loadstate_callback = Konami68000.LoadStateBinary_punkshot; - break; + break; case "lgtnfght": case "lgtnfghta": case "lgtnfghtu": @@ -207,7 +202,7 @@ namespace mame case "ssridersjbd"://ym k053260 K052109 K053245 eeprom savestate_callback = Konami68000.SaveStateBinary_ssriders; loadstate_callback = Konami68000.LoadStateBinary_ssriders; - break; + break; case "thndrx2": case "thndrx2a": case "thndrx2j"://ym k053260 K052109 K051960 eeprom diff --git a/MAME.Core/emu/Tilemap.cs b/MAME.Core/emu/Tilemap.cs index 1363ce5..fc73794 100644 --- a/MAME.Core/emu/Tilemap.cs +++ b/MAME.Core/emu/Tilemap.cs @@ -1,7 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; namespace mame { @@ -49,7 +47,7 @@ namespace mame public int mask, value; public int total_elements; public Action tile_update3; - public Action tilemap_draw_instance3; + public Action tilemap_draw_instance3; public int effective_rowscroll(int index) { int value; @@ -104,7 +102,7 @@ namespace mame { palette_offset = offset; } - public static void tilemap_set_flip(Tmap tmap,byte _attributes) + public static void tilemap_set_flip(Tmap tmap, byte _attributes) { if (tmap == null) { @@ -153,12 +151,12 @@ namespace mame { scrollcols = scroll_cols; } - public void tilemap_set_scrolldx(int _dx,int _dx2) + public void tilemap_set_scrolldx(int _dx, int _dx2) { dx = _dx; dx_flipped = _dx2; } - public void tilemap_set_scrolldy(int _dy,int _dy2) + public void tilemap_set_scrolldy(int _dy, int _dy2) { dy = _dy; dy_flipped = _dy2; @@ -269,7 +267,7 @@ namespace mame { public static List lsTmap = new List(); public static byte[,] priority_bitmap; - public static byte[,] bb00,bbFF; + public static byte[,] bb00, bbFF; public static byte[] bb0F; public static int screen_width, screen_height; private static int INVALID_LOGICAL_INDEX = -1; @@ -352,7 +350,7 @@ namespace mame priority_bitmap = new byte[0x200, 0x200]; Capcom.tilemap_init(); break; - } + } switch (Machine.sBoard) { case "CPS-1": diff --git a/MAME.Core/emu/Timer.cs b/MAME.Core/emu/Timer.cs index 908ead4..654fb26 100644 --- a/MAME.Core/emu/Timer.cs +++ b/MAME.Core/emu/Timer.cs @@ -1,9 +1,7 @@ -using System; +using cpu.m6800; +using System; using System.Collections.Generic; -using System.Linq; using System.IO; -using System.Text; -using cpu.m6800; namespace mame { diff --git a/MAME.Core/emu/Video.cs b/MAME.Core/emu/Video.cs index 3d8a3fb..cdcd423 100644 --- a/MAME.Core/emu/Video.cs +++ b/MAME.Core/emu/Video.cs @@ -1,8 +1,7 @@ using MAME.Core.run_interface; using System; -using System.Drawing; -using System.Drawing.Imaging; using System.IO; +using Bitmap = MAME.Core.AxiBitmap.AxiBitmap; namespace mame { @@ -27,12 +26,12 @@ namespace mame public static Atime frame_update_time; public static screen_state screenstate; public static int video_attributes; - private static int PAUSED_REFRESH_RATE = 30, VIDEO_UPDATE_AFTER_VBLANK=4; - public static Timer.emu_timer vblank_begin_timer,vblank_end_timer; + private static int PAUSED_REFRESH_RATE = 30, VIDEO_UPDATE_AFTER_VBLANK = 4; + public static Timer.emu_timer vblank_begin_timer, vblank_end_timer; public static Timer.emu_timer scanline0_timer, scanline_timer; private static Atime throttle_emutime, throttle_realtime, speed_last_emutime, overall_emutime; private static long throttle_last_ticks; - private static long average_oversleep; + private static long average_oversleep; private static long speed_last_realtime, overall_real_ticks; private static double speed_percent; private static uint throttle_history, overall_valid_counter, overall_real_seconds; @@ -50,7 +49,7 @@ namespace mame public static string sDrawText; public static long popup_text_end; public static int iMode, nMode; - private static BitmapData bitmapData; + //private static BitmapData bitmapData; public static int offsetx, offsety, width, height; public delegate void video_delegate(); public static video_delegate video_update_callback, video_eof_callback; @@ -63,7 +62,7 @@ namespace mame #region 抽象出去 - static Action Act_SubmitVideo; + static Action Act_SubmitVideo; public static void BindFunc(IVideoPlayer Ivp) { @@ -72,7 +71,7 @@ namespace mame Act_SubmitVideo += Ivp.SubmitVideo; } - static void SubmitVideo(Bitmap Bitmap) + static void SubmitVideo(int[] Bitmap) { Act_SubmitVideo?.Invoke(Bitmap); } @@ -82,18 +81,18 @@ namespace mame { Wintime.wintime_init(); global_throttle = true; - UI.ui_handler_callback = UI.handler_ingame; + Motion.motion_handler_callback = Motion.handler_ingame; sDrawText = ""; popup_text_end = 0; popcount = new int[256]{ - 0,1,1,2,1,2,2,3, 1,2,2,3,2,3,3,4, 1,2,2,3,2,3,3,4, 2,3,3,4,3,4,4,5, - 1,2,2,3,2,3,3,4, 2,3,3,4,3,4,4,5, 2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6, - 1,2,2,3,2,3,3,4, 2,3,3,4,3,4,4,5, 2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6, - 2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6, 3,4,4,5,4,5,5,6, 4,5,5,6,5,6,6,7, - 1,2,2,3,2,3,3,4, 2,3,3,4,3,4,4,5, 2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6, - 2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6, 3,4,4,5,4,5,5,6, 4,5,5,6,5,6,6,7, - 2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6, 3,4,4,5,4,5,5,6, 4,5,5,6,5,6,6,7, - 3,4,4,5,4,5,5,6, 4,5,5,6,5,6,6,7, 4,5,5,6,5,6,6,7, 5,6,6,7,6,7,7,8 + 0,1,1,2,1,2,2,3, 1,2,2,3,2,3,3,4, 1,2,2,3,2,3,3,4, 2,3,3,4,3,4,4,5, + 1,2,2,3,2,3,3,4, 2,3,3,4,3,4,4,5, 2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6, + 1,2,2,3,2,3,3,4, 2,3,3,4,3,4,4,5, 2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6, + 2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6, 3,4,4,5,4,5,5,6, 4,5,5,6,5,6,6,7, + 1,2,2,3,2,3,3,4, 2,3,3,4,3,4,4,5, 2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6, + 2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6, 3,4,4,5,4,5,5,6, 4,5,5,6,5,6,6,7, + 2,3,3,4,3,4,4,5, 3,4,4,5,4,5,5,6, 3,4,4,5,4,5,5,6, 4,5,5,6,5,6,6,7, + 3,4,4,5,4,5,5,6, 4,5,5,6,5,6,6,7, 4,5,5,6,5,6,6,7, 5,6,6,7,6,7,7,8 }; switch (Machine.sBoard) { @@ -111,7 +110,7 @@ namespace mame screenstate.vblank_period = 0; video_attributes = 0; bitmapGDI = new Bitmap(Video.fullwidth, Video.fullheight); - UI.ui_update_callback = UI.ui_updateC; + Motion.motion_update_callback = Motion.ui_updateC; bitmapbase = new ushort[2][]; bitmapbase[0] = new ushort[0x200 * 0x200]; bitmapbase[1] = new ushort[0x200 * 0x200]; @@ -135,7 +134,7 @@ namespace mame screenstate.vblank_period = 0; video_attributes = 0; bitmapGDI = new Bitmap(Video.fullwidth, Video.fullheight); - UI.ui_update_callback = UI.ui_updateC; + Motion.motion_update_callback = Motion.ui_updateC; bitmapbase = new ushort[2][]; bitmapbase[0] = new ushort[0x200 * 0x200]; bitmapbase[1] = new ushort[0x200 * 0x200]; @@ -159,7 +158,7 @@ namespace mame screenstate.vblank_period = 0; video_attributes = 0; bitmapGDI = new Bitmap(Video.fullwidth, Video.fullheight); - UI.ui_update_callback = UI.ui_updateC; + Motion.motion_update_callback = Motion.ui_updateC; bitmapbase = new ushort[2][]; bitmapbase[0] = new ushort[0x100 * 0x100]; bitmapbase[1] = new ushort[0x100 * 0x100]; @@ -192,7 +191,7 @@ namespace mame screenstate.vblank_period = 0; video_attributes = 0; bitmapGDI = new Bitmap(Video.fullwidth, Video.fullheight); - UI.ui_update_callback = UI.ui_updateTehkan; + Motion.motion_update_callback = Motion.ui_updateTehkan; bitmapbase = new ushort[2][]; bitmapbase[0] = new ushort[0x100 * 0x100]; bitmapbase[1] = new ushort[0x100 * 0x100]; @@ -213,7 +212,7 @@ namespace mame frame_update_time = new Atime(0, (long)(1e18 / 6000000) * screenstate.width * screenstate.height);//59.1856060608428Hz screenstate.vblank_period = (long)(1e18 / 6000000) * 384 * (264 - 224); video_attributes = 0; - UI.ui_update_callback = UI.ui_updateN; + Motion.motion_update_callback = Motion.ui_updateN; bitmapbaseN = new int[2][]; bitmapbaseN[0] = new int[384 * 264]; bitmapbaseN[1] = new int[384 * 264]; @@ -234,7 +233,7 @@ namespace mame frame_update_time = new Atime(0, (long)(1e18 / 60)); screenstate.vblank_period = (long)(1e12 * 2500); video_attributes = 0; - UI.ui_update_callback = UI.ui_updatePGM; + Motion.motion_update_callback = Motion.ui_updatePGM; bitmapbase = new ushort[2][]; bitmapbase[0] = new ushort[0x100 * 0x100]; bitmapbase[1] = new ushort[0x100 * 0x100]; @@ -255,7 +254,7 @@ namespace mame frame_update_time = new Atime(0, (long)(1e18 / 60.606060)); screenstate.vblank_period = 0; video_attributes = 0; - UI.ui_update_callback = UI.ui_updateNa; + Motion.motion_update_callback = Motion.ui_updateNa; bitmapGDI = new Bitmap(Video.fullwidth, Video.fullheight); bitmapbase = new ushort[2][]; bitmapbase[0] = new ushort[0x200 * 0x200]; @@ -278,7 +277,7 @@ namespace mame frame_update_time = new Atime(0, (long)(1e18 / 60)); screenstate.vblank_period = 0; video_attributes = 0; - UI.ui_update_callback = UI.ui_updateIGS011; + Motion.motion_update_callback = Motion.ui_updateIGS011; bitmapGDI = new Bitmap(Video.fullwidth, Video.fullheight); bitmapbase = new ushort[2][]; bitmapbase[0] = new ushort[0x200 * 0x200]; @@ -300,7 +299,7 @@ namespace mame frame_update_time = new Atime(0, (long)(1e18 / 60)); screenstate.vblank_period = 0; video_attributes = 0; - UI.ui_update_callback = UI.ui_updatePGM; + Motion.motion_update_callback = Motion.ui_updatePGM; bitmapGDI = new Bitmap(Video.fullwidth, Video.fullheight); bitmapbase = new ushort[2][]; bitmapbase[0] = new ushort[0x200 * 0x200]; @@ -322,7 +321,7 @@ namespace mame frame_update_time = new Atime(0, (long)(1e18 / 8000000) * screenstate.width * screenstate.height); screenstate.vblank_period = (long)(1e18 / 8000000) * 512 * (284 - 256); video_attributes = 0; - UI.ui_update_callback = UI.ui_updatePGM; + Motion.motion_update_callback = Motion.ui_updatePGM; bitmapbase = new ushort[2][]; bitmapbase[0] = new ushort[0x200 * 0x200];//0x11c bitmapbase[1] = new ushort[0x200 * 0x200];//0x11c @@ -343,7 +342,7 @@ namespace mame frame_update_time = new Atime(0, (long)(1e18 / 60)); screenstate.vblank_period = 0; video_attributes = 0; - UI.ui_update_callback = UI.ui_updatePGM; + Motion.motion_update_callback = Motion.ui_updatePGM; bitmapbase = new ushort[2][]; bitmapbase[0] = new ushort[0x200 * 0x200]; bitmapbase[1] = new ushort[0x200 * 0x200]; @@ -352,9 +351,9 @@ namespace mame video_update_callback = M92.video_update_m92; video_eof_callback = M92.video_eof_m92; break; - case "Taito": + case "Taito": video_attributes = 0; - UI.ui_update_callback = UI.ui_updatePGM; + Motion.motion_update_callback = Motion.ui_updatePGM; switch (Machine.sName) { case "tokio": @@ -435,7 +434,7 @@ namespace mame frame_update_time = new Atime(0, (long)(1e18 / 60)); screenstate.vblank_period = 0; video_attributes = 0; - UI.ui_update_callback = UI.ui_updatePGM; + Motion.motion_update_callback = Motion.ui_updatePGM; bitmapbase = new ushort[2][]; bitmapbase[0] = new ushort[0x200 * 0x100]; bitmapbase[1] = new ushort[0x200 * 0x100]; @@ -452,7 +451,7 @@ namespace mame frame_update_time = new Atime(0, (long)(1e18 / 60)); screenstate.vblank_period = (long)(1e12 * 2500); video_attributes = 0x34; - UI.ui_update_callback = UI.ui_updatePGM; + Motion.motion_update_callback = Motion.ui_updatePGM; bitmapbase = new ushort[2][]; bitmapbase[0] = new ushort[0x200 * 0x100]; bitmapbase[1] = new ushort[0x200 * 0x100]; @@ -604,7 +603,7 @@ namespace mame frame_update_time = new Atime(0, (long)(1e18 / 60)); screenstate.vblank_period = 0; video_attributes = 0; - UI.ui_update_callback = UI.ui_updatePGM; + Motion.motion_update_callback = Motion.ui_updatePGM; bitmapbase = new ushort[2][]; bitmapbase[0] = new ushort[0x100 * 0x100]; bitmapbase[1] = new ushort[0x100 * 0x100]; @@ -630,7 +629,7 @@ namespace mame frame_update_time = new Atime(0, (long)(1e18 / 60)); screenstate.vblank_period = 0; video_attributes = 0; - UI.ui_update_callback = UI.ui_updatePGM; + Motion.motion_update_callback = Motion.ui_updatePGM; bitmapbase = new ushort[2][]; bitmapbase[0] = new ushort[0x200 * 0x100]; bitmapbase[1] = new ushort[0x200 * 0x100]; @@ -659,7 +658,7 @@ namespace mame case "CPS-1(QSound)": case "Namco System 1": case "M92": - case "Taito B": + case "Taito B": break; case "CPS2": Cpuexec.cpu[0].partial_frame_period = Attotime.attotime_div(Video.frame_update_time, 262); @@ -699,7 +698,7 @@ namespace mame Cpuexec.cpu[0].partial_frame_period = Attotime.attotime_div(Video.frame_update_time, 4); Cpuexec.cpu[0].partial_frame_timer = Timer.timer_alloc_common(Cpuexec.trigger_partial_frame_interrupt, "trigger_partial_frame_interrupt", false); break; - } + } break; case "M72": Cpuexec.cpu[1].partial_frame_period = Attotime.attotime_div(Video.frame_update_time, 128); @@ -752,7 +751,7 @@ namespace mame screenstate.height = height; screenstate.visarea = visarea; //realloc_screen_bitmaps(screen); - screenstate.frame_period=frame_period; + screenstate.frame_period = frame_period; screenstate.scantime = frame_period / height; screenstate.pixeltime = frame_period / (height * width); /*if (config->vblank == 0 && !config->oldstyle_vblank_supplied) @@ -779,7 +778,7 @@ namespace mame new_clip.max_y = scanline; } if (new_clip.min_y <= new_clip.max_y) - { + { video_update_callback(); result = true; } @@ -853,7 +852,7 @@ namespace mame } else { - Timer.timer_adjust_periodic(vblank_end_timer, video_screen_get_time_until_vblank_end(),Attotime.ATTOTIME_NEVER); + Timer.timer_adjust_periodic(vblank_end_timer, video_screen_get_time_until_vblank_end(), Attotime.ATTOTIME_NEVER); } } public static void vblank_end_callback() @@ -878,7 +877,7 @@ namespace mame { scanline = screenstate.visarea.min_y; } - scanline_param=scanline; + scanline_param = scanline; Timer.timer_adjust_periodic(scanline_timer, video_screen_get_time_until_pos(scanline, 0), Attotime.ATTOTIME_NEVER); } public static void video_frame_update() @@ -891,10 +890,10 @@ namespace mame Keyboard.Update(); Mouse.Update(); Inptport.frame_update_callback(); - UI.ui_update_and_render(); - if(Machine.FORM.cheatform.lockState == MAME.Core.Common.cheatForm.LockState.LOCK_FRAME) + Motion.ui_update_and_render(); + if (Machine.FORM.cheatmotion.lockState == MAME.Core.Common.cheatMotion.LockState.LOCK_FRAME) { - Machine.FORM.cheatform.ApplyCheat(); + Machine.FORM.cheatmotion.ApplyCheat(); } GDIDraw(); if (effective_throttle()) diff --git a/MAME.Core/emu/Watchdog.cs b/MAME.Core/emu/Watchdog.cs index e31f70b..1663d3e 100644 --- a/MAME.Core/emu/Watchdog.cs +++ b/MAME.Core/emu/Watchdog.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace mame +namespace mame { public class Watchdog { @@ -33,7 +28,7 @@ namespace mame break; case "Neo Geo": watchdog_time = new Atime(0, (long)128762e12); - break; + break; } } public static void watchdog_internal_reset() diff --git a/MAME.Core/emu/Window.cs b/MAME.Core/emu/Window.cs index 2883582..eb64310 100644 --- a/MAME.Core/emu/Window.cs +++ b/MAME.Core/emu/Window.cs @@ -1,17 +1,19 @@ using MAME.Core.Common; -using System; -using System.Drawing; -using System.Runtime.InteropServices; namespace mame { public class Window { - private static mainForm _myParentForm; - [DllImport("kernel32.dll ")] - private static extern uint GetTickCount(); - - public static bool input_enabled,input_paused, mouse_enabled, lightgun_enabled; + private static mainMotion _myParentForm; + //[DllImport("kernel32.dll ")] + //private static extern uint GetTickCount(); + + private static uint GetTickCount() + { + return (uint)Wintime._stopwatch.ElapsedMilliseconds; + } + + public static bool input_enabled, input_paused, mouse_enabled, lightgun_enabled; public static uint last_poll, last_event_check; private static bool _CursorShown = true; public static void osd_update(bool skip_redraw) @@ -45,7 +47,7 @@ namespace mame } winwindow_process_events(true); } - public static void osd_init(mainForm form) + public static void osd_init(mainMotion form) { _myParentForm = form; wininput_init(); @@ -70,7 +72,7 @@ namespace mame break; } wininput_poll(); - } + } public static void wininput_pause(bool paused) { input_paused = paused; diff --git a/MAME.Core/emu/Wintime.cs b/MAME.Core/emu/Wintime.cs index 0e1e130..3c56aad 100644 --- a/MAME.Core/emu/Wintime.cs +++ b/MAME.Core/emu/Wintime.cs @@ -1,18 +1,33 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Runtime.InteropServices; +using System.Diagnostics; using System.Threading; namespace mame { public class Wintime { - [DllImport("kernel32.dll ")] - public static extern bool QueryPerformanceCounter(ref long lpPerformanceCount); - [DllImport("kernel32.dll")] - private static extern bool QueryPerformanceFrequency(ref long PerformanceFrequency); + //[DllImport("kernel32.dll ")] + //public static extern bool QueryPerformanceCounter(ref long lpPerformanceCount); + //[DllImport("kernel32.dll")] + //private static extern bool QueryPerformanceFrequency(ref long PerformanceFrequency); + + #region 跨平台等效实现 + public static Stopwatch _stopwatch = Stopwatch.StartNew(); + private static long _lastReportedCount = 0; + + public static bool QueryPerformanceCounter(ref long lpPerformanceCount) + { + lpPerformanceCount = _stopwatch.ElapsedTicks; + return true; + } + + public static bool QueryPerformanceFrequency(ref long PerformanceFrequency) + { + PerformanceFrequency = Stopwatch.Frequency; + return true; + } + #endregion + + public static long ticks_per_second; public static void wintime_init() { diff --git a/MAME.Core/mame/capcom/Capcom.cs b/MAME.Core/mame/capcom/Capcom.cs index ee2b8c8..a84a16a 100644 --- a/MAME.Core/mame/capcom/Capcom.cs +++ b/MAME.Core/mame/capcom/Capcom.cs @@ -1,36 +1,32 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using cpu.m68000; +using cpu.m68000; namespace mame { public partial class Capcom { public static byte[] audiorom2; - public static int basebankmain,basebanksnd1; - public static byte[] gfx1rom, gfx2rom, gfx3rom,gfx4rom,gfx5rom,gfx12rom,gfx22rom,gfx32rom,gfx42rom; + public static int basebankmain, basebanksnd1; + public static byte[] gfx1rom, gfx2rom, gfx3rom, gfx4rom, gfx5rom, gfx12rom, gfx22rom, gfx32rom, gfx42rom; public static ushort dsw1, dsw2; public static byte bytedsw1, bytedsw2; public static ushort[] sf_objectram, sf_videoram; public static int[] scale = new int[8] { 0x00, 0x40, 0xe0, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe }; public static void CapcomInit() { - int i,n; + int i, n; Machine.bRom = true; switch (Machine.sName) { case "gng": case "gnga": - case "gngbl": - case "gngprot": - case "gngblita": - case "gngc": - case "gngt": - case "makaimur": - case "makaimurc": - case "makaimurg": + case "gngbl": + case "gngprot": + case "gngblita": + case "gngc": + case "gngt": + case "makaimur": + case "makaimurc": + case "makaimurg": case "diamond": Generic.spriteram = new byte[0x200]; Generic.buffered_spriteram = new byte[0x200]; @@ -149,7 +145,7 @@ namespace mame dsw1 = 0xdfff; dsw2 = 0xfbff; shorts = unchecked((short)0xff7f); - break; + break; case "sfjan": case "sfan": case "sfp": @@ -200,11 +196,11 @@ namespace mame public static void protection_w(ushort data) { int[,] maplist = new int[4, 10] { - { 1, 0, 3, 2, 4, 5, 6, 7, 8, 9 }, - { 4, 5, 6, 7, 1, 0, 3, 2, 8, 9 }, - { 3, 2, 1, 0, 6, 7, 4, 5, 8, 9 }, - { 6, 7, 4, 5, 3, 2, 1, 0, 8, 9 } - }; + { 1, 0, 3, 2, 4, 5, 6, 7, 8, 9 }, + { 4, 5, 6, 7, 1, 0, 3, 2, 8, 9 }, + { 3, 2, 1, 0, 6, 7, 4, 5, 8, 9 }, + { 6, 7, 4, 5, 3, 2, 1, 0, 8, 9 } + }; int map; map = maplist[MC68000.m1.ReadByte(0xffc006), (MC68000.m1.ReadByte(0xffc003) << 1) + (MC68000.m1.ReadWord(0xffc004) >> 8)]; switch (MC68000.m1.ReadByte(0xffc684)) @@ -233,11 +229,11 @@ namespace mame case 2: { int[] delta1 = new int[10]{ - 0x1f80, 0x1c80, 0x2700, 0x2400, 0x2b80, 0x2e80, 0x3300, 0x3600, 0x3a80, 0x3d80 - }; - int[] delta2 = new int[10]{ - 0x2180, 0x1800, 0x3480, 0x2b00, 0x3e00, 0x4780, 0x5100, 0x5a80, 0x6400, 0x6d80 - }; + 0x1f80, 0x1c80, 0x2700, 0x2400, 0x2b80, 0x2e80, 0x3300, 0x3600, 0x3a80, 0x3d80 + }; + int[] delta2 = new int[10]{ + 0x2180, 0x1800, 0x3480, 0x2b00, 0x3e00, 0x4780, 0x5100, 0x5a80, 0x6400, 0x6d80 + }; int d1 = delta1[map] + 0xc0; int d2 = delta2[map]; MC68000.m1.WriteWord(0xffc680, (short)d1); @@ -282,11 +278,11 @@ namespace mame public static void protection_w1(byte data) { int[,] maplist = new int[4, 10] { - { 1, 0, 3, 2, 4, 5, 6, 7, 8, 9 }, - { 4, 5, 6, 7, 1, 0, 3, 2, 8, 9 }, - { 3, 2, 1, 0, 6, 7, 4, 5, 8, 9 }, - { 6, 7, 4, 5, 3, 2, 1, 0, 8, 9 } - }; + { 1, 0, 3, 2, 4, 5, 6, 7, 8, 9 }, + { 4, 5, 6, 7, 1, 0, 3, 2, 8, 9 }, + { 3, 2, 1, 0, 6, 7, 4, 5, 8, 9 }, + { 6, 7, 4, 5, 3, 2, 1, 0, 8, 9 } + }; int map; map = maplist[MC68000.m1.ReadByte(0xffc006), (MC68000.m1.ReadByte(0xffc003) << 1) + (MC68000.m1.ReadWord(0xffc004) >> 8)]; switch (MC68000.m1.ReadByte(0xffc684)) @@ -315,11 +311,11 @@ namespace mame case 2: { int[] delta1 = new int[10]{ - 0x1f80, 0x1c80, 0x2700, 0x2400, 0x2b80, 0x2e80, 0x3300, 0x3600, 0x3a80, 0x3d80 - }; + 0x1f80, 0x1c80, 0x2700, 0x2400, 0x2b80, 0x2e80, 0x3300, 0x3600, 0x3a80, 0x3d80 + }; int[] delta2 = new int[10]{ - 0x2180, 0x1800, 0x3480, 0x2b00, 0x3e00, 0x4780, 0x5100, 0x5a80, 0x6400, 0x6d80 - }; + 0x2180, 0x1800, 0x3480, 0x2b00, 0x3e00, 0x4780, 0x5100, 0x5a80, 0x6400, 0x6d80 + }; int d1 = delta1[map] + 0xc0; int d2 = delta2[map]; MC68000.m1.WriteWord(0xffc680, (short)d1); @@ -351,7 +347,7 @@ namespace mame } MC68000.m1.WriteWord(0xffc682, (short)d1); MC68000.m1.WriteWord(0xffc00e, (short)off); - sf_bg_scroll_w((byte)(d1>>8)); + sf_bg_scroll_w((byte)(d1 >> 8)); } break; } @@ -364,11 +360,11 @@ namespace mame public static void protection_w2(byte data) { int[,] maplist = new int[4, 10] { - { 1, 0, 3, 2, 4, 5, 6, 7, 8, 9 }, - { 4, 5, 6, 7, 1, 0, 3, 2, 8, 9 }, - { 3, 2, 1, 0, 6, 7, 4, 5, 8, 9 }, - { 6, 7, 4, 5, 3, 2, 1, 0, 8, 9 } - }; + { 1, 0, 3, 2, 4, 5, 6, 7, 8, 9 }, + { 4, 5, 6, 7, 1, 0, 3, 2, 8, 9 }, + { 3, 2, 1, 0, 6, 7, 4, 5, 8, 9 }, + { 6, 7, 4, 5, 3, 2, 1, 0, 8, 9 } + }; int map; map = maplist[MC68000.m1.ReadByte(0xffc006), (MC68000.m1.ReadByte(0xffc003) << 1) + (MC68000.m1.ReadWord(0xffc004) >> 8)]; switch (MC68000.m1.ReadByte(0xffc684)) @@ -397,11 +393,11 @@ namespace mame case 2: { int[] delta1 = new int[10]{ - 0x1f80, 0x1c80, 0x2700, 0x2400, 0x2b80, 0x2e80, 0x3300, 0x3600, 0x3a80, 0x3d80 - }; + 0x1f80, 0x1c80, 0x2700, 0x2400, 0x2b80, 0x2e80, 0x3300, 0x3600, 0x3a80, 0x3d80 + }; int[] delta2 = new int[10]{ - 0x2180, 0x1800, 0x3480, 0x2b00, 0x3e00, 0x4780, 0x5100, 0x5a80, 0x6400, 0x6d80 - }; + 0x2180, 0x1800, 0x3480, 0x2b00, 0x3e00, 0x4780, 0x5100, 0x5a80, 0x6400, 0x6d80 + }; int d1 = delta1[map] + 0xc0; int d2 = delta2[map]; MC68000.m1.WriteWord(0xffc680, (short)d1); diff --git a/MAME.Core/mame/capcom/Drawgfx.cs b/MAME.Core/mame/capcom/Drawgfx.cs index 9d097a2..4f84627 100644 --- a/MAME.Core/mame/capcom/Drawgfx.cs +++ b/MAME.Core/mame/capcom/Drawgfx.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace mame +namespace mame { public partial class Drawgfx { @@ -163,7 +158,7 @@ namespace mame int colorbase = 0x200 + 0x10 * color; blockmove_8toN_transpen16_sf(bb1, code, sw, sh, 0x10, ls, ts, flipx, flipy, dw, dh, colorbase, sy, sx); } - public static void blockmove_8toN_transpen16_sf(byte[] bb1, int code, int srcwidth, int srcheight, int srcmodulo,int leftskip, int topskip, int flipx, int flipy,int dstwidth, int dstheight, int colorbase, int offsety, int offsetx) + public static void blockmove_8toN_transpen16_sf(byte[] bb1, int code, int srcwidth, int srcheight, int srcmodulo, int leftskip, int topskip, int flipx, int flipy, int dstwidth, int dstheight, int colorbase, int offsety, int offsetx) { int ydir, xdir, col, i, j; int srcdata_offset = code * 0x100; diff --git a/MAME.Core/mame/capcom/Gdi.cs b/MAME.Core/mame/capcom/Gdi.cs index 31b7f83..85c7a71 100644 --- a/MAME.Core/mame/capcom/Gdi.cs +++ b/MAME.Core/mame/capcom/Gdi.cs @@ -1,6 +1,4 @@ -using System.Drawing; -using System.Drawing.Imaging; - + namespace mame { public partial class Capcom @@ -10,731 +8,5 @@ namespace mame { } - public static Bitmap GetBg_gng() - { - int i1, i2, iOffset, i3, i4; - int rows, cols, width, height; - int tilewidth, tileheight; - int tile_index; - tilewidth = 0x10; - tileheight = tilewidth; - rows = 0x20; - cols = 0x20; - width = tilewidth * cols; - height = tileheight * rows; - int iByte; - int code, color; - int group, flags, attributes = 0; - int pen_data_offset, palette_base; - int x0 = 0, y0 = 0, dx0 = 0, dy0 = 0; - Color c1 = new Color(); - Bitmap bm1; - bm1 = new Bitmap(width, height); - BitmapData bmData; - bmData = bm1.LockBits(new Rectangle(0, 0, bm1.Width, bm1.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); - unsafe - { - byte* ptr = (byte*)(bmData.Scan0); - byte* ptr2 = (byte*)0; - for (i3 = 0; i3 < cols; i3++) - { - for (i4 = 0; i4 < rows; i4++) - { - tile_index = i3 * rows + i4; - int base_offset = 2 * tile_index; - int attr = gng_bgvideoram[tile_index + 0x400]; - color = attr & 0x07; - code = gng_bgvideoram[tile_index] + ((attr & 0xc0) << 2); - code = code % bg_tilemap.total_elements; - pen_data_offset = code * 0x100; - palette_base = color * 8; - flags = (((attr & 0x30) >> 4) & 0x03) ^ (attributes & 0x03); - group = (attr & 0x08) >> 3; - if (flags == 0) - { - x0 = tilewidth * i3; - y0 = tileheight * i4; - dx0 = 1; - dy0 = 1; - } - else if (flags == 1) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4; - dx0 = -1; - dy0 = 1; - } - else if (flags == 2) - { - x0 = tilewidth * i3; - y0 = tileheight * i4 + tileheight - 1; - dx0 = 1; - dy0 = -1; - } - else if (flags == 3) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4 + tileheight - 1; - dx0 = -1; - dy0 = -1; - } - for (i1 = 0; i1 < tilewidth; i1++) - { - for (i2 = 0; i2 < tileheight; i2++) - { - iOffset = pen_data_offset + i2 * 0x10 + i1; - iByte = gfx2rom[iOffset]; - c1 = Color.FromArgb((int)Palette.entry_color[palette_base + iByte]); - ptr2 = ptr + ((y0 + dy0 * i2) * width + x0 + dx0 * i1) * 4; - *ptr2 = c1.B; - *(ptr2 + 1) = c1.G; - *(ptr2 + 2) = c1.R; - *(ptr2 + 3) = c1.A; - } - } - } - } - } - bm1.UnlockBits(bmData); - return bm1; - } - public static Bitmap GetFg_gng() - { - int i1, i2, iOffset, i3, i4; - int rows, cols, width, height; - int tilewidth, tileheight; - int tile_index; - tilewidth = 8; - tileheight = tilewidth; - rows = 0x20; - cols = 0x20; - width = tilewidth * cols; - height = tileheight * rows; - int iByte; - int code, color; - int group, flags, attributes = 0; - int pen_data_offset, palette_base; - int x0 = 0, y0 = 0, dx0 = 0, dy0 = 0; - Color c1 = new Color(); - Bitmap bm1; - bm1 = new Bitmap(width, height); - BitmapData bmData; - bmData = bm1.LockBits(new Rectangle(0, 0, bm1.Width, bm1.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); - unsafe - { - byte* ptr = (byte*)(bmData.Scan0); - byte* ptr2 = (byte*)0; - for (i3 = 0; i3 < cols; i3++) - { - for (i4 = 0; i4 < rows; i4++) - { - tile_index = i4 * cols + i3; - int base_offset = 2 * tile_index; - int attr = Capcom.gng_fgvideoram[tile_index + 0x400]; - color = attr & 0x0f; - code = Capcom.gng_fgvideoram[tile_index] + ((attr & 0xc0) << 2); - code = code % fg_tilemap.total_elements; - pen_data_offset = code * 0x40; - palette_base = 0x80 + color * 4; - flags = (((attr & 0x30) >> 4) & 0x03) ^ (attributes & 0x03); - group = 0; - if (flags == 0) - { - x0 = tilewidth * i3; - y0 = tileheight * i4; - dx0 = 1; - dy0 = 1; - } - else if (flags == 1) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4; - dx0 = -1; - dy0 = 1; - } - else if (flags == 2) - { - x0 = tilewidth * i3; - y0 = tileheight * i4 + tileheight - 1; - dx0 = 1; - dy0 = -1; - } - else if (flags == 3) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4 + tileheight - 1; - dx0 = -1; - dy0 = -1; - } - for (i1 = 0; i1 < tilewidth; i1++) - { - for (i2 = 0; i2 < tileheight; i2++) - { - iOffset = pen_data_offset + i2 * 8 + i1; - iByte = gfx1rom[iOffset]; - if (iByte != 3) - { - c1 = Color.FromArgb((int)Palette.entry_color[palette_base + iByte]); - ptr2 = ptr + ((y0 + dy0 * i2) * width + x0 + dx0 * i1) * 4; - *ptr2 = c1.B; - *(ptr2 + 1) = c1.G; - *(ptr2 + 2) = c1.R; - *(ptr2 + 3) = c1.A; - } - } - } - } - } - } - bm1.UnlockBits(bmData); - return bm1; - } - public static Bitmap GetSprite_gng() - { - Bitmap bm1; - int offs; - int i5, i6; - int xdir, ydir, offx, offy,color; - int iByte; - Color c1 = new Color(); - bm1 = new Bitmap(256, 256); - for (offs = 0x200 - 4; offs >= 0; offs -= 4) - { - byte attributes = Generic.buffered_spriteram[offs + 1]; - int sx = Generic.buffered_spriteram[offs + 3] - 0x100 * (attributes & 0x01); - int sy = Generic.buffered_spriteram[offs + 2]; - int flipx = attributes & 0x04; - int flipy = attributes & 0x08; - if (Generic.buffered_spriteram[offs] == 0 && Generic.buffered_spriteram[offs + 1] == 0 && Generic.buffered_spriteram[offs + 2] == 0 && Generic.buffered_spriteram[offs + 3] == 0) - { - continue; - } - color=(attributes >> 4) & 3; - if (Generic.flip_screen_get() != 0) - { - sx = 240 - sx; - sy = 240 - sy; - flipx = (flipx == 0 ? 1 : 0); - flipy = (flipy == 0 ? 1 : 0); - } - if (flipx != 0) - { - offx = 0x0f; - xdir = -1; - } - else - { - offx = 0; - xdir = 1; - } - if (flipy != 0) - { - offy = 0x0f; - ydir = -1; - } - else - { - offy = 0; - ydir = 1; - } - for (i5 = 0; i5 < 0x10; i5++) - { - for (i6 = 0; i6 < 0x10; i6++) - { - if (sx + offx + xdir * i5 >= 0 && sx + offx + xdir * i5 < 0x100 && sy + offy + ydir * i6 >= 0 && sy + offy + ydir * i6 < 0x100) - { - iByte = gfx3rom[(Generic.buffered_spriteram[offs] + ((attributes << 2) & 0x300)) * 0x100 + i5 + i6 * 0x10]; - if (iByte != 0x0f) - { - c1 = Color.FromArgb((int)Palette.entry_color[0x40 + 0x10 * color + iByte]); - bm1.SetPixel(sx + offx + xdir * i5, sy + offy + ydir * i6, c1); - } - } - } - } - } - return bm1; - } - public static Bitmap GetAllGDI_gng() - { - Bitmap bm1 = new Bitmap(0x200, 0x100), bm2; - Graphics g = Graphics.FromImage(bm1); - g.Clear(Color.Transparent); - if (bBg) - { - bm2 = GetBg_gng(); - g.DrawImage(bm2, -(scrollx[0] + 256 * scrollx[1]), 0); - } - if (bSprite) - { - bm2 = GetSprite_gng(); - g.DrawImage(bm2, 0, 0); - } - if (bFg) - { - bm2 = GetFg_gng(); - g.DrawImage(bm2, -(scrolly[0] + 256 * scrolly[1]), 0); - } - return bm1; - } - public static Bitmap GetBg_sf() - { - int i1, i2, iOffset, i3, i4; - int rows, cols, width, height; - int tilewidth, tileheight; - int tile_index; - tilewidth = 0x10; - tileheight = tilewidth; - rows = 0x10; - cols = 0x800; - width = tilewidth * cols; - height = tileheight * rows; - int iByte; - int code, color; - int group, flags, attributes = 0; - int pen_data_offset, palette_base; - int x0 = 0, y0 = 0, dx0 = 0, dy0 = 0; - Color c1 = new Color(); - Bitmap bm1; - bm1 = new Bitmap(width, height); - BitmapData bmData; - bmData = bm1.LockBits(new Rectangle(0, 0, bm1.Width, bm1.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); - unsafe - { - byte* ptr = (byte*)(bmData.Scan0); - byte* ptr2 = (byte*)0; - for (i3 = 0; i3 < cols; i3++) - { - for (i4 = 0; i4 < rows; i4++) - { - tile_index = i3 * rows + i4; - int base_offset = 2 * tile_index; - int attr = gfx5rom[base_offset + 0x10000]; - color = gfx5rom[base_offset]; - code = (gfx5rom[base_offset + 0x10000 + 1] << 8) | gfx5rom[base_offset + 1]; - code = code % bg_tilemap.total_elements; - pen_data_offset = code * 0x100; - palette_base = color * 0x10; - group = 0; - flags = (attr & 0x03) ^ (attributes & 0x03); - pen_data_offset = code * 0x100; - if (flags == 0) - { - x0 = tilewidth * i3; - y0 = tileheight * i4; - dx0 = 1; - dy0 = 1; - } - else if (flags == 1) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4; - dx0 = -1; - dy0 = 1; - } - else if (flags == 2) - { - x0 = tilewidth * i3; - y0 = tileheight * i4 + tileheight - 1; - dx0 = 1; - dy0 = -1; - } - else if (flags == 3) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4 + tileheight - 1; - dx0 = -1; - dy0 = -1; - } - for (i1 = 0; i1 < tilewidth; i1++) - { - for (i2 = 0; i2 < tileheight; i2++) - { - iOffset = pen_data_offset + i2 * 0x10 + i1; - iByte = gfx1rom[iOffset]; - if (iByte == 0) - { - c1 = Color.Transparent; - } - else - { - if (palette_base + iByte >= 0x400) - { - c1 = Color.Transparent; - } - else - { - c1 = Color.FromArgb((int)Palette.entry_color[palette_base + iByte]); - } - } - ptr2 = ptr + ((y0 + dy0 * i2) * width + x0 + dx0 * i1) * 4; - *ptr2 = c1.B; - *(ptr2 + 1) = c1.G; - *(ptr2 + 2) = c1.R; - *(ptr2 + 3) = c1.A; - } - } - } - } - } - bm1.UnlockBits(bmData); - return bm1; - } - public static Bitmap GetFg_sf() - { - int i1, i2, iOffset, i3, i4; - int rows, cols, width, height; - int tilewidth, tileheight; - int tile_index; - tilewidth = 0x10; - tileheight = tilewidth; - rows = 0x10; - cols = 0x800; - width = tilewidth * cols; - height = tileheight * rows; - int iByte; - int code,color; - int group, flags,attributes=0; - int pen_data_offset, palette_base; - int x0 = 0, y0 = 0, dx0 = 0, dy0 = 0; - Color c1 = new Color(); - Bitmap bm1; - bm1 = new Bitmap(width, height); - BitmapData bmData; - bmData = bm1.LockBits(new Rectangle(0, 0, bm1.Width, bm1.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); - unsafe - { - byte* ptr = (byte*)(bmData.Scan0); - byte* ptr2 = (byte*)0; - for (i3 = 0; i3 < cols; i3++) - { - for (i4 = 0; i4 < rows; i4++) - { - tile_index = i3 * rows + i4; - int base_offset = 0x20000 + 2 * tile_index; - int attr = gfx5rom[base_offset + 0x10000]; - color = gfx5rom[base_offset]; - code = (gfx5rom[base_offset + 0x10000 + 1] << 8) | gfx5rom[base_offset + 1]; - code = code % fg_tilemap.total_elements; - pen_data_offset = code * 0x100; - palette_base = 0x100 + color * 0x10; - group = 0; - flags = (attr & 0x03) ^ (attributes & 0x03); - pen_data_offset = code * 0x100; - palette_base = 0x100+ 0x10 * color; - if (flags == 0) - { - x0 = tilewidth * i3; - y0 = tileheight * i4; - dx0 = 1; - dy0 = 1; - } - else if (flags == 1) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4; - dx0 = -1; - dy0 = 1; - } - else if (flags == 2) - { - x0 = tilewidth * i3; - y0 = tileheight * i4 + tileheight - 1; - dx0 = 1; - dy0 = -1; - } - else if (flags == 3) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4 + tileheight - 1; - dx0 = -1; - dy0 = -1; - } - for (i1 = 0; i1 < tilewidth; i1++) - { - for (i2 = 0; i2 < tileheight; i2++) - { - iOffset = pen_data_offset + i2 * 0x10 + i1; - iByte = gfx2rom[iOffset]; - if (iByte == 15) - { - c1 = Color.Transparent; - } - else - { - c1 = Color.FromArgb((int)Palette.entry_color[palette_base + iByte]); - } - ptr2 = ptr + ((y0 + dy0 * i2) * width + x0 + dx0 * i1) * 4; - *ptr2 = c1.B; - *(ptr2 + 1) = c1.G; - *(ptr2 + 2) = c1.R; - *(ptr2 + 3) = c1.A; - } - } - } - } - } - bm1.UnlockBits(bmData); - return bm1; - } - public static Bitmap GetTx_sf() - { - int i1, i2, iOffset, i3, i4; - int rows, cols, width, height; - int tilewidth, tileheight; - int tile_index; - tilewidth = 0x8; - tileheight = tilewidth; - rows = 0x20; - cols = 0x40; - width = tilewidth * cols; - height = tileheight * rows; - int iByte; - int code, color; - int group, flags, attributes = 0; - int pen_data_offset, palette_base; - int x0 = 0, y0 = 0, dx0 = 0, dy0 = 0; - Color c1 = new Color(); - Bitmap bm1; - bm1 = new Bitmap(width, height); - BitmapData bmData; - bmData = bm1.LockBits(new Rectangle(0, 0, bm1.Width, bm1.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); - unsafe - { - byte* ptr = (byte*)(bmData.Scan0); - byte* ptr2 = (byte*)0; - for (i3 = 0; i3 < cols; i3++) - { - for (i4 = 0; i4 < rows; i4++) - { - tile_index = i4 * cols + i3; - int base_offset = 0x20000 + 2 * tile_index; - code = Capcom.sf_videoram[tile_index]; - color = code >> 12; - flags = (((code & 0xc00) >> 10) & 0x03) ^ (attributes & 0x03); - code = (code & 0x3ff) % tx_tilemap.total_elements; - pen_data_offset = code * 0x40; - palette_base = 0x300 + color * 4; - group = 0; - if (flags == 0) - { - x0 = tilewidth * i3; - y0 = tileheight * i4; - dx0 = 1; - dy0 = 1; - } - else if (flags == 1) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4; - dx0 = -1; - dy0 = 1; - } - else if (flags == 2) - { - x0 = tilewidth * i3; - y0 = tileheight * i4 + tileheight - 1; - dx0 = 1; - dy0 = -1; - } - else if (flags == 3) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4 + tileheight - 1; - dx0 = -1; - dy0 = -1; - } - for (i1 = 0; i1 < tilewidth; i1++) - { - for (i2 = 0; i2 < tileheight; i2++) - { - iOffset = pen_data_offset + i2 * 0x8 + i1; - iByte = gfx4rom[iOffset]; - if (iByte == 3) - { - c1 = Color.Transparent; - } - else - { - c1 = Color.FromArgb((int)Palette.entry_color[palette_base + iByte]); - } - ptr2 = ptr + ((y0 + dy0 * i2) * width + x0 + dx0 * i1) * 4; - *ptr2 = c1.B; - *(ptr2 + 1) = c1.G; - *(ptr2 + 2) = c1.R; - *(ptr2 + 3) = c1.A; - } - } - } - } - } - bm1.UnlockBits(bmData); - return bm1; - } - public static Bitmap GetSprite_sf() - { - Bitmap bm1; - int offs; - int i5, i6; - int xdir, ydir, offx, offy; - int iByte1,iByte2,iByte3,iByte4; - Color c11 = new Color(),c12=new Color(),c13=new Color(),c14=new Color(); - bm1 = new Bitmap(512,256); - for (offs = 0x1000 - 0x20; offs >= 0; offs -= 0x20) - { - int c = sf_objectram[offs]; - int attr = sf_objectram[offs + 1]; - int sy = sf_objectram[offs + 2]; - int sx = sf_objectram[offs + 3]; - int color = attr & 0x000f; - int flipx = attr & 0x0100; - int flipy = attr & 0x0200; - if ((attr & 0x400) != 0) - { - int c1, c2, c3, c4, t; - if (Generic.flip_screen_get() != 0) - { - sx = 480 - sx; - sy = 224 - sy; - flipx = (flipx == 0) ? 1 : 0; - flipy = (flipy == 0) ? 1 : 0; - } - c1 = c; - c2 = c + 1; - c3 = c + 16; - c4 = c + 17; - if (flipx != 0) - { - t = c1; c1 = c2; c2 = t; - t = c3; c3 = c4; c4 = t; - } - if (flipy != 0) - { - t = c1; c1 = c3; c3 = t; - t = c2; c2 = c4; c4 = t; - } - if (flipx != 0) - { - offx = 0x0f; - xdir = -1; - } - else - { - offx = 0; - xdir = 1; - } - if (flipy != 0) - { - offy = 0x0f; - ydir = -1; - } - else - { - offy = 0; - ydir = 1; - } - for (i5 = 0; i5 < 0x10; i5++) - { - for (i6 = 0; i6 < 0x10; i6++) - { - iByte1 = gfx3rom[(sf_invert(c1)) * 0x100 + i5 + i6 * 0x10]; - iByte2 = gfx3rom[(sf_invert(c2)) * 0x100 + i5 + i6 * 0x10]; - iByte3 = gfx3rom[(sf_invert(c3)) * 0x100 + i5 + i6 * 0x10]; - iByte4 = gfx3rom[(sf_invert(c4)) * 0x100 + i5 + i6 * 0x10]; - if (iByte1 != 0x0f) - { - c11 = Color.FromArgb((int)Palette.entry_color[0x200 + 0x10 * color + iByte1]); - bm1.SetPixel(sx + offx + xdir * i5, sy + offy + ydir * i6, c11); - } - if (iByte2 != 0x0f) - { - c12 = Color.FromArgb((int)Palette.entry_color[0x200 + 0x10 * color + iByte2]); - bm1.SetPixel(sx + 16 + offx + xdir * i5, sy + offy + ydir * i6, c12); - } - if (iByte3 != 0x0f) - { - bm1.SetPixel(sx + offx + xdir * i5, sy + 16 + offy + ydir * i6, c13); - c13 = Color.FromArgb((int)Palette.entry_color[0x200 + 0x10 * color + iByte3]); - } - if (iByte4 != 0x0f) - { - c14 = Color.FromArgb((int)Palette.entry_color[0x200 + 0x10 * color + iByte4]); - bm1.SetPixel(sx + 16 + offx + xdir * i5, sy + 16 + offy + ydir * i6, c14); - } - } - } - } - else - { - if (Generic.flip_screen_get() != 0) - { - sx = 496 - sx; - sy = 240 - sy; - flipx = (flipx == 0) ? 1 : 0; - flipy = (flipy == 0) ? 1 : 0; - } - if (flipx != 0) - { - offx = 0x0f; - xdir = -1; - } - else - { - offx = 0; - xdir = 1; - } - if (flipy != 0) - { - offy = 0x0f; - ydir = -1; - } - else - { - offy = 0; - ydir = 1; - } - for (i5 = 0; i5 < 0x10; i5++) - { - for (i6 = 0; i6 < 0x10; i6++) - { - iByte1 = gfx3rom[(sf_invert(c)) * 0x100 + i5 + i6 * 0x10]; - if (iByte1 != 0x0f) - { - c11 = Color.FromArgb((int)Palette.entry_color[0x200 + 0x10 * color + iByte1]); - bm1.SetPixel(sx + offx + xdir * i5, sy + offy + ydir * i6, c11); - } - } - } - } - } - return bm1; - } - public static Bitmap GetAllGDI_sf() - { - Bitmap bm1 = new Bitmap(0x200, 0x100), bm2; - Graphics g = Graphics.FromImage(bm1); - g.Clear(Color.Transparent); - if (bBg) - { - bm2 = GetBg_sf(); - g.DrawImage(bm2, -bg_scrollx, 0); - } - if(bFg) - { - bm2 = GetFg_sf(); - g.DrawImage(bm2, -fg_scrollx, 0); - } - if(bTx) - { - bm2 = GetTx_sf(); - g.DrawImage(bm2, 0,0); - } - if(bSprite) - { - bm2 = GetSprite_sf(); - g.DrawImage(bm2, 0,0); - } - return bm1; - } } } diff --git a/MAME.Core/mame/capcom/Gng.cs b/MAME.Core/mame/capcom/Gng.cs index 32b5fe7..3d3633c 100644 --- a/MAME.Core/mame/capcom/Gng.cs +++ b/MAME.Core/mame/capcom/Gng.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace mame +namespace mame { public partial class Capcom { diff --git a/MAME.Core/mame/capcom/Input.cs b/MAME.Core/mame/capcom/Input.cs index 5e3752c..06683f2 100644 --- a/MAME.Core/mame/capcom/Input.cs +++ b/MAME.Core/mame/capcom/Input.cs @@ -85,7 +85,7 @@ namespace mame else { byte1 |= 0x20; - } + } if (Keyboard.IsPressed(Key.Right)) { byte2 &= unchecked((byte)~0x01); @@ -216,7 +216,7 @@ namespace mame else { byte1 |= 0x10; - } + } } public static void loop_inputports_sfus() { @@ -720,11 +720,11 @@ namespace mame } else { - sbyte1 &= ~0x02; + sbyte1 &= ~0x02; } if (Keyboard.IsPressed(Key.L)) { - sbyte1 |= 0x04; + sbyte1 |= 0x04; } else { @@ -736,10 +736,10 @@ namespace mame } else { - sbyte2 &= ~0x01; + sbyte2 &= ~0x01; } if (Keyboard.IsPressed(Key.I)) - { + { sbyte2 |= 0x02; } else @@ -748,7 +748,7 @@ namespace mame } if (Keyboard.IsPressed(Key.O)) { - sbyte2 |= 0x04; + sbyte2 |= 0x04; } else { @@ -787,7 +787,7 @@ namespace mame short0 |= 0x0800; } if (Keyboard.IsPressed(Key.NumPad1)) - { + { sbyte3 |= 0x01; } else @@ -795,7 +795,7 @@ namespace mame sbyte3 &= ~0x01; } if (Keyboard.IsPressed(Key.NumPad2)) - { + { sbyte3 |= 0x02; } else @@ -803,7 +803,7 @@ namespace mame sbyte3 &= ~0x02; } if (Keyboard.IsPressed(Key.NumPad3)) - { + { sbyte3 |= 0x04; } else @@ -832,7 +832,7 @@ namespace mame } else { - sbyte4 &= ~0x04; + sbyte4 &= ~0x04; } if (Keyboard.IsPressed(Key.R)) { @@ -895,7 +895,7 @@ namespace mame } public static void record_port_sf() { - if (short0 != short0_old || short1!=short1_old|| short2!=short2_old||shorts!=shorts_old||shortc!=shortc_old|| sbyte1 != sbyte1_old || sbyte2 != sbyte2_old || sbyte3 != sbyte3_old || sbyte4 != sbyte4_old) + if (short0 != short0_old || short1 != short1_old || short2 != short2_old || shorts != shorts_old || shortc != shortc_old || sbyte1 != sbyte1_old || sbyte2 != sbyte2_old || sbyte3 != sbyte3_old || sbyte4 != sbyte4_old) { short0_old = short0; short1_old = short1; diff --git a/MAME.Core/mame/capcom/Memory.cs b/MAME.Core/mame/capcom/Memory.cs index 0cebd83..f5e2782 100644 --- a/MAME.Core/mame/capcom/Memory.cs +++ b/MAME.Core/mame/capcom/Memory.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using cpu.z80; +using cpu.z80; namespace mame { @@ -10,8 +6,8 @@ namespace mame { public static sbyte sbyte1, sbyte2, sbyte3, sbyte4; public static sbyte sbyte1_old, sbyte2_old, sbyte3_old, sbyte4_old; - public static short short0, short1,short2,shorts,shortc; - public static short short0_old, short1_old,short2_old,shorts_old,shortc_old; + public static short short0, short1, short2, shorts, shortc; + public static short short0_old, short1_old, short2_old, shorts_old, shortc_old; public static byte bytes, byte1, byte2; public static byte bytes_old, byte1_old, byte2_old; public static byte MReadOpByte_gng(ushort address) @@ -83,7 +79,7 @@ namespace mame result = bytedsw2; } else if (address == 0x3c00) - { + { result = 0; } else if (address >= 0x4000 && address <= 0x5fff) @@ -852,11 +848,11 @@ namespace mame else if (address >= 0xff8000 && address + 1 <= 0xffdfff) { int offset = address - 0xff8000; - result = (short)(Memory.mainram[offset]*0x100+Memory.mainram[offset+1]); + result = (short)(Memory.mainram[offset] * 0x100 + Memory.mainram[offset + 1]); } else if (address >= 0xffe000 && address + 1 <= 0xffffff) { - int offset = (address - 0xffe000)/2; + int offset = (address - 0xffe000) / 2; result = (short)sf_objectram[offset]; } return result; @@ -960,7 +956,7 @@ namespace mame else if (address >= 0x800000 && address + 3 <= 0x800fff) { int offset = (address - 0x800000) / 2; - result = (int)(sf_videoram[offset]*0x10000+sf_videoram[offset+1]); + result = (int)(sf_videoram[offset] * 0x10000 + sf_videoram[offset + 1]); } else if (address >= 0xff8000 && address + 3 <= 0xffdfff) { @@ -1045,7 +1041,7 @@ namespace mame { if (address % 2 == 0) { - + } else if (address % 2 == 1) { @@ -1056,7 +1052,7 @@ namespace mame { if (address % 2 == 0) { - + } else if (address % 2 == 1) { @@ -1140,7 +1136,7 @@ namespace mame else if (address >= 0xff8000 && address + 1 <= 0xffdfff) { int offset = address - 0xff8000; - Memory.mainram[offset] = (byte)(value>>8); + Memory.mainram[offset] = (byte)(value >> 8); Memory.mainram[offset + 1] = (byte)value; } else if (address >= 0xffe000 && address + 1 <= 0xffffff) @@ -1165,7 +1161,7 @@ namespace mame else if (address >= 0x800000 && address + 3 <= 0x800fff) { int offset = (address - 0x800000) / 2; - sf_videoram_w(offset, (ushort)(value>>16)); + sf_videoram_w(offset, (ushort)(value >> 16)); sf_videoram_w(offset + 1, (ushort)value); } else if (address >= 0xb00000 && address + 3 <= 0xb007ff) diff --git a/MAME.Core/mame/capcom/State.cs b/MAME.Core/mame/capcom/State.cs index d2a6ccd..99d4115 100644 --- a/MAME.Core/mame/capcom/State.cs +++ b/MAME.Core/mame/capcom/State.cs @@ -1,11 +1,7 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using cpu.m68000; +using cpu.m68000; using cpu.m6809; using cpu.z80; +using System.IO; namespace mame { @@ -23,7 +19,7 @@ namespace mame writer.Write(scrolly, 0, 2); writer.Write(Generic.paletteram, 0, 0x100); writer.Write(Generic.paletteram_2, 0, 0x100); - writer.Write(Generic.spriteram,0,0x200); + writer.Write(Generic.spriteram, 0, 0x200); writer.Write(Generic.buffered_spriteram, 0, 0x200); for (i = 0; i < 0x100; i++) { @@ -97,7 +93,7 @@ namespace mame AY8910.AA8910[1].stream.output_sampindex = reader.ReadInt32(); AY8910.AA8910[1].stream.output_base_sampindex = reader.ReadInt32(); YM2203.FF2203[0].stream.output_sampindex = reader.ReadInt32(); - YM2203.FF2203[0].stream.output_base_sampindex = reader.ReadInt32(); + YM2203.FF2203[0].stream.output_base_sampindex = reader.ReadInt32(); YM2203.FF2203[1].stream.output_sampindex = reader.ReadInt32(); YM2203.FF2203[1].stream.output_base_sampindex = reader.ReadInt32(); Sound.mixerstream.output_sampindex = reader.ReadInt32(); diff --git a/MAME.Core/mame/capcom/Tilemap.cs b/MAME.Core/mame/capcom/Tilemap.cs index c44619a..b0bc7d6 100644 --- a/MAME.Core/mame/capcom/Tilemap.cs +++ b/MAME.Core/mame/capcom/Tilemap.cs @@ -1,8 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; namespace mame { @@ -426,7 +423,7 @@ namespace mame int pen_data_offset, palette_base, group; tile_index = col * rows + row; int base_offset = 0x20000 + 2 * tile_index; - int attr = Capcom.gfx5rom[base_offset+0x10000]; + int attr = Capcom.gfx5rom[base_offset + 0x10000]; color = Capcom.gfx5rom[base_offset]; code = (Capcom.gfx5rom[base_offset + 0x10000 + 1] << 8) | Capcom.gfx5rom[base_offset + 1]; code = code % total_elements; @@ -451,7 +448,7 @@ namespace mame code = (code & 0x3ff) % total_elements; pen_data_offset = code * 0x40; palette_base = 0x300 + (color * 0x4); - group = 0; + group = 0; tileflags[row, col] = tile_drawCapcomtx(Capcom.gfx4rom, pen_data_offset, x0, y0, palette_base, group, flags); } public void tile_updateCapcombg_gng(int col, int row) diff --git a/MAME.Core/mame/capcom/Video.cs b/MAME.Core/mame/capcom/Video.cs index 06c6334..b00b025 100644 --- a/MAME.Core/mame/capcom/Video.cs +++ b/MAME.Core/mame/capcom/Video.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; namespace mame { diff --git a/MAME.Core/mame/cps/CPS.cs b/MAME.Core/mame/cps/CPS.cs index 8c36b06..b341368 100644 --- a/MAME.Core/mame/cps/CPS.cs +++ b/MAME.Core/mame/cps/CPS.cs @@ -1,7 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.IO; namespace mame { @@ -2455,8 +2453,8 @@ namespace mame /* EEPROM */ Eeprom.eeprom_write_bit(data & 0x1000); - Eeprom.eeprom_set_clock_line(((data & 0x2000)!=0) ? LineState.ASSERT_LINE : LineState.CLEAR_LINE); - Eeprom.eeprom_set_cs_line(((data & 0x4000)!=0) ? LineState.CLEAR_LINE : LineState.ASSERT_LINE); + Eeprom.eeprom_set_clock_line(((data & 0x2000) != 0) ? LineState.ASSERT_LINE : LineState.CLEAR_LINE); + Eeprom.eeprom_set_cs_line(((data & 0x4000) != 0) ? LineState.CLEAR_LINE : LineState.ASSERT_LINE); } //low 8 bits { @@ -2472,9 +2470,9 @@ namespace mame /* Z80 Reset */ Cpuint.cpunum_set_input_line(1, (int)LineState.INPUT_LINE_RESET, ((data & 0x0008) != 0) ? LineState.CLEAR_LINE : LineState.ASSERT_LINE); - Generic.coin_counter_w(0, data & 0x0001); + Generic.coin_counter_w(0, data & 0x0001); Generic.coin_counter_w(1, data & 0x0002); - + Generic.coin_lockout_w(0, ~data & 0x0010); Generic.coin_lockout_w(1, ~data & 0x0020); Generic.coin_lockout_w(2, ~data & 0x0040); diff --git a/MAME.Core/mame/cps/Drawgfx.cs b/MAME.Core/mame/cps/Drawgfx.cs index ecd1f21..6fbc758 100644 --- a/MAME.Core/mame/cps/Drawgfx.cs +++ b/MAME.Core/mame/cps/Drawgfx.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace mame +namespace mame { public partial class Drawgfx { diff --git a/MAME.Core/mame/cps/Gdi.cs b/MAME.Core/mame/cps/Gdi.cs index 559125b..066e6a0 100644 --- a/MAME.Core/mame/cps/Gdi.cs +++ b/MAME.Core/mame/cps/Gdi.cs @@ -1,7 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Drawing.Imaging; +using Bitmap = MAME.Core.AxiBitmap.AxiBitmap; +using Color = MAME.Core.AxiBitmap.AxiColor; namespace mame { @@ -39,7 +37,7 @@ namespace mame { maskG = new int[4]; mapsizeG = new int[3] { 0x200, 0x400, 0x800 }; - nColorG=0xc00; + nColorG = 0xc00; sde2 = new string[] { "," }; scrollxSG = 0; scrollySG = 0; @@ -48,16 +46,9 @@ namespace mame cps1_scrollxG = new int[3]; cps1_scrollyG = new int[3]; gettileDelegatesG = new gettileDelegateG[]{ - new gettileDelegateG(GetSpriteGDI), - new gettileDelegateG(GetTilemapGDI0), - new gettileDelegateG(GetTilemapGDI1), - new gettileDelegateG(GetTilemapGDI2) }; gethighDelegatesG = new gethighDelegateG[]{ null, - new gethighDelegateG(GetHighGDI0), - new gethighDelegateG(GetHighGDI1), - new gethighDelegateG(GetHighGDI2) }; flagsmap0G = new byte[0x200, 0x200]; flagsmap1G = new byte[0x400, 0x400]; @@ -67,1143 +58,6 @@ namespace mame pen_to_flags2G = new byte[4, 16]; priority_bitmapG = new byte[0x200, 0x200]; cc1G = new Color[nColorG]; - m_ColorG = Color.Magenta; - } - public static void GetData() - { - string[] ss1 = Machine.FORM.cpsform.tbInput.Split(sde2, StringSplitOptions.RemoveEmptyEntries); - int n1 = ss1.Length; - int i1, iR, iG, iB; - int bright; - int i; - int group, pen; - byte fgbits, bgbits; - iiCutColorG = new int[n1]; - for (i1 = 0; i1 < n1; i1++) - { - iiCutColorG[i1] = int.Parse(ss1[i1]); - } - base_cps1_objG = (cps_a_regs[0] * 0x100) & 0x3ffff; - baseTilemap0G = (cps_a_regs[1] * 0x100) & 0x3ffff; - baseTilemap1G = (cps_a_regs[2] * 0x100) & 0x3ffff; - baseTilemap2G = (cps_a_regs[3] * 0x100) & 0x3ffff; - basePaletteG = (cps_a_regs[5] * 0x100) & 0x3ffff; - if (!Machine.FORM.cpsform.cbLockpal) - { - for (i1 = 0; i1 < nColorG * 2; i1++) - { - bbPaletteG[i1] = gfxram[basePaletteG + i1]; - } - } - int ctrl = cps_b_regs[palette_control / 2]; - int page, startpage = 0; - for (page = 0; page < 6; ++page) - { - if (((ctrl >> page) & 1) != 0) - { - startpage = page; - break; - } - } - for (i1 = 0; i1 < nColorG - startpage * 0x200; i1++) - { - bright = bbPaletteG[i1 * 2] / 16 * 2 + 0x0f; - iR = bbPaletteG[i1 * 2] % 16 * 0x11 * bright / 0x2d; - iG = bbPaletteG[i1 * 2 + 1] / 16 * 0x11 * bright / 0x2d; - iB = bbPaletteG[i1 * 2 + 1] % 16 * 0x11 * bright / 0x2d; - if (i1 % 16 == 15) - { - cc1G[startpage * 0x200 + i1] = Color.Transparent; - } - else - { - cc1G[startpage * 0x200 + i1] = Color.FromArgb(iR, iG, iB); - } - } - if (Machine.FORM.cpsform.cbRowscroll == true) - { - videocontrolG = cps_a_regs[0x22 / 2]; - } - else - { - videocontrolG = cps_a_regs[0x22 / 2] & 0xfffe; - } - cps1_scrollxG[0] = cps_a_regs[0x0c / 2] + scroll1xoff - scrollxoff; - cps1_scrollyG[0] = cps_a_regs[0x0e / 2] - scrollyoff; - cps1_scrollxG[1] = cps_a_regs[0x10 / 2] + scroll2xoff - scrollxoff; - cps1_scrollyG[1] = cps_a_regs[0x12 / 2] - scrollyoff; - cps1_scrollxG[2] = cps_a_regs[0x14 / 2] + scroll3xoff - scrollxoff; - cps1_scrollyG[2] = cps_a_regs[0x16 / 2] - scrollyoff; - scrollx0 = (-scroll1x) & 0x1ff; - scrolly0 = (0x100 - scroll1y) & 0x1ff; - scrollx1 = (-scroll2x) & 0x3ff; - scrolly1 = (0x100 - scroll2y) & 0x3ff; - scrollx2 = (-scroll3x) & 0x7ff; - scrolly2 = (0x100 - scroll3y) & 0x7ff; - layercontrolG = cps_b_regs[layer_control / 2]; - enable0G = ((layercontrolG & layer_enable_mask[0]) != 0); - enable1G = ((layercontrolG & layer_enable_mask[1]) != 0 && (videocontrolG & 4) != 0); - enable2G = ((layercontrolG & layer_enable_mask[2]) != 0 && (videocontrolG & 8) != 0); - l0G = (layercontrolG >> 0x06) & 03; - l1G = (layercontrolG >> 0x08) & 03; - l2G = (layercontrolG >> 0x0a) & 03; - l3G = (layercontrolG >> 0x0c) & 03; - for (group = 0; group < 4; group++) - { - if (priority[group] != -1) - { - maskG[group] = cps_b_regs[priority[group] / 2] ^ 0xffff; - } - else - { - if ((layercontrolG & (1 << group)) != 0) - { - maskG[group] = 0x8000; - } - else - { - maskG[group] = 0xffff; - } - } - for (pen = 0; pen < 16; pen++) - { - fgbits = ((maskG[group] >> pen) % 2 == 1) ? (byte)0x00 : (byte)0x10; - if (pen < 15) - { - bgbits = 0x20; - } - else - { - bgbits = 0x00; - } - pen_to_flags0G[group, pen] = (byte)(fgbits | bgbits); - pen_to_flags1G[group, pen] = (byte)(fgbits | bgbits); - pen_to_flags2G[group, pen] = (byte)(fgbits | bgbits); - } - } - if ((videocontrolG & 0x01) != 0) - { - int scrly = -scroll2y; - scrollrows1G = 1024; - int otheroffs = cps_a_regs[CPS1_ROWSCROLL_OFFS]; - for (i = 0; i < 0x400; i++) - { - rowscroll1G[(i - scrly) & 0x3ff] = gfxram[(other + otheroffs + i) * 2] * 0x100 + gfxram[(other + otheroffs + i) * 2 + 1]; - } - } - else - { - scrollrows1G = 1; - rowscroll1G[0] = scroll2x; - for (i = 1; i < 1024; i++) - { - rowscroll1G[i] = 0; - } - } - } - public static Bitmap GetTilemapGDI0() - { - int i1, i2, iOffset, i3, i4, iOffset3 = 0; - int rows, cols, width, height; - int scanheight = 0x100, scanrows; - int tilewidth, tileheight; - int gfxset; - tilewidth = 8; - tileheight = tilewidth; - rows = 0x40; - cols = rows; - width = tilewidth * cols; - height = width; - scanrows = scanheight / tileheight; - int iByte; - int iCode, iAttr; - int iColor, iFlag, iGroup; - int idx = 0; - int x0 = 0, y0 = 0, dx0 = 0, dy0 = 0, match; - ushort[] uuVRam0; - uuVRam0 = new ushort[0x2000]; - for (i1 = 0; i1 < 0x2000; i1++) - { - uuVRam0[i1] = (ushort)(gfxram[baseTilemap0G + i1 * 2] * 0x100 + gfxram[baseTilemap0G + i1 * 2 + 1]); - } - 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 - { - if (enable0G) - { - byte* ptr = (byte*)(bmData.Scan0); - byte* ptr2 = (byte*)0; - for (i3 = 0; i3 < cols; i3++) - { - for (i4 = 0; i4 < rows; i4++) - { - iOffset3 = (i3 * scanrows + i4 % scanrows) * 2 + i4 / scanrows * 0x1000; - iCode = uuVRam0[iOffset3]; - iAttr = uuVRam0[iOffset3 + 1]; - iColor = iAttr % 0x20 + 0x20; - iFlag = ((iAttr & 0x60) >> 5) & 3; - iGroup = (iAttr & 0x0180) >> 7; - match = 0; - foreach (gfx_range r in lsRange0) - { - if (iCode >= r.start && iCode <= r.end) - { - iCode += r.add; - match = 1; - break; - } - } - if (match == 0) - { - continue; - } - else - { - if (iFlag == 0) - { - x0 = tilewidth * i3; - y0 = tileheight * i4; - dx0 = 1; - dy0 = 1; - } - else if (iFlag == 1) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4; - dx0 = -1; - dy0 = 1; - } - else if (iFlag == 2) - { - x0 = tilewidth * i3; - y0 = tileheight * i4 + tileheight - 1; - dx0 = 1; - dy0 = -1; - } - else if (iFlag == 3) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4 + tileheight - 1; - dx0 = -1; - dy0 = -1; - } - gfxset = i3 & 1; - for (i1 = 0; i1 < tilewidth; i1++) - { - for (i2 = 0; i2 < tileheight; i2++) - { - iOffset = iCode * 0x80 + gfxset * 8 + i1 + i2 * 0x10; - iByte = gfx1rom[iOffset]; - idx = iColor * 0x10 + iByte; - c1 = cc1G[idx]; - 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 GetTilemapGDI1() - { - int i1, i2, iOffset, i3, i4, iOffset3 = 0; - int rows, cols, width, height; - int scanheight = 0x100, scanrows; - int tilewidth, tileheight; - int x0 = 0, y0 = 0, dx0 = 0, dy0 = 0, match; - tilewidth = 16; - tileheight = tilewidth; - rows = 0x40; - cols = rows; - width = tilewidth * cols; - height = width; - scanrows = scanheight / tileheight; - int iByte; - int iCode, iAttr; - int iColor, iFlag, iGroup; - int idx; - ushort[] uuVRam1; - uuVRam1 = new ushort[0x2000]; - for (i1 = 0; i1 < 0x2000; i1++) - { - uuVRam1[i1] = (ushort)(gfxram[baseTilemap1G + i1 * 2] * 0x100 + gfxram[baseTilemap1G + i1 * 2 + 1]); - } - 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 - { - if (enable1G) - { - byte* ptr = (byte*)(bmData.Scan0); - byte* ptr2 = (byte*)0; - if (scrollrows1G == 1) - { - for (i3 = 0; i3 < cols; i3++) - { - for (i4 = 0; i4 < rows; i4++) - { - iOffset3 = (i3 * scanrows + i4 % scanrows) * 2 + i4 / scanrows * 0x1000 / 2; - iCode = uuVRam1[iOffset3]; - iAttr = uuVRam1[iOffset3 + 1]; - iColor = iAttr % 0x20 + 0x40; - iFlag = ((iAttr & 0x60) >> 5) & 3; - iGroup = (iAttr & 0x0180) >> 7; - match = 0; - foreach (gfx_range r in lsRange1) - { - if (iCode >= r.start && iCode <= r.end) - { - iCode += r.add; - match = 1; - break; - } - } - if (match == 0) - { - continue; - } - else - { - if (iFlag == 0) - { - x0 = tilewidth * i3; - y0 = tileheight * i4; - dx0 = 1; - dy0 = 1; - } - else if (iFlag == 1) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4; - dx0 = -1; - dy0 = 1; - } - else if (iFlag == 2) - { - x0 = tilewidth * i3; - y0 = tileheight * i4 + tileheight - 1; - dx0 = 1; - dy0 = -1; - } - else if (iFlag == 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 = iCode * 0x40 * 4 + i1 + i2 * 16; - iByte = gfx1rom[iOffset]; - idx = iColor * 0x10 + iByte; - c1 = cc1G[idx]; - 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; - } - } - } - } - } - } - else - { - for (i3 = 0; i3 < cols; i3++) - { - for (i4 = 0; i4 < rows; i4++) - { - iOffset3 = (i3 * scanrows + i4 % scanrows) * 2 + i4 / scanrows * 0x1000 / 2; - iCode = uuVRam1[iOffset3]; - iAttr = uuVRam1[iOffset3 + 1]; - iColor = iAttr % 0x20 + 0x40; - iFlag = ((iAttr & 0x60) >> 5) & 3; - iGroup = (iAttr & 0x0180) >> 7; - match = 0; - foreach (gfx_range r in lsRange1) - { - if (iCode >= r.start && iCode <= r.end) - { - iCode += r.add; - match = 1; - break; - } - } - if (match == 0) - { - continue; - } - if (iCode == -1) - { - continue; - } - else - { - if (iFlag == 0) - { - x0 = tilewidth * i3; - y0 = tileheight * i4; - dx0 = 1; - dy0 = 1; - } - else if (iFlag == 1) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4; - dx0 = -1; - dy0 = 1; - } - else if (iFlag == 2) - { - x0 = tilewidth * i3; - y0 = tileheight * i4 + tileheight - 1; - dx0 = 1; - dy0 = -1; - } - else if (iFlag == 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 = iCode * 0x100 + i1 + i2 * 0x10; - iByte = gfx1rom[iOffset]; - idx = iColor * 0x10 + iByte; - c1 = cc1G[idx]; - ptr2 = ptr + ((y0 + dy0 * i2) * width + ((-rowscroll1G[y0 + dy0 * i2] + x0 + dx0 * i1) & 0x3ff)) * 4; - *ptr2 = c1.B; - *(ptr2 + 1) = c1.G; - *(ptr2 + 2) = c1.R; - *(ptr2 + 3) = c1.A; - } - } - } - } - } - } - } - } - bm1.UnlockBits(bmData); - return bm1; - } - public static Bitmap GetTilemapGDI2() - { - int i1, i2, iOffset, i3, i4, iOffset3 = 0; - int rows, cols, width, height; - int scanheight = 0x100, scanrows; - int tilewidth, tileheight; - int x0 = 0, y0 = 0, dx0 = 0, dy0 = 0, match; - tilewidth = 0x20; - tileheight = tilewidth; - cols = 0x40; - rows = cols; - width = tilewidth * cols; - height = width; - scanrows = scanheight / tileheight; - int iByte; - int iCode, iAttr; - int iColor, iFlag, iGroup; - int idx; - ushort[] uuVRam2; - uuVRam2 = new ushort[0x2000]; - for (i1 = 0; i1 < 0x2000; i1++) - { - uuVRam2[i1] = (ushort)(gfxram[baseTilemap2G + i1 * 2] * 0x100 + gfxram[baseTilemap2G + i1 * 2 + 1]); - } - 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 - { - if (enable2G) - { - byte* ptr = (byte*)(bmData.Scan0); - byte* ptr2 = (byte*)0; - for (i3 = 0; i3 < cols; i3++) - { - for (i4 = 0; i4 < rows; i4++) - { - iOffset3 = (i3 * scanrows + i4 % scanrows) * 2 + i4 / scanrows * 0x1000 / 4; - iCode = uuVRam2[iOffset3]; - iAttr = uuVRam2[iOffset3 + 1]; - iColor = iAttr % 0x20 + 0x60; - iFlag = ((iAttr & 0x60) >> 5) & 3; - iGroup = (iAttr & 0x0180) >> 7; - match = 0; - foreach (gfx_range r in lsRange2) - { - if (iCode >= r.start && iCode <= r.end) - { - iCode += r.add; - match = 1; - break; - } - } - if (match == 0) - { - continue; - } - else - { - if (iFlag == 0) - { - x0 = tilewidth * i3; - y0 = tileheight * i4; - dx0 = 1; - dy0 = 1; - } - else if (iFlag == 1) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4; - dx0 = -1; - dy0 = 1; - } - else if (iFlag == 2) - { - x0 = tilewidth * i3; - y0 = tileheight * i4 + tileheight - 1; - dx0 = 1; - dy0 = -1; - } - else if (iFlag == 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 = iCode * 0x400 + i1 + i2 * 0x20; - iByte = gfx1rom[iOffset]; - idx = iColor * 0x10 + iByte; - c1 = cc1G[idx]; - 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; - } - private static Bitmap GetSpriteGDI() - { - int i1, iX, iY, iXin, iYin, iCode, iAttr, iColor, iFlag, iOffset, iByte, cols, rows; - Bitmap bm1 = null; - ushort[] VRAMS; - List lsColor = new List(); - int iSprite, i3, i4, i5, i6, match; - int tilewidth = 16, tileheight = 16; - Color c1 = new Color(); - bm1 = new Bitmap(512, 512); - VRAMS = new ushort[0x400]; - nSpriteG = 0x100; - for (i1 = 0; i1 < 0x400; i1++) - { - VRAMS[i1] = (ushort)(gfxram[base_cps1_objG + i1 * 2] * 0x100 + gfxram[base_cps1_objG + i1 * 2 + 1]); - if (i1 % 4 == 3 && (VRAMS[i1] & 0xff00) == 0xff00) - { - nSpriteG = i1 / 4; - break; - } - } - Machine.FORM.cpsform.tbResult.Clear(); - Bitmap[] bbm2 = new Bitmap[nSpriteG]; - Graphics g = Graphics.FromImage(bm1); - int x0 = 0, y0 = 0, dx0 = 0, dy0 = 0; - int baseSprite = 0, addSprite = 0; - if (bootleg_kludge == 1 || bootleg_kludge == 2 || bootleg_kludge == 3) - { - baseSprite = 0; - addSprite = 1; - } - else - { - baseSprite = nSpriteG - 1; - addSprite = -1; - } - for (i1 = 0; i1 < nSpriteG; i1++) - { - iSprite = baseSprite + addSprite * i1; - iX = VRAMS[iSprite * 4]; - iY = VRAMS[iSprite * 4 + 1]; - iCode = VRAMS[iSprite * 4 + 2]; - iAttr = VRAMS[iSprite * 4 + 3]; - if (iX == 0 && iY == 0 && iCode == 0 && iAttr == 0) - { - continue; - } - match = 0; - foreach (gfx_range r in lsRangeS) - { - if (iCode >= r.start && iCode <= r.end) - { - iCode += r.add; - match = 1; - break; - } - } - if (match == 0) - { - continue; - } - iY = (iY + 0x100) & 0x1ff; - iColor = iAttr % 0x20; - iFlag = ((iAttr & 0x60) >> 5) & 3; - cols = iAttr / 256 % 16 + 1; - rows = iAttr / 256 / 16 + 1; - if (lsColor.IndexOf(iColor) < 0) - { - Machine.FORM.cpsform.tbResult.Add(iColor.ToString() + ","); - lsColor.Add(iColor); - } - if (Array.IndexOf(iiCutColorG, iColor) >= 0) - { - continue; - } - bbm2[iSprite] = new Bitmap(16 * cols, 16 * rows); - for (i3 = 0; i3 < cols; i3++) - { - for (i4 = 0; i4 < rows; i4++) - { - iOffset = (iCode + i3 + i4 * 16) * 0x100; - if (iFlag == 0) - { - x0 = tilewidth * i3; - y0 = tileheight * i4; - dx0 = 1; - dy0 = 1; - } - else if (iFlag == 1) - { - x0 = tilewidth * (cols - 1 - i3) + 15; - y0 = tileheight * i4; - dx0 = -1; - dy0 = 1; - } - else if (iFlag == 2) - { - x0 = tilewidth * i3; - y0 = tileheight * (rows - 1 - i4) * 16 + 15; - dx0 = 1; - dy0 = -1; - } - else if (iFlag == 3) - { - x0 = tilewidth * (cols - 1 - i3) + 15; - y0 = tileheight * (rows - 1 - i4) * 16 + 15; - dx0 = -1; - dy0 = -1; - } - for (i5 = 0; i5 < 0x10; i5++) - { - for (i6 = 0; i6 < 0x10; i6++) - { - iByte = gfx1rom[iOffset + i5 + i6 * 0x10]; - c1 = cc1G[iColor * 0x10 + iByte]; - iXin = (iX + scrollxSG + x0 + dx0 * i5) & 0x1ff; - iYin = (iY + scrollySG + y0 + dy0 * i6) & 0x1ff; - if ((priority_bitmapG[iXin, iYin] & 0x1f) == 0x00) - { - bbm2[iSprite].SetPixel(x0 + dx0 * i5, y0 + dy0 * i6, c1); - } - } - } - } - } - g.DrawImage(bbm2[iSprite], iX + scrollxSG, iY + scrollySG); - //g.DrawImage(bbm2[iSprite], iX + scrollxSG - 0x200, iY + scrollySG); - //g.DrawImage(bbm2[iSprite], iX + scrollxSG, iY + scrollySG - 0x200); - } - g.Dispose(); - return bm1; - } - public static void GetHighGDI0() - { - int iPen = 0; - int i1, i2, iOffset, i3, i4, iOffset3 = 0; - int rows, cols, tilewidth, tileheight, width, height; - int scanheight = 0x100, scanrows; - int xpos, ypos, match; - rows = 0x40; - cols = rows; - tilewidth = 8; - tileheight = tilewidth; - width = tilewidth * cols; - height = width; - scanrows = scanheight / tileheight; - int iCode, iAttr; - int iColor, iFlag, iGroup; - int palette_base; - int x0 = 0, y0 = 0, dx0 = 0, dy0 = 0; - //byte andmask, ormask; - byte data, pen = 0, map; - ushort[] uuVRam0 = new ushort[0x2000]; - for (i1 = 0; i1 < 0x2000; i1++) - { - uuVRam0[i1] = (ushort)(gfxram[baseTilemap0G + i1 * 2] * 0x100 + gfxram[baseTilemap0G + i1 * 2 + 1]); - } - for (i3 = 0; i3 < cols; i3++) - { - for (i4 = 0; i4 < rows; i4++) - { - iOffset3 = (i3 * scanrows + i4 % scanrows) * 2 + i4 / scanrows * 0x1000; - iCode = uuVRam0[iOffset3]; - iAttr = uuVRam0[iOffset3 + 1]; - iColor = iAttr % 0x20 + 0x20; - iFlag = ((iAttr & 0x60) >> 5) & 3; - iGroup = (iAttr & 0x0180) >> 7; - iPen = iAttr % 0x20; - palette_base = iColor * 0x10; - match = 0; - foreach (gfx_range r in lsRange0) - { - if (iCode >= r.start && iCode <= r.end) - { - iCode += r.add; - match = 1; - break; - } - } - //andmask = 0xff; - //ormask = 0; - if (match == 0) - { - continue; - } - else - { - if (iFlag == 0) - { - x0 = tilewidth * i3; - y0 = tileheight * i4; - dx0 = 1; - dy0 = 1; - } - else if (iFlag == 1) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4; - dx0 = -1; - dy0 = 1; - } - else if (iFlag == 2) - { - x0 = tilewidth * i3; - y0 = tileheight * i4 + tileheight - 1; - dx0 = 1; - dy0 = -1; - } - else if (iFlag == 3) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4 + tileheight - 1; - dx0 = -1; - dy0 = -1; - } - for (i2 = 0; i2 < tileheight; i2++) - { - for (i1 = 0; i1 < tilewidth; i1 ++) - { - iOffset = iCode * 0x80 + i1 + i2 * 0x10; - pen = gfx1rom[iOffset]; - map = pen_to_flags0G[iGroup, pen]; - //andmask &= map; - //ormask |= map; - flagsmap0G[x0 + dx0 * i1, y0 + dy0 * i2] = map; - } - } - //tileflags0G[i3, i4] = (byte)(andmask ^ ormask); - } - } - } - for (ypos = scrolly0 - height; ypos <= 0x1ff; ypos += height) - { - for (xpos = scrollx0 - width; xpos <= 0x1ff; xpos += width) - { - for (i1 = 0; i1 < 0x200; i1++) - { - for (i2 = 0; i2 < 0x200; i2++) - { - if (xpos + i1 >= 0 && xpos + i1 < 0x200 && ypos + i2 >= 0 && ypos + i2 < 0x200) - { - priority_bitmapG[xpos + i1, ypos + i2] = flagsmap0G[(0x200 + xpos + i1 - scrolly1) & 0x1ff, (0x200 + ypos + i2 + scrolly0) & 0x1ff]; - } - } - } - } - } - } - public static void GetHighGDI1() - { - int i1, i2, iOffset, i3, i4, iOffset3 = 0; - int rows, cols, tilewidth, tileheight, width, height; - int scanheight = 0x100, scanrows; - int xpos, ypos, match; - rows = 0x40; - cols = rows; - tilewidth = 0x10; - tileheight = tilewidth; - width = tilewidth * cols; - height = width; - scanrows = scanheight / tileheight; - int iCode, iAttr; - int iColor, iFlag, iGroup; - int palette_base; - //byte andmask, ormask; - byte data, pen = 0, map; - int x0 = 0, y0 = 0, dx0 = 0, dy0 = 0; - ushort[] uuVRam1; - uuVRam1 = new ushort[0x2000]; - for (i1 = 0; i1 < 0x2000; i1++) - { - uuVRam1[i1] = (ushort)(CPS.gfxram[baseTilemap1G + i1 * 2] * 0x100 + CPS.gfxram[baseTilemap1G + i1 * 2 + 1]); - } - for (i3 = 0; i3 < cols; i3++) - { - for (i4 = 0; i4 < rows; i4++) - { - iOffset3 = (i3 * scanrows + i4 % scanrows) * 2 + i4 / scanrows * 0x1000 / 2; - iCode = uuVRam1[iOffset3]; - iAttr = uuVRam1[iOffset3 + 1]; - iColor = iAttr % 0x20 + 0x40; - iFlag = ((iAttr & 0x60) >> 5) & 3; - iGroup = (iAttr & 0x0180) >> 7; - palette_base = iColor * 0x10; - match = 0; - foreach (gfx_range r in lsRange1) - { - if (iCode >= r.start && iCode <= r.end) - { - iCode += r.add; - match = 1; - break; - } - } - //andmask = 0xff; - //ormask = 0; - if (match == 0) - { - continue; - } - else - { - if (iFlag == 0) - { - x0 = tilewidth * i3; - y0 = tileheight * i4; - dx0 = 1; - dy0 = 1; - } - else if (iFlag == 1) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4; - dx0 = -1; - dy0 = 1; - } - else if (iFlag == 2) - { - x0 = tilewidth * i3; - y0 = tileheight * i4 + tileheight - 1; - dx0 = 1; - dy0 = -1; - } - else if (iFlag == 3) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4 + tileheight - 1; - dx0 = -1; - dy0 = -1; - } - for (i2 = 0; i2 < tileheight; i2++) - { - for (i1 = 0; i1 < tilewidth; i1 ++) - { - iOffset = iCode * 0x100 + i1 + i2 * 0x10; - pen = gfx1rom[iOffset]; - map = pen_to_flags1G[iGroup, pen]; - //andmask &= map; - //ormask |= map; - flagsmap1G[x0 + dx0 * i1, y0 + dy0 * i2] = map; - } - } - //tileflags1G[i3, i4] = (byte)(andmask ^ ormask); - } - } - } - if (scrollrows1G == 1) - { - //Tilemap.effective_rowscroll1(0); - //Tilemap.effective_colscroll1(); - for (ypos = scrolly1 - height; ypos <= 0x1ff; ypos += height) - { - for (xpos = -width; xpos <= 0x1ff; xpos += width) - { - for (i1 = 0; i1 < 0x400; i1++) - { - for (i2 = 0; i2 < 0x400; i2++) - { - if (xpos + i1 >= 0 && xpos + i1 < 0x200 && ypos + i2 >= 0 && ypos + i2 < 0x200) - { - priority_bitmapG[xpos + i1, ypos + i2] = flagsmap1G[(xpos + i1 + scroll2x) & 0x3ff, (ypos + i2 - scrolly1) & 0x3ff]; - } - } - } - } - } - } - else - { - int scrollx; - for (ypos = scrolly1 - height; ypos <= 0x1ff; ypos += height) - { - scrollx = (-scroll2x) & 0x3ff; - for (xpos = scrollx - width; xpos <= 0x1ff; xpos += width) - { - for (i1 = 0; i1 < 0x400; i1++) - { - for (i2 = 0; i2 <= 0x400; i2++) - { - if (xpos + i1 >= 0 && xpos + i1 < 0x200 && ypos + i2 >= 0 && ypos + i2 < 0x200) - { - priority_bitmapG[xpos + i1, ypos + i2] = flagsmap1G[(rowscroll1G[(ypos + i2 - scrolly1) & 0x3ff] - scrollx + xpos + i1) & 0x3ff, (ypos + i2 - scrolly1) & 0x3ff]; - } - } - } - } - } - } - } - public static void GetHighGDI2() - { - int i1, i2, iOffset, i3, i4, iOffset3 = 0; - int rows, cols, tilewidth, tileheight, width, height; - int scanheight = 0x100, scanrows; - int xpos, ypos, match; - cols = 0x40; - rows = cols; - tilewidth = 0x20; - tileheight = tilewidth; - width = tilewidth * cols; - height = width; - scanrows = scanheight / tileheight; - int iCode, iAttr; - int iColor, iFlag, iGroup; - int palette_base; - byte pen = 0, map; - int x0 = 0, y0 = 0, dx0 = 0, dy0 = 0; - ushort[] uuVRam2 = new ushort[0x2000]; - for (i1 = 0; i1 < 0x2000; i1++) - { - uuVRam2[i1] = (ushort)(gfxram[baseTilemap2G + i1 * 2] * 0x100 + gfxram[baseTilemap2G + i1 * 2 + 1]); - } - for (i3 = 0; i3 < cols; i3++) - { - for (i4 = 0; i4 < rows; i4++) - { - iOffset3 = (i3 * scanrows + i4 % scanrows) * 2 + i4 / scanrows * 0x1000 / 4; - iCode = uuVRam2[iOffset3]; - iAttr = uuVRam2[iOffset3 + 1]; - iColor = iAttr % 0x20 + 0x60; - iFlag = ((iAttr & 0x60) >> 5) & 3; - iGroup = (iAttr & 0x0180) >> 7; - palette_base = iColor * 0x10; - match = 0; - foreach (gfx_range r in lsRange2) - { - if (iCode >= r.start && iCode <= r.end) - { - iCode += r.add; - match = 1; - break; - } - } - if (match == 0) - { - continue; - } - else - { - if (iFlag == 0) - { - x0 = tilewidth * i3; - y0 = tileheight * i4; - dx0 = 1; - dy0 = 1; - } - else if (iFlag == 1) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4; - dx0 = -1; - dy0 = 1; - } - else if (iFlag == 2) - { - x0 = tilewidth * i3; - y0 = tileheight * i4 + tileheight - 1; - dx0 = 1; - dy0 = -1; - } - else if (iFlag == 3) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4 + tileheight - 1; - dx0 = -1; - dy0 = -1; - } - for (i2 = 0; i2 < tileheight; i2++) - { - for (i1 = 0; i1 < tilewidth; i1 ++) - { - iOffset = iCode * 0x400 + i1 + i2 * 0x20; - pen = gfx1rom[iOffset]; - map = pen_to_flags2G[iGroup, pen]; - flagsmap2G[x0 + dx0 * i1, y0 + dy0 * i2] = map; - } - } - } - } - } - for (ypos = scrolly2 - height; ypos <= 0x1ff; ypos += height) - { - for (xpos = scrollx2 - width; xpos <= 0x1ff; xpos += width) - { - for (i1 = 0; i1 < 0x800; i1++) - { - for (i2 = 0; i2 < 0x800; i2++) - { - if (xpos + i1 >= 0 && xpos + i1 < 0x200 && ypos + i2 >= 0 && ypos + i2 < 0x200) - { - priority_bitmapG[xpos + i1, ypos + i2] = flagsmap2G[(0x800 + xpos + i1 - scrollx2) & 0x7ff, (0x800 + ypos + i2 - scrolly2) & 0x7ff]; - } - } - } - } - } - } - public static Bitmap GetAllGDI() - { - string[] ss1 = Machine.FORM.cpsform.tbPoint.Split(sde2, StringSplitOptions.RemoveEmptyEntries); - int width, height; - width = int.Parse(ss1[0]); - height = int.Parse(ss1[1]); - Bitmap bm1 = new Bitmap(width, height), bm2; - Graphics g = Graphics.FromImage(bm1); - g.Clear(m_ColorG); - if (bRender0G) - { - if (l0G == 0) - { - bm2 = gettileDelegatesG[l0G](); - g.DrawImage(bm2, 0, 0); - } - else - { - bm2 = gettileDelegatesG[l0G](); - g.DrawImage(bm2, -cps1_scrollxG[l0G - 1] % mapsizeG[l0G - 1], -cps1_scrollyG[l0G - 1] % mapsizeG[l0G - 1]); - g.DrawImage(bm2, mapsizeG[l0G - 1] - cps1_scrollxG[l0G - 1] % mapsizeG[l0G - 1], -cps1_scrollyG[l0G - 1] % mapsizeG[l0G - 1]); - g.DrawImage(bm2, -cps1_scrollxG[l0G - 1] % mapsizeG[l0G - 1], mapsizeG[l0G - 1] - cps1_scrollyG[l0G - 1] % mapsizeG[l0G - 1]); - g.DrawImage(bm2, mapsizeG[l0G - 1] - cps1_scrollxG[l0G - 1] % mapsizeG[l0G - 1], mapsizeG[l0G - 1] - cps1_scrollyG[l0G - 1] % mapsizeG[l0G - 1]); - } - } - if (bRender1G) - { - if (l1G == 0) - { - gethighDelegatesG[l0G](); - bm2 = gettileDelegatesG[l1G](); - g.DrawImage(bm2, 0, 0); - } - else - { - bm2 = gettileDelegatesG[l1G](); - g.DrawImage(bm2, -cps1_scrollxG[l1G - 1] % mapsizeG[l1G - 1], -cps1_scrollyG[l1G - 1] % mapsizeG[l1G - 1]); - g.DrawImage(bm2, mapsizeG[l1G - 1] - cps1_scrollxG[l1G - 1] % mapsizeG[l1G - 1], -cps1_scrollyG[l1G - 1] % mapsizeG[l1G - 1]); - g.DrawImage(bm2, -cps1_scrollxG[l1G - 1] % mapsizeG[l1G - 1], mapsizeG[l1G - 1] - cps1_scrollyG[l1G - 1] % mapsizeG[l1G - 1]); - g.DrawImage(bm2, mapsizeG[l1G - 1] - cps1_scrollxG[l1G - 1] % mapsizeG[l1G - 1], mapsizeG[l1G - 1] - cps1_scrollyG[l1G - 1] % mapsizeG[l1G - 1]); - } - } - if (bRender2G) - { - if (l2G == 0) - { - gethighDelegatesG[l1G](); - bm2 = gettileDelegatesG[l2G](); - g.DrawImage(bm2, 0, 0); - } - else - { - bm2 = gettileDelegatesG[l2G](); - g.DrawImage(bm2, -cps1_scrollxG[l2G - 1] % mapsizeG[l2G - 1], -cps1_scrollyG[l2G - 1] % mapsizeG[l2G - 1]); - g.DrawImage(bm2, mapsizeG[l2G - 1] - cps1_scrollxG[l2G - 1] % mapsizeG[l2G - 1], -cps1_scrollyG[l2G - 1] % mapsizeG[l2G - 1]); - g.DrawImage(bm2, -cps1_scrollxG[l2G - 1] % mapsizeG[l2G - 1], mapsizeG[l2G - 1] - cps1_scrollyG[l2G - 1] % mapsizeG[l2G - 1]); - g.DrawImage(bm2, mapsizeG[l2G - 1] - cps1_scrollxG[l2G - 1] % mapsizeG[l2G - 1], mapsizeG[l2G - 1] - cps1_scrollyG[l2G - 1] % mapsizeG[l2G - 1]); - } - } - if (bRender3G) - { - if (l3G == 0) - { - gethighDelegatesG[l2G](); - bm2 = gettileDelegatesG[l3G](); - g.DrawImage(bm2, 0, 0); - } - else - { - bm2 = gettileDelegatesG[l3G](); - g.DrawImage(bm2, -cps1_scrollxG[l3G - 1] % mapsizeG[l3G - 1], -cps1_scrollyG[l3G - 1] % mapsizeG[l3G - 1]); - g.DrawImage(bm2, mapsizeG[l3G - 1] - cps1_scrollxG[l3G - 1] % mapsizeG[l3G - 1], -cps1_scrollyG[l3G - 1] % mapsizeG[l3G - 1]); - g.DrawImage(bm2, -cps1_scrollxG[l3G - 1] % mapsizeG[l3G - 1], mapsizeG[l3G - 1] - cps1_scrollyG[l3G - 1] % mapsizeG[l3G - 1]); - g.DrawImage(bm2, mapsizeG[l3G - 1] - cps1_scrollxG[l3G - 1] % mapsizeG[l3G - 1], mapsizeG[l3G - 1] - cps1_scrollyG[l3G - 1] % mapsizeG[l3G - 1]); - } - } - g.Dispose(); - switch (Machine.sDirection) - { - case "": - break; - case "270": - bm1.RotateFlip(RotateFlipType.Rotate270FlipNone); - break; - } - return bm1; } } } diff --git a/MAME.Core/mame/cps/Input.cs b/MAME.Core/mame/cps/Input.cs index a95590d..953c6fb 100644 --- a/MAME.Core/mame/cps/Input.cs +++ b/MAME.Core/mame/cps/Input.cs @@ -288,7 +288,7 @@ namespace mame else { short1 |= 0x10; - } + } if (Keyboard.IsPressed(Key.Right)) { short1 &= ~0x0100; @@ -592,7 +592,7 @@ namespace mame else { sbyte0 |= 0x20; - } + } if (Keyboard.IsPressed(Key.J)) { short1 &= ~0x10; @@ -624,7 +624,7 @@ namespace mame else { short1 |= 0x80; - } + } if (Keyboard.IsPressed(Key.NumPad1)) { short1 &= ~0x1000; @@ -1201,7 +1201,7 @@ namespace mame else { short0 |= 0x0040; - } + } if (Keyboard.IsPressed(Key.Right)) { short0 &= ~0x0100; @@ -1310,7 +1310,7 @@ namespace mame else { short2 |= 0x0200; - } + } if (Keyboard.IsPressed(Key.J)) { short0 &= ~0x0008; @@ -1399,7 +1399,7 @@ namespace mame sbyte0_old = sbyte0; short1_old = short1; short2_old = short2; - sbyte3_old = sbyte3; + sbyte3_old = sbyte3; Mame.bwRecord.Write(Video.screenstate.frame_number); Mame.bwRecord.Write(sbyte0); Mame.bwRecord.Write(short1); diff --git a/MAME.Core/mame/cps/Memory.cs b/MAME.Core/mame/cps/Memory.cs index 10e1e49..2dcbce5 100644 --- a/MAME.Core/mame/cps/Memory.cs +++ b/MAME.Core/mame/cps/Memory.cs @@ -929,7 +929,7 @@ namespace mame else { result = 0; - + } } else @@ -1594,7 +1594,7 @@ namespace mame else if (address >= 0x618000 && address <= 0x619fff) { int offset = (address - 0x618000) / 2; - qsound_sharedram1_w(offset, (byte)(value>>16)); + qsound_sharedram1_w(offset, (byte)(value >> 16)); qsound_sharedram1_w(offset + 1, (byte)value); } else if (address >= 0x662000 && address <= 0x662001) @@ -1632,7 +1632,7 @@ namespace mame else if (address >= 0x70a000 && address <= 0x70bfff) { int offset = (address - 0x70a000) / 2; - cps2_objram2_w(offset, (ushort)(value>>16)); + cps2_objram2_w(offset, (ushort)(value >> 16)); cps2_objram2_w(offset + 1, (ushort)value); } else if (address >= 0x70c000 && address <= 0x70dfff) diff --git a/MAME.Core/mame/cps/Memory2.cs b/MAME.Core/mame/cps/Memory2.cs index 437f127..39d9eef 100644 --- a/MAME.Core/mame/cps/Memory2.cs +++ b/MAME.Core/mame/cps/Memory2.cs @@ -8,7 +8,7 @@ sbyte result = 0; if (address >= 0x800052 && address <= 0x800055) { - int offset=(address-0x800052)/2; + int offset = (address - 0x800052) / 2; result = (sbyte)((Inptport.input_port_read_direct(Inptport.analog_p0) - dial0) >> (8 * offset)); } else if (address >= 0x80005a && address <= 0x80005d) @@ -184,7 +184,7 @@ } else { - MCWriteWord(address,value); + MCWriteWord(address, value); } } public static sbyte MCReadByte_sf2m3(int address) @@ -628,7 +628,7 @@ { int offset = (address - 0x800140) / 2; result = cps1_cps_b_r(offset) * 0x10000 + cps1_cps_b_r(offset + 1); - } + } else if (address >= 0x900000 && address + 3 <= 0x92ffff) { result = (int)(gfxram[(address & 0x3ffff)] * 0x1000000 + gfxram[(address & 0x3ffff) + 1] * 0x10000 + gfxram[(address & 0x3ffff) + 2] * 0x100 + gfxram[(address & 0x3ffff) + 3]); @@ -921,7 +921,7 @@ } else { - MCWriteWord(address,value); + MCWriteWord(address, value); } } public static sbyte MC2ReadByte_ecofghtr(int address) @@ -942,7 +942,7 @@ { address &= 0xffffff; short result = 0; - if (address >= 0x804000 && address+1 <= 0x804001) + if (address >= 0x804000 && address + 1 <= 0x804001) { result = 0; } @@ -1670,7 +1670,7 @@ else if (address >= 0x70a000 && address + 3 <= 0x70bfff) { int offset = (address - 0x70a000) / 2; - cps2_objram2_w(offset, (ushort)(value>>16)); + cps2_objram2_w(offset, (ushort)(value >> 16)); cps2_objram2_w(offset + 1, (ushort)value); } else if (address >= 0x70c000 && address <= 0x70dfff) @@ -1740,7 +1740,7 @@ else if (address >= 0xfffff0 && address + 3 <= 0xfffffb) { int offset = (address - 0xfffff0) / 2; - cps2_output[offset] = (ushort)(value>>16); + cps2_output[offset] = (ushort)(value >> 16); cps2_output[offset + 1] = (ushort)value; } else if (address >= 0xfffffc && address + 3 <= 0xffffff) diff --git a/MAME.Core/mame/cps/State.cs b/MAME.Core/mame/cps/State.cs index 0eaca45..c09f9e2 100644 --- a/MAME.Core/mame/cps/State.cs +++ b/MAME.Core/mame/cps/State.cs @@ -1,10 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using cpu.m68000; +using cpu.m68000; using cpu.z80; +using System.IO; namespace mame { @@ -157,7 +153,7 @@ namespace mame writer.Write(scancount); writer.Write(cps1_scanline1); writer.Write(cps1_scanline2); - writer.Write(cps1_scancalls); + writer.Write(cps1_scancalls); for (i = 0; i < 0xc00; i++) { writer.Write(Palette.entry_color[i]); @@ -334,11 +330,11 @@ namespace mame cps2_output[i] = reader.ReadUInt16(); } cps2networkpresent = reader.ReadInt32(); - cps2_objram_bank= reader.ReadInt32(); - scancount= reader.ReadInt32(); - cps1_scanline1= reader.ReadInt32(); - cps1_scanline2= reader.ReadInt32(); - cps1_scancalls= reader.ReadInt32(); + cps2_objram_bank = reader.ReadInt32(); + scancount = reader.ReadInt32(); + cps1_scanline1 = reader.ReadInt32(); + cps1_scanline2 = reader.ReadInt32(); + cps1_scancalls = reader.ReadInt32(); for (i = 0; i < 0xc00; i++) { Palette.entry_color[i] = reader.ReadUInt32(); diff --git a/MAME.Core/mame/cps/Tilemap.cs b/MAME.Core/mame/cps/Tilemap.cs index 77306cc..d539272 100644 --- a/MAME.Core/mame/cps/Tilemap.cs +++ b/MAME.Core/mame/cps/Tilemap.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; namespace mame { @@ -55,8 +52,8 @@ namespace mame ttmap[i].rowscroll = new int[ttmap[i].scrollrows]; ttmap[i].colscroll = new int[ttmap[i].scrollcols]; ttmap[i].tilemap_draw_instance3 = ttmap[i].tilemap_draw_instanceC; - ttmap[i].tilemap_set_scrolldx(0,0); - ttmap[i].tilemap_set_scrolldy(0x100,0); + ttmap[i].tilemap_set_scrolldx(0, 0); + ttmap[i].tilemap_set_scrolldy(0x100, 0); } ttmap[0].tile_update3 = ttmap[0].tile_updateC0; ttmap[1].tile_update3 = ttmap[1].tile_updateC1; @@ -375,7 +372,7 @@ namespace mame { for (cury = y; cury < nexty; cury++) { - for (i = xpos + x_start; i < xpos+x_end; i++) + for (i = xpos + x_start; i < xpos + x_end; i++) { if ((flagsmap[offsety2, i - xpos] & mask) == value) { diff --git a/MAME.Core/mame/cps/Video.cs b/MAME.Core/mame/cps/Video.cs index c29cd90..37223f8 100644 --- a/MAME.Core/mame/cps/Video.cs +++ b/MAME.Core/mame/cps/Video.cs @@ -1,20 +1,15 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Drawing; -using System.Drawing.Imaging; -using System.IO; namespace mame { public partial class CPS - { + { private static int iXAll, iYAll, nBitmap; - private static Bitmap bmAll=new Bitmap(512,512); + //private static Bitmap bmAll=new Bitmap(512,512); private static List lBitmapHash = new List(); private static int cpsb_addr, cpsb_value, mult_factor1, mult_factor2, mult_result_lo, mult_result_hi; - public static int layercontrol, layer_control, palette_control, in2_addr, in3_addr, out2_addr, bootleg_kludge; + public static int layercontrol, layer_control, palette_control, in2_addr, in3_addr, out2_addr, bootleg_kludge; public static int[] priority, layer_enable_mask; public static int total_elements; public static uint[] primasks; @@ -49,9 +44,9 @@ namespace mame public static int scroll1x, scroll1y; public static int scroll2x, scroll2y; public static int scroll3x, scroll3y; - private static int stars1x, stars1y, stars2x, stars2y; + private static int stars1x, stars1y, stars2x, stars2y; public static int pri_ctrl; - + public static bool bRecord; private static int cps1_base(int offset, int boundary) @@ -80,7 +75,7 @@ namespace mame } private static void cps1_cps_a_w(int offset, ushort data) { - cps_a_regs[offset] =data; + cps_a_regs[offset] = data; if (offset == CPS1_PALETTE_BASE) { cps1_build_palette(cps1_base(CPS1_PALETTE_BASE, 0x0400)); @@ -279,10 +274,10 @@ namespace mame } public static void video_start_cps() { - bmAll = new Bitmap(512, 512); - Graphics g = Graphics.FromImage(bmAll); - g.Clear(Color.Magenta); - g.Dispose(); + //bmAll = new Bitmap(512, 512); + //Graphics g = Graphics.FromImage(bmAll); + //g.Clear(Color.Magenta); + //g.Dispose(); int i; ttmap[0].enable = true; ttmap[1].enable = true; @@ -302,9 +297,9 @@ namespace mame cps1_stars_enabled = new int[2]; cps1_buffered_obj = new ushort[0x400]; cps2_buffered_obj = new ushort[0x1000]; - cps2_objram1=new ushort[0x1000]; - cps2_objram2=new ushort[0x1000]; - + cps2_objram1 = new ushort[0x1000]; + cps2_objram2 = new ushort[0x1000]; + uuBFF = new ushort[0x200 * 0x200]; for (i = 0; i < 0x40000; i++) { @@ -554,13 +549,13 @@ namespace mame code = cps2_buffered_obj[i * 4 + 2] + ((y & 0x6000) << 3); colour = cps2_buffered_obj[i * 4 + 3]; col = colour & 0x1f; - if ((colour & 0x80)!=0) + if ((colour & 0x80) != 0) { x += cps2_port(0x08); /* fix the offset of some games */ y += cps2_port(0x0a); /* like Marvel vs. Capcom ending credits */ } y += 0x100; - if ((colour & 0xff00)!=0) + if ((colour & 0xff00) != 0) { /* handle blocked sprites */ int nx = (colour & 0x0f00) >> 8; @@ -568,10 +563,10 @@ namespace mame int nxs, nys, sx, sy; nx++; ny++; - if ((colour & 0x40)!=0) + if ((colour & 0x40) != 0) { /* Y flip */ - if ((colour & 0x20)!=0) + if ((colour & 0x20) != 0) { for (nys = 0; nys < ny; nys++) { @@ -598,7 +593,7 @@ namespace mame } else { - if ((colour & 0x20)!=0) + if ((colour & 0x20) != 0) { for (nys = 0; nys < ny; nys++) { @@ -635,7 +630,7 @@ namespace mame { int offs; if (starsrom == null && (cps1_stars_enabled[0] != 0 || cps1_stars_enabled[1] != 0)) - { + { return;//stars enabled but no stars ROM } if (cps1_stars_enabled[0] != 0) @@ -719,7 +714,7 @@ namespace mame cps1_update_transmasks(); ttmap[0].tilemap_set_scrollx(0, scroll1x); ttmap[0].tilemap_set_scrolly(0, scroll1y); - if ((videocontrol & 0x01)!=0) /* linescroll enable */ + if ((videocontrol & 0x01) != 0) /* linescroll enable */ { int scrly = -scroll2y; int otheroffs; @@ -732,7 +727,7 @@ namespace mame } else { - ttmap[1].scrollrows = 1; + ttmap[1].scrollrows = 1; ttmap[1].tilemap_set_scrollx(0, scroll2x); } ttmap[1].tilemap_set_scrolly(0, scroll2y); @@ -852,7 +847,7 @@ namespace mame //memcpy(cps2_buffered_obj, cps2_objbase(), cps2_obj_size); int baseptr; baseptr = 0x7000; - if ((cps2_objram_bank & 1)!=0) + if ((cps2_objram_bank & 1) != 0) { baseptr ^= 0x0080; } @@ -864,6 +859,6 @@ namespace mame { Array.Copy(cps2_objram2, cps2_buffered_obj, 0x1000); } - } + } } } \ No newline at end of file diff --git a/MAME.Core/mame/dataeast/Drawgfx.cs b/MAME.Core/mame/dataeast/Drawgfx.cs index 19af784..b2dda01 100644 --- a/MAME.Core/mame/dataeast/Drawgfx.cs +++ b/MAME.Core/mame/dataeast/Drawgfx.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace mame +namespace mame { public partial class Drawgfx { diff --git a/MAME.Core/mame/dataeast/Gdi.cs b/MAME.Core/mame/dataeast/Gdi.cs index 60536c2..fadec03 100644 --- a/MAME.Core/mame/dataeast/Gdi.cs +++ b/MAME.Core/mame/dataeast/Gdi.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Drawing; -using System.Drawing.Imaging; - -namespace mame +namespace mame { public partial class Dataeast { @@ -14,206 +7,5 @@ namespace mame { } - public static Bitmap GetBg() - { - int i1, i2, iOffset, i3, i4; - int rows, cols, width, height; - int tilewidth, tileheight; - tilewidth = 0x8; - tileheight = tilewidth; - rows = 0x20; - cols = rows; - width = tilewidth * cols; - height = width; - int iByte; - int tile_index, attr, color, flipyx, code, flags; - int pen_data_offset, palette_base; - int x0 = 0, y0 = 0, dx0 = 0, dy0 = 0; - Color c1 = new Color(); - Bitmap bm1; - bm1 = new Bitmap(width, height); - BitmapData bmData; - bmData = bm1.LockBits(new Rectangle(0, 0, bm1.Width, bm1.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); - unsafe - { - byte* ptr = (byte*)(bmData.Scan0); - byte* ptr2 = (byte*)0; - for (i3 = 0; i3 < cols; i3++) - { - for (i4 = 0; i4 < rows; i4++) - { - tile_index = i4 * cols + i3; - code = Generic.videoram[tile_index * 2 + 1] + ((Generic.videoram[tile_index * 2] & 0x0f) << 8); - color = Generic.videoram[tile_index * 2] >> 4; - flags = 0; - palette_base = 0x100 + 0x10 * color; - pen_data_offset = code * 0x40; - if (flags == 0) - { - x0 = tilewidth * i3; - y0 = tileheight * i4; - dx0 = 1; - dy0 = 1; - } - else if (flags == 1) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4; - dx0 = -1; - dy0 = 1; - } - else if (flags == 2) - { - x0 = tilewidth * i3; - y0 = tileheight * i4 + tileheight - 1; - dx0 = 1; - dy0 = -1; - } - else if (flags == 3) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4 + tileheight - 1; - dx0 = -1; - dy0 = -1; - } - for (i1 = 0; i1 < tilewidth; i1++) - { - for (i2 = 0; i2 < tileheight; i2++) - { - iOffset = pen_data_offset + i2 * 8 + i1; - iByte = Dataeast.gfx1rom[iOffset]; - if (palette_base + iByte < 0x200) - { - c1 = Color.FromArgb((int)Palette.entry_color[palette_base + iByte]); - } - ptr2 = ptr + ((y0 + dy0 * i2) * width + (x0 + dx0 * i1)) * 4; - *ptr2 = c1.B; - *(ptr2 + 1) = c1.G; - *(ptr2 + 2) = c1.R; - *(ptr2 + 3) = c1.A; - } - } - } - } - } - bm1.UnlockBits(bmData); - return bm1; - } - public static Bitmap GetSprite() - { - int i, j, offsetx, offsety, xdir, ydir, sx1, code = 0, color = 0; - Bitmap bm1; - Color c1 = new Color(); - bm1 = new Bitmap(0x100, 0x100); - int offs; - BitmapData bmData; - bmData = bm1.LockBits(new Rectangle(0, 0, bm1.Width, bm1.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); - unsafe - { - byte* ptr = (byte*)(bmData.Scan0); - byte* ptr2 = (byte*)0; - for (offs = 0; offs < 0x200; offs += 4) - { - if (Generic.spriteram[offs] != 0xf8) - { - int sx, sy, flipx, flipy; - sx = 240 - Generic.spriteram[offs + 2]; - sy = 240 - Generic.spriteram[offs]; - flipx = Generic.spriteram[offs + 1] & 0x04; - flipy = Generic.spriteram[offs + 1] & 0x02; - if (Generic.flip_screen_get() != 0) - { - sx = 240 - sx; - sy = 240 - sy; - if (flipx != 0) - { - flipx = 0; - } - else - { - flipx = 1; - } - if (flipy != 0) - { - flipy = 0; - } - else - { - flipy = 1; - } - } - if (flipx != 0) - { - offsetx = 0x0f; - xdir = -1; - } - else - { - offsetx = 0; - xdir = 1; - } - if (flipy != 0) - { - offsety = 0x0f; - ydir = -1; - } - else - { - offsety = 0; - ydir = 1; - } - sx1 = sx; - code = Generic.spriteram[offs + 3] + ((Generic.spriteram[offs + 1] & 1) << 8); - color = (Generic.spriteram[offs + 1] & 0x70) >> 4; - for (i = 0; i < 0x10; i++) - { - for (j = 0; j < 0x10; j++) - { - if (sx1 + offsetx + xdir * j >= 0 && sx1 + offsetx + xdir * j < 0x100 && sy + offsety + ydir * i >= 0 && sy + offsety + ydir * i < 0x100) - { - ushort c = gfx2rom[code * 0x100 + 0x10 * i + j]; - if (c != 0) - { - c1 = Color.FromArgb((int)Palette.entry_color[color * 4 + c]); - ptr2 = ptr + ((sy + offsety + ydir * i) * 0x100 + (sx1 + offsetx + xdir * j)) * 4; - *ptr2 = c1.B; - *(ptr2 + 1) = c1.G; - *(ptr2 + 2) = c1.R; - *(ptr2 + 3) = c1.A; - } - } - } - } - } - } - } - bm1.UnlockBits(bmData); - return bm1; - } - public static Bitmap GetAllGDI() - { - Bitmap bm1 = new Bitmap(0x100, 0x100), bm2; - Graphics g = Graphics.FromImage(bm1); - g.Clear(Color.Transparent); - if (bBg) - { - bm2 = GetBg(); - g.DrawImage(bm2, 0, 0); - } - if (bSprite) - { - bm2 = GetSprite(); - g.DrawImage(bm2, 0, 0); - } - switch (Machine.sDirection) - { - case "": - break; - case "90": - bm1.RotateFlip(RotateFlipType.Rotate90FlipNone); - break; - } - return bm1; - } } } diff --git a/MAME.Core/mame/dataeast/Input.cs b/MAME.Core/mame/dataeast/Input.cs index d56f62b..bb006b0 100644 --- a/MAME.Core/mame/dataeast/Input.cs +++ b/MAME.Core/mame/dataeast/Input.cs @@ -152,8 +152,8 @@ namespace mame lfr = new List(); lfr.Add(new fr1((int)(Video.screenstate.frame_number + 1), 0x7f)); lfr.Add(new fr1((int)(Video.screenstate.frame_number + 2), 0xff)); - lfr.Add(new fr1((int)(Video.screenstate.frame_number + 2+i3), 0x7f)); - lfr.Add(new fr1((int)(Video.screenstate.frame_number + 2+i3+1), 0xff)); + lfr.Add(new fr1((int)(Video.screenstate.frame_number + 2 + i3), 0x7f)); + lfr.Add(new fr1((int)(Video.screenstate.frame_number + 2 + i3 + 1), 0xff)); } if (Keyboard.IsTriggered(Key.U)) { diff --git a/MAME.Core/mame/dataeast/Memory.cs b/MAME.Core/mame/dataeast/Memory.cs index 498309f..a6f13c0 100644 --- a/MAME.Core/mame/dataeast/Memory.cs +++ b/MAME.Core/mame/dataeast/Memory.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace mame +namespace mame { public partial class Dataeast { diff --git a/MAME.Core/mame/dataeast/Pcktgal.cs b/MAME.Core/mame/dataeast/Pcktgal.cs index e79ce32..55e527a 100644 --- a/MAME.Core/mame/dataeast/Pcktgal.cs +++ b/MAME.Core/mame/dataeast/Pcktgal.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; - -namespace mame +namespace mame { public partial class Dataeast { @@ -13,7 +7,7 @@ namespace mame public static int basebankmain1, basebankmain2, basebanksnd, msm5205next, toggle; public static void DataeastInit() { - int i,n; + int i, n; Machine.bRom = true; Memory.mainram = new byte[0x800]; Memory.audioram = new byte[0x800]; @@ -48,7 +42,7 @@ namespace mame Machine.bRom = false; } break; - } + } if (Machine.bRom) { dsw = 0xbf; diff --git a/MAME.Core/mame/dataeast/State.cs b/MAME.Core/mame/dataeast/State.cs index e3dc2a0..e9067e9 100644 --- a/MAME.Core/mame/dataeast/State.cs +++ b/MAME.Core/mame/dataeast/State.cs @@ -1,9 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using cpu.m6502; using System.IO; -using cpu.m6502; namespace mame { diff --git a/MAME.Core/mame/dataeast/Tilemap.cs b/MAME.Core/mame/dataeast/Tilemap.cs index 2c7de45..4ce5d6d 100644 --- a/MAME.Core/mame/dataeast/Tilemap.cs +++ b/MAME.Core/mame/dataeast/Tilemap.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; namespace mame { diff --git a/MAME.Core/mame/dataeast/Video.cs b/MAME.Core/mame/dataeast/Video.cs index ff943ca..b8d700e 100644 --- a/MAME.Core/mame/dataeast/Video.cs +++ b/MAME.Core/mame/dataeast/Video.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace mame +namespace mame { public partial class Dataeast { diff --git a/MAME.Core/mame/igs011/Gdi.cs b/MAME.Core/mame/igs011/Gdi.cs index 8cfe7ef..ebe6c51 100644 --- a/MAME.Core/mame/igs011/Gdi.cs +++ b/MAME.Core/mame/igs011/Gdi.cs @@ -1,12 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Drawing; -using System.Drawing.Imaging; -using System.IO; - -namespace mame +namespace mame { public partial class IGS011 { @@ -14,82 +6,5 @@ namespace mame { } - public static Bitmap GetBmp(string layer1) - { - int width = 0x200, height = 0xf0; - int x, y, l, scr_addr, pri_addr; - int pri_ram_offset; - pri_ram_offset = (priority & 7) * 0x100; - Color c1 = new Color(); - Bitmap bm1; - bm1 = new Bitmap(width, height); - BitmapData bmData; - bmData = bm1.LockBits(new Rectangle(0, 0, bm1.Width, bm1.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); - unsafe - { - byte* ptr = (byte*)(bmData.Scan0); - byte* ptr2 = (byte*)0; - for (y = 0; y < 0xef; y++) - { - for (x = 0; x < 0x1ff; x++) - { - scr_addr = x + y * 0x200; - pri_addr = 0xff; - for (l = 0; l < 8; l++) - { - if (layer[l][scr_addr] != 0xff) - { - pri_addr &= ~(1 << l); - } - } - if (layer1 == "normal") - { - l = priority_ram[pri_ram_offset + pri_addr] & 7; - } - else - { - l = int.Parse(layer1); - } - c1 = Color.FromArgb((int)Palette.entry_color[layer[l][scr_addr] | (l << 8)]); - ptr2 = ptr + (y * width + x) * 4; - *ptr2 = c1.B; - *(ptr2 + 1) = c1.G; - *(ptr2 + 2) = c1.R; - *(ptr2 + 3) = c1.A; - } - } - } - bm1.UnlockBits(bmData); - return bm1; - } - public static Bitmap GetAllGDI(string layer) - { - Bitmap bm1 = new Bitmap(0x200, 0xf0), bm2; - Graphics g = Graphics.FromImage(bm1); - g.Clear(Color.Transparent); - bm2 = GetBmp(layer); - g.DrawImage(bm2, 0, 0); - /*if (bBg) - { - bm2 = GetBg_sf(); - g.DrawImage(bm2, -bg_scrollx, 0); - } - if (bFg) - { - bm2 = GetFg_sf(); - g.DrawImage(bm2, -fg_scrollx, 0); - } - if (bTx) - { - bm2 = GetTx_sf(); - g.DrawImage(bm2, 0, 0); - } - if (bSprite) - { - bm2 = GetSprite_sf(); - g.DrawImage(bm2, 0, 0); - }*/ - return bm1; - } } } diff --git a/MAME.Core/mame/igs011/IGS011.cs b/MAME.Core/mame/igs011/IGS011.cs index 5e19126..0afd299 100644 --- a/MAME.Core/mame/igs011/IGS011.cs +++ b/MAME.Core/mame/igs011/IGS011.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace mame +namespace mame { public partial class IGS011 { @@ -11,7 +6,7 @@ namespace mame public static byte prot1, prot2, prot1_swap; public static uint prot1_addr; public static ushort[] igs003_reg, vbowl_trackball; - public static ushort priority, igs_dips_sel,igs_input_sel, lhb_irq_enable; + public static ushort priority, igs_dips_sel, igs_input_sel, lhb_irq_enable; public static byte igs012_prot, igs012_prot_swap; private static bool igs012_prot_mode; public static byte[] gfx1rom, gfx2rom; @@ -62,13 +57,13 @@ namespace mame Machine.bRom = false; } break; - case "lhb2": + case "lhb2": Memory.mainrom = Machine.GetRom("maincpu.rom"); gfx1rom = Machine.GetRom("gfx1.rom"); gfx2rom = Machine.GetRom("gfx2.rom"); break; - } + } } public static void machine_reset_igs011() { @@ -476,7 +471,7 @@ namespace mame } return 0; } - private static void lhb_inputs_w(int offset,byte data) + private static void lhb_inputs_w(int offset, byte data) { if (offset == 0) { @@ -840,7 +835,7 @@ namespace mame //if (ACCESSING_BITS_0_7) YM3812.ym3812_write_port_0_w(data); } - private static void lhb_irq_enable_w(int offset,byte data) + private static void lhb_irq_enable_w(int offset, byte data) { if ((offset & 1) == 0) { diff --git a/MAME.Core/mame/igs011/Input.cs b/MAME.Core/mame/igs011/Input.cs index 3e325dd..d15c4a2 100644 --- a/MAME.Core/mame/igs011/Input.cs +++ b/MAME.Core/mame/igs011/Input.cs @@ -96,7 +96,7 @@ namespace mame } if (Keyboard.IsPressed(Key.U)) { - + } else { diff --git a/MAME.Core/mame/igs011/Machine.cs b/MAME.Core/mame/igs011/Machine.cs index 8156a9f..8df8abf 100644 --- a/MAME.Core/mame/igs011/Machine.cs +++ b/MAME.Core/mame/igs011/Machine.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace mame +namespace mame { public partial class IGS011 { diff --git a/MAME.Core/mame/igs011/Memory.cs b/MAME.Core/mame/igs011/Memory.cs index cbbdf1c..3ee3e9e 100644 --- a/MAME.Core/mame/igs011/Memory.cs +++ b/MAME.Core/mame/igs011/Memory.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace mame +namespace mame { public partial class IGS011 { @@ -17,7 +12,7 @@ namespace mame sbyte result = 0; if (address >= prot1_addr + 8 && address <= prot1_addr + 9) { - if (address %2==0) + if (address % 2 == 0) { result = (sbyte)(igs011_prot1_r() >> 8); } @@ -71,11 +66,11 @@ namespace mame else if (address >= 0x400000 && address <= 0x401fff) { int offset = (address - 0x400000) / 2; - if (address %2 == 0) + if (address % 2 == 0) { result = (sbyte)(paletteram16[offset] >> 8); } - else if (address %2 == 1) + else if (address % 2 == 1) { result = (sbyte)paletteram16[offset]; } @@ -100,7 +95,8 @@ namespace mame { int i1 = 1; } - else*/ if(address == 0x800003) + else*/ + if (address == 0x800003) { result = (sbyte)drgnwrld_igs003_r(); } @@ -328,7 +324,7 @@ namespace mame { int offset = address - 0xa5c000; igs011_blit_depth_w(offset, (byte)value); - } + } } public static void MWriteWord_drgnwrld(int address, short value) { @@ -338,7 +334,7 @@ namespace mame int offset = (int)(address - prot1_addr); igs011_prot1_w(offset, (ushort)value); } - else if (address >= 0x100000 && address+1 <= 0x103fff) + else if (address >= 0x100000 && address + 1 <= 0x103fff) { int offset = address - 0x100000; Generic.generic_nvram[offset] = (byte)(value >> 8); @@ -351,9 +347,9 @@ namespace mame } else if (address >= 0x400000 && address + 1 <= 0x401fff) { - int offset = (address - 0x400000)/2; - igs011_palette(offset,(ushort)value); - } + int offset = (address - 0x400000) / 2; + igs011_palette(offset, (ushort)value); + } else if (address >= 0x600000 && address + 1 <= 0x600001) { OKI6295.okim6295_data_0_lsb_w((byte)value); @@ -368,7 +364,7 @@ namespace mame } else if (address >= 0x800000 && address + 1 <= 0x800003) { - int offset = (address - 0x800000)/2; + int offset = (address - 0x800000) / 2; drgnwrld_igs003_w(offset, (ushort)value); } else if (address >= 0xa20000 && address + 1 <= 0xa20001) diff --git a/MAME.Core/mame/igs011/Memory2.cs b/MAME.Core/mame/igs011/Memory2.cs index cf581ad..5a0887b 100644 --- a/MAME.Core/mame/igs011/Memory2.cs +++ b/MAME.Core/mame/igs011/Memory2.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace mame +namespace mame { public partial class IGS011 { @@ -750,7 +745,7 @@ namespace mame public static void MWriteLong_lhb(int address, int value) { address &= 0xffffff; - if (address >= prot1_addr && address+3 <= prot1_addr + 7) + if (address >= prot1_addr && address + 3 <= prot1_addr + 7) { int i1 = 1; } @@ -3141,7 +3136,7 @@ namespace mame } else if (address >= 0x600000 && address + 1 <= 0x600007) { - int offset=(address-0x600000)/2; + int offset = (address - 0x600000) / 2; ics2115_0_word_w(offset, (ushort)value); } else if (address >= 0x700000 && address + 1 <= 0x700003) @@ -3419,7 +3414,7 @@ namespace mame { result = 0; } - } + } else if (address >= 0x100000 && address + 1 <= 0x103fff) { int offset = address - 0x100000; diff --git a/MAME.Core/mame/igs011/State.cs b/MAME.Core/mame/igs011/State.cs index b501138..cb59e7d 100644 --- a/MAME.Core/mame/igs011/State.cs +++ b/MAME.Core/mame/igs011/State.cs @@ -1,9 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using cpu.m68000; using System.IO; -using cpu.m68000; namespace mame { @@ -120,15 +116,15 @@ namespace mame layer[i][j] = reader.ReadByte(); } } - lhb2_pen_hi= reader.ReadByte(); - blitter.x= reader.ReadUInt16(); - blitter.y= reader.ReadUInt16(); - blitter.w= reader.ReadUInt16(); - blitter.h= reader.ReadUInt16(); - blitter.gfx_lo= reader.ReadUInt16(); - blitter.gfx_hi= reader.ReadUInt16(); - blitter.depth= reader.ReadUInt16(); - blitter.pen= reader.ReadUInt16(); + lhb2_pen_hi = reader.ReadByte(); + blitter.x = reader.ReadUInt16(); + blitter.y = reader.ReadUInt16(); + blitter.w = reader.ReadUInt16(); + blitter.h = reader.ReadUInt16(); + blitter.gfx_lo = reader.ReadUInt16(); + blitter.gfx_hi = reader.ReadUInt16(); + blitter.depth = reader.ReadUInt16(); + blitter.pen = reader.ReadUInt16(); blitter.flags = reader.ReadUInt16(); MC68000.m1.LoadStateBinary(reader); Cpuint.LoadStateBinary(reader); diff --git a/MAME.Core/mame/igs011/Video.cs b/MAME.Core/mame/igs011/Video.cs index 0d6e97d..236ad04 100644 --- a/MAME.Core/mame/igs011/Video.cs +++ b/MAME.Core/mame/igs011/Video.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace mame +namespace mame { public partial class IGS011 { @@ -143,7 +138,7 @@ namespace mame } 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) { @@ -258,7 +253,7 @@ namespace mame int clear, opaque, z; byte trans_pen, clear_pen, pen_hi, pen = 0; int gfx_size = gfx1rom.Length; - int gfx2_size=0; + int gfx2_size = 0; if (gfx2rom != null) { gfx2_size = gfx2rom.Length; @@ -287,7 +282,7 @@ namespace mame { trans_pen = 0x0f; } - clear_pen =(byte)(blitter.pen | 0xf0); + clear_pen = (byte)(blitter.pen | 0xf0); } else { @@ -303,7 +298,7 @@ namespace mame } xstart = (blitter.x & 0x1ff) - (blitter.x & 0x200); ystart = (blitter.y & 0x0ff) - (blitter.y & 0x100); - if (flipx!=0) + if (flipx != 0) { xend = xstart - (blitter.w & 0x1ff) - 1; xinc = -1; @@ -327,7 +322,7 @@ namespace mame { for (x = xstart; x != xend; x += xinc) { - if (clear==0) + if (clear == 0) { if (depth4) { @@ -337,7 +332,7 @@ namespace mame { pen = gfx1rom[z % gfx_size]; } - if (gfx2rom!=null) + if (gfx2rom != null) { pen &= 0x0f; if ((gfx2rom[(z / 8) % gfx2_size] & (1 << (z & 7))) != 0) diff --git a/MAME.Core/mame/konami68000/Drawgfx.cs b/MAME.Core/mame/konami68000/Drawgfx.cs index 01ed7c9..e62c5ac 100644 --- a/MAME.Core/mame/konami68000/Drawgfx.cs +++ b/MAME.Core/mame/konami68000/Drawgfx.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace mame +namespace mame { 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)) { @@ -272,7 +267,7 @@ namespace mame } 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 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 srcdata_offset = code * 0x100; @@ -307,9 +302,9 @@ namespace mame col = bb1[srcdata_offset + srcmodulo * i + j]; 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]]; } diff --git a/MAME.Core/mame/konami68000/Gdi.cs b/MAME.Core/mame/konami68000/Gdi.cs index c4e8360..8273450 100644 --- a/MAME.Core/mame/konami68000/Gdi.cs +++ b/MAME.Core/mame/konami68000/Gdi.cs @@ -1,7 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Drawing.Imaging; +using System.Collections.Generic; +using Bitmap = MAME.Core.AxiBitmap.AxiBitmap; namespace mame { @@ -13,1144 +11,10 @@ namespace mame public static GetBitmap[] GetTilemaps; public static GetBitmap GetSprite; private static List lSprite; - public static int min_priority,max_priority; + public static int min_priority, max_priority; public static void GDIInit() { lSprite = new List(); - GetTilemaps = new GetBitmap[3] { GetTilemap0_K052109, GetTilemap1_K052109, GetTilemap2_K052109 }; - switch (Machine.sName) - { - case "cuebrick": - case "mia": - case "mia2": - case "tmnt": - case "tmntu": - case "tmntua": - case "tmntub": - case "tmht": - case "tmhta": - case "tmhtb": - case "tmntj": - case "tmnta": - case "tmht2p": - case "tmht2pa": - case "tmnt2pj": - case "tmnt2po": - min_priority = 0; - max_priority = 0; - GetSprite = GetSprite_K051960; - break; - case "lgtnfght": - case "lgtnfghta": - case "lgtnfghtu": - case "trigon": - case "tmnt2": - case "tmnt2a": - case "tmht22pe": - case "tmht24pe": - case "tmnt22pu": - case "qgakumon": - case "ssriders": - case "ssriderseaa": - case "ssridersebd": - case "ssridersebc": - case "ssridersuda": - case "ssridersuac": - case "ssridersuab": - case "ssridersubc": - case "ssridersadd": - case "ssridersabd": - case "ssridersjad": - case "ssridersjac": - case "ssridersjbd": - GetSprite = GetSprite_K053245; - break; - case "thndrx2": - case "thndrx2a": - case "thndrx2j": - min_priority = -1; - max_priority = -1; - GetSprite = GetSprite_K051960; - break; - default: - GetSprite = GetNull; - break; - } - } - public static Bitmap GetNull() - { - Bitmap bm1; - bm1 = new Bitmap(512, 256); - return bm1; - } - public static Bitmap GetTilemap0_K052109() - { - int i1, i2, iOffset, i3, i4, iOffset3 = 0; - int rows, cols, width, height; - int tilewidth, tileheight; - int bank, priority; - int code2, color2,flags2; - tilewidth = 8; - tileheight = tilewidth; - rows = 0x20; - cols = 0x40; - width = tilewidth * cols; - height = tileheight * rows; - int iByte; - int iCode, iCode1, iColor; - int iTile, iFlag; - 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++) - { - iOffset3 = i4 * cols + i3; - iTile = iOffset3; - iCode = K052109_ram[K052109_videoram_F_offset + iTile] + 256 * K052109_ram[K052109_videoram2_F_offset + iTile]; ; - iColor = K052109_ram[K052109_colorram_F_offset + iTile]; - bank = K052109_charrombank[(iColor & 0x0c) >> 2]; - priority = 0; - iFlag = 0; - iColor = (iColor & 0xf3) | ((bank & 0x03) << 2); - bank >>= 2; - K052109_callback(0, bank, iCode, iColor, iFlag, priority, out code2, out color2,out flags2); - iCode = code2; - iColor = color2; - iFlag = flags2; - iCode1 = iCode % K052109_tilemap[0].total_elements; - pen_data_offset = iCode1 * 0x40; - palette_base = 0x10 * iColor; - if (iFlag == 0) - { - x0 = tilewidth * i3; - y0 = tileheight * i4; - dx0 = 1; - dy0 = 1; - } - else if (iFlag == 1) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4; - dx0 = -1; - dy0 = 1; - } - else if (iFlag == 2) - { - x0 = tilewidth * i3; - y0 = tileheight * i4 + tileheight - 1; - dx0 = 1; - dy0 = -1; - } - else if (iFlag == 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 * 0x08 + i1; - iByte = gfx12rom[iOffset]; - if (iByte == 0) - { - 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 GetTilemap1_K052109() - { - int i1, i2, iOffset, i3, i4, iOffset3 = 0; - int rows, cols, width, height; - int bank, priority; - int code2, color2,flags2; - int tilewidth, tileheight; - tilewidth = 8; - tileheight = tilewidth; - rows = 0x20; - cols = 0x40; - width = tilewidth * cols; - height = width; - int iByte; - int iCode, iCode1, iColor; - int iTile, iFlag; - 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++) - { - iOffset3 = i4 * cols + i3; - iTile = iOffset3; - iCode = K052109_ram[K052109_videoram_A_offset + iTile] + 256 * K052109_ram[K052109_videoram2_A_offset + iTile]; ; - iColor = K052109_ram[K052109_colorram_A_offset + iTile]; - bank = K052109_charrombank[(iColor & 0x0c) >> 2]; - priority = 0; - iFlag = 0; - iColor = (iColor & 0xf3) | ((bank & 0x03) << 2); - bank >>= 2; - K052109_callback(1, bank, iCode, iColor, iFlag, priority, out code2, out color2, out flags2); - iCode = code2; - iColor = color2; - iFlag = flags2; - iCode1 = iCode % K052109_tilemap[1].total_elements; - pen_data_offset = iCode1 * 0x40; - palette_base = 0x10 * iColor; - if (iFlag == 0) - { - x0 = tilewidth * i3; - y0 = tileheight * i4; - dx0 = 1; - dy0 = 1; - } - else if (iFlag == 1) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4; - dx0 = -1; - dy0 = 1; - } - else if (iFlag == 2) - { - x0 = tilewidth * i3; - y0 = tileheight * i4 + tileheight - 1; - dx0 = 1; - dy0 = -1; - } - else if (iFlag == 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 * 0x08 + i1; - iByte = gfx12rom[iOffset]; - if (iByte == 0) - { - 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 GetTilemap2_K052109() - { - int i1, i2, iOffset, i3, i4, iOffset3 = 0; - int rows, cols, width, height; - int bank, priority; - int code2, color2,flags2; - int tilewidth, tileheight; - tilewidth = 8; - tileheight = tilewidth; - rows = 0x20; - cols = 0x40; - width = tilewidth * cols; - height = width; - int iByte; - int iCode, iCode1, iColor; - int iTile, iFlag; - 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++) - { - iOffset3 = i4 * cols + i3; - iTile = iOffset3; - iCode = K052109_ram[K052109_videoram_B_offset + iTile] + 256 * K052109_ram[K052109_videoram2_B_offset + iTile]; ; - iColor = K052109_ram[K052109_colorram_B_offset + iTile]; - bank = K052109_charrombank[(iColor & 0x0c) >> 2]; - priority = 0; - iFlag = 0; - iColor = (iColor & 0xf3) | ((bank & 0x03) << 2); - bank >>= 2; - K052109_callback(2, bank, iCode, iColor, iFlag, priority, out code2, out color2,out flags2); - iCode = code2; - iColor = color2; - iFlag = flags2; - iCode1 = iCode % K052109_tilemap[2].total_elements; - pen_data_offset = iCode1 * 0x40; - palette_base = 0x10 * iColor; - if (iFlag == 0) - { - x0 = tilewidth * i3; - y0 = tileheight * i4; - dx0 = 1; - dy0 = 1; - } - else if (iFlag == 1) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4; - dx0 = -1; - dy0 = 1; - } - else if (iFlag == 2) - { - x0 = tilewidth * i3; - y0 = tileheight * i4 + tileheight - 1; - dx0 = 1; - dy0 = -1; - } - else if (iFlag == 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 * 0x08 + i1; - iByte = gfx12rom[iOffset]; - if (iByte == 0) - { - 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_K053245() - { - Color c1 = new Color(); - byte col; - Bitmap bm1; - bm1 = new Bitmap(512, 256); - BitmapData bmData; - bmData = bm1.LockBits(new Rectangle(0, 0, bm1.Width, bm1.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); - int offs, pri_code, i; - int[] sortedlist = new int[128]; - int flipscreenX, flipscreenY, spriteoffsX, spriteoffsY; - flipscreenX = K053244_regs[0][5] & 0x01; - flipscreenY = K053244_regs[0][5] & 0x02; - spriteoffsX = (K053244_regs[0][0] << 8) | K053244_regs[0][1]; - spriteoffsY = (K053244_regs[0][2] << 8) | K053244_regs[0][3]; - for (offs = 0; offs < 128; offs++) - { - sortedlist[offs] = -1; - } - i = K053245_ramsize[0] / 2; - unsafe - { - byte* ptr = (byte*)(bmData.Scan0); - byte* ptr2 = (byte*)0; - int x1, y1; - for (offs = 0; offs < i; offs += 8) - { - pri_code = K053245_buffer[0][offs]; - if ((pri_code & 0x8000) != 0) - { - pri_code &= 0x007f; - if (offs != 0 && pri_code == K05324x_z_rejection) - { - continue; - } - if (sortedlist[pri_code] == -1) - { - sortedlist[pri_code] = offs; - } - } - } - for(pri_code=0;pri_code<128;pri_code++) - //for(pri_code=127;pri_code>=0;pri_code--) - { - int ox, oy, color, color2, code,code2, size, w, h, x, y, flipx, flipy, mirrorx, mirrory, shadow, zoomx, zoomy, pri, pri2; - offs = sortedlist[pri_code]; - if (offs == -1) - { - continue; - } - code = K053245_buffer[0][offs + 1]; - code = ((code & 0xffe1) + ((code & 0x0010) >> 2) + ((code & 0x0008) << 1) + ((code & 0x0004) >> 1) + ((code & 0x0002) << 2)); - color = K053245_buffer[0][offs + 6] & 0x00ff; - pri = 0; - K053245_callback(code, color,out code2, out color2, out pri2); - size = (K053245_buffer[0][offs] & 0x0f00) >> 8; - w = 1 << (size & 0x03); - h = 1 << ((size >> 2) & 0x03); - zoomy = K053245_buffer[0][offs + 4]; - if (zoomy > 0x2000) - { - continue; - } - if (zoomy != 0) - { - zoomy = (0x400000 + zoomy / 2) / zoomy; - } - else - { - zoomy = 2 * 0x400000; - } - if ((K053245_buffer[0][offs] & 0x4000) == 0) - { - zoomx = K053245_buffer[0][offs + 5]; - if (zoomx > 0x2000) - { - continue; - } - if (zoomx != 0) - { - zoomx = (0x400000 + zoomx / 2) / zoomx; - } - else - { - zoomx = 2 * 0x400000; - } - } - else - { - zoomx = zoomy; - } - ox = K053245_buffer[0][offs + 3] + spriteoffsX; - oy = K053245_buffer[0][offs + 2]; - ox += K053245_dx[0]; - oy += K053245_dy[0]; - flipx = K053245_buffer[0][offs] & 0x1000; - flipy = K053245_buffer[0][offs] & 0x2000; - mirrorx = K053245_buffer[0][offs + 6] & 0x0100; - if (mirrorx != 0) - { - flipx = 0; - } - mirrory = K053245_buffer[0][offs + 6] & 0x0200; - shadow = K053245_buffer[0][offs + 6] & 0x0080; - if (flipscreenX != 0) - { - ox = 512 - ox; - if (mirrorx == 0) - { - flipx = (flipx == 0) ? 1 : 0; - } - } - if (flipscreenY != 0) - { - oy = -oy; - if (mirrory == 0) - { - flipy = (flipy == 0) ? 1 : 0; - } - } - ox = (ox + 0x5d) & 0x3ff; - if (ox >= 768) - { - ox -= 1024; - } - oy = (-(oy + spriteoffsY + 0x07)) & 0x3ff; - if (oy >= 640) - { - oy -= 1024; - } - ox -= (zoomx * w) >> 13; - oy -= (zoomy * h) >> 13; - for (y = 0; y < h; y++) - { - int sx, sy, zw, zh; - sy = oy + ((zoomy * y + (1 << 11)) >> 12); - zh = (oy + ((zoomy * (y + 1) + (1 << 11)) >> 12)) - sy; - for (x = 0; x < w; x++) - { - int c, fx, fy; - sx = ox + ((zoomx * x + (1 << 11)) >> 12); - zw = (ox + ((zoomx * (x + 1) + (1 << 11)) >> 12)) - sx; - c = code2; - if (mirrorx != 0) - { - if ((flipx == 0) ^ (2 * x < w)) - { - c += (w - x - 1); - fx = 1; - } - else - { - c += x; - fx = 0; - } - } - else - { - if (flipx != 0) - { - c += w - 1 - x; - } - else - { - c += x; - } - fx = flipx; - } - if (mirrory != 0) - { - if ((flipy == 0) ^ (2 * y >= h)) - { - c += 8 * (h - y - 1); - fy = 1; - } - else - { - c += 8 * y; - fy = 0; - } - } - else - { - if (flipy != 0) - { - c += 8 * (h - 1 - y); - } - else - { - c += 8 * y; - } - fy = flipy; - } - c = (c & 0x3f) | (code2 & ~0x3f); - if (lSprite.IndexOf(c) < 0) - { - continue; - } - if (zoomx == 0x10000 && zoomy == 0x10000) - { - //common_drawgfx_konami68000(gfx22rom, c, color2, fx, fy, sx, sy, cliprect, (uint)(pri2 | (1 << 31))); - int xdir, ydir, offx, offy; - if (fy != 0) - { - ydir = -1; - offy = 0x0f; - } - else - { - ydir = 1; - offy = 0; - } - if (fx != 0) - { - xdir = -1; - offx = 0x0f; - } - else - { - xdir = 1; - offx = 0; - } - for (y1 = 0; y1 < 0x10; y1++) - { - for (x1 = 0; x1 < 0x10; x1++) - { - col = gfx22rom[c * 0x100 + 0x10 * y1 + x1]; - if (col == 0) - { - c1 = Color.Transparent; - } - else - { - c1 = Color.FromArgb((int)Palette.entry_color[color2 * 0x10 + col]); - ptr2 = ptr + ((sy + offy + y1 * ydir) * 0x200 + (sx + offx + x1 * xdir)) * 4; - *ptr2 = c1.B; - *(ptr2 + 1) = c1.G; - *(ptr2 + 2) = c1.R; - *(ptr2 + 3) = c1.A; - } - } - } - } - else - { - int scalex, scaley, x2, y2; - scalex = (zw << 16) / 16; - scaley = (zh << 16) / 16; - int colorbase = 0x10 * (color2 % 0x80); - int source_baseoffset = (c % sprite_totel_element) * 0x100; - int sprite_screen_height = (scaley * 0x10 + 0x8000) >> 16; - int sprite_screen_width = (scalex * 0x10 + 0x8000) >> 16; - int countx, county, srcoffset, dstoffset; - if (sprite_screen_width != 0 && sprite_screen_height != 0) - { - int dx = (0x10 << 16) / sprite_screen_width; - int dy = (0x10 << 16) / sprite_screen_height; - int ex = sx + sprite_screen_width; - int ey = sy + sprite_screen_height; - int x_index_base; - int y_index; - if (flipx != 0) - { - x_index_base = (sprite_screen_width - 1) * dx; - dx = -dx; - } - else - { - x_index_base = 0; - } - if (flipy != 0) - { - y_index = (sprite_screen_height - 1) * dy; - dy = -dy; - } - else - { - y_index = 0; - } - countx = ex - sx; - county = ey - sy; - for (y2 = 0; y2 < county; y2++) - { - for (x2 = 0; x2 < countx; x2++) - { - srcoffset = ((y_index + dy * y2) >> 16) * 0x10 + ((x_index_base + dx * x2) >> 16); - dstoffset = (sy + y2) * 0x200 + sx + x2; - col = gfx22rom[source_baseoffset + srcoffset]; - if (col == 0) - { - c1 = Color.Transparent; - } - else - { - c1 = Color.FromArgb((int)Palette.entry_color[color2 * 0x10 + col]); - if (sy + y2 >= 0 && sy + y2 < 0x100 && sx + x2 >= 0 && sx + x2 < 0x200) - { - ptr2 = ptr + ((sy + y2) * 0x200 + (sx + x2)) * 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_K051960() - { - Color c1 = new Color(); - byte col; - Bitmap bm1; - bm1 = new Bitmap(512, 256); - BitmapData bmData; - bmData = bm1.LockBits(new Rectangle(0, 0, bm1.Width, bm1.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb); - int offs, pri_code; - int[] sortedlist = new int[128]; - int[] xoffset = new int[8] { 0, 1, 4, 5, 16, 17, 20, 21 }; - int[] yoffset = new int[8] { 0, 2, 8, 10, 32, 34, 40, 42 }; - int[] width = new int[8] { 1, 2, 1, 2, 4, 2, 4, 8 }; - int[] height = new int[8] { 1, 1, 2, 2, 2, 4, 4, 8 }; - for (offs = 0; offs < 128; offs++) - { - sortedlist[offs] = -1; - } - for (offs = 0; offs < 0x400; offs += 8) - { - if ((K051960_ram[offs] & 0x80) != 0) - { - if (max_priority == -1) - { - sortedlist[(K051960_ram[offs] & 0x7f) ^ 0x7f] = offs; - } - else - { - sortedlist[K051960_ram[offs] & 0x7f] = offs; - } - } - } - unsafe - { - byte* ptr = (byte*)(bmData.Scan0); - byte* ptr2 = (byte*)0; - int x1, y1,fx,fy; - for (pri_code = 127; pri_code >=0; pri_code--) - { - int ox, oy, code, code2, color, color2, pri, pri2, shadow, shadow2, size, w, h, x, y, flipx, flipy, zoomx, zoomy; - offs = sortedlist[pri_code]; - if (offs == -1) - { - continue; - } - code = K051960_ram[offs + 2] + ((K051960_ram[offs + 1] & 0x1f) << 8); - color = K051960_ram[offs + 3] & 0xff; - pri = 0; - shadow = color & 0x80; - K051960_callback(code, color, pri, shadow, out code2, out color2, out pri2); - code = code2; - color = color2; - pri = pri2; - if (max_priority != -1) - { - if (pri < min_priority || pri > max_priority) - { - continue; - } - } - size = (K051960_ram[offs + 1] & 0xe0) >> 5; - w = width[size]; - h = height[size]; - if (w >= 2) code &= ~0x01; - if (h >= 2) code &= ~0x02; - if (w >= 4) code &= ~0x04; - if (h >= 4) code &= ~0x08; - if (w >= 8) code &= ~0x10; - if (h >= 8) code &= ~0x20; - ox = (256 * K051960_ram[offs + 6] + K051960_ram[offs + 7]) & 0x01ff; - oy = 256 - ((256 * K051960_ram[offs + 4] + K051960_ram[offs + 5]) & 0x01ff); - ox += K051960_dx; - oy += K051960_dy; - flipx = K051960_ram[offs + 6] & 0x02; - flipy = K051960_ram[offs + 4] & 0x02; - zoomx = (K051960_ram[offs + 6] & 0xfc) >> 2; - zoomy = (K051960_ram[offs + 4] & 0xfc) >> 2; - zoomx = 0x10000 / 128 * (128 - zoomx); - zoomy = 0x10000 / 128 * (128 - zoomy); - if (K051960_spriteflip != 0) - { - ox = 512 - (zoomx * w >> 12) - ox; - oy = 256 - (zoomy * h >> 12) - oy; - flipx = (flipx == 0) ? 1 : 0; - flipy = (flipy == 0) ? 1 : 0; - } - fx = flipx; - fy = flipy; - if (zoomx == 0x10000 && zoomy == 0x10000) - { - int sx, sy; - for (y = 0; y < h; y++) - { - sy = oy + 16 * y; - for (x = 0; x < w; x++) - { - int c = code; - if (lSprite.IndexOf(c) < 0) - { - continue; - } - sx = ox + 16 * x; - if (flipx != 0) - { - c += xoffset[(w - 1 - x)]; - } - else - { - c += xoffset[x]; - } - if (flipy != 0) - { - c += yoffset[(h - 1 - y)]; - } - else - { - c += yoffset[y]; - } - if (max_priority == -1) - { - int xdir, ydir, offx, offy; - if (fy != 0) - { - ydir = -1; - offy = 0x0f; - } - else - { - ydir = 1; - offy = 0; - } - if (fx != 0) - { - xdir = -1; - offx = 0x0f; - } - else - { - xdir = 1; - offx = 0; - } - for (y1 = 0; y1 < 0x10; y1++) - { - for (x1 = 0; x1 < 0x10; x1++) - { - col = gfx22rom[c * 0x100 + 0x10 * y1 + x1]; - if (col == 0) - { - c1 = Color.Transparent; - } - else - { - c1 = Color.FromArgb((int)Palette.entry_color[color * 0x10 + col]); - ptr2 = ptr + ((sy + offy + y1 * ydir) * 0x200 + (sx + offx + x1 * xdir)) * 4; - *ptr2 = c1.B; - *(ptr2 + 1) = c1.G; - *(ptr2 + 2) = c1.R; - *(ptr2 + 3) = c1.A; - } - } - } - /*pdrawgfx(bitmap, K051960_gfx, - c, - color, - flipx, flipy, - sx & 0x1ff, sy, - cliprect, shadow ? TRANSPARENCY_PEN_TABLE : TRANSPARENCY_PEN, 0, pri);*/ - } - else - { - int i11 = 1; - /*drawgfx(bitmap, K051960_gfx, - c, - color, - flipx, flipy, - sx & 0x1ff, sy, - cliprect, shadow ? TRANSPARENCY_PEN_TABLE : TRANSPARENCY_PEN, 0);*/ - } - } - } - } - else - { - int sx, sy, zw, zh; - for (y = 0; y < h; y++) - { - sy = oy + ((zoomy * y + (1 << 11)) >> 12); - zh = (oy + ((zoomy * (y + 1) + (1 << 11)) >> 12)) - sy; - for (x = 0; x < w; x++) - { - int c = code; - sx = ox + ((zoomx * x + (1 << 11)) >> 12); - zw = (ox + ((zoomx * (x + 1) + (1 << 11)) >> 12)) - sx; - if (flipx != 0) - { - c += xoffset[(w - 1 - x)]; - } - else - { - c += xoffset[x]; - } - if (flipy != 0) - { - c += yoffset[(h - 1 - y)]; - } - else - { - c += yoffset[y]; - } - if (max_priority == -1) - { - int i11 = 1; - /*pdrawgfxzoom(bitmap,K051960_gfx, - c, - color, - flipx,flipy, - sx & 0x1ff,sy, - cliprect,shadow ? TRANSPARENCY_PEN_TABLE : TRANSPARENCY_PEN,0, - (zw << 16) / 16,(zh << 16) / 16,pri);*/ - } - else - { - int i11 = 1; - /*drawgfxzoom(bitmap, K051960_gfx, - c, - color, - flipx, flipy, - sx & 0x1ff, sy, - cliprect, shadow ? TRANSPARENCY_PEN_TABLE : TRANSPARENCY_PEN, 0, - (zw << 16) / 16, (zh << 16) / 16);*/ - } - } - } - } - } - } - bm1.UnlockBits(bmData); - return bm1; - } - public static Bitmap GetFlag1() - { - int i1, i2, i3, i4, i5, i6, iOffset, iTile, iCode, iColor, iByte; - int pen_data_offset, palette_base; - Color c1 = new Color(); - Bitmap bm1 = new Bitmap(0x200, 0x100), bm2; - Graphics g = Graphics.FromImage(bm1); - g.Clear(Color.Transparent); - 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; - int x, y; - for (i3 = 0; i3 < 0x20; i3++) - { - for (i4 = 0; i4 < 0x40; i4++) - { - iCode = K052109_tilemap[1].tileflags[i3, i4]; - for (i1 = 0; i1 < 8; i1++) - { - for (i2 = 0; i2 < 8; i2++) - { - iByte = iCode; - if (iByte == 0) - { - c1 = Color.Transparent; - } - else - { - c1 = Color.Black;// Color.FromArgb((int)Palette.entry_color[palette_base + iByte]); - } - ptr2 = ptr + ((8 * i3 + i2) * 0x200 + 8 * i4 + 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 GetTile() - { - int i1,i2,i3,i4,i5,i6,iOffset,iTile,iCode,iColor,iByte; - int pen_data_offset, palette_base; - Color c1 = new Color(); - Bitmap bm1 = new Bitmap(0x200, 0x100), bm2; - Graphics g = Graphics.FromImage(bm1); - g.Clear(Color.Transparent); - 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; - int x, y; - for (i3 = 0; i3 < 0x10; i3++) - { - for (i4 = 0; i4 < 0x10; i4++) - { - iCode = 0x5300+ i4 * 0x10 + i3; - iColor = Konami68000.K052109_ram[Konami68000.K052109_colorram_B_offset + 0]; - pen_data_offset = iCode * 0x40; - palette_base = 0x10 * iColor; - for (i1 = 0; i1 < 8; i1++) - { - for (i2 = 0; i2 < 8; i2++) - { - iOffset = pen_data_offset + i2 * 0x08 + i1; - iByte = gfx12rom[iOffset]; - if (iByte == 0) - { - c1 = Color.Transparent; - } - else - { - c1 = Color.Black; - } - ptr2 = ptr + ((8 * i4 + i2) * 0x200 + 8 * i3 + 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 GetAllGDI() - { - string[] ss1, ss2, ss3; - int i1, i2, i3, i4, n1, n2; - lSprite.Clear(); - ss1 = Machine.FORM.konami68000form.tbSprite.Split(sde2, StringSplitOptions.RemoveEmptyEntries); - n1 = ss1.Length; - for (i1 = 0; i1 < n1; i1++) - { - ss2 = ss1[i1].Split(sde6, StringSplitOptions.RemoveEmptyEntries); - n2 = ss2.Length; - if (n2 == 1) - { - i3 = Convert.ToInt32(ss2[0], 16); - i4 = i3; - } - else - { - i3 = Convert.ToInt32(ss2[0], 16); - i4 = Convert.ToInt32(ss2[1], 16); - } - for (i2 = i3; i2 <= i4; i2++) - { - lSprite.Add(i2); - } - } - ss3 = Machine.FORM.neogeoform.tbPoint.Split(sde2, StringSplitOptions.RemoveEmptyEntries); - Bitmap bm1 = new Bitmap(0x200, 0x100), bm2; - Graphics g = Graphics.FromImage(bm1); - Color c1 = Color.FromArgb((int)Palette.entry_color[16 * bg_colorbase]); - g.Clear(c1); - if (bTile0) - { - bm2 = GetTilemaps[sorted_layer[0]](); - short scrollx, scrolly; - scrollx = (short)(-K052109_tilemap[sorted_layer[0]].rowscroll[0]); - if (scrollx < 0) - { - scrollx = (short)(0x200 - (-scrollx) % 0x200); - } - else - { - scrollx %= 0x200; - } - scrolly = (short)(-K052109_tilemap[sorted_layer[0]].colscroll[0]); - if (scrolly < 0) - { - scrolly = (short)(0x100 - (-scrolly) % 0x100); - } - else - { - scrolly %= 0x100; - } - g.DrawImage(bm2, scrollx - 0x200, scrolly); - g.DrawImage(bm2, scrollx, scrolly); - } - if (bTile1) - { - bm2 = GetTilemaps[sorted_layer[1]](); - short scrollx, scrolly; - scrollx = (short)(-K052109_tilemap[sorted_layer[1]].rowscroll[0]); - if (scrollx < 0) - { - scrollx = (short)(0x200 - (-scrollx) % 0x200); - } - else - { - scrollx %= 0x200; - } - scrolly = (short)(-K052109_tilemap[sorted_layer[1]].colscroll[0]); - if (scrolly < 0) - { - scrolly = (short)(0x100 - (-scrolly) % 0x100); - } - else - { - scrolly %= 0x100; - } - g.DrawImage(bm2, scrollx - 0x200, scrolly); - g.DrawImage(bm2, scrollx, scrolly); - } - if (bTile2) - { - bm2 = GetTilemaps[sorted_layer[2]](); - short scrollx, scrolly; - scrollx = (short)(-K052109_tilemap[sorted_layer[2]].rowscroll[0]); - if (scrollx < 0) - { - scrollx = (short)(0x200 - (-scrollx) % 0x200); - } - else - { - scrollx %= 0x200; - } - scrolly = (short)(-K052109_tilemap[sorted_layer[2]].colscroll[0]); - if (scrolly < 0) - { - scrolly = (short)(0x100 - (-scrolly) % 0x100); - } - else - { - scrolly %= 0x100; - } - g.DrawImage(bm2, scrollx - 0x200, scrolly); - g.DrawImage(bm2, scrollx, scrolly); - } - if (bSprite) - { - bm2 = GetSprite(); - g.DrawImage(bm2, 0, 0); - } - return bm1; } } } diff --git a/MAME.Core/mame/konami68000/Input.cs b/MAME.Core/mame/konami68000/Input.cs index 06e70c9..cbfe292 100644 --- a/MAME.Core/mame/konami68000/Input.cs +++ b/MAME.Core/mame/konami68000/Input.cs @@ -336,7 +336,7 @@ namespace mame { sbyte0 |= 0x02; } - if(Keyboard.IsPressed(Key.D1)) + if (Keyboard.IsPressed(Key.D1)) { sbyte0 &= ~0x10; } @@ -635,7 +635,7 @@ namespace mame { sbyte2 |= 0x40; } - if(Keyboard.IsPressed(Key.NumPad4)) + if (Keyboard.IsPressed(Key.NumPad4)) { sbyte2 &= unchecked((sbyte)~0x80); } @@ -1083,7 +1083,7 @@ namespace mame else { //sbyte1 |= 0x04; - } + } if (Keyboard.IsPressed(Key.Right)) { sbyte2 &= ~0x02; @@ -1380,7 +1380,7 @@ namespace mame } 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; sbyte1_old = sbyte1; diff --git a/MAME.Core/mame/konami68000/Konami68000.cs b/MAME.Core/mame/konami68000/Konami68000.cs index debc27e..789104f 100644 --- a/MAME.Core/mame/konami68000/Konami68000.cs +++ b/MAME.Core/mame/konami68000/Konami68000.cs @@ -1,15 +1,11 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using cpu.m68000; +using cpu.m68000; +using System; namespace mame { public partial class Konami68000 { - public static byte[] gfx1rom, gfx2rom, gfx12rom, gfx22rom,titlerom,user1rom,zoomrom; + public static byte[] gfx1rom, gfx2rom, gfx12rom, gfx22rom, titlerom, user1rom, zoomrom; public static byte dsw1, dsw2, dsw3, bytee; public static byte[] mainram2; public static short[] sampledata; @@ -29,7 +25,7 @@ namespace mame Memory.audioram = new byte[0x2000];//0x800 prmrsocr_0x2000 mainram2 = new byte[0x4000];//0x4000 tmnt2_ssriders_0x80 layer_colorbase = new int[3]; - cuebrick_nvram=new ushort[0x400*0x20]; + cuebrick_nvram = new ushort[0x400 * 0x20]; tmnt2_1c0800 = new ushort[0x10]; K053245_memory_region = new byte[2][]; K053244_rombank = new int[2]; @@ -65,7 +61,7 @@ namespace mame sorted_layer = new int[3]; Machine.bRom = true; Memory.mainrom = Machine.GetRom("maincpu.rom"); - Memory.audiorom = Machine.GetRom("audiocpu.rom"); + Memory.audiorom = Machine.GetRom("audiocpu.rom"); gfx1rom = Machine.GetRom("gfx1.rom"); n1 = gfx1rom.Length; gfx12rom = new byte[n1 * 2]; @@ -217,7 +213,7 @@ namespace mame dsw3 = 0x0f; K052109_callback = mia_tile_callback; K051960_callback = mia_sprite_callback; - break; + break; case "tmnt": case "tmntu": case "tmntua": @@ -295,7 +291,7 @@ namespace mame case "ssridersabd": case "ssridersjad": case "ssridersjac": - case "ssridersjbd": + case "ssridersjbd": K052109_callback = tmnt_tile_callback; K053245_callback = lgtnfght_sprite_callback; break; @@ -307,7 +303,7 @@ namespace mame K051960_callback = thndrx2_sprite_callback; break; case "prmrsocr": - case "prmrsocrj": + case "prmrsocrj": K052109_callback = tmnt_tile_callback; K053245_callback = prmrsocr_sprite_callback; break; @@ -327,17 +323,17 @@ namespace mame int offset1 = ((offset & 0x3000) >> 1) | (offset & 0x07ff); return K052109_word_r(offset1); } - public static void K052109_word_noA12_w(int offset,ushort data) + public static void K052109_word_noA12_w(int offset, ushort data) { int offset1; - offset1 = ((offset & 0x3000) >> 1) | (offset & 0x07ff); - K052109_word_w(offset1,data); + offset1 = ((offset & 0x3000) >> 1) | (offset & 0x07ff); + K052109_word_w(offset1, data); } public static void K052109_word_noA12_w1(int offset, byte data) { int offset1; offset1 = ((offset & 0x3000) >> 1) | (offset & 0x07ff); - K052109_w(offset1, data); + K052109_w(offset1, data); } public static void K052109_word_noA12_w2(int offset, byte data) { @@ -380,12 +376,12 @@ namespace mame ushort result; if ((offset & 0x0031) != 0) { - result= Generic.spriteram16[offset]; + result = Generic.spriteram16[offset]; } else { offset = ((offset & 0x000e) >> 1) | ((offset & 0x1fc0) >> 3); - result= K053245_word_r(offset); + result = K053245_word_r(offset); } return result; } @@ -426,13 +422,13 @@ namespace mame offset &= ~1; return (ushort)(K053244_r(offset + 1) | (K053244_r(offset) << 8)); } - public static void K053244_word_noA1_w(int offset,ushort data) + public static void K053244_word_noA1_w(int offset, ushort data) { offset &= ~1; //if (ACCESSING_BITS_8_15) - K053244_w(offset, (byte)((data >> 8) & 0xff)); + K053244_w(offset, (byte)((data >> 8) & 0xff)); //if (ACCESSING_BITS_0_7) - K053244_w(offset + 1, (byte)(data & 0xff)); + K053244_w(offset + 1, (byte)(data & 0xff)); } public static void K053244_word_noA1_w1(int offset, byte data) { @@ -461,7 +457,7 @@ namespace mame } public static void punkshot_interrupt() { - if (K052109_is_IRQ_enabled()!=0) + if (K052109_is_IRQ_enabled() != 0) { Generic.irq4_line_hold(0); } @@ -575,7 +571,7 @@ namespace mame Upd7759.upd7759_reset_w(0, (byte)(data & 2)); if ((data & 0x04) != 0) { - if (Sample.sample_playing(0)==0) + if (Sample.sample_playing(0) == 0) { Sample.sample_start_raw(0, sampledata, 0x40000, 20000, 0); } @@ -740,7 +736,7 @@ namespace mame //if (ACCESSING_BITS_0_7) { Eeprom.eeprom_write_bit(data & 0x01); - Eeprom.eeprom_set_cs_line((data & 0x02)!=0 ?LineState.CLEAR_LINE :LineState.ASSERT_LINE); + Eeprom.eeprom_set_cs_line((data & 0x02) != 0 ? LineState.CLEAR_LINE : LineState.ASSERT_LINE); Eeprom.eeprom_set_clock_line((data & 0x04) != 0 ? LineState.ASSERT_LINE : LineState.CLEAR_LINE); dim_c = data & 0x18; K053244_bankselect(0, ((data & 0x20) >> 5) << 2); @@ -770,7 +766,7 @@ namespace mame } public static ushort thndrx2_eeprom_r() { - int res; + int res; res = (Eeprom.eeprom_read_bit() << 8) | (ushort)((bytee << 8) | (byte)sbyte2); toggle ^= 0x0800; return (ushort)(res ^ toggle); @@ -780,15 +776,15 @@ namespace mame //if (ACCESSING_BITS_0_7) { Eeprom.eeprom_write_bit(data & 0x01); - Eeprom.eeprom_set_cs_line((data & 0x02)!=0 ? LineState.CLEAR_LINE : LineState.ASSERT_LINE); - Eeprom.eeprom_set_clock_line((data & 0x04)!=0 ? LineState.ASSERT_LINE : LineState.CLEAR_LINE); + Eeprom.eeprom_set_cs_line((data & 0x02) != 0 ? LineState.CLEAR_LINE : LineState.ASSERT_LINE); + Eeprom.eeprom_set_clock_line((data & 0x04) != 0 ? LineState.ASSERT_LINE : LineState.CLEAR_LINE); if (last == 0 && (data & 0x20) != 0) { Cpuint.cpunum_set_input_line(1, 0, LineState.HOLD_LINE); //cpunum_set_input_line_and_vector(machine, 1, 0, LineState.HOLD_LINE, 0xff); } last = data & 0x20; - K052109_set_RMRD_line((data & 0x40)!=0 ? LineState.ASSERT_LINE : LineState.CLEAR_LINE); + K052109_set_RMRD_line((data & 0x40) != 0 ? LineState.ASSERT_LINE : LineState.CLEAR_LINE); } } public static void thndrx2_eeprom_w2(byte data) @@ -806,7 +802,7 @@ namespace mame public static ushort prmrsocr_IN0_r() { ushort res; - res = (ushort)((sbyte0 << 8)|(byte)sbyte1); + res = (ushort)((sbyte0 << 8) | (byte)sbyte1); if (init_eeprom_count != 0) { init_eeprom_count--; @@ -926,7 +922,7 @@ namespace mame } public static byte tmnt2_get_byte(int addr) { - byte result=0; + byte result = 0; if (addr <= 0x07ffff) { result = Memory.mainrom[addr]; @@ -1205,7 +1201,7 @@ namespace mame { K054539.k054539_0_w(0x200 + offset, data); } - public static void volume_callback(int v) + public static void volume_callback(int v) { K007232.k007232_set_volume(0, 0, (v >> 4) * 0x11, 0); K007232.k007232_set_volume(0, 1, 0, (v & 0x0f) * 0x11); diff --git a/MAME.Core/mame/konami68000/Konamiic.cs b/MAME.Core/mame/konami68000/Konamiic.cs index 3f8a719..32d2941 100644 --- a/MAME.Core/mame/konami68000/Konamiic.cs +++ b/MAME.Core/mame/konami68000/Konamiic.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; +using System.IO; namespace mame { @@ -10,18 +6,18 @@ namespace mame { private static byte[] K052109_memory_region; public static int K052109_videoram_F_offset, K052109_videoram2_F_offset, K052109_colorram_F_offset, K052109_videoram_A_offset, K052109_videoram2_A_offset, K052109_colorram_A_offset, K052109_videoram_B_offset, K052109_videoram2_B_offset, K052109_colorram_B_offset; - public static byte[] K052109_ram,K052109_charrombank,K052109_charrombank_2; + public static byte[] K052109_ram, K052109_charrombank, K052109_charrombank_2; public static LineState K052109_RMRD_line; public static byte K052109_romsubbank, K052109_scrollctrl, K052109_irq_enabled, has_extra_video_ram; public static int[] K052109_dx, K052109_dy; - public static int K052109_tileflip_enable; - + public static int K052109_tileflip_enable; + public static byte[] K051960_memory_region; public static int K051960_romoffset, K051960_spriteflip, K051960_readroms; public static byte[] K051960_spriterombank, K051960_ram; public static int K051960_dx, K051960_dy; public static int K051960_irq_enabled, K051960_nmi_enabled; - + private static byte[][] K053245_memory_region; private static int K05324x_z_rejection; private static int[] K053244_rombank, K053245_ramsize, K053245_dx, K053245_dy; @@ -35,19 +31,19 @@ namespace mame public static int[] K053936_wraparound; public static byte[] K053251_ram; - public static int[] K053251_palette_index; - public static int K053251_tilemaps_set; + public static int[] K053251_palette_index; + public static int K053251_tilemaps_set; public static int counter; - public delegate void K052109_delegate(int tmap, int bank, int code, int color, int flags, int priority, out int code2, out int color2,out int flags2); + public delegate void K052109_delegate(int tmap, int bank, int code, int color, int flags, int priority, out int code2, out int color2, out int flags2); public static K052109_delegate K052109_callback; public delegate void K051960_delegate(int code, int color, int priority, int shadow, out int code2, out int color2, out int priority2); public static K051960_delegate K051960_callback; - public delegate void K053245_delegate(int code, int color,out int code2,out int color2,out int priority_mask); + public delegate void K053245_delegate(int code, int color, out int code2, out int color2, out int priority_mask); public static K053245_delegate K053245_callback; public static void K052109_vh_start() { - int i,j; + int i, j; K052109_RMRD_line = LineState.CLEAR_LINE; K052109_irq_enabled = 0; has_extra_video_ram = 0; @@ -97,7 +93,7 @@ namespace mame for (j = 1; j < 16; j++) { K052109_tilemap[i].pen_to_flags[0, j] = 0x10; - } + } K052109_tilemap[i].total_elements = gfx12rom.Length / 0x40; } K052109_tilemap[0].tile_update3 = K052109_tilemap[0].tile_updateKonami68000_0; @@ -118,19 +114,19 @@ namespace mame { int code = (offset & 0x1fff) >> 5; int color = K052109_romsubbank; - int code2,color2,flags2; + int code2, color2, flags2; int flags = 0; int priority = 0; int bank = K052109_charrombank[(color & 0x0c) >> 2] >> 2; int addr; bank |= (K052109_charrombank_2[(color & 0x0c) >> 2] >> 2); - if (has_extra_video_ram!=0) + if (has_extra_video_ram != 0) { code |= color << 8; } else { - K052109_callback(0, bank, code, color, flags, priority, out code2, out color2,out flags2); + K052109_callback(0, bank, code, color, flags, priority, out code2, out color2, out flags2); code = code2; color = color2; } @@ -171,7 +167,7 @@ namespace mame } else if (offset >= 0x1a00 && offset < 0x1c00) { - + } else if (offset == 0x1c80) { @@ -189,7 +185,7 @@ namespace mame int dirty = 0; if (K052109_charrombank[0] != (data & 0x0f)) dirty |= 1; if (K052109_charrombank[1] != ((data >> 4) & 0x0f)) dirty |= 2; - if (dirty!=0) + if (dirty != 0) { int i; K052109_charrombank[0] = (byte)(data & 0x0f); @@ -197,11 +193,11 @@ namespace mame for (i = 0; i < 0x1800; i++) { int bank = (K052109_ram[i] & 0x0c) >> 2; - if ((bank == 0 && ((dirty & 1)!=0) || (bank == 1 && ((dirty & 2)!=0)))) + if ((bank == 0 && ((dirty & 1) != 0) || (bank == 1 && ((dirty & 2) != 0)))) { - row=(i&0x7ff)/0x40; - col=(i&0x7ff)%0x40; - K052109_tilemap[(i & 0x1800) >> 11].tilemap_mark_tile_dirty(row,col); + row = (i & 0x7ff) / 0x40; + col = (i & 0x7ff) % 0x40; + K052109_tilemap[(i & 0x1800) >> 11].tilemap_mark_tile_dirty(row, col); //tilemap_mark_tile_dirty(K052109_tilemap[(i & 0x1800) >> 11], i & 0x7ff); } } @@ -219,9 +215,9 @@ namespace mame if (K052109_tileflip_enable != ((data & 0x06) >> 1)) { K052109_tileflip_enable = ((data & 0x06) >> 1); - K052109_tilemap[0].all_tiles_dirty=true; - K052109_tilemap[1].all_tiles_dirty=true; - K052109_tilemap[2].all_tiles_dirty=true; + K052109_tilemap[0].all_tiles_dirty = true; + K052109_tilemap[1].all_tiles_dirty = true; + K052109_tilemap[2].all_tiles_dirty = true; } } else if (offset == 0x1f00) @@ -229,7 +225,7 @@ namespace mame int dirty = 0; if (K052109_charrombank[2] != (data & 0x0f)) dirty |= 1; if (K052109_charrombank[3] != ((data >> 4) & 0x0f)) dirty |= 2; - if (dirty!=0) + if (dirty != 0) { int i; K052109_charrombank[2] = (byte)(data & 0x0f); @@ -237,11 +233,11 @@ namespace mame for (i = 0; i < 0x1800; i++) { int bank = (K052109_ram[i] & 0x0c) >> 2; - if ((bank == 2 && ((dirty & 1)!=0)) || (bank == 3 && ((dirty & 2)!=0))) + if ((bank == 2 && ((dirty & 1) != 0)) || (bank == 3 && ((dirty & 2) != 0))) { - row=(i&0x7ff)/0x40; - col=(i&0x7ff)%0x40; - K052109_tilemap[(i & 0x1800) >> 11].tilemap_mark_tile_dirty(row,col); + row = (i & 0x7ff) / 0x40; + col = (i & 0x7ff) % 0x40; + K052109_tilemap[(i & 0x1800) >> 11].tilemap_mark_tile_dirty(row, col); //tilemap_mark_tile_dirty(K052109_tilemap[(i & 0x1800) >> 11], i & 0x7ff); } } @@ -270,7 +266,7 @@ namespace mame public static ushort K052109_word_r(int offset) { return (ushort)(K052109_r(offset + 0x2000) | (K052109_r(offset) << 8)); - } + } public static void K052109_word_w(int offset, ushort data) { K052109_w(offset, (byte)((data >> 8) & 0xff)); @@ -446,7 +442,7 @@ namespace mame K052109_charrombank_2 = reader.ReadBytes(4); for (i = 0; i < 3; i++) { - K052109_dx[i]=reader.ReadInt32(); + K052109_dx[i] = reader.ReadInt32(); } for (i = 0; i < 3; i++) { @@ -484,7 +480,7 @@ namespace mame } public static byte K051960_fetchromdata(int byte1) { - int code, color, pri, shadow, off1, addr, code2, color2,pri2; + int code, color, pri, shadow, off1, addr, code2, color2, pri2; addr = K051960_romoffset + (K051960_spriterombank[0] << 8) + ((K051960_spriterombank[1] & 0x03) << 16); code = (addr & 0x3ffe0) >> 5; @@ -492,7 +488,7 @@ namespace mame color = ((K051960_spriterombank[1] & 0xfc) >> 2) + ((K051960_spriterombank[2] & 0x03) << 6); pri = 0; shadow = color & 0x80; - K051960_callback(code, color, pri, shadow, out code2, out color2,out pri2); + K051960_callback(code, color, pri, shadow, out code2, out color2, out pri2); addr = (code2 << 7) | (off1 << 2) | byte1; addr &= K051960_memory_region.Length - 1; return K051960_memory_region[addr]; @@ -515,7 +511,7 @@ namespace mame } public static byte K051937_r(int offset) { - if (K051960_readroms!=0 && offset >= 4 && offset < 8) + if (K051960_readroms != 0 && offset >= 4 && offset < 8) { return K051960_fetchromdata(offset & 3); } @@ -730,9 +726,9 @@ namespace mame { writer.Write(K051960_romoffset); writer.Write(K051960_spriteflip); - writer.Write(K051960_readroms); - writer.Write(K051960_spriterombank,0,3); - writer.Write(K051960_ram,0, 0x400); + writer.Write(K051960_readroms); + writer.Write(K051960_spriterombank, 0, 3); + writer.Write(K051960_ram, 0, 0x400); writer.Write(K051960_dx); writer.Write(K051960_dy); writer.Write(K051960_irq_enabled); @@ -821,11 +817,11 @@ namespace mame } public static byte K053244_chip_r(int chip, int offset) { - if ((K053244_regs[chip][5] & 0x10)!=0 && offset >= 0x0c && offset < 0x10) + if ((K053244_regs[chip][5] & 0x10) != 0 && offset >= 0x0c && offset < 0x10) { int addr; - addr = (K053244_rombank[chip] << 19) | ((K053244_regs[chip][11] & 0x7) << 18)| (K053244_regs[chip][8] << 10) | (K053244_regs[chip][9] << 2)| ((offset & 3) ^ 1); - addr &= K053245_memory_region[chip].Length - 1; + addr = (K053244_rombank[chip] << 19) | ((K053244_regs[chip][11] & 0x7) << 18) | (K053244_regs[chip][8] << 10) | (K053244_regs[chip][9] << 2) | ((offset & 3) ^ 1); + addr &= K053245_memory_region[chip].Length - 1; return K053245_memory_region[chip][addr]; } else if (offset == 0x06) @@ -1234,7 +1230,7 @@ namespace mame } public static void SaveStateBinary_K053936(BinaryWriter writer) { - int i,j; + int i, j; for (i = 0; i < 0x10; i++) { writer.Write(K053936_0_ctrl[i]); @@ -1243,9 +1239,9 @@ namespace mame { writer.Write(K053936_0_linectrl[i]); } - for(i=0;i<2;i++) + for (i = 0; i < 2; i++) { - for(j=0;j<2;j++) + for (j = 0; j < 2; j++) { writer.Write(K053936_offset[i][j]); } @@ -1257,7 +1253,7 @@ namespace mame } public static void LoadStateBinary_K053936(BinaryReader reader) { - int i,j; + int i, j; for (i = 0; i < 0x10; i++) { K053936_0_ctrl[i] = reader.ReadUInt16(); @@ -1354,7 +1350,7 @@ namespace mame public static void K053251_lsb_w(int offset, ushort data) { //if (ACCESSING_BITS_0_7) - K053251_w(offset, (byte)(data & 0xff)); + K053251_w(offset, (byte)(data & 0xff)); } public static void K053251_lsb_w2(int offset, byte data) { @@ -1460,7 +1456,7 @@ namespace mame public static void K054000_lsb_w(int offset, ushort data) { //if (ACCESSING_BITS_0_7) - K054000_w(offset,(byte)(data & 0xff)); + K054000_w(offset, (byte)(data & 0xff)); } public static void K054000_lsb_w2(int offset, byte data) { diff --git a/MAME.Core/mame/konami68000/Memory.cs b/MAME.Core/mame/konami68000/Memory.cs index 51e7570..40120cf 100644 --- a/MAME.Core/mame/konami68000/Memory.cs +++ b/MAME.Core/mame/konami68000/Memory.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using cpu.z80; +using cpu.z80; namespace mame { @@ -28,7 +24,7 @@ namespace mame } else if (address >= 0x040000 && address <= 0x043fff) { - int offset=address-0x040000; + int offset = address - 0x040000; result = (sbyte)Memory.mainram[offset]; } else if (address >= 0x060000 && address <= 0x063fff) @@ -143,7 +139,7 @@ namespace mame } else if (address >= 0x0b0000 && address <= 0x0b03ff) { - int offset=(address-0x0b0000)/2; + int offset = (address - 0x0b0000) / 2; if (address % 2 == 0) { result = (sbyte)cuebrick_nv_r1(offset); @@ -494,13 +490,13 @@ namespace mame if (address >= 0x040000 && address + 1 <= 0x043fff) { int offset = address - 0x040000; - Memory.mainram[offset] = (byte)(value>>8); - Memory.mainram[offset+1] = (byte)value; + Memory.mainram[offset] = (byte)(value >> 8); + Memory.mainram[offset + 1] = (byte)value; } else if (address >= 0x060000 && address + 1 <= 0x063fff) { int offset = address - 0x060000; - mainram2[offset] = (byte)(value>>8); + mainram2[offset] = (byte)(value >> 8); mainram2[offset + 1] = (byte)value; } else if (address >= 0x080000 && address + 1 <= 0x080fff) @@ -543,14 +539,14 @@ namespace mame else if (address >= 0x140000 && address + 1 <= 0x140007) { int offset = address - 0x140000; - K051937_w(offset, (byte)(value>>8)); - K051937_w(offset+1, (byte)value); + K051937_w(offset, (byte)(value >> 8)); + K051937_w(offset + 1, (byte)value); } else if (address >= 0x140400 && address + 1 <= 0x1407ff) { int offset = address - 0x140400; - K051960_w(offset, (byte)(value>>8)); - K051960_w(offset+1, (byte)value); + K051960_w(offset, (byte)(value >> 8)); + K051960_w(offset + 1, (byte)value); } } public static void MWriteLong_cuebrick(int address, int value) @@ -791,7 +787,7 @@ namespace mame { int offset = address - 0x060000; result = (short)(mainram2[offset] * 0x100 + mainram2[offset + 1]); - } + } return result; } public static short MReadWord_mia(int address) @@ -1438,7 +1434,7 @@ namespace mame } return result; } - public static void MWriteByte_tmnt(int address,sbyte value) + public static void MWriteByte_tmnt(int address, sbyte value) { address &= 0xffffff; if (address >= 0x060000 && address <= 0x063fff) @@ -1460,7 +1456,7 @@ namespace mame } else if (address >= 0x0a0000 && address <= 0x0a0001) { - if(address%2==0) + if (address % 2 == 0) { } @@ -1468,7 +1464,7 @@ namespace mame { tmnt_0a0000_w2((byte)value); } - } + } else if (address >= 0x0a0008 && address <= 0x0a0009) { if (address % 2 == 0) @@ -1503,7 +1499,7 @@ namespace mame else if (address >= 0x140000 && address <= 0x140007) { int offset = address - 0x140000; - K051937_w(offset,(byte)value); + K051937_w(offset, (byte)value); } else if (address >= 0x140400 && address <= 0x1407ff) { @@ -1700,9 +1696,9 @@ namespace mame else if (address >= 0x0a0040 && address <= 0x0a0043) { int offset = (address - 0x0a0040) / 2; - if(address%2==0) + if (address % 2 == 0) { - result=(sbyte)0; + result = (sbyte)0; } else if (address % 2 == 1) { @@ -1755,8 +1751,8 @@ namespace mame else if (address >= 0x080000 && address + 1 <= 0x083fff) { int offset = address - 0x080000; - result = (short)(Memory.mainram[offset]*0x100+Memory.mainram[offset+1]); - } + result = (short)(Memory.mainram[offset] * 0x100 + Memory.mainram[offset + 1]); + } return result; } public static short MReadWord_punkshot(int address) @@ -1872,7 +1868,7 @@ namespace mame else if (address >= 0x090000 && address + 3 <= 0x090fff) { int offset = (address - 0x090000) / 2; - result = (int)(Generic.paletteram16[offset]*0x10000+Generic.paletteram16[offset+1]); + result = (int)(Generic.paletteram16[offset] * 0x10000 + Generic.paletteram16[offset + 1]); } else if (address >= 0x0a0040 && address + 3 <= 0x0a0043) { @@ -1882,12 +1878,12 @@ namespace mame else if (address >= 0x100000 && address + 3 <= 0x107fff) { int offset = (address - 0x100000) / 2; - result = (int)(K052109_word_noA12_r(offset)*0x10000+K052109_word_noA12_r(offset+1)); + result = (int)(K052109_word_noA12_r(offset) * 0x10000 + K052109_word_noA12_r(offset + 1)); } else if (address >= 0x110000 && address + 3 <= 0x110007) { int offset = address - 0x110000; - result = (int)(K051937_r(offset) * 0x1000000 + K051937_r(offset + 1)*0x10000+K051937_r(offset +2)*0x100+K051937_r(offset +3)); + result = (int)(K051937_r(offset) * 0x1000000 + K051937_r(offset + 1) * 0x10000 + K051937_r(offset + 2) * 0x100 + K051937_r(offset + 3)); } else if (address >= 0x110400 && address + 3 <= 0x1107ff) { @@ -1987,8 +1983,8 @@ namespace mame if (address >= 0x080000 && address + 1 <= 0x083fff) { int offset = address - 0x080000; - Memory.mainram[offset] = (byte)(value>>8); - Memory.mainram[offset+1] = (byte)value; + Memory.mainram[offset] = (byte)(value >> 8); + Memory.mainram[offset + 1] = (byte)value; } else if (address >= 0x090000 && address + 1 <= 0x090fff) { @@ -2037,27 +2033,27 @@ namespace mame { int offset = address - 0x080000; Memory.mainram[offset] = (byte)(value >> 24); - Memory.mainram[offset + 1] = (byte)(value>>16); - Memory.mainram[offset+2] = (byte)(value >> 8); + Memory.mainram[offset + 1] = (byte)(value >> 16); + Memory.mainram[offset + 2] = (byte)(value >> 8); Memory.mainram[offset + 3] = (byte)value; } else if (address >= 0x090000 && address + 3 <= 0x090fff) { int offset = (address - 0x090000) / 2; - Generic.paletteram16_xBBBBBGGGGGRRRRR_word_w(offset, (ushort)(value>>16)); - Generic.paletteram16_xBBBBBGGGGGRRRRR_word_w(offset+1, (ushort)value); + Generic.paletteram16_xBBBBBGGGGGRRRRR_word_w(offset, (ushort)(value >> 16)); + Generic.paletteram16_xBBBBBGGGGGRRRRR_word_w(offset + 1, (ushort)value); } else if (address >= 0x0a0060 && address + 3 <= 0x0a007f) { int offset = (address - 0x0a0060) / 2; - K053251_lsb_w(offset, (ushort)(value>>16)); - K053251_lsb_w(offset+1, (ushort)value); + K053251_lsb_w(offset, (ushort)(value >> 16)); + K053251_lsb_w(offset + 1, (ushort)value); } else if (address >= 0x100000 && address + 3 <= 0x107fff) { int offset = (address - 0x100000) / 2; - punkshot_K052109_word_noA12_w(offset, (ushort)(value>>16)); - punkshot_K052109_word_noA12_w(offset+1, (ushort)value); + punkshot_K052109_word_noA12_w(offset, (ushort)(value >> 16)); + punkshot_K052109_word_noA12_w(offset + 1, (ushort)value); } else if (address >= 0x110000 && address + 3 <= 0x110007) { @@ -2466,7 +2462,7 @@ namespace mame int offset = (address - 0x0b0000) / 2; if (address % 2 == 0) { - K053245_scattered_word_w1(offset,(byte)value); + K053245_scattered_word_w1(offset, (byte)value); } else if (address % 2 == 1) { @@ -2478,7 +2474,7 @@ namespace mame int offset = (address - 0x0c0000) / 2; if (address % 2 == 0) { - K053244_word_noA1_w1(offset,(byte)value); + K053244_word_noA1_w1(offset, (byte)value); } else if (address % 2 == 1) { @@ -2490,7 +2486,7 @@ namespace mame int offset = (address - 0x0e0000) / 2; if (address % 2 == 0) { - + } else if (address % 2 == 1) { @@ -2502,7 +2498,7 @@ namespace mame int offset = (address - 0x100000) / 2; if (address % 2 == 0) { - K052109_word_noA12_w1(offset,(byte)value); + K052109_word_noA12_w1(offset, (byte)value); } else if (address % 2 == 1) { @@ -2521,8 +2517,8 @@ namespace mame else if (address >= 0x090000 && address + 1 <= 0x093fff) { int offset = address - 0x090000; - Memory.mainram[offset] = (byte)(value>>8); - Memory.mainram[offset+1] = (byte)value; + Memory.mainram[offset] = (byte)(value >> 8); + Memory.mainram[offset + 1] = (byte)value; } else if (address >= 0x0a0018 && address + 1 <= 0x0a0019) { @@ -3443,9 +3439,9 @@ namespace mame int offset = address - 0x8000; result = Memory.audioram[offset]; } - else if(address==0xa001) + else if (address == 0xa001) { - result=YM2151.ym2151_status_port_0_r(); + result = YM2151.ym2151_status_port_0_r(); } else if (address >= 0xc000 && address <= 0xc02f) { diff --git a/MAME.Core/mame/konami68000/Memory2.cs b/MAME.Core/mame/konami68000/Memory2.cs index 1869bfd..e0a8037 100644 --- a/MAME.Core/mame/konami68000/Memory2.cs +++ b/MAME.Core/mame/konami68000/Memory2.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using cpu.z80; - -namespace mame +namespace mame { public partial class Konami68000 { @@ -649,9 +643,9 @@ namespace mame { result = (sbyte)(K053936_0_linectrl[offset] >> 8); } - else if(address%2==1) + else if (address % 2 == 1) { - result= (sbyte)K053936_0_linectrl[offset]; + result = (sbyte)K053936_0_linectrl[offset]; } } else if (address >= 0x114000 && address <= 0x11401f) @@ -920,7 +914,7 @@ namespace mame else if (address >= 0x10c000 && address + 3 <= 0x10cfff) { int offset = (address - 0x10c000) / 2; - result = (int)(K053936_0_linectrl[offset]*0x10000+K053936_0_linectrl[offset+1]); + result = (int)(K053936_0_linectrl[offset] * 0x10000 + K053936_0_linectrl[offset + 1]); } else if (address >= 0x114000 && address + 3 <= 0x11401f) { @@ -1155,8 +1149,8 @@ namespace mame else if (address >= 0x104000 && address + 3 <= 0x107fff) { int offset = (address - 0x104000) / 2; - K053245_scattered_word_w(offset, (ushort)(value>>16)); - K053245_scattered_word_w(offset+1, (ushort)value); + K053245_scattered_word_w(offset, (ushort)(value >> 16)); + K053245_scattered_word_w(offset + 1, (ushort)value); } else if (address >= 0x108000 && address + 3 <= 0x108fff) { @@ -1369,7 +1363,7 @@ namespace mame } else { - result=(sbyte)tmnt2_sound_r(offset); + result = (sbyte)tmnt2_sound_r(offset); } } else if (address >= 0x600000 && address <= 0x603fff) @@ -2086,7 +2080,7 @@ namespace mame else if (address >= 0x500000 && address + 3 <= 0x50003f) { int offset = (address - 0x500000) / 2; - result = (int)(K054000_lsb_r(offset)*0x10000+K054000_lsb_r(offset+1)); + result = (int)(K054000_lsb_r(offset) * 0x10000 + K054000_lsb_r(offset + 1)); } else if (address >= 0x600000 && address + 3 <= 0x607fff) { @@ -2162,7 +2156,7 @@ namespace mame } else if (address >= 0x500100 && address <= 0x500101) { - if(address%2==0) + if (address % 2 == 0) { } @@ -2281,14 +2275,14 @@ namespace mame else if (address >= 0x500000 && address + 3 <= 0x50003f) { int offset = (address - 0x500000) / 2; - K054000_lsb_w(offset, (ushort)(value>>16)); - K054000_lsb_w(offset+1, (ushort)value); + K054000_lsb_w(offset, (ushort)(value >> 16)); + K054000_lsb_w(offset + 1, (ushort)value); } else if (address >= 0x600000 && address + 3 <= 0x607fff) { int offset = (address - 0x600000) / 2; K052109_word_noA12_w(offset, (ushort)(value >> 16)); - K052109_word_noA12_w(offset+1, (ushort)value); + K052109_word_noA12_w(offset + 1, (ushort)value); } else if (address >= 0x700000 && address + 3 <= 0x700007) { @@ -2403,7 +2397,7 @@ namespace mame { result = (sbyte)(prmrsocr_IN0_r() >> 8); } - else if(address%2==1) + else if (address % 2 == 1) { result = (sbyte)prmrsocr_IN0_r(); } @@ -2606,7 +2600,7 @@ namespace mame else if (address >= 0x114000 && address + 3 <= 0x11401f) { int offset = (address - 0x114000) / 2; - result = (int)(K053244_lsb_r(offset) * 0x10000 + K053244_lsb_r(offset+1)); + result = (int)(K053244_lsb_r(offset) * 0x10000 + K053244_lsb_r(offset + 1)); } else if (address >= 0x200000 && address + 3 <= 0x207fff) { @@ -2867,20 +2861,20 @@ namespace mame else if (address >= 0x118000 && address + 3 <= 0x11801f) { int offset = (address - 0x118000) / 2; - K053936_0_ctrl[offset] = (ushort)(value>>16); - K053936_0_ctrl[offset+1] = (ushort)value; + K053936_0_ctrl[offset] = (ushort)(value >> 16); + K053936_0_ctrl[offset + 1] = (ushort)value; } else if (address >= 0x11c000 && address + 3 <= 0x11c01f) { int offset = (address - 0x11c000) / 2; K053251_msb_w(offset, (ushort)(value >> 16)); - K053251_msb_w(offset+1, (ushort)value); + K053251_msb_w(offset + 1, (ushort)value); } else if (address >= 0x12100c && address + 3 <= 0x12100f) { int offset = (address - 0x12100c) / 2; prmrsocr_sound_cmd_w(offset, (ushort)(value >> 16)); - prmrsocr_sound_cmd_w(offset+1, (ushort)value); + prmrsocr_sound_cmd_w(offset + 1, (ushort)value); } else if (address >= 0x200000 && address + 3 <= 0x207fff) { @@ -3049,7 +3043,7 @@ namespace mame int offset = address - 0xc000; result = Memory.audioram[offset]; } - else if (address>=0xe000&&address<=0xe0ff) + else if (address >= 0xe000 && address <= 0xe0ff) { int offset = address - 0xe000; result = K054539.k054539_0_r(offset); @@ -3081,12 +3075,12 @@ namespace mame int offset = address - 0xc000; Memory.audioram[offset] = value; } - else if (address>=0xe000&&address<=0xe0ff) + else if (address >= 0xe000 && address <= 0xe0ff) { int offset = address - 0xe000; K054539.k054539_0_w(offset, value); } - else if (address >=0xe100&&address<=0xe12f) + else if (address >= 0xe100 && address <= 0xe12f) { int offset = address - 0xe100; k054539_0_ctrl_w(offset, value); diff --git a/MAME.Core/mame/konami68000/State.cs b/MAME.Core/mame/konami68000/State.cs index 9dbd911..f37fd1a 100644 --- a/MAME.Core/mame/konami68000/State.cs +++ b/MAME.Core/mame/konami68000/State.cs @@ -1,10 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using cpu.m68000; +using cpu.m68000; using cpu.z80; +using System.IO; namespace mame { @@ -705,7 +701,7 @@ namespace mame Sound.mixerstream.output_sampindex = reader.ReadInt32(); Sound.mixerstream.output_base_sampindex = reader.ReadInt32(); Eeprom.LoadStateBinary(reader); - } + } public static void SaveStateBinary_glfgreat(BinaryWriter writer) { int i; diff --git a/MAME.Core/mame/konami68000/Tilemap.cs b/MAME.Core/mame/konami68000/Tilemap.cs index ab31f3b..dd9b45f 100644 --- a/MAME.Core/mame/konami68000/Tilemap.cs +++ b/MAME.Core/mame/konami68000/Tilemap.cs @@ -1,16 +1,13 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; namespace mame { public partial class Konami68000 { - public static Tmap[] K052109_tilemap,K053251_tilemaps; + public static Tmap[] K052109_tilemap, K053251_tilemaps; public static void tilemap_init() { - + } } public partial class Tmap @@ -46,7 +43,7 @@ namespace mame int x_start = x1; int column; for (column = mincol; column <= maxcol; column++) - { + { int x_end; if (column == maxcol) { @@ -141,8 +138,8 @@ namespace mame color = (color & 0xf3) | ((bank & 0x03) << 2); bank >>= 2; flipy = color & 0x02; - int code2, color2,flags2; - Konami68000.K052109_callback(0, bank, code, color, flags, priority, out code2, out color2,out flags2); + int code2, color2, flags2; + Konami68000.K052109_callback(0, bank, code, color, flags, priority, out code2, out color2, out flags2); code = code2; color = color2; flags = flags2; @@ -182,8 +179,8 @@ namespace mame color = (color & 0xf3) | ((bank & 0x03) << 2); bank >>= 2; flipy = color & 0x02; - int code2, color2,flags2; - Konami68000.K052109_callback(1, bank, code, color, flags, priority, out code2, out color2,out flags2); + int code2, color2, flags2; + Konami68000.K052109_callback(1, bank, code, color, flags, priority, out code2, out color2, out flags2); code = code2; color = color2; flags = flags2; @@ -223,8 +220,8 @@ namespace mame color = (color & 0xf3) | ((bank & 0x03) << 2); bank >>= 2; flipy = color & 0x02; - int code2,color2,flags2; - Konami68000.K052109_callback(2, bank, code, color, flags, priority, out code2, out color2,out flags2); + int code2, color2, flags2; + Konami68000.K052109_callback(2, bank, code, color, flags, priority, out code2, out color2, out flags2); code = code2; color = color2; flags = flags2; diff --git a/MAME.Core/mame/konami68000/Video.cs b/MAME.Core/mame/konami68000/Video.cs index 64798fa..9de79ee 100644 --- a/MAME.Core/mame/konami68000/Video.cs +++ b/MAME.Core/mame/konami68000/Video.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; namespace mame { @@ -12,7 +8,7 @@ namespace mame private static int sprite_colorbase, bg_colorbase; private static int priorityflag; private static int dim_c, dim_v; - private static int lastdim, lasten,last; + private static int lastdim, lasten, last; private static int[] layerpri, sorted_layer; private static int blswhstl_rombank, glfgreat_pixel; private static int glfgreat_roz_rom_bank, glfgreat_roz_char_bank, glfgreat_roz_rom_mode, prmrsocr_sprite_bank; @@ -54,10 +50,10 @@ namespace mame public static void blswhstl_tile_callback(int layer, int bank, int code, int color, int flags, int priority, out int code2, out int color2, out int flags2) { flags2 = flags; - code2 = code| ((color & 0x01) << 8) | ((color & 0x10) << 5) | ((color & 0x0c) << 8) | (bank << 12) | blswhstl_rombank << 14; + code2 = code | ((color & 0x01) << 8) | ((color & 0x10) << 5) | ((color & 0x0c) << 8) | (bank << 12) | blswhstl_rombank << 14; color2 = layer_colorbase[layer] + ((color & 0xe0) >> 5); } - public static void mia_sprite_callback(int code, int color, int priority, int shadow, out int code2, out int color2,out int priority2) + public static void mia_sprite_callback(int code, int color, int priority, int shadow, out int code2, out int color2, out int priority2) { code2 = code; color2 = sprite_colorbase + (color & 0x0f); @@ -91,7 +87,7 @@ namespace mame code2 = code | ((color & 0x10) << 9); color2 = sprite_colorbase + (color & 0x0f); } - public static void thndrx2_sprite_callback(int code, int color,int proority,int shadow,out int code2,out int color2,out int priority_mask) + public static void thndrx2_sprite_callback(int code, int color, int proority, int shadow, out int code2, out int color2, out int priority_mask) { int pri = 0x20 | ((color & 0x60) >> 2); if (pri <= layerpri[2]) @@ -113,7 +109,7 @@ namespace mame code2 = code; color2 = sprite_colorbase + (color & 0x0f); } - public static void lgtnfght_sprite_callback(int code, int color,out int code2, out int color2, out int priority_mask) + public static void lgtnfght_sprite_callback(int code, int color, out int code2, out int color2, out int priority_mask) { int pri = 0x20 | ((color & 0x60) >> 2); if (pri <= layerpri[2]) @@ -201,7 +197,7 @@ namespace mame K052109_vh_start(); K053245_vh_start(); K05324x_set_z_rejection(0); - dim_c = dim_v = lastdim = lasten = 0; + dim_c = dim_v = lastdim = lasten = 0; } public static void video_start_blswhstl() { @@ -259,7 +255,7 @@ namespace mame public static void tmnt_paletteram_word_w1(int offset, byte data) { ushort data1; - Generic.paletteram16[offset] = (ushort)((data<<8) | (Generic.paletteram16[offset]&0xff)); + Generic.paletteram16[offset] = (ushort)((data << 8) | (Generic.paletteram16[offset] & 0xff)); offset &= ~1; data1 = (ushort)((Generic.paletteram16[offset] << 8) | Generic.paletteram16[offset + 1]); Palette.palette_set_callback(offset / 2, Palette.make_rgb(Palette.pal5bit((byte)(data1 >> 0)), Palette.pal5bit((byte)(data1 >> 5)), Palette.pal5bit((byte)(data1 >> 10)))); @@ -267,7 +263,7 @@ namespace mame public static void tmnt_paletteram_word_w2(int offset, byte data) { ushort data1; - Generic.paletteram16[offset] = (ushort)((Generic.paletteram16[offset]&0xff00)|data); + Generic.paletteram16[offset] = (ushort)((Generic.paletteram16[offset] & 0xff00) | data); offset &= ~1; data1 = (ushort)((Generic.paletteram16[offset] << 8) | Generic.paletteram16[offset + 1]); Palette.palette_set_callback(offset / 2, Palette.make_rgb(Palette.pal5bit((byte)(data1 >> 0)), Palette.pal5bit((byte)(data1 >> 5)), Palette.pal5bit((byte)(data1 >> 10)))); @@ -332,16 +328,16 @@ namespace mame public static void lgtnfght_0a0018_w(ushort data) { //if (ACCESSING_BITS_0_7) - { + { //coin_counter_w(0,data & 0x01); - //coin_counter_w(1,data & 0x02); - if (last == 0x00 && (data & 0x04) == 0x04) + //coin_counter_w(1,data & 0x02); + if (last == 0x00 && (data & 0x04) == 0x04) { - Cpuint.cpunum_set_input_line(1,0,LineState.HOLD_LINE); + Cpuint.cpunum_set_input_line(1, 0, LineState.HOLD_LINE); } - last = data & 0x04; - K052109_set_RMRD_line((data & 0x08)!=0 ? LineState.ASSERT_LINE : LineState.CLEAR_LINE); - } + last = data & 0x04; + K052109_set_RMRD_line((data & 0x08) != 0 ? LineState.ASSERT_LINE : LineState.CLEAR_LINE); + } } public static void lgtnfght_0a0018_w2(byte data) { @@ -459,7 +455,7 @@ namespace mame { //coin_counter_w(0,data & 0x01); //coin_counter_w(1,data & 0x02); - K052109_set_RMRD_line((data & 0x10)!=0 ? LineState.ASSERT_LINE : LineState.CLEAR_LINE); + K052109_set_RMRD_line((data & 0x10) != 0 ? LineState.ASSERT_LINE : LineState.CLEAR_LINE); prmrsocr_sprite_bank = (data & 0x40) >> 6; K053244_bankselect(0, prmrsocr_sprite_bank << 2); glfgreat_roz_char_bank = (data & 0x80) >> 7; diff --git a/MAME.Core/mame/m72/Audio.cs b/MAME.Core/mame/m72/Audio.cs index 475390d..42d5e52 100644 --- a/MAME.Core/mame/m72/Audio.cs +++ b/MAME.Core/mame/m72/Audio.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; - -namespace mame +namespace mame { public partial class M72 { @@ -78,7 +72,7 @@ namespace mame { Sound.soundlatch_w(data); Cpuint.lvec.Add(new vec(3, Timer.get_current_time())); - setvector_param = 3; + setvector_param = 3; Timer.emu_timer timer = Timer.timer_alloc_common(setvector_callback, "setvector_callback", true); Timer.timer_adjust_periodic(timer, Attotime.ATTOTIME_ZERO, Attotime.ATTOTIME_NEVER); } diff --git a/MAME.Core/mame/m72/Drawgfx.cs b/MAME.Core/mame/m72/Drawgfx.cs index 1192684..7515f67 100644 --- a/MAME.Core/mame/m72/Drawgfx.cs +++ b/MAME.Core/mame/m72/Drawgfx.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace mame +namespace mame { public partial class Drawgfx { diff --git a/MAME.Core/mame/m72/Gdi.cs b/MAME.Core/mame/m72/Gdi.cs index f138a36..55e1360 100644 --- a/MAME.Core/mame/m72/Gdi.cs +++ b/MAME.Core/mame/m72/Gdi.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Drawing; -using System.Drawing.Imaging; - -namespace mame +namespace mame { public partial class M72 { @@ -14,341 +7,5 @@ namespace mame { } - public static void GetData() - { - - } - public static Bitmap GetBG() - { - int i1, i2, iOffset, i3, i4, iOffset3 = 0; - int rows, cols, width, height; - int tilewidth, tileheight; - tilewidth = 8; - tileheight = tilewidth; - rows = 0x40; - cols = rows; - width = tilewidth * cols; - height = width; - int iByte; - int iCode, iCode1, iAttr; - int iColor, iFlag, iGroup; - int idx = 0, pri, pen_data_offset, palette_base; - int x0 = 0, y0 = 0, dx0 = 0, dy0 = 0, match; - 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++) - { - iOffset3 = (i4 * 0x40 + i3) * 2; - iCode = m72_videoram2[iOffset3*2]+m72_videoram2[iOffset3*2+1]*0x100; - iColor = m72_videoram2[(iOffset3 + 1) * 2]; - iAttr = m72_videoram2[(iOffset3 + 1) * 2 + 1]; - if ((iAttr & 0x01) != 0) - { - pri = 2; - } - else if ((iColor & 0x80) != 0) - { - pri = 1; - } - else - { - pri = 0; - } - iCode1 = iCode % bg_tilemap.total_elements; - pen_data_offset = iCode1 * 0x40; - palette_base = 0x100 + 0x10 * (iColor & 0x0f); - iFlag = (((iColor & 0x60) >> 5) & 3) ^ (bg_tilemap.attributes & 0x03); - if (iFlag == 0) - { - x0 = tilewidth * i3; - y0 = tileheight * i4; - dx0 = 1; - dy0 = 1; - } - else if (iFlag == 1) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4; - dx0 = -1; - dy0 = 1; - } - else if (iFlag == 2) - { - x0 = tilewidth * i3; - y0 = tileheight * i4 + tileheight - 1; - dx0 = 1; - dy0 = -1; - } - else if (iFlag == 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 = M72.gfx21rom[iOffset]; - if (iByte == 0) - { - c1 = Color.Transparent; - } - else - { - c1 = Color.FromArgb((int)Palette.entry_color[0x100 + 0x10 * (iColor & 0x0f) + 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() - { - int i1, i2, iOffset, i3, i4, iOffset3 = 0; - int rows, cols, width, height; - int tilewidth, tileheight; - tilewidth = 8; - tileheight = tilewidth; - rows = 0x40; - cols = rows; - width = tilewidth * cols; - height = width; - int iByte; - int iCode, iCode1, iAttr; - int iColor, iFlag, iGroup; - int idx = 0, pri, pen_data_offset, palette_base; - int x0 = 0, y0 = 0, dx0 = 0, dy0 = 0, match,y0offset; - 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++) - { - iOffset3 = (i4 * 0x40 + i3) * 2; - iCode = m72_videoram1[iOffset3 * 2] + m72_videoram1[iOffset3 * 2 + 1] * 0x100; - iColor = m72_videoram1[(iOffset3 + 1) * 2]; - iAttr = m72_videoram1[(iOffset3 + 1) * 2 + 1]; - if ((iAttr & 0x01) != 0) - { - pri = 2; - } - else if ((iColor & 0x80) != 0) - { - pri = 1; - } - else - { - pri = 0; - } - if (pri == 0) - { - y0offset = 0;// 0x90; - } - else - { - y0offset = 0; - } - iCode1 = iCode % bg_tilemap.total_elements; - pen_data_offset = iCode1 * 0x40; - palette_base = 0x100 + 0x10 * (iColor & 0x0f); - iFlag = (((iColor & 0x60) >> 5) & 3) ^ (bg_tilemap.attributes & 0x03); - if (iFlag == 0) - { - x0 = tilewidth * i3; - y0 = y0offset + tileheight * i4; - dx0 = 1; - dy0 = 1; - } - else if (iFlag == 1) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = y0offset + tileheight * i4; - dx0 = -1; - dy0 = 1; - } - else if (iFlag == 2) - { - x0 = tilewidth * i3; - y0 = y0offset+ tileheight * i4 + tileheight - 1; - dx0 = 1; - dy0 = -1; - } - else if (iFlag == 3) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = y0offset + 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 = M72.gfx21rom[iOffset]; - if (iByte == 0) - { - c1 = Color.Transparent; - } - else - { - c1 = Color.FromArgb((int)Palette.entry_color[0x100 + 0x10 * (iColor & 0x0f) + iByte]); - } - ptr2 = ptr + (((y0 + dy0 * i2)%0x200) * 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 n1,int n2) - { - Bitmap bm1 = new Bitmap(512, 512); - Color c1; - int offs; - int x0, y0, dx0, dy0, i5, i6,startx,starty,xdir,ydir; - offs = 0; - while (offs < 0x400 / 2) - { - int code, color, sx, sy, flipx, flipy, w, h, x, y; - code = m72_spriteram[offs + 1]; - color = m72_spriteram[offs + 2] & 0x0f; - sx = -256 + (m72_spriteram[offs + 3] & 0x3ff); - sy = 384 - (m72_spriteram[offs + 0] & 0x1ff); - flipx = m72_spriteram[offs + 2] & 0x0800; - flipy = m72_spriteram[offs + 2] & 0x0400; - w = 1 << ((m72_spriteram[offs + 2] & 0xc000) >> 14); - h = 1 << ((m72_spriteram[offs + 2] & 0x3000) >> 12); - sy -= 16 * h; - if (offs >= n1 && offs <= n2) - { - /*if (flip_screen_get()) - { - sx = 512 - 16 * w - sx; - sy = 284 - 16 * h - sy; - flipx = !flipx; - flipy = !flipy; - }*/ - if (flipy != 0) - { - starty = 15; - ydir = -1; - } - else - { - starty = 0; - ydir = 1; - } - if (flipx != 0) - { - startx = 15; - xdir = -1; - } - else - { - startx = 0; - xdir = 1; - } - for (x = 0; x < w; x++) - { - for (y = 0; y < h; y++) - { - int c = code; - if (flipx != 0) - { - c += 8 * (w - 1 - x); - } - else - { - c += 8 * x; - } - if (flipy != 0) - { - c += h - 1 - y; - } - else - { - c += y; - } - for (i5 = 0; i5 < 16; i5++) - { - for (i6 = 0; i6 < 16; i6++) - { - if (sprites1rom[c * 0x100 + i6 * 0x10 + i5] == 0) - { - c1 = Color.Transparent; - } - else - { - if (sx + 16 * x + i5 >= 0 && sx + 0x10 * x + i5 < 0x200) - { - c1 = Color.FromArgb((int)Palette.entry_color[0x10 * color + sprites1rom[c * 0x100 + i6 * 0x10 + i5]]); - bm1.SetPixel((0x200 + sx + 0x10 * x + startx + i5 * xdir) % 0x200, sy + 0x10 * y + starty + i6 * ydir, c1); - } - } - } - } - } - } - } - offs += w * 4; - } - return bm1; - } - public static Bitmap GetAllGDI(int n1, int n2) - { - Bitmap bm1 = new Bitmap(0x200, 0x200), bm2; - Graphics g = Graphics.FromImage(bm1); - g.Clear(Color.Transparent); - if (bBg) - { - bm2 = GetBG(); - g.DrawImage(bm2, 0, 0); - } - if (bFg) - { - bm2 = GetFg(); - g.DrawImage(bm2, 0, 0); - } - if (bSprite) - { - bm2 = GetSprite(n1, n2); - g.DrawImage(bm2, -0x40, 0); - } - return bm1; - } } } diff --git a/MAME.Core/mame/m72/M72.cs b/MAME.Core/mame/m72/M72.cs index 8ee8faa..d1d513b 100644 --- a/MAME.Core/mame/m72/M72.cs +++ b/MAME.Core/mame/m72/M72.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using cpu.nec; namespace mame { @@ -13,7 +9,7 @@ namespace mame public static byte m72_irq_base; public static int m72_scanline_param; - public static byte[] spritesrom,sprites1rom, samplesrom,gfx2rom, gfx21rom,gfx3rom,gfx31rom; + public static byte[] spritesrom, sprites1rom, samplesrom, gfx2rom, gfx21rom, gfx3rom, gfx31rom; public static byte[] airduelm72_code = new byte[] { 0x68, 0x00, 0xd0, 0x1f, 0xc6, 0x06, 0xc0, 0x1c, 0x57, 0xea, 0x69, 0x0b, 0x00, 0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, @@ -23,7 +19,7 @@ namespace mame 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 }; public static byte[] gunforce_decryption_table = new byte[256] { - 0xff,0x90,0x90,0x2c,0x90,0x90,0x43,0x88, 0x90,0x13,0x0a,0xbd,0xba,0x60,0xea,0x90, /* 00 */ + 0xff,0x90,0x90,0x2c,0x90,0x90,0x43,0x88, 0x90,0x13,0x0a,0xbd,0xba,0x60,0xea,0x90, /* 00 */ 0x90,0x90,0xf2,0x29,0xb3,0x22,0x90,0x0c, 0xa9,0x5f,0x9d,0x07,0x90,0x90,0x0b,0xbb, /* 10 */ 0x8a,0x90,0x90,0x90,0x3a,0x3c,0x5a,0x38, 0x99,0x90,0xf8,0x89,0x90,0x91,0x90,0x55, /* 20 */ 0xac,0x40,0x73,0x90,0x59,0x90,0xfc,0x90, 0x50,0xfa,0x90,0x25,0x90,0x34,0x47,0xb7, /* 30 */ @@ -43,7 +39,7 @@ namespace mame public static byte[] airduelm72_crc = new byte[] { 0x72, 0x9c, 0xca, 0x85, 0xc9, 0x12, 0xcc, 0xea, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; public static void M72Init() { - int i1, i2,i3, n1, n2,n3; + int i1, i2, i3, n1, n2, n3; Generic.paletteram16 = new ushort[0x600]; Generic.paletteram16_2 = new ushort[0x600]; Generic.spriteram16 = new ushort[0x200]; @@ -123,7 +119,7 @@ namespace mame public static void fake_nmi() { byte sample = m72_sample_r(); - if (sample!=0) + if (sample != 0) { m72_sample_w(sample); } @@ -131,8 +127,8 @@ namespace mame public static void airduelm72_sample_trigger_w(byte data) { int[] a = new int[16]{ - 0x00000, 0x00020, 0x03ec0, 0x05640, 0x06dc0, 0x083a0, 0x0c000, 0x0eb60, - 0x112e0, 0x13dc0, 0x16520, 0x16d60, 0x18ae0, 0x1a5a0, 0x1bf00, 0x1c340 + 0x00000, 0x00020, 0x03ec0, 0x05640, 0x06dc0, 0x083a0, 0x0c000, 0x0eb60, + 0x112e0, 0x13dc0, 0x16520, 0x16d60, 0x18ae0, 0x1a5a0, 0x1bf00, 0x1c340 }; if ((data & 0xff) < 16) { diff --git a/MAME.Core/mame/m72/Memory.cs b/MAME.Core/mame/m72/Memory.cs index 6637358..884b816 100644 --- a/MAME.Core/mame/m72/Memory.cs +++ b/MAME.Core/mame/m72/Memory.cs @@ -1,14 +1,8 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; - -namespace mame +namespace mame { public partial class M72 { - public static ushort ushort0,ushort1,dsw; + public static ushort ushort0, ushort1, dsw; public static ushort ushort0_old, ushort1_old; public static byte NReadOpByte(int address) { @@ -157,7 +151,7 @@ namespace mame public static void NWriteWord_m72(int address, ushort value) { address &= 0xfffff; - if (address >= 0xa0000 && address+1 <= 0xa3fff) + if (address >= 0xa0000 && address + 1 <= 0xa3fff) { Memory.mainram[address - 0xa0000] = (byte)value; Memory.mainram[address - 0xa0000 + 1] = (byte)(value >> 8); @@ -189,7 +183,7 @@ namespace mame } else if (address >= 0xe0000 && address + 1 <= 0xeffff) { - int offset = (address - 0xe0000)/2; + int offset = (address - 0xe0000) / 2; soundram_w(offset, value); } } @@ -228,7 +222,7 @@ namespace mame return result; } public static void NWriteIOByte_m72(int address, byte value) - { + { if (address >= 0x00 && address <= 0x01) { m72_sound_command_w(0, value); @@ -358,7 +352,7 @@ namespace mame } else if (address >= 0x80000 && address + 1 <= 0x83fff) { - int offset=address-0x80000; + int offset = address - 0x80000; result = (ushort)(m72_videoram1[offset] + m72_videoram1[offset + 1] * 0x100); } else if (address >= 0x84000 && address + 1 <= 0x87fff) @@ -406,7 +400,7 @@ namespace mame } else if (address >= 0xa0000 && address <= 0xa0bff) { - int offset=(address-0xa0000)/2; + int offset = (address - 0xa0000) / 2; m72_palette1_w(offset, value); } else if (address >= 0xa8000 && address <= 0xa8bff) @@ -426,7 +420,7 @@ namespace mame { int offset = (address - 0xc0000) / 2; Generic.spriteram16[offset] = value; - } + } else if (address >= 0xe0000 && address <= 0xe3fff) { Memory.mainram[address - 0xe0000] = value; @@ -445,7 +439,7 @@ namespace mame int offset = (address - 0x84000) / 2; m72_videoram2_w(offset, value); } - else if (address >= 0xa0000 && address+1 <= 0xa0bff) + else if (address >= 0xa0000 && address + 1 <= 0xa0bff) { int offset = (address - 0xa0000) / 2; m72_palette1_w(offset, value); @@ -467,7 +461,7 @@ namespace mame { int offset = (address - 0xc0000) / 2; Generic.spriteram16[offset] = value; - } + } else if (address >= 0xe0000 && address + 1 <= 0xe3fff) { Memory.mainram[address - 0xe0000] = (byte)value; @@ -612,7 +606,7 @@ namespace mame { result = (byte)Sound.soundlatch_r(); } - else if(address==0x84) + else if (address == 0x84) { result = m72_sample_r(); } diff --git a/MAME.Core/mame/m72/Memory2.cs b/MAME.Core/mame/m72/Memory2.cs index d4989ef..1f0c4a3 100644 --- a/MAME.Core/mame/m72/Memory2.cs +++ b/MAME.Core/mame/m72/Memory2.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; namespace mame { @@ -31,7 +27,7 @@ namespace mame { int offset = address - 0xb0ffa; Array.Copy(airduelm72_code, protection_ram, 96); - result= protection_ram[0xffa + offset]; + result = protection_ram[0xffa + offset]; } else if (address >= 0xb0000 && address <= 0xb0fff) { @@ -104,7 +100,7 @@ namespace mame } public static void NWriteIOWord_m72_airduel(int address, ushort data) { - if (address >= 0xc0 && address+1 <= 0xc1) + if (address >= 0xc0 && address + 1 <= 0xc1) { airduelm72_sample_trigger_w((byte)data); } diff --git a/MAME.Core/mame/m72/State.cs b/MAME.Core/mame/m72/State.cs index 00df566..1e3ba17 100644 --- a/MAME.Core/mame/m72/State.cs +++ b/MAME.Core/mame/m72/State.cs @@ -1,10 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using cpu.nec; +using cpu.nec; using cpu.z80; +using System.IO; namespace mame { @@ -17,7 +13,7 @@ namespace mame writer.Write(setvector_param); writer.Write(irqvector); writer.Write(sample_addr); - writer.Write(protection_ram,0,0x1000); + writer.Write(protection_ram, 0, 0x1000); writer.Write(m72_irq_base); writer.Write(m72_scanline_param); for (i = 0; i < 0x600; i++) @@ -32,15 +28,15 @@ namespace mame { writer.Write(Generic.spriteram16[i]); } - writer.Write(m72_videoram1,0,0x4000); - writer.Write(m72_videoram2,0,0x4000); + writer.Write(m72_videoram1, 0, 0x4000); + writer.Write(m72_videoram2, 0, 0x4000); writer.Write(m72_raster_irq_position); writer.Write(video_off); writer.Write(scrollx1); writer.Write(scrolly1); writer.Write(scrollx2); writer.Write(scrolly2); - for(i=0;i<0x200;i++) + for (i = 0; i < 0x200; i++) { writer.Write(m72_spriteram[i]); } @@ -118,7 +114,7 @@ namespace mame Cpuint.LoadStateBinary_v(reader); Timer.global_basetime.seconds = reader.ReadInt32(); Timer.global_basetime.attoseconds = reader.ReadInt64(); - Video.LoadStateBinary(reader); + Video.LoadStateBinary(reader); Sound.last_update_second = reader.ReadInt32(); Cpuexec.LoadStateBinary(reader); Timer.LoadStateBinary(reader); diff --git a/MAME.Core/mame/m72/Tilemap.cs b/MAME.Core/mame/m72/Tilemap.cs index f196b2f..778adbe 100644 --- a/MAME.Core/mame/m72/Tilemap.cs +++ b/MAME.Core/mame/m72/Tilemap.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; namespace mame { @@ -22,7 +19,7 @@ namespace mame bg_tilemap.all_tiles_dirty = true; bg_tilemap.pixmap = new ushort[0x200 * 0x200]; bg_tilemap.flagsmap = new byte[0x200, 0x200]; - bg_tilemap.tileflags = new byte[0x40, 0x40]; + bg_tilemap.tileflags = new byte[0x40, 0x40]; bg_tilemap.total_elements = M72.gfx21rom.Length / 0x40; bg_tilemap.pen_data = new byte[0x40]; bg_tilemap.pen_to_flags = new byte[3, 16]; @@ -59,7 +56,7 @@ namespace mame fg_tilemap.all_tiles_dirty = true; fg_tilemap.pixmap = new ushort[0x200 * 0x200]; fg_tilemap.flagsmap = new byte[0x200, 0x200]; - fg_tilemap.tileflags = new byte[0x40, 0x40]; + fg_tilemap.tileflags = new byte[0x40, 0x40]; fg_tilemap.total_elements = M72.gfx21rom.Length / 0x40; fg_tilemap.pen_data = new byte[0x400]; fg_tilemap.pen_to_flags = new byte[3, 32]; @@ -92,7 +89,7 @@ namespace mame case "airduel": case "airduelm72": bg_tilemap.tile_update3 = bg_tilemap.tile_updateM72_bg_m72; - fg_tilemap.tile_update3 = fg_tilemap.tile_updateM72_fg_m72; + fg_tilemap.tile_update3 = fg_tilemap.tile_updateM72_fg_m72; break; case "ltswords": case "kengo": @@ -373,7 +370,7 @@ namespace mame } code1 = code % M72.bg_tilemap.total_elements; pen_data_offset = code1 * 0x40; - tileflags[row, col] = tile_drawM72(M72.gfx21rom,pen_data_offset, x0, y0, 0x100 + 0x10 * (color & 0x0f), pri, (((color & 0x60) >> 5) & 3) ^ (attributes & 0x03)); + tileflags[row, col] = tile_drawM72(M72.gfx21rom, pen_data_offset, x0, y0, 0x100 + 0x10 * (color & 0x0f), pri, (((color & 0x60) >> 5) & 3) ^ (attributes & 0x03)); } public byte tile_drawM72(byte[] bb1, int pen_data_offset, int x0, int y0, int palette_base, int group, int flags) { @@ -407,8 +404,8 @@ namespace mame pen = pen_data[offset1]; map = pen_to_flags[group, pen]; offset1++; - pixmap[(offsety1%0x200) * 0x200 + x0 + xoffs] = (ushort)(palette_base + pen); - flagsmap[offsety1%0x200, x0 + xoffs] = map; + pixmap[(offsety1 % 0x200) * 0x200 + x0 + xoffs] = (ushort)(palette_base + pen); + flagsmap[offsety1 % 0x200, x0 + xoffs] = map; andmask &= map; ormask |= map; xoffs += dx0; diff --git a/MAME.Core/mame/m72/Video.cs b/MAME.Core/mame/m72/Video.cs index 749b8d8..2790434 100644 --- a/MAME.Core/mame/m72/Video.cs +++ b/MAME.Core/mame/m72/Video.cs @@ -1,13 +1,10 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; namespace mame { public partial class M72 { - public static byte[] m72_videoram1,m72_videoram2; + public static byte[] m72_videoram1, m72_videoram2; public static ushort[] majtitle_rowscrollram; public static int m72_raster_irq_position; public static ushort[] m72_spriteram; @@ -222,7 +219,7 @@ namespace mame } public static void video_update_m72() { - if (video_off!=0) + if (video_off != 0) { Array.Copy(uuB200, Video.bitmapbase[Video.curbitmap], 0x40000); return; diff --git a/MAME.Core/mame/m92/Drawgfx.cs b/MAME.Core/mame/m92/Drawgfx.cs index 1faacca..8a9e53a 100644 --- a/MAME.Core/mame/m92/Drawgfx.cs +++ b/MAME.Core/mame/m92/Drawgfx.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace mame +namespace mame { public partial class Drawgfx { @@ -66,7 +61,7 @@ namespace mame int colorbase = 0x10 * color; blockmove_8toN_transpen_pri16_m92(bb1, code, sw, sh, 0x10, ls, ts, flipx, flipy, dw, dh, colorbase, sy, sx, primask); } - public static void blockmove_8toN_transpen_pri16_m92(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 sy, int sx, uint primask) + public static void blockmove_8toN_transpen_pri16_m92(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 sy, int sx, uint primask) { int ydir, xdir, col, i, j; int offsetx = sx, offsety = sy; diff --git a/MAME.Core/mame/m92/Gdi.cs b/MAME.Core/mame/m92/Gdi.cs index 962512b..55458d1 100644 --- a/MAME.Core/mame/m92/Gdi.cs +++ b/MAME.Core/mame/m92/Gdi.cs @@ -1,1299 +1,11 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Drawing; -using System.Drawing.Imaging; - -namespace mame +namespace mame { public partial class M92 { - public static bool bG00,bG01,bG10,bG11,bG20,bG21, bSprite; + public static bool bG00, bG01, bG10, bG11, bG20, bG21, bSprite; public static void GDIInit() { } - public static Bitmap GetG00() - { - int i1, i2, iOffset, i3, i4, iOffset3 = 0; - int rows, cols, width, height; - int tilewidth, tileheight; - tilewidth = 8; - tileheight = tilewidth; - rows = 0x40; - cols = rows; - width = tilewidth * cols; - height = width; - int iByte; - int iCode, iCode1, iAttr; - int iTile, iFlag, iGroup; - 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; - if ((pf_master_control[0] & 0x40) != 0) - { - for (i3 = 0; i3 < cols; i3++) - { - for (i4 = 0; i4 < rows; i4++) - { - iOffset3 = 2 * (i4 * cols + i3) + M92.pf_layer[0].vram_base; - iAttr = m92_vram_data[iOffset3 + 1]; - iTile = m92_vram_data[iOffset3] + ((iAttr & 0x8000) << 1); - iCode = iTile; - if ((iAttr & 0x100) != 0) - { - iGroup = 2; - } - else if ((iAttr & 0x80) != 0) - { - iGroup = 1; - } - else - { - iGroup = 0; - } - iCode1 = iCode % pf_layer[0].tmap.total_elements; - pen_data_offset = iCode1 * 0x40; - palette_base = 0x10 * (iAttr & 0x7f); - iFlag = ((iAttr >> 9) & 3) ^ (pf_layer[0].tmap.attributes & 0x03); - if (iFlag == 0) - { - x0 = tilewidth * i3; - y0 = tileheight * i4; - dx0 = 1; - dy0 = 1; - } - else if (iFlag == 1) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4; - dx0 = -1; - dy0 = 1; - } - else if (iFlag == 2) - { - x0 = tilewidth * i3; - y0 = tileheight * i4 + tileheight - 1; - dx0 = 1; - dy0 = -1; - } - else if (iFlag == 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 = M92.gfx11rom[iOffset]; - if (iByte == 0) - { - c1 = Color.Transparent; - } - else - { - c1 = Color.FromArgb((int)Palette.entry_color[palette_base + iByte]); - } - ptr2 = ptr + ((y0 + dy0 * i2) * width + (0x10000 - m92_vram_data[0xf400 / 2 + (y0 + dy0 * i2)] + x0 + dx0 * i1) % width) * 4; - *ptr2 = c1.B; - *(ptr2 + 1) = c1.G; - *(ptr2 + 2) = c1.R; - *(ptr2 + 3) = c1.A; - } - } - } - } - } - else - { - for (i3 = 0; i3 < cols; i3++) - { - for (i4 = 0; i4 < rows; i4++) - { - iOffset3 = 2 * (i4 * cols + i3) + M92.pf_layer[0].vram_base; - iAttr = m92_vram_data[iOffset3 + 1]; - iTile = m92_vram_data[iOffset3] + ((iAttr & 0x8000) << 1); - iCode = iTile; - if ((iAttr & 0x100) != 0) - { - iGroup = 2; - } - else if ((iAttr & 0x80) != 0) - { - iGroup = 1; - } - else - { - iGroup = 0; - } - iCode1 = iCode % pf_layer[0].tmap.total_elements; - pen_data_offset = iCode1 * 0x40; - palette_base = 0x10 * (iAttr & 0x7f); - iFlag = ((iAttr >> 9) & 3) ^ (pf_layer[0].tmap.attributes & 0x03); - if (iFlag == 0) - { - x0 = tilewidth * i3; - y0 = tileheight * i4; - dx0 = 1; - dy0 = 1; - } - else if (iFlag == 1) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4; - dx0 = -1; - dy0 = 1; - } - else if (iFlag == 2) - { - x0 = tilewidth * i3; - y0 = tileheight * i4 + tileheight - 1; - dx0 = 1; - dy0 = -1; - } - else if (iFlag == 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 = M92.gfx11rom[iOffset]; - if (iByte == 0) - { - c1 = Color.Transparent; - } - else - { - c1 = Color.FromArgb((int)Palette.entry_color[palette_base + iByte]); - } - ptr2 = ptr + ((y0 + dy0 * i2) * width + (0x10000 - pf_layer[0].control[2] + x0 + dx0 * i1) % width) * 4; - *ptr2 = c1.B; - *(ptr2 + 1) = c1.G; - *(ptr2 + 2) = c1.R; - *(ptr2 + 3) = c1.A; - } - } - } - } - } - } - bm1.UnlockBits(bmData); - return bm1; - } - public static Bitmap GetG01() - { - int i1, i2, iOffset, i3, i4, iOffset3 = 0; - int rows, cols, width, height; - int tilewidth, tileheight; - tilewidth = 8; - tileheight = tilewidth; - rows = 0x40; - cols = 0x80; - width = tilewidth * cols; - height = tileheight * rows; - int iByte; - int xoffs; - int iCode, iCode1, iAttr; - int iTile, iFlag, iGroup; - 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; - if ((pf_master_control[0] & 0x40) != 0) - { - for (i3 = 0; i3 < cols; i3++) - { - for (i4 = 0; i4 < rows; i4++) - { - iOffset3 = 2 * (i4 * cols + i3) + M92.pf_layer[0].vram_base; - iAttr = m92_vram_data[iOffset3 + 1]; - iTile = m92_vram_data[iOffset3] + ((iAttr & 0x8000) << 1); - iCode = iTile; - if ((iAttr & 0x100) != 0) - { - iGroup = 2; - } - else if ((iAttr & 0x80) != 0) - { - iGroup = 1; - } - else - { - iGroup = 0; - } - iCode1 = iCode % pf_layer[0].wide_tmap.total_elements; - pen_data_offset = iCode1 * 0x40; - palette_base = 0x10 * (iAttr & 0x7f); - iFlag = ((iAttr >> 9) & 3) ^ (pf_layer[0].wide_tmap.attributes & 0x03); - if (iFlag == 0) - { - x0 = tilewidth * i3; - y0 = tileheight * i4; - dx0 = 1; - dy0 = 1; - } - else if (iFlag == 1) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4; - dx0 = -1; - dy0 = 1; - } - else if (iFlag == 2) - { - x0 = tilewidth * i3; - y0 = tileheight * i4 + tileheight - 1; - dx0 = 1; - dy0 = -1; - } - else if (iFlag == 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 = M92.gfx11rom[iOffset]; - if (iByte == 0) - { - c1 = Color.Transparent; - } - else - { - c1 = Color.FromArgb((int)Palette.entry_color[palette_base + iByte]); - } - ptr2 = ptr + ((y0 + dy0 * i2) * width + (0x10000-m92_vram_data[0xf400 / 2 + (y0 + dy0 * i2)] + x0 + dx0 * i1) % width) * 4; - *ptr2 = c1.B; - *(ptr2 + 1) = c1.G; - *(ptr2 + 2) = c1.R; - *(ptr2 + 3) = c1.A; - } - } - } - } - } - else - { - for (i3 = 0; i3 < cols; i3++) - { - for (i4 = 0; i4 < rows; i4++) - { - iOffset3 = 2 * (i4 * cols + i3) + M92.pf_layer[0].vram_base; - iAttr = m92_vram_data[iOffset3 + 1]; - iTile = m92_vram_data[iOffset3] + ((iAttr & 0x8000) << 1); - iCode = iTile; - if ((iAttr & 0x100) != 0) - { - iGroup = 2; - } - else if ((iAttr & 0x80) != 0) - { - iGroup = 1; - } - else - { - iGroup = 0; - } - if (iCode == 0x1041) - { - int i11 = 1; - } - iCode1 = iCode % pf_layer[0].wide_tmap.total_elements; - pen_data_offset = iCode1 * 0x40; - palette_base = 0x10 * (iAttr & 0x7f); - iFlag = ((iAttr >> 9) & 3) ^ (pf_layer[0].wide_tmap.attributes & 0x03); - if (iFlag == 0) - { - x0 = tilewidth * i3; - y0 = tileheight * i4; - dx0 = 1; - dy0 = 1; - } - else if (iFlag == 1) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4; - dx0 = -1; - dy0 = 1; - } - else if (iFlag == 2) - { - x0 = tilewidth * i3; - y0 = tileheight * i4 + tileheight - 1; - dx0 = 1; - dy0 = -1; - } - else if (iFlag == 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 = M92.gfx11rom[iOffset]; - if (iByte == 0) - { - c1 = Color.Transparent; - } - else - { - c1 = Color.FromArgb((int)Palette.entry_color[palette_base + iByte]); - } - ptr2 = ptr + ((y0 + dy0 * i2) % height * width + (0x10000- pf_layer[0].control[2] + x0 + dx0 * i1) % width) * 4; - *ptr2 = c1.B; - *(ptr2 + 1) = c1.G; - *(ptr2 + 2) = c1.R; - *(ptr2 + 3) = c1.A; - } - } - } - } - } - } - bm1.UnlockBits(bmData); - return bm1; - } - public static Bitmap GetG10() - { - int i1, i2, iOffset, i3, i4, iOffset3 = 0; - int rows, cols, width, height; - int tilewidth, tileheight; - tilewidth = 8; - tileheight = tilewidth; - rows = 0x40; - cols = rows; - width = tilewidth * cols; - height = width; - int iByte; - int iCode, iCode1, iAttr,iGroup; - int iTile, iFlag; - 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; - if ((pf_master_control[1] & 0x40) != 0) - { - for (i3 = 0; i3 < cols; i3++) - { - for (i4 = 0; i4 < rows; i4++) - { - iOffset3 = 2 * (i4 * cols + i3) + M92.pf_layer[1].vram_base; - iAttr = m92_vram_data[iOffset3 + 1]; - iTile = m92_vram_data[iOffset3] + ((iAttr & 0x8000) << 1); - iCode = iTile; - if ((iAttr & 0x100) != 0) - { - iGroup = 2; - } - else if ((iAttr & 0x80) != 0) - { - iGroup = 1; - } - else - { - iGroup = 0; - } - iCode1 = iCode % pf_layer[1].tmap.total_elements; - pen_data_offset = iCode1 * 0x40; - palette_base = 0x10 * (iAttr & 0x7f); - iFlag = ((iAttr >> 9) & 3) ^ (pf_layer[1].tmap.attributes & 0x03); - if (iFlag == 0) - { - x0 = tilewidth * i3; - y0 = tileheight * i4; - dx0 = 1; - dy0 = 1; - } - else if (iFlag == 1) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4; - dx0 = -1; - dy0 = 1; - } - else if (iFlag == 2) - { - x0 = tilewidth * i3; - y0 = tileheight * i4 + tileheight - 1; - dx0 = 1; - dy0 = -1; - } - else if (iFlag == 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 = M92.gfx11rom[iOffset]; - if (iByte == 0) - { - c1 = Color.Transparent; - } - else - { - c1 = Color.FromArgb((int)Palette.entry_color[palette_base + iByte]); - } - ptr2 = ptr + ((y0 + dy0 * i2) * width + (0x10000 - m92_vram_data[0xf800 / 2 + (y0 + dy0 * i2)] + x0 + dx0 * i1) % width) * 4; - //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; - } - } - } - } - } - else - { - for (i3 = 0; i3 < cols; i3++) - { - for (i4 = 0; i4 < rows; i4++) - { - iOffset3 = 2 * (i4 * cols + i3) + M92.pf_layer[1].vram_base; - iAttr = m92_vram_data[iOffset3 + 1]; - iTile = m92_vram_data[iOffset3] + ((iAttr & 0x8000) << 1); - iCode = iTile; - if ((iAttr & 0x100) != 0) - { - iGroup = 2; - } - else if ((iAttr & 0x80) != 0) - { - iGroup = 1; - } - else - { - iGroup = 0; - } - iCode1 = iCode % pf_layer[1].tmap.total_elements; - pen_data_offset = iCode1 * 0x40; - palette_base = 0x10 * (iAttr & 0x7f); - iFlag = ((iAttr >> 9) & 3) ^ (pf_layer[1].tmap.attributes & 0x03); - if (iFlag == 0) - { - x0 = tilewidth * i3; - y0 = tileheight * i4; - dx0 = 1; - dy0 = 1; - } - else if (iFlag == 1) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4; - dx0 = -1; - dy0 = 1; - } - else if (iFlag == 2) - { - x0 = tilewidth * i3; - y0 = tileheight * i4 + tileheight - 1; - dx0 = 1; - dy0 = -1; - } - else if (iFlag == 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 = M92.gfx11rom[iOffset]; - if (iByte == 0) - { - c1 = Color.Transparent; - } - else - { - c1 = Color.FromArgb((int)Palette.entry_color[palette_base + iByte]); - } - ptr2 = ptr + ((y0 + dy0 * i2) * width + (0x10000 - pf_layer[1].control[2] + x0 + dx0 * i1) % width) * 4; - *ptr2 = c1.B; - *(ptr2 + 1) = c1.G; - *(ptr2 + 2) = c1.R; - *(ptr2 + 3) = c1.A; - } - } - } - } - } - } - bm1.UnlockBits(bmData); - return bm1; - } - public static Bitmap GetG11() - { - int i1, i2, iOffset, i3, i4, iOffset3 = 0; - int rows, cols, width, height; - int tilewidth, tileheight; - tilewidth = 8; - tileheight = tilewidth; - rows = 0x40; - cols = 0x80; - width = tilewidth * cols; - height = tileheight * rows; - int iByte; - int iCode, iCode1, iAttr; - int iTile, iFlag, iGroup; - 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; - if ((pf_master_control[1] & 0x40) != 0) - { - for (i3 = 0; i3 < cols; i3++) - { - for (i4 = 0; i4 < rows; i4++) - { - iOffset3 = 2 * (i4 * cols + i3) + M92.pf_layer[1].vram_base; - iAttr = m92_vram_data[iOffset3 + 1]; - iTile = m92_vram_data[iOffset3] + ((iAttr & 0x8000) << 1); - iCode = iTile; - if ((iAttr & 0x100) != 0) - { - iGroup = 2; - } - else if ((iAttr & 0x80) != 0) - { - iGroup = 1; - } - else - { - iGroup = 0; - } - iCode1 = iCode % pf_layer[1].wide_tmap.total_elements; - pen_data_offset = iCode1 * 0x40; - palette_base = 0x10 * (iAttr & 0x7f); - iFlag = ((iAttr >> 9) & 3) ^ (pf_layer[1].wide_tmap.attributes & 0x03); - if (iFlag == 0) - { - x0 = tilewidth * i3; - y0 = tileheight * i4; - dx0 = 1; - dy0 = 1; - } - else if (iFlag == 1) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4; - dx0 = -1; - dy0 = 1; - } - else if (iFlag == 2) - { - x0 = tilewidth * i3; - y0 = tileheight * i4 + tileheight - 1; - dx0 = 1; - dy0 = -1; - } - else if (iFlag == 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 = M92.gfx11rom[iOffset]; - if (iByte == 0) - { - c1 = Color.Transparent; - } - else - { - c1 = Color.FromArgb((int)Palette.entry_color[palette_base + iByte]); - } - ptr2 = ptr + ((y0 + dy0 * i2) * width + (0x10000-m92_vram_data[0xf800/2 + (y0 + dy0 * i2)] + x0 + dx0 * i1)%width) * 4; - *ptr2 = c1.B; - *(ptr2 + 1) = c1.G; - *(ptr2 + 2) = c1.R; - *(ptr2 + 3) = c1.A; - } - } - } - } - } - else - { - for (i3 = 0; i3 < cols; i3++) - { - for (i4 = 0; i4 < rows; i4++) - { - iOffset3 = 2 * (i4 * cols + i3) + M92.pf_layer[1].vram_base; - iAttr = m92_vram_data[iOffset3 + 1]; - iTile = m92_vram_data[iOffset3] + ((iAttr & 0x8000) << 1); - iCode = iTile; - if ((iAttr & 0x100) != 0) - { - iGroup = 2; - } - else if ((iAttr & 0x80) != 0) - { - iGroup = 1; - } - else - { - iGroup = 0; - } - iCode1 = iCode % pf_layer[1].wide_tmap.total_elements; - pen_data_offset = iCode1 * 0x40; - palette_base = 0x10 * (iAttr & 0x7f); - iFlag = ((iAttr >> 9) & 3) ^ (pf_layer[1].wide_tmap.attributes & 0x03); - if (iFlag == 0) - { - x0 = tilewidth * i3; - y0 = tileheight * i4; - dx0 = 1; - dy0 = 1; - } - else if (iFlag == 1) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4; - dx0 = -1; - dy0 = 1; - } - else if (iFlag == 2) - { - x0 = tilewidth * i3; - y0 = tileheight * i4 + tileheight - 1; - dx0 = 1; - dy0 = -1; - } - else if (iFlag == 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 = M92.gfx11rom[iOffset]; - if (iByte == 0) - { - c1 = Color.Transparent; - } - else - { - c1 = Color.FromArgb((int)Palette.entry_color[palette_base + iByte]); - } - ptr2 = ptr + ((y0 + dy0 * i2) * width + (0x10000 - pf_layer[1].control[2] + x0 + dx0 * i1) % width) * 4; - *ptr2 = c1.B; - *(ptr2 + 1) = c1.G; - *(ptr2 + 2) = c1.R; - *(ptr2 + 3) = c1.A; - } - } - } - } - } - } - bm1.UnlockBits(bmData); - return bm1; - } - public static Bitmap GetG20() - { - int i1, i2, iOffset, i3, i4, iOffset3 = 0; - int rows, cols, width, height; - int tilewidth, tileheight; - tilewidth = 8; - tileheight = tilewidth; - rows = 0x40; - cols = rows; - width = tilewidth * cols; - height = width; - int iByte; - int iCode, iCode1, iAttr, iGroup; - int iTile, iFlag; - 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; - if ((pf_master_control[2] & 0x40) != 0) - { - for (i3 = 0; i3 < cols; i3++) - { - for (i4 = 0; i4 < rows; i4++) - { - iOffset3 = 2 * (i4 * cols + i3) + M92.pf_layer[2].vram_base; - iAttr = m92_vram_data[iOffset3 + 1]; - iTile = m92_vram_data[iOffset3] + ((iAttr & 0x8000) << 1); - iCode = iTile; - if ((iAttr & 0x100) != 0) - { - iGroup = 2; - } - else if ((iAttr & 0x80) != 0) - { - iGroup = 1; - } - else - { - iGroup = 0; - } - iCode1 = iCode % pf_layer[2].tmap.total_elements; - pen_data_offset = iCode1 * 0x40; - palette_base = 0x10 * (iAttr & 0x7f); - iFlag = ((iAttr >> 9) & 3) ^ (pf_layer[2].tmap.attributes & 0x03); - if (iFlag == 0) - { - x0 = tilewidth * i3; - y0 = tileheight * i4; - dx0 = 1; - dy0 = 1; - } - else if (iFlag == 1) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4; - dx0 = -1; - dy0 = 1; - } - else if (iFlag == 2) - { - x0 = tilewidth * i3; - y0 = tileheight * i4 + tileheight - 1; - dx0 = 1; - dy0 = -1; - } - else if (iFlag == 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 = M92.gfx11rom[iOffset]; - if (iByte == 0) - { - c1 = Color.Transparent; - } - else - { - c1 = Color.FromArgb((int)Palette.entry_color[palette_base + iByte]); - } - ptr2 = ptr + ((y0 + dy0 * i2) * width + (0x10000-m92_vram_data[0xfc00/2 + (y0 + dy0 * i2)] + x0 + dx0 * i1)%width) * 4; - *ptr2 = c1.B; - *(ptr2 + 1) = c1.G; - *(ptr2 + 2) = c1.R; - *(ptr2 + 3) = c1.A; - } - } - } - } - } - else - { - for (i3 = 0; i3 < cols; i3++) - { - for (i4 = 0; i4 < rows; i4++) - { - iOffset3 = 2 * (i4 * cols + i3) + M92.pf_layer[2].vram_base; - iAttr = m92_vram_data[iOffset3 + 1]; - iTile = m92_vram_data[iOffset3] + ((iAttr & 0x8000) << 1); - iCode = iTile; - if ((iAttr & 0x100) != 0) - { - iGroup = 2; - } - else if ((iAttr & 0x80) != 0) - { - iGroup = 1; - } - else - { - iGroup = 0; - } - iCode1 = iCode % pf_layer[2].tmap.total_elements; - pen_data_offset = iCode1 * 0x40; - palette_base = 0x10 * (iAttr & 0x7f); - iFlag = ((iAttr >> 9) & 3) ^ (pf_layer[2].tmap.attributes & 0x03); - if (iFlag == 0) - { - x0 = tilewidth * i3; - y0 = tileheight * i4; - dx0 = 1; - dy0 = 1; - } - else if (iFlag == 1) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4; - dx0 = -1; - dy0 = 1; - } - else if (iFlag == 2) - { - x0 = tilewidth * i3; - y0 = tileheight * i4 + tileheight - 1; - dx0 = 1; - dy0 = -1; - } - else if (iFlag == 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 = M92.gfx11rom[iOffset]; - if (iByte == 0) - { - c1 = Color.Transparent; - } - else - { - c1 = Color.FromArgb((int)Palette.entry_color[palette_base + iByte]); - } - ptr2 = ptr + ((y0 + dy0 * i2) * width + (0x10000 - pf_layer[2].control[2] + x0 + dx0 * i1) % width) * 4; - *ptr2 = c1.B; - *(ptr2 + 1) = c1.G; - *(ptr2 + 2) = c1.R; - *(ptr2 + 3) = c1.A; - } - } - } - } - } - } - bm1.UnlockBits(bmData); - return bm1; - } - public static Bitmap GetG21() - { - int i1, i2, iOffset, i3, i4, iOffset3 = 0; - int rows, cols, width, height; - int tilewidth, tileheight; - tilewidth = 8; - tileheight = tilewidth; - rows = 0x40; - cols = 0x80; - width = tilewidth * cols; - height = tileheight * rows; - int iByte; - int iCode, iCode1, iAttr; - int iTile, iFlag, iGroup; - 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; - if ((pf_master_control[2] & 0x40) != 0) - { - for (i3 = 0; i3 < cols; i3++) - { - for (i4 = 0; i4 < rows; i4++) - { - iOffset3 = 2 * (i4 * cols + i3) + M92.pf_layer[2].vram_base; - iAttr = m92_vram_data[iOffset3 + 1]; - iTile = m92_vram_data[iOffset3] + ((iAttr & 0x8000) << 1); - iCode = iTile; - if ((iAttr & 0x100) != 0) - { - iGroup = 2; - } - else if ((iAttr & 0x80) != 0) - { - iGroup = 1; - } - else - { - iGroup = 0; - } - iCode1 = iCode % pf_layer[2].wide_tmap.total_elements; - pen_data_offset = iCode1 * 0x40; - palette_base = 0x10 * (iAttr & 0x7f); - iFlag = ((iAttr >> 9) & 3) ^ (pf_layer[2].wide_tmap.attributes & 0x03); - if (iFlag == 0) - { - x0 = tilewidth * i3; - y0 = tileheight * i4; - dx0 = 1; - dy0 = 1; - } - else if (iFlag == 1) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4; - dx0 = -1; - dy0 = 1; - } - else if (iFlag == 2) - { - x0 = tilewidth * i3; - y0 = tileheight * i4 + tileheight - 1; - dx0 = 1; - dy0 = -1; - } - else if (iFlag == 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 = M92.gfx11rom[iOffset]; - if (iByte == 0) - { - c1 = Color.Transparent; - } - else - { - c1 = Color.FromArgb((int)Palette.entry_color[palette_base + iByte]); - } - ptr2 = ptr + ((y0 + dy0 * i2) * width + (0x10000-m92_vram_data[0xfc00 + (y0 + dy0 * i2)] + x0 + dx0 * i1)%width) * 4; - *ptr2 = c1.B; - *(ptr2 + 1) = c1.G; - *(ptr2 + 2) = c1.R; - *(ptr2 + 3) = c1.A; - } - } - } - } - } - else - { - for (i3 = 0; i3 < cols; i3++) - { - for (i4 = 0; i4 < rows; i4++) - { - iOffset3 = 2 * (i4 * cols + i3) + M92.pf_layer[2].vram_base; - iAttr = m92_vram_data[iOffset3 + 1]; - iTile = m92_vram_data[iOffset3] +((iAttr & 0x8000) << 1); - iCode = iTile; - if ((iAttr & 0x100) != 0) - { - iGroup = 2; - } - else if ((iAttr & 0x80) != 0) - { - iGroup = 1; - } - else - { - iGroup = 0; - } - iCode1 = iCode % pf_layer[2].wide_tmap.total_elements; - pen_data_offset = iCode1 * 0x40; - palette_base = 0x10 * (iAttr & 0x7f); - iFlag = ((iAttr >> 9) & 3) ^ (pf_layer[2].wide_tmap.attributes & 0x03); - if (iFlag == 0) - { - x0 = tilewidth * i3; - y0 = tileheight * i4; - dx0 = 1; - dy0 = 1; - } - else if (iFlag == 1) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4; - dx0 = -1; - dy0 = 1; - } - else if (iFlag == 2) - { - x0 = tilewidth * i3; - y0 = tileheight * i4 + tileheight - 1; - dx0 = 1; - dy0 = -1; - } - else if (iFlag == 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 = M92.gfx11rom[iOffset]; - if (iByte == 0) - { - c1 = Color.Transparent; - } - else - { - c1 = Color.FromArgb((int)Palette.entry_color[palette_base + iByte]); - } - ptr2 = ptr + ((y0 + dy0 * i2) * width + (0x10000 - pf_layer[2].control[2] + x0 + dx0 * i1) % width) * 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 n1, int n2) - { - Bitmap bm1; - bm1 = new Bitmap(0x200, 0x200); - int offs, k, i5, i6, iByte; - int xdir, ydir; - Color c1 = new Color(); - for (k = 0; k < 8; k++) - { - //for (offs = 0; offs < m92_sprite_list; ) - for(offs=m92_sprite_list-4;offs>=0;) - { - int x, y, sprite, colour, fx, fy, x_multi, y_multi, i, j, s_ptr, pri_back, pri_sprite; - y = Generic.buffered_spriteram16[offs + 0] & 0x1ff; - x = Generic.buffered_spriteram16[offs + 3] & 0x1ff; - if ((Generic.buffered_spriteram16[offs + 2] & 0x0080) != 0) - { - pri_back = 0; - } - else - { - pri_back = 2; - } - sprite = Generic.buffered_spriteram16[offs + 1]; - colour = Generic.buffered_spriteram16[offs + 2] & 0x007f; - pri_sprite = (Generic.buffered_spriteram16[offs + 0] & 0xe000) >> 13; - fx = (Generic.buffered_spriteram16[offs + 2] >> 8) & 1; - fy = (Generic.buffered_spriteram16[offs + 2] >> 9) & 1; - y_multi = (Generic.buffered_spriteram16[offs + 0] >> 9) & 3; - x_multi = (Generic.buffered_spriteram16[offs + 0] >> 11) & 3; - y_multi = 1 << y_multi; - x_multi = 1 << x_multi; - //offs += 4 * x_multi; - if (offs < n1 || offs > n2) - { - offs -= 4 * x_multi; - continue; - } - offs -= 4 * x_multi; - if (pri_sprite != k) - { - continue; - } - x = x; - y = 512 - 16 - y; - if (fx != 0) - { - x += 16 * (x_multi - 1); - xdir = -1; - } - else - { - xdir = 1; - } - if (fy != 0) - { - ydir = -1; - } - else - { - ydir = 1; - } - for (j = 0; j < x_multi; j++) - { - s_ptr = 8 * j; - if (fy == 0) - { - s_ptr += y_multi - 1; - } - x &= 0x1ff; - for (i = 0; i < y_multi; i++) - { - for (i5 = 0; i5 < 0x10; i5++) - { - for (i6 = 0; i6 < 0x10; i6++) - { - iByte = gfx21rom[(sprite + s_ptr) * 0x100 + i5 + i6 * 0x10]; - if (iByte != 0) - { - c1 = Color.FromArgb((int)Palette.entry_color[0x10 * colour + iByte]); - if (x + xdir * i5 >= 0 && x + xdir * i5 <= 0x1ff && y - i * 16 + ydir * i6 >= 0 && y - i * 16 + ydir * i6 <= 0x1ff) - { - bm1.SetPixel(x + xdir * i5, y - i * 16 + ydir * i6, c1); - } - } - } - } - //Drawgfx.common_drawgfx_m92(gfx21rom, sprite + s_ptr, colour, fx, fy, x, y - i * 16, cliprect, (uint)(pri_back | (1 << 31))); - //Drawgfx.common_drawgfx_m92(gfx21rom, sprite + s_ptr, colour, fx, fy, x - 512, y - i * 16, cliprect, (uint)(pri_back | (1 << 31))); - if (fy != 0) - { - s_ptr++; - } - else - { - s_ptr--; - } - } - if (fx != 0) - { - x -= 16; - } - else - { - x += 16; - } - } - } - } - return bm1; - } - public static Bitmap GetAllGDI(int n1, int n2) - { - Bitmap bm1 = new Bitmap(0x200, 0x200), bm2; - Graphics g = Graphics.FromImage(bm1); - g.Clear(Color.Transparent); - if (bG21 && pf_layer[2].wide_tmap.enable && (((~pf_master_control[2] >> 4) & 1) != 0)) - { - bm2 = GetG21(); - int y = pf_layer[2].wide_tmap.effective_colscroll(0); - g.DrawImage(bm2, 0, -0x200 + y); - g.DrawImage(bm2, 0, y); - } - if (bG20 && pf_layer[2].tmap.enable && (((~pf_master_control[2] >> 4) & 1) != 0)) - { - bm2 = GetG20(); - int y = pf_layer[2].tmap.effective_colscroll(0); - g.DrawImage(bm2, 0, -0x200 + y); - g.DrawImage(bm2, 0, y); - } - if (bG11 && pf_layer[1].wide_tmap.enable) - { - bm2 = GetG11(); - int y = pf_layer[1].wide_tmap.effective_colscroll(0); - g.DrawImage(bm2, 0, -0x200 + y); - g.DrawImage(bm2, 0, y); - } - if (bG10 && pf_layer[1].tmap.enable) - { - bm2 = GetG10(); - int y = pf_layer[1].tmap.effective_colscroll(0); - g.DrawImage(bm2, 0, -0x200 + y); - g.DrawImage(bm2, 0, y); - } - if (bG01 && pf_layer[0].wide_tmap.enable) - { - bm2 = GetG01(); - int y = pf_layer[0].wide_tmap.effective_colscroll(0); - g.DrawImage(bm2, 0, -0x200 + y); - g.DrawImage(bm2, 0, y); - } - if (bG00 && pf_layer[0].tmap.enable) - { - bm2 = GetG00(); - int y = pf_layer[0].tmap.effective_colscroll(0); - g.DrawImage(bm2, 0, -0x200 + y); - g.DrawImage(bm2, 0, y); - } - if (bSprite) - { - bm2 = GetSprite(n1, n2); - g.DrawImage(bm2, 0, -0x80); - } - return bm1; - } } } diff --git a/MAME.Core/mame/m92/Input.cs b/MAME.Core/mame/m92/Input.cs index 4a19dc1..f6b99c6 100644 --- a/MAME.Core/mame/m92/Input.cs +++ b/MAME.Core/mame/m92/Input.cs @@ -185,7 +185,7 @@ namespace mame } public static void record_port() { - if (ushort0 != ushort0_old || ushort1 != ushort1_old||ushort2!=ushort2_old) + if (ushort0 != ushort0_old || ushort1 != ushort1_old || ushort2 != ushort2_old) { ushort0_old = ushort0; ushort1_old = ushort1; diff --git a/MAME.Core/mame/m92/M92.cs b/MAME.Core/mame/m92/M92.cs index dcb009d..e747fcf 100644 --- a/MAME.Core/mame/m92/M92.cs +++ b/MAME.Core/mame/m92/M92.cs @@ -1,9 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using cpu.nec; namespace mame { @@ -18,9 +14,9 @@ namespace mame public static int m92_scanline_param; public static int setvector_param; public static byte m92_sprite_buffer_busy; - public static byte[] gfx1rom, gfx11rom, gfx2rom, gfx21rom,eeprom; - public static byte[] gunforce_decryption_table=new byte[256] { - 0xff,0x90,0x90,0x2c,0x90,0x90,0x43,0x88, 0x90,0x13,0x0a,0xbd,0xba,0x60,0xea,0x90, /* 00 */ + public static byte[] gfx1rom, gfx11rom, gfx2rom, gfx21rom, eeprom; + public static byte[] gunforce_decryption_table = new byte[256] { + 0xff,0x90,0x90,0x2c,0x90,0x90,0x43,0x88, 0x90,0x13,0x0a,0xbd,0xba,0x60,0xea,0x90, /* 00 */ 0x90,0x90,0xf2,0x29,0xb3,0x22,0x90,0x0c, 0xa9,0x5f,0x9d,0x07,0x90,0x90,0x0b,0xbb, /* 10 */ 0x8a,0x90,0x90,0x90,0x3a,0x3c,0x5a,0x38, 0x99,0x90,0xf8,0x89,0x90,0x91,0x90,0x55, /* 20 */ 0xac,0x40,0x73,0x90,0x59,0x90,0xfc,0x90, 0x50,0xfa,0x90,0x25,0x90,0x34,0x47,0xb7, /* 30 */ @@ -38,7 +34,7 @@ namespace mame 0x90,0x90,0x09,0xa1,0x03,0x90,0x23,0xc1, 0x8e,0xe9,0xd1,0x7c,0x90,0x90,0xc7,0x06, /* F0 */ }; public static byte[] bomberman_decryption_table = new byte[256] { - 0x90,0x90,0x79,0x90,0x9d,0x48,0x90,0x90, 0x90,0x90,0x2e,0x90,0x90,0xa5,0x72,0x90, /* 00 */ + 0x90,0x90,0x79,0x90,0x9d,0x48,0x90,0x90, 0x90,0x90,0x2e,0x90,0x90,0xa5,0x72,0x90, /* 00 */ 0x46,0x5b,0xb1,0x3a,0xc3,0x90,0x35,0x90, 0x90,0x23,0x90,0x99,0x90,0x05,0x90,0x3c, /* 10 */ 0x3b,0x76,0x11,0x90,0x90,0x4b,0x90,0x92, 0x90,0x32,0x5d,0x90,0xf7,0x5a,0x9c,0x90, /* 20 */ 0x26,0x40,0x89,0x90,0x90,0x90,0x90,0x57, 0x90,0x90,0x90,0x90,0x90,0xba,0x53,0xbb, /* 30 */ @@ -55,7 +51,7 @@ namespace mame 0xbd,0x90,0x81,0xb7,0x90,0x8a,0x0d,0x90, 0x58,0xa1,0xa9,0x36,0x90,0xc4,0x90,0x8f, /* E0 */ 0x8c,0x1f,0x51,0x04,0xf2,0x90,0xb3,0xb4, 0xe9,0x2a,0x90,0x90,0x90,0x25,0x90,0xbc, /* F0 */ }; - public static byte[] lethalth_decryption_table=new byte[256]{ + public static byte[] lethalth_decryption_table = new byte[256]{ 0x7f,0x26,0x5d,0x90,0xba,0x90,0x1e,0x5e, 0xb8,0x90,0xbc,0xe8,0x01,0x90,0x4a,0x25, /* 00 */ 0x90,0xbd,0x90,0x22,0x10,0x90,0x02,0x57, 0x70,0x90,0x7e,0x90,0xe7,0x52,0x90,0xa9, /* 10 */ 0x90,0x90,0xc6,0x06,0xa0,0xfe,0xcf,0x8e, 0x43,0x8f,0x2d,0x90,0xd4,0x85,0x75,0xa2, /* 20 */ @@ -73,8 +69,8 @@ namespace mame 0x90,0xb6,0x90,0xea,0x90,0x73,0xe5,0x58, 0x00,0xf7,0x90,0x74,0x90,0x76,0x90,0xa3, /* E0 */ 0x90,0x5a,0xf6,0x32,0x46,0x2a,0x90,0x90, 0x53,0x4b,0x90,0x0d,0x51,0x68,0x99,0x13, /* F0 */ }; - public static byte[] dynablaster_decryption_table=new byte[256]{ - 0x1f,0x51,0x84,0x90,0x3d,0x09,0x0d,0x90, 0x90,0x57,0x90,0x90,0x90,0x32,0x11,0x90, /* 00 */ + public static byte[] dynablaster_decryption_table = new byte[256]{ + 0x1f,0x51,0x84,0x90,0x3d,0x09,0x0d,0x90, 0x90,0x57,0x90,0x90,0x90,0x32,0x11,0x90, /* 00 */ 0x90,0x9c,0x90,0x90,0x4b,0x90,0x90,0x03, 0x90,0x90,0x90,0x89,0xb0,0x90,0x90,0x90, /* 10 */ 0x90,0xbb,0x18,0xbe,0x53,0x21,0x55,0x7c, 0x90,0x90,0x47,0x58,0xf6,0x90,0x90,0xb2, /* 20 */ 0x06,0x90,0x2b,0x90,0x2f,0x0b,0xfc, 0x91 , 0x90,0x90,0xfa,0x81,0x83,0x40,0x38,0x90, /* 30 */ @@ -91,8 +87,8 @@ namespace mame 0x75,0x90,0xb7,0x90,0x23,0x90, 0x90/*0xe2*/,0x8f, 0x90,0x90,0x2c,0x90,0x77,0x7e,0x90,0x0f, /* e0 */ 0x0c,0xa0,0xbd,0x90,0x90,0x2d,0x29,0xea, 0x90,0x3b,0x73,0x90,0xfb,0x20,0x90,0x5a /* f0 */ }; - public static byte[] mysticri_decryption_table=new byte[256]{ - 0x90,0x57,0x90,0x90,0x90,0x90,0x90,0x90, 0xbf,0x43,0x90,0x90,0x90,0x90,0xfc,0x90, /* 00 */ + public static byte[] mysticri_decryption_table = new byte[256]{ + 0x90,0x57,0x90,0x90,0x90,0x90,0x90,0x90, 0xbf,0x43,0x90,0x90,0x90,0x90,0xfc,0x90, /* 00 */ 0x90,0x90,0x90,0x90,0x90,0x52,0xa3,0x26, 0x90,0xc7,0x90,0x0f,0x90,0x0c,0x90,0x90, /* 10 */ 0x90,0x90,0xff,0x90,0x90,0x02,0x90,0x90, 0x2e,0x90,0x5f,0x90,0x90,0x90,0x73,0x50, /* 20 */ 0xb2,0x3a,0x90,0x90,0xbb,0x90,0x90,0x90, 0x90,0x90,0x90,0x90,0x90,0x90,0x90,0x90, /* 30 */ @@ -109,8 +105,8 @@ namespace mame 0xeb,0x90,0x90,0x33,0x90,0xfa,0x90,0x90, 0xd2,0x90,0x24,0x90,0x74,0x41,0xb8,0x90, /* E0 */ 0x90,0x90,0xd0,0x07,0x90,0x90,0x90,0x90, 0x90,0x46,0x90,0xea,0xfe,0x78,0x90,0x90, /* F0 */ }; - public static byte[] majtitl2_decryption_table=new byte[256]{ - 0x87,0x90,0x78,0xaa,0x90,0x90,0x90,0x2c, 0x32,0x0a,0x0f,0x90,0x5e,0x90,0xc6,0x8a, /* 00 */ + public static byte[] majtitl2_decryption_table = new byte[256]{ + 0x87,0x90,0x78,0xaa,0x90,0x90,0x90,0x2c, 0x32,0x0a,0x0f,0x90,0x5e,0x90,0xc6,0x8a, /* 00 */ 0x33,0x90,0x90,0x90,0x90,0xea,0x90,0x72, 0x90,0x90,0x90,0x90,0x90,0x90,0x24,0x55, /* 10 */ 0x90,0x90,0x90,0x89,0xfb,0x90,0x59,0x02, 0x90,0x90,0x5d,0x90,0x90,0x90,0x36,0x90, /* 20 */ 0x90,0x06,0x79,0x90,0x90,0x1e,0x07,0x90, 0x90,0x90,0x83,0x90,0x90,0x90,0x90,0x90, /* 30 */ @@ -127,8 +123,8 @@ namespace mame 0x23,0x90,0xf3,0x90,0x90,0x90,0x90,0x90, 0x90,0xd2,0x8b,0xba,0x90,0x90,0x90,0x5b, /* E0 */ 0x90,0x90,0x9c,0x90,0x90,0x90,0x90,0xfc, 0xbc,0xa2,0x2a,0x90,0x90,0x8e,0xbb,0x90, /* F0 */ }; - public static byte[] hook_decryption_table=new byte[256] { - 0xb6,0x20,0x22,0x90,0x0f,0x57,0x59,0xc6, 0xeb,0x90,0xb0,0xbb,0x3b,0x90,0x90,0x90, /* 00 */ + public static byte[] hook_decryption_table = new byte[256] { + 0xb6,0x20,0x22,0x90,0x0f,0x57,0x59,0xc6, 0xeb,0x90,0xb0,0xbb,0x3b,0x90,0x90,0x90, /* 00 */ 0x36,0x90,0x90,0x90,0x90,0x90,0x90,0x90, 0x90,0xfe,0x90,0x90,0x90,0x90,0x90,0xa0, /* 10 */ 0x2e,0x90,0x0b,0x90,0x90,0x58,0x90,0x90, 0x90,0x90,0x90,0x90,0x90,0x80,0x90,0x90, /* 20 */ 0x33,0x90,0x90,0xbf,0x55,0x90,0x90,0x90, 0x53,0x90,0x90,0x90,0x90,0x90,0x90,0x90, /* 30 */ @@ -145,8 +141,8 @@ namespace mame 0x8b,0x90,0xf3,0xea,0x04,0x2c,0xb5,0x90, 0x0a,0x90,0x51,0x90,0x90,0x3a,0x90,0x9c, /* E0 */ 0x90,0x90,0x78,0x90,0xba,0x90,0x90,0x90, 0x90,0x90,0x90,0x90,0xd0,0x56,0x90,0x90, /* F0 */ }; - public static byte[] rtypeleo_decryption_table=new byte[256]{ - 0x5d,0x90,0xc6,0x90,0x90,0x90,0x2a,0x3a, 0x90,0x90,0x90,0x86,0x90,0x22,0x90,0xf3, /* 00 */ + public static byte[] rtypeleo_decryption_table = new byte[256]{ + 0x5d,0x90,0xc6,0x90,0x90,0x90,0x2a,0x3a, 0x90,0x90,0x90,0x86,0x90,0x22,0x90,0xf3, /* 00 */ 0x90,0x90,0x90,0x90,0x90,0x38,0x01,0x42, 0x04,0x90,0x90,0x1f,0x90,0x90,0x90,0x58, /* 10 */ 0x57,0x2e,0x90,0x90,0x53,0x90,0xb9,0x90, 0x90,0x90,0x90,0x90,0x20,0x55,0x90,0x3d, /* 20 */ 0xa0,0x90,0x90,0x0c,0x03,0x90,0x83,0x90, 0x90,0x90,0x8a,0x90,0x90,0xaa,0x90,0x90, /* 30 */ @@ -163,8 +159,8 @@ namespace mame 0x90,0xba,0xf6,0x51,0x90,0x90,0x90,0xfe, 0x90,0x90,0x90,0x90,0x90,0x90,0xe9,0x90, /* E0 */ 0x90,0x90,0x90,0x90,0x90,0x90,0xe8,0xd2, 0x90,0x18,0x90,0x90,0x90,0xd1,0x90,0x90, /* F0 */ }; - public static byte[] inthunt_decryption_table=new byte[256]{ - 0x1f,0x90,0xbb,0x50,0x90,0x58,0x42,0x57, 0x90,0x90,0xe9,0x90,0x90,0x90,0x90,0x0b, /* 00 */ + public static byte[] inthunt_decryption_table = new byte[256]{ + 0x1f,0x90,0xbb,0x50,0x90,0x58,0x42,0x57, 0x90,0x90,0xe9,0x90,0x90,0x90,0x90,0x0b, /* 00 */ 0x90,0x90,0x9d,0x9c,0x90,0x90,0x1e,0x90, 0x90,0xb4,0x5b,0x90,0x90,0x90,0x90,0x90, /* 10 */ 0x90,0x90,0x78,0xc7,0x90,0x90,0x83,0x90, 0x90,0x0c,0xb0,0x04,0x90,0x90,0x90,0x90, /* 20 */ 0x90,0x90,0x90,0x90,0x3b,0xc3,0xb5,0x47, 0x90,0x90,0x90,0x90,0x59,0x90,0x90,0x90, /* 30 */ @@ -181,8 +177,8 @@ namespace mame 0xfe,0x90,0x90,0x22,0x20,0x72,0xf6,0x80, 0x02,0x2e,0x90,0x74,0x0f,0x90,0x90,0x90, /* E0 */ 0x90,0x90,0x90,0x90,0xbc,0x41,0x90,0xfb, 0x73,0x90,0x90,0x90,0x23,0xd2,0x90,0x90, /* F0 */ }; - public static byte[] leagueman_decryption_table=new byte[256]{ - 0x90,0x90,0x90,0x55,0xbb,0x90,0x23,0x79, 0x90,0x90,0x90,0x90,0x90,0x90,0x38,0x90, /* 00 */ + public static byte[] leagueman_decryption_table = new byte[256]{ + 0x90,0x90,0x90,0x55,0xbb,0x90,0x23,0x79, 0x90,0x90,0x90,0x90,0x90,0x90,0x38,0x90, /* 00 */ 0x01,0x90,0x90,0x90,0x90,0x90,0x90,0x90, 0x3d,0x90,0x90,0x90,0xba,0x90,0x1e,0x90, /* 10 */ 0x2c,0x46,0x90,0xb5,0x90,0x4b,0x90,0xfe, 0x90,0x90,0xfb,0x2e,0x90,0x90,0x36,0x04, /* 20 */ 0xcf,0x90,0xf3,0x5a,0x8a,0x0c,0x9c,0x90, 0x90,0x90,0xb2,0x50,0x90,0x90,0x90,0x5f, /* 30 */ @@ -200,7 +196,7 @@ namespace mame 0x90,0x90,0x90,0xea,0x90,0x52,0x90,0x5d, 0x90,0x90,0x90,0x90,0xbc,0x90,0x90,0x90, /* F0 */ }; public static byte[] psoldier_decryption_table = new byte[256]{ - 0x90,0x90,0x90,0x8a,0x90,0xaa,0x90,0x90, 0x90,0x20,0x23,0x55,0x90,0xb5,0x0a,0x90, /* 00 */ + 0x90,0x90,0x90,0x8a,0x90,0xaa,0x90,0x90, 0x90,0x20,0x23,0x55,0x90,0xb5,0x0a,0x90, /* 00 */ 0x90,0x46,0x90,0xb6,0x90,0x74,0x8b,0x90, 0x90,0xba,0x01,0x90,0x90,0x5a,0x86,0xfb, /* 10 */ 0xb2,0x90,0xb0,0x90,0x42,0x06,0x1e,0x08, 0x22,0x9d,0x90,0x90,0x90,0x90,0x90,0x73, /* 20 */ 0x90,0x90,0x5f,0x90,0x90,0xd0,0x90,0xff, 0x90,0x90,0xbd,0x90,0x03,0x90,0xb9,0x90, /* 30 */ @@ -418,7 +414,7 @@ namespace mame public static void m92_soundlatch_w(ushort data) { Cpuint.lvec.Add(new vec(3, Timer.get_current_time())); - setvector_param = 3; + setvector_param = 3; Timer.emu_timer timer = Timer.timer_alloc_common(setvector_callback, "setvector_callback", true); Timer.timer_adjust_periodic(timer, Attotime.ATTOTIME_ZERO, Attotime.ATTOTIME_NEVER); Sound.soundlatch_w((ushort)(data & 0xff)); diff --git a/MAME.Core/mame/m92/Memory.cs b/MAME.Core/mame/m92/Memory.cs index 70b3c33..48917b7 100644 --- a/MAME.Core/mame/m92/Memory.cs +++ b/MAME.Core/mame/m92/Memory.cs @@ -1,14 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace mame +namespace mame { public partial class M92 { - public static ushort ushort0, ushort1,ushort2, dsw; - public static ushort ushort0_old, ushort1_old,ushort2_old; + public static ushort ushort0, ushort1, ushort2, dsw; + public static ushort ushort0_old, ushort1_old, ushort2_old; public static byte N0ReadOpByte(int address) { address &= 0xfffff; @@ -88,7 +83,7 @@ namespace mame } else if (address >= 0xd0000 && address + 1 <= 0xdffff) { - int offset = (address - 0xd0000)/2; + int offset = (address - 0xd0000) / 2; result = m92_vram_data[offset]; } else if (address >= 0xe0000 && address + 1 <= 0xeffff) diff --git a/MAME.Core/mame/m92/Memory2.cs b/MAME.Core/mame/m92/Memory2.cs index 2825df3..8cb3f17 100644 --- a/MAME.Core/mame/m92/Memory2.cs +++ b/MAME.Core/mame/m92/Memory2.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace mame +namespace mame { public partial class M92 { @@ -58,7 +53,7 @@ namespace mame } else if (address >= 0x80000 && address + 1 <= 0x8ffff) { - int offset = (address - 0x80000)/2; + int offset = (address - 0x80000) / 2; result = m92_vram_data[offset]; } else if (address >= 0xe0000 && address + 1 <= 0xeffff) @@ -87,7 +82,7 @@ namespace mame address &= 0xfffff; if (address >= 0x80000 && address <= 0x8ffff) { - int offset = (address - 0x80000)/2; + int offset = (address - 0x80000) / 2; if (address % 2 == 0) { m92_vram_data[offset] = (ushort)((value << 8) | (m92_vram_data[offset] & 0xff)); @@ -115,12 +110,12 @@ namespace mame } else if (address >= 0xf9000 && address <= 0xf900f) { - int offset = (address - 0xf9000)/2; + int offset = (address - 0xf9000) / 2; if (address % 2 == 0) { m92_spritecontrol_w1(offset, value); } - else if(address%2==1) + else if (address % 2 == 1) { m92_spritecontrol_w2(offset, value); } @@ -272,7 +267,7 @@ namespace mame byte result = 0; if (address >= 0xf0000 && address <= 0xf3fff) { - int offset=(address-0xf0000)/2; + int offset = (address - 0xf0000) / 2; result = m92_eeprom_r(offset); } else @@ -287,7 +282,7 @@ namespace mame ushort result = 0; if (address >= 0xf0000 && address + 1 <= 0xf3fff) { - int offset = (address - 0xf0000)/2; + int offset = (address - 0xf0000) / 2; result = m92_eeprom_r2(offset); } else @@ -301,7 +296,7 @@ namespace mame address &= 0xfffff; if (address >= 0xf0000 && address <= 0xf3fff) { - int offset = (address - 0xf0000)/2; + int offset = (address - 0xf0000) / 2; m92_eeprom_w(offset, value); } else @@ -314,7 +309,7 @@ namespace mame address &= 0xfffff; if (address >= 0xf0000 && address + 1 <= 0xf3fff) { - int offset = (address - 0xf0000)/2; + int offset = (address - 0xf0000) / 2; m92_eeprom_w(offset, (byte)value); } else diff --git a/MAME.Core/mame/m92/State.cs b/MAME.Core/mame/m92/State.cs index ffbcc49..57cdaad 100644 --- a/MAME.Core/mame/m92/State.cs +++ b/MAME.Core/mame/m92/State.cs @@ -1,14 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using cpu.nec; using System.IO; -using cpu.nec; namespace mame { public partial class M92 - { + { public static void SaveStateBinary(BinaryWriter writer) { int i, j; @@ -148,7 +144,7 @@ namespace mame Cpuint.LoadStateBinary_v(reader); Timer.global_basetime.seconds = reader.ReadInt32(); Timer.global_basetime.attoseconds = reader.ReadInt64(); - Video.LoadStateBinary(reader); + Video.LoadStateBinary(reader); Sound.last_update_second = reader.ReadInt32(); Cpuexec.LoadStateBinary(reader); Timer.LoadStateBinary(reader); diff --git a/MAME.Core/mame/m92/Tilemap.cs b/MAME.Core/mame/m92/Tilemap.cs index 1805ae5..924009c 100644 --- a/MAME.Core/mame/m92/Tilemap.cs +++ b/MAME.Core/mame/m92/Tilemap.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; namespace mame { @@ -254,12 +251,12 @@ namespace mame int offsety1; int xoffs; Array.Copy(bb1, pen_data_offset, pen_data, 0, 0x40); - if ((flags & Tilemap.TILE_FLIPY)!=0) + if ((flags & Tilemap.TILE_FLIPY) != 0) { y0 += tileheight - 1; dy0 = -1; } - if ((flags & Tilemap.TILE_FLIPX)!=0) + if ((flags & Tilemap.TILE_FLIPX) != 0) { x0 += tilewidth - 1; dx0 = -1; diff --git a/MAME.Core/mame/m92/Video.cs b/MAME.Core/mame/m92/Video.cs index 31268f9..de72b87 100644 --- a/MAME.Core/mame/m92/Video.cs +++ b/MAME.Core/mame/m92/Video.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; namespace mame { @@ -138,7 +134,7 @@ namespace mame pf_layer[0].control[offset] = (ushort)((pf_layer[0].control[offset] & 0xff00) | data); } public static void m92_pf1_control_w(int offset, ushort data) - { + { pf_layer[0].control[offset] = data; } public static void m92_pf2_control_w1(int offset, byte data) @@ -227,7 +223,7 @@ namespace mame break; } } - public static void m92_master_control_w(int offset,ushort data) + public static void m92_master_control_w(int offset, ushort data) { ushort old = pf_master_control[offset]; //COMBINE_DATA(&pf_master_control[offset]); @@ -274,14 +270,14 @@ namespace mame pf_layer[laynum].tmap.tilemap_set_scrolldy(-128, -128); pf_layer[laynum].wide_tmap.tilemap_set_scrolldx(2 * laynum - 256, -2 * laynum + 8 - 256); pf_layer[laynum].wide_tmap.tilemap_set_scrolldy(-128, -128); - } + } } public static void draw_sprites(RECT cliprect) { int offs, k; for (k = 0; k < 8; k++) { - for (offs = 0; offs < m92_sprite_list; ) + for (offs = 0; offs < m92_sprite_list;) { int x, y, sprite, colour, fx, fy, x_multi, y_multi, i, j, s_ptr, pri_back, pri_sprite; y = Generic.buffered_spriteram16[offs + 0] & 0x1ff; @@ -324,7 +320,8 @@ namespace mame x &= 0x1ff; for (i = 0; i < y_multi; i++) { - if (Generic.flip_screen_get()!=0) { + if (Generic.flip_screen_get() != 0) + { int i1 = 1; /*pdrawgfx(bitmap,machine->gfx[1], sprite + s_ptr, @@ -388,7 +385,7 @@ namespace mame { if ((pf_master_control[laynum] & 0x40) != 0) { - int scrolldata_offset = (0xf400 + 0x400 * laynum)/2; + int scrolldata_offset = (0xf400 + 0x400 * laynum) / 2; pf_layer[laynum].tmap.tilemap_set_scroll_rows(512); pf_layer[laynum].wide_tmap.tilemap_set_scroll_rows(512); for (i = 0; i < 512; i++) diff --git a/MAME.Core/mame/namcos1/Drawgfx.cs b/MAME.Core/mame/namcos1/Drawgfx.cs index b78c29c..79f062d 100644 --- a/MAME.Core/mame/namcos1/Drawgfx.cs +++ b/MAME.Core/mame/namcos1/Drawgfx.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace mame +namespace mame { public partial class Drawgfx { @@ -114,6 +109,6 @@ namespace mame } } } - } + } } } diff --git a/MAME.Core/mame/namcos1/Gdi.cs b/MAME.Core/mame/namcos1/Gdi.cs index 352875d..e4d008d 100644 --- a/MAME.Core/mame/namcos1/Gdi.cs +++ b/MAME.Core/mame/namcos1/Gdi.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Drawing; -using System.Drawing.Imaging; - -namespace mame +namespace mame { public partial class Namcos1 { @@ -13,81 +6,5 @@ namespace mame { } - public static Bitmap GetLayer(int n) - { - int i, j, i1; - uint u1; - Color c1; - Bitmap bm1 = new Bitmap(512, 512); - for (i = 0; i < 0x200; i++) - { - for (j = 0; j < 0x200; j++) - { - i1 = Namcos1.ttmap[n].pixmap[i + j * 0x200] + Namcos1.ttmap[n].palette_offset; - u1 = Palette.entry_color[i1]; - c1 = Color.FromArgb((int)Palette.entry_color[Namcos1.ttmap[n].pixmap[i + j * 0x200] + Namcos1.ttmap[n].palette_offset]); - bm1.SetPixel(i, j, c1); - } - } - return bm1; - } - public static Bitmap GetPri() - { - int i, j; - byte priority; - Color c1; - Bitmap bm1 = new Bitmap(512, 512); - RECT new_clip = new RECT(); - new_clip.min_x = 0x49; - new_clip.max_x = 0x168; - new_clip.min_y = 0x10; - new_clip.max_y = 0xef; - for (priority = 0; priority < 8; priority++) - { - for (i = 0; i < 6; i++) - { - if (Namcos1.namcos1_playfield_control[16 + i] == priority) - { - Namcos1.ttmap[i].tilemap_draw_primask(new_clip, 0x10, priority); - } - } - } - for (i = 0; i < 0x200; i++) - { - for (j = 0; j < 0x200; j++) - { - if (Tilemap.priority_bitmap[i, j] == 0) - { - c1 = Color.Black; - } - else if (Tilemap.priority_bitmap[i, j] == 0x01) - { - c1 = Color.Red; - } - else if (Tilemap.priority_bitmap[i, j] == 0x03) - { - c1 = Color.Orange; - } - else if (Tilemap.priority_bitmap[i, j] == 0x04) - { - c1 = Color.Yellow; - } - else if (Tilemap.priority_bitmap[i, j] == 0x07) - { - c1 = Color.Green; - } - else if (Tilemap.priority_bitmap[i, j] == 0x1f) - { - c1 = Color.Blue; - } - else - { - c1 = Color.White; - } - bm1.SetPixel(j, i, c1); - } - } - return bm1; - } } } diff --git a/MAME.Core/mame/namcos1/Input.cs b/MAME.Core/mame/namcos1/Input.cs index c7dbece..dd1c3be 100644 --- a/MAME.Core/mame/namcos1/Input.cs +++ b/MAME.Core/mame/namcos1/Input.cs @@ -93,7 +93,7 @@ namespace mame else { byte0 |= 0x40; - } + } if (Keyboard.IsPressed(Key.Right)) { byte1 &= unchecked((byte)~0x01); @@ -200,7 +200,7 @@ namespace mame else { byte1 |= 0x80; - } + } if (Keyboard.IsPressed(Key.J)) { byte0 &= unchecked((byte)~0x10); @@ -224,7 +224,7 @@ namespace mame else { byte0 |= 0x40; - } + } if (Keyboard.IsPressed(Key.NumPad1)) { byte1 &= unchecked((byte)~0x10); @@ -592,7 +592,7 @@ namespace mame else { byte01 |= 0x08; - } + } if (Keyboard.IsPressed(Key.R)) { byte2 &= unchecked((byte)~0x20); diff --git a/MAME.Core/mame/namcos1/Machine.cs b/MAME.Core/mame/namcos1/Machine.cs index 4027220..5d9c5ca 100644 --- a/MAME.Core/mame/namcos1/Machine.cs +++ b/MAME.Core/mame/namcos1/Machine.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; namespace mame { @@ -173,7 +169,7 @@ namespace mame public static void namcos1_watchdog_w() { wdog |= 1 << Cpuexec.activecpu; - if (wdog == 7 || (namcos1_reset==0)) + if (wdog == 7 || (namcos1_reset == 0)) { wdog = 0; Generic.watchdog_reset_w(); @@ -208,17 +204,17 @@ namespace mame public static void namcos1_bankswitch(int cpu, int offset, byte data) { int reg = (offset >> 9) & 0x7; - if ((offset & 1)!=0) + if ((offset & 1) != 0) { - cus117_offset[cpu,reg] = (cus117_offset[cpu,reg] & 0x600000) | (data * 0x2000); + cus117_offset[cpu, reg] = (cus117_offset[cpu, reg] & 0x600000) | (data * 0x2000); } else { - cus117_offset[cpu,reg] = (cus117_offset[cpu,reg] & 0x1fe000) | ((data & 0x03) * 0x200000); + cus117_offset[cpu, reg] = (cus117_offset[cpu, reg] & 0x1fe000) | ((data & 0x03) * 0x200000); } - if (cus117_offset[cpu,reg] >= 0x400000 && cus117_offset[cpu,reg] <= 0x7fffff) + if (cus117_offset[cpu, reg] >= 0x400000 && cus117_offset[cpu, reg] <= 0x7fffff) { - user1rom_offset[cpu,reg] = cus117_offset[cpu,reg] - 0x400000; + user1rom_offset[cpu, reg] = cus117_offset[cpu, reg] - 0x400000; } } public static void namcos1_bankswitch_w(int offset, byte data) @@ -227,25 +223,25 @@ namespace mame } public static void namcos1_subcpu_bank_w(byte data) { - cus117_offset[1,7] = 0x600000 | (data * 0x2000); - user1rom_offset[1,7] = cus117_offset[1,7] - 0x400000; + cus117_offset[1, 7] = 0x600000 | (data * 0x2000); + user1rom_offset[1, 7] = cus117_offset[1, 7] - 0x400000; } public static void machine_reset_namcos1() { - cus117_offset[0,0] = 0x0180 * 0x2000; - cus117_offset[0,1] = 0x0180 * 0x2000; - cus117_offset[0,7] = 0x03ff * 0x2000; - cus117_offset[1,0] = 0x0180 * 0x2000; - cus117_offset[1,7] = 0x03ff * 0x2000; - user1rom_offset[0,7] = cus117_offset[0,7] - 0x400000; - user1rom_offset[1,7] = cus117_offset[1,7] - 0x400000; + cus117_offset[0, 0] = 0x0180 * 0x2000; + cus117_offset[0, 1] = 0x0180 * 0x2000; + cus117_offset[0, 7] = 0x03ff * 0x2000; + cus117_offset[1, 0] = 0x0180 * 0x2000; + cus117_offset[1, 7] = 0x03ff * 0x2000; + user1rom_offset[0, 7] = cus117_offset[0, 7] - 0x400000; + user1rom_offset[1, 7] = cus117_offset[1, 7] - 0x400000; Cpuint.cpunum_set_input_line(1, (int)LineState.INPUT_LINE_RESET, LineState.ASSERT_LINE); Cpuint.cpunum_set_input_line(2, (int)LineState.INPUT_LINE_RESET, LineState.ASSERT_LINE); Cpuint.cpunum_set_input_line(3, (int)LineState.INPUT_LINE_RESET, LineState.ASSERT_LINE); mcu_patch_data = 0; namcos1_reset = 0; namcos1_init_DACs(); - int i,j; + int i, j; for (i = 0; i < 8; i++) { key[i] = 0; @@ -254,7 +250,7 @@ namespace mame { for (j = 0; j < 8; j++) { - cus117_offset[i,j] = 0; + cus117_offset[i, j] = 0; } } wdog = 0; @@ -432,8 +428,8 @@ namespace mame namcos1_driver_init(new namcos1_specific(311, 2, 3, 0, -1, 4, -1)); break; case "puzlclub": - key_r= key_type1_r; - key_w=key_type1_w; + key_r = key_type1_r; + key_w = key_type1_w; namcos1_driver_init(new namcos1_specific(0x35, 0, 0, 0, 0, 0, 0)); break; case "tankfrce": diff --git a/MAME.Core/mame/namcos1/Memory.cs b/MAME.Core/mame/namcos1/Memory.cs index ffd311a..9f08539 100644 --- a/MAME.Core/mame/namcos1/Memory.cs +++ b/MAME.Core/mame/namcos1/Memory.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using cpu.m6800; -using cpu.m6809; +using cpu.m6800; namespace mame { @@ -88,37 +83,37 @@ namespace mame int reg; reg = address / 0x2000; offset = address & 0x1fff; - if (cus117_offset[0,reg] == 0) + if (cus117_offset[0, reg] == 0) { - result = user1rom[user1rom_offset[0,reg] + offset]; + result = user1rom[user1rom_offset[0, reg] + offset]; } - else if (cus117_offset[0,reg] >= 0x2e0000 && cus117_offset[0,reg] <= 0x2e7fff) + else if (cus117_offset[0, reg] >= 0x2e0000 && cus117_offset[0, reg] <= 0x2e7fff) { - result = namcos1_paletteram[cus117_offset[0,reg] - 0x2e0000 + offset]; + result = namcos1_paletteram[cus117_offset[0, reg] - 0x2e0000 + offset]; } - else if (cus117_offset[0,reg] >= 0x2f0000 && cus117_offset[0,reg] <= 0x2f7fff) + else if (cus117_offset[0, reg] >= 0x2f0000 && cus117_offset[0, reg] <= 0x2f7fff) { - result = namcos1_videoram_r(cus117_offset[0,reg] - 0x2f0000 + offset); + result = namcos1_videoram_r(cus117_offset[0, reg] - 0x2f0000 + offset); } - else if (cus117_offset[0,reg] == 0x2f8000) + else if (cus117_offset[0, reg] == 0x2f8000) { result = key_r(offset); } - else if (cus117_offset[0,reg] == 0x2fc000) + else if (cus117_offset[0, reg] == 0x2fc000) { result = namcos1_spriteram_r(offset); } - else if (cus117_offset[0,reg] == 0x2fe000) + else if (cus117_offset[0, reg] == 0x2fe000) { result = soundram_r(offset); } - else if (cus117_offset[0,reg] >= 0x300000 && cus117_offset[0,reg] <= 0x307fff) + else if (cus117_offset[0, reg] >= 0x300000 && cus117_offset[0, reg] <= 0x307fff) { - result = s1ram[cus117_offset[0,reg] - 0x300000 + offset]; + result = s1ram[cus117_offset[0, reg] - 0x300000 + offset]; } - else if (cus117_offset[0,reg] >= 0x400000 && cus117_offset[0,reg] <= 0x7fffff) + else if (cus117_offset[0, reg] >= 0x400000 && cus117_offset[0, reg] <= 0x7fffff) { - result = user1rom[cus117_offset[0,reg] - 0x400000 + offset]; + result = user1rom[cus117_offset[0, reg] - 0x400000 + offset]; } else { @@ -133,33 +128,33 @@ namespace mame int reg; reg = address / 0x2000; offset = address & 0x1fff; - if (cus117_offset[1,reg] >= 0x2e0000 && cus117_offset[1,reg] <= 0x2e7fff) + if (cus117_offset[1, reg] >= 0x2e0000 && cus117_offset[1, reg] <= 0x2e7fff) { - result = namcos1_paletteram[cus117_offset[1,reg] - 0x2e0000 + offset]; + result = namcos1_paletteram[cus117_offset[1, reg] - 0x2e0000 + offset]; } - else if (cus117_offset[1,reg] >= 0x2f0000 && cus117_offset[1,reg] <= 0x2f7fff) + else if (cus117_offset[1, reg] >= 0x2f0000 && cus117_offset[1, reg] <= 0x2f7fff) { - result = namcos1_videoram_r(cus117_offset[1,reg] - 0x2f0000 + offset); + result = namcos1_videoram_r(cus117_offset[1, reg] - 0x2f0000 + offset); } - else if (cus117_offset[1,reg] == 0x2f8000) + else if (cus117_offset[1, reg] == 0x2f8000) { result = key_r(offset); } - else if (cus117_offset[1,reg] == 0x2fc000) + else if (cus117_offset[1, reg] == 0x2fc000) { result = namcos1_spriteram_r(offset); } - else if (cus117_offset[1,reg] == 0x2fe000) + else if (cus117_offset[1, reg] == 0x2fe000) { result = soundram_r(offset); } - else if (cus117_offset[1,reg] >= 0x300000 && cus117_offset[1,reg] <= 0x307fff) + else if (cus117_offset[1, reg] >= 0x300000 && cus117_offset[1, reg] <= 0x307fff) { result = s1ram[cus117_offset[1, reg] - 0x300000 + offset]; } - else if (cus117_offset[1,reg] >= 0x400000 && cus117_offset[1,reg] <= 0x7fffff) + else if (cus117_offset[1, reg] >= 0x400000 && cus117_offset[1, reg] <= 0x7fffff) { - result = user1rom[cus117_offset[1,reg] - 0x400000 + offset]; + result = user1rom[cus117_offset[1, reg] - 0x400000 + offset]; } else if (cus117_offset[0, reg] == 0) { @@ -262,7 +257,7 @@ namespace mame result = 0; } return result; - } + } public static byte N3ReadIO(ushort address) { byte result; @@ -286,11 +281,11 @@ namespace mame int reg; reg = address / 0x2000; offset = address & 0x1fff; - if (cus117_offset[0,reg] == 0) + if (cus117_offset[0, reg] == 0) { if (address >= 0x0000 && address <= 0xdfff) { - user1rom[user1rom_offset[0,reg] + offset] = data; + user1rom[user1rom_offset[0, reg] + offset] = data; } if (address >= 0xe000 && address <= 0xefff) { @@ -325,31 +320,31 @@ namespace mame int i1 = 1; } } - else if (cus117_offset[0,reg] == 0x2c0000) + else if (cus117_offset[0, reg] == 0x2c0000) { namcos1_3dcs_w(offset); } - else if (cus117_offset[0,reg] >= 0x2e0000 && cus117_offset[0,reg] <= 0x2e7fff) + else if (cus117_offset[0, reg] >= 0x2e0000 && cus117_offset[0, reg] <= 0x2e7fff) { - namcos1_paletteram_w(cus117_offset[0,reg] - 0x2e0000 + offset, data); + namcos1_paletteram_w(cus117_offset[0, reg] - 0x2e0000 + offset, data); } - else if (cus117_offset[0,reg] >= 0x2f0000 && cus117_offset[0,reg] <= 0x2f7fff) + else if (cus117_offset[0, reg] >= 0x2f0000 && cus117_offset[0, reg] <= 0x2f7fff) { - namcos1_videoram_w(cus117_offset[0,reg] - 0x2f0000 + offset, data); + namcos1_videoram_w(cus117_offset[0, reg] - 0x2f0000 + offset, data); } - else if (cus117_offset[0,reg] == 0x2f8000) + else if (cus117_offset[0, reg] == 0x2f8000) { key_w(offset, data); } - else if (cus117_offset[0,reg] == 0x2fc000) + else if (cus117_offset[0, reg] == 0x2fc000) { namcos1_spriteram_w(offset, data); } - else if (cus117_offset[0,reg] == 0x2fe000) + else if (cus117_offset[0, reg] == 0x2fe000) { soundram_w(offset, data); } - else if (cus117_offset[0,reg] >= 0x300000 && cus117_offset[0,reg] <= 0x307fff) + else if (cus117_offset[0, reg] >= 0x300000 && cus117_offset[0, reg] <= 0x307fff) { s1ram[cus117_offset[0, reg] - 0x300000 + offset] = data; } diff --git a/MAME.Core/mame/namcos1/Memory2.cs b/MAME.Core/mame/namcos1/Memory2.cs index 87bdb60..c790a07 100644 --- a/MAME.Core/mame/namcos1/Memory2.cs +++ b/MAME.Core/mame/namcos1/Memory2.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using cpu.m6800; -using cpu.m6809; - -namespace mame +namespace mame { public partial class Namcos1 { @@ -31,7 +24,7 @@ namespace mame } else { - result= N3ReadMemory(address); + result = N3ReadMemory(address); } return result; } diff --git a/MAME.Core/mame/namcos1/Namcos1.cs b/MAME.Core/mame/namcos1/Namcos1.cs index 92352ec..da7d93c 100644 --- a/MAME.Core/mame/namcos1/Namcos1.cs +++ b/MAME.Core/mame/namcos1/Namcos1.cs @@ -1,27 +1,24 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using MAME.Core.Common; +using System; using System.IO; -using MAME.Core.Common; namespace mame { public partial class Namcos1 { public static int dac0_value, dac1_value, dac0_gain, dac1_gain; - public static byte[] gfx1rom, gfx2rom, gfx3rom, user1rom,mcurom; + public static byte[] gfx1rom, gfx2rom, gfx3rom, user1rom, mcurom; public static byte[] audiorom, voicerom, bank_ram20, bank_ram30; public static int namcos1_pri; public static byte dipsw; public static byte[] ByteTo2byte(byte[] bb1) { byte[] bb2 = null; - int i1,n1; + int i1, n1; if (bb1 != null) { n1 = bb1.Length; - bb2 = new byte[n1*2]; + bb2 = new byte[n1 * 2]; for (i1 = 0; i1 < n1; i1++) { bb2[i1 * 2] = (byte)(bb1[i1] >> 4); @@ -32,14 +29,14 @@ namespace mame } public static void Namcos1Init() { - Machine.bRom = true; + Machine.bRom = true; user1rom_offset = new int[2, 8]; audiorom = Machine.GetRom("audiocpu.rom"); gfx1rom = Machine.GetRom("gfx1.rom"); gfx2rom = Machine.GetRom("gfx2.rom"); gfx3rom = ByteTo2byte(Machine.GetRom("gfx3.rom")); user1rom = Machine.GetRom("user1.rom"); - mcurom = mainForm.resource.Get_mcu(); + mcurom = mainMotion.resource.Get_mcu(); voicerom = new byte[0xc0000]; byte[] bb1 = Machine.GetRom("voice.rom"); Array.Copy(bb1, voicerom, bb1.Length); diff --git a/MAME.Core/mame/namcos1/State.cs b/MAME.Core/mame/namcos1/State.cs index b4c1611..9cbd114 100644 --- a/MAME.Core/mame/namcos1/State.cs +++ b/MAME.Core/mame/namcos1/State.cs @@ -1,10 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; +using cpu.m6800; using cpu.m6809; -using cpu.m6800; +using System.IO; namespace mame { @@ -79,7 +75,7 @@ namespace mame } public static void LoadStateBinary(BinaryReader reader) { - int i,j; + int i, j; dipsw = reader.ReadByte(); for (i = 0; i < 0x2000; i++) { diff --git a/MAME.Core/mame/namcos1/Tilemap.cs b/MAME.Core/mame/namcos1/Tilemap.cs index 37e8450..e2d426c 100644 --- a/MAME.Core/mame/namcos1/Tilemap.cs +++ b/MAME.Core/mame/namcos1/Tilemap.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; namespace mame { @@ -72,9 +69,9 @@ namespace mame { int x0 = tilewidth * col; int y0 = tileheight * row; - int code, tile_index,col2,row2; + int code, tile_index, col2, row2; byte flags; - if ((attributes & Tilemap.TILEMAP_FLIPX)!=0) + if ((attributes & Tilemap.TILEMAP_FLIPX) != 0) { col2 = (cols - 1) - col; } @@ -82,7 +79,7 @@ namespace mame { col2 = col; } - if ((attributes & Tilemap.TILEMAP_FLIPY)!=0) + if ((attributes & Tilemap.TILEMAP_FLIPY) != 0) { row2 = (rows - 1) - row; } @@ -93,10 +90,10 @@ namespace mame tile_index = (row2 * cols + col2) << 1; code = Namcos1.namcos1_videoram[videoram_offset + tile_index + 1] + ((Namcos1.namcos1_videoram[videoram_offset + tile_index] & 0x3f) << 8); flags = (byte)(attributes & 0x03); - tileflags[row, col] = tile_drawNa(code * 0x40, x0, y0, 0x800,flags); - tileflags[row, col] = tile_apply_bitmaskNa(code << 3, x0, y0,flags); + tileflags[row, col] = tile_drawNa(code * 0x40, x0, y0, 0x800, flags); + tileflags[row, col] = tile_apply_bitmaskNa(code << 3, x0, y0, flags); } - public byte tile_drawNa(int pendata_offset, int x0, int y0, int palette_base,byte flags) + public byte tile_drawNa(int pendata_offset, int x0, int y0, int palette_base, byte flags) { int height = tileheight; int width = tilewidth; @@ -104,12 +101,12 @@ namespace mame int tx, ty; int offset1 = pendata_offset; int offsety1; - if ((flags & Tilemap.TILE_FLIPY)!=0) + if ((flags & Tilemap.TILE_FLIPY) != 0) { y0 += height - 1; dy0 = -1; } - if ((flags & Tilemap.TILE_FLIPX)!=0) + if ((flags & Tilemap.TILE_FLIPX) != 0) { x0 += width - 1; dx0 = -1; @@ -145,7 +142,7 @@ namespace mame y0 += height - 1; dy0 = -1; } - if ((flags & Tilemap.TILE_FLIPX)!=0) + if ((flags & Tilemap.TILE_FLIPX) != 0) { x0 += width - 1; dx0 = -1; diff --git a/MAME.Core/mame/namcos1/Video.cs b/MAME.Core/mame/namcos1/Video.cs index 15f0771..bfdd2d7 100644 --- a/MAME.Core/mame/namcos1/Video.cs +++ b/MAME.Core/mame/namcos1/Video.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; namespace mame { @@ -163,7 +160,7 @@ namespace mame flipy ^= 1; } sy++; - Drawgfx.common_drawgfx_na(sizex,sizey,tx,ty,sprite,color,flipx,flipy,sx & 0x1ff,((sy + 16) & 0xff) - 16,cliprect); + Drawgfx.common_drawgfx_na(sizex, sizey, tx, ty, sprite, color, flipx, flipy, sx & 0x1ff, ((sy + 16) & 0xff) - 16, cliprect); } } public static void video_update_namcos1() @@ -244,6 +241,6 @@ namespace mame } copy_sprites = 0; } - } + } } } diff --git a/MAME.Core/mame/neogeo/Gdi.cs b/MAME.Core/mame/neogeo/Gdi.cs index 1620ea4..1496f9e 100644 --- a/MAME.Core/mame/neogeo/Gdi.cs +++ b/MAME.Core/mame/neogeo/Gdi.cs @@ -1,10 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Drawing; -using System.Drawing.Imaging; -using System.IO; +using System.Collections.Generic; +using Color = MAME.Core.AxiBitmap.AxiColor; namespace mame { @@ -16,313 +11,8 @@ namespace mame public static bool bRender0G, bRender1G; public static void GDIInit() { - m_ColorG = Color.Magenta; + //m_ColorG = Color.Magenta; lSprite = new List(); } - public static Bitmap GetSprite() - { - int i, x, x2, y, rows, zoom_x, zoom_y, scanline, attr_and_code_offs, code, gfx_offset; - int sprite_y, tile, zoom_x_table_offset, line_pens_offset, sprite_line, zoom_line, x_inc; - ushort y_control, zoom_control, attr, x_2, code_2; - byte sprite_y_and_tile; - bool invert; - Machine.FORM.neogeoform.tbResult.Clear(); - Bitmap bm1; - bm1 = new Bitmap(384, 264); - 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; - y = 0; - x = 0; - rows = 0; - zoom_y = 0; - zoom_x = 0; - foreach (int sprite_number in lSprite) - { - y_control = Neogeo.neogeo_videoram[0x8200 | sprite_number]; - zoom_control = Neogeo.neogeo_videoram[0x8000 | sprite_number]; - x_2 = Neogeo.neogeo_videoram[0x8400 | sprite_number]; - code_2 = Neogeo.neogeo_videoram[sprite_number << 6]; - if ((y_control & 0x40) != 0) - { - x = (x + zoom_x + 1) & 0x01ff; - zoom_x = (zoom_control >> 8) & 0x0f; - } - else - { - y = 0x200 - (y_control >> 7); - x = Neogeo.neogeo_videoram[0x8400 | sprite_number] >> 7; - zoom_y = zoom_control & 0xff; - zoom_x = (zoom_control >> 8) & 0x0f; - rows = y_control & 0x3f; - } - Machine.FORM.neogeoform.tbResult.Add(sprite_number.ToString("X3") + " " + x_2.ToString("X4") + " " + y_control.ToString("X4") + " " + code_2.ToString("X4") + " " + zoom_control.ToString("X4") + "\r\n"); - if (((x >= 0x140) && (x <= 0x1f0)) || rows == 0) - continue; - if (x == 0) - { - int i1 = 1; - } - for (scanline = 0; scanline < 264; scanline++) - { - if (Neogeo.sprite_on_scanline(scanline, y, rows)) - { - sprite_line = (scanline - y) & 0x1ff; - zoom_line = sprite_line & 0xff; - invert = ((sprite_line & 0x100) != 0) ? true : false; - if (invert) - zoom_line ^= 0xff; - if (rows > 0x20) - { - zoom_line = zoom_line % ((zoom_y + 1) << 1); - if (zoom_line > zoom_y) - { - zoom_line = ((zoom_y + 1) << 1) - 1 - zoom_line; - invert = !invert; - } - } - sprite_y_and_tile = Neogeo.zoomyrom[(zoom_y << 8) | zoom_line]; - sprite_y = sprite_y_and_tile & 0x0f; - tile = sprite_y_and_tile >> 4; - if (invert) - { - sprite_y ^= 0x0f; - tile ^= 0x1f; - } - attr_and_code_offs = (sprite_number << 6) | (tile << 1); - attr = Neogeo.neogeo_videoram[attr_and_code_offs + 1]; - code = ((attr << 12) & 0x70000) | Neogeo.neogeo_videoram[attr_and_code_offs]; - if (Neogeo.auto_animation_disabled == 0) - { - if ((attr & 0x0008) != 0) - code = (code & ~0x07) | (Neogeo.auto_animation_counter & 0x07); - else if ((attr & 0x0004) != 0) - code = (code & ~0x03) | (Neogeo.auto_animation_counter & 0x03); - } - if ((attr & 0x0002) != 0) - sprite_y ^= 0x0f; - zoom_x_table_offset = 0; - gfx_offset = (int)(((code << 8) | (sprite_y << 4)) & Neogeo.sprite_gfx_address_mask); - line_pens_offset = attr >> 8 << 4; - if ((attr & 0x0001) != 0) - { - gfx_offset = gfx_offset + 0x0f; - x_inc = -1; - } - else - { - x_inc = 1; - } - if (x <= 0x01f0) - { - x2 = x + 30; - for (i = 0; i < 0x10; i++) - { - if (Neogeo.zoom_x_tables[zoom_x, zoom_x_table_offset] != 0) - { - if (Neogeo.sprite_gfx[gfx_offset] != 0) - { - ptr2 = ptr + (scanline * 384 + x2) * 4; - *ptr2 = (byte)(Neogeo.pens[line_pens_offset + Neogeo.sprite_gfx[gfx_offset]] & 0xff); - *(ptr2 + 1) = (byte)((Neogeo.pens[line_pens_offset + Neogeo.sprite_gfx[gfx_offset]] & 0xff00) >> 8); - *(ptr2 + 2) = (byte)((Neogeo.pens[line_pens_offset + Neogeo.sprite_gfx[gfx_offset]] & 0xff0000) >> 16); - *(ptr2 + 3) = 0xff; - } - x2++; - } - zoom_x_table_offset++; - gfx_offset += x_inc; - } - } - else - { - int i1 = 1; - } - } - } - } - } - bm1.UnlockBits(bmData); - return bm1; - } - public static Bitmap GetFixedlayer() - { - byte[] gfx_base; - int i, j,x,y, addr_mask, code, gfx_offset,char_pens_offset; - int[] garouoffsets, pix_offsets = new int[] { 0x10, 0x18, 0x00, 0x08 }; - ushort code_and_palette; - bool banked; - byte data; - Bitmap bm1; - bm1 = new Bitmap(384,264); - 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; - if (fixed_layer_source != 0) - { - gfx_base = fixedrom; - addr_mask = fixedrom.Length - 1; - } - else - { - gfx_base = fixedbiosrom; - addr_mask = fixedbiosrom.Length - 1; - } - banked = (fixed_layer_source != 0) && (addr_mask > 0x1ffff); - garouoffsets = new int[32]; - banked = (fixed_layer_source != 0) && (addr_mask > 0x1ffff); - if (banked && neogeo_fixed_layer_bank_type == 1) - { - int garoubank = 0; - int k = 0; - y = 0; - while (y < 32) - { - if (neogeo_videoram[0x7500 + k] == 0x0200 && (neogeo_videoram[0x7580 + k] & 0xff00) == 0xff00) - { - garoubank = neogeo_videoram[0x7580 + k] & 3; - garouoffsets[y++] = garoubank; - } - garouoffsets[y++] = garoubank; - k += 2; - } - } - for (y = 0; y < 33; y++) - { - for (x = 0; x < 40; x++) - { - code_and_palette = neogeo_videoram[0x7000 | (y + x * 0x20)]; - code = code_and_palette & 0x0fff; - if (banked) - { - switch (neogeo_fixed_layer_bank_type) - { - case 1: - code += 0x1000 * (garouoffsets[(y - 2) & 31] ^ 3); - break; - case 2: - code += 0x1000 * (((neogeo_videoram[0x7500 + ((y - 1) & 31) + 32 * (x / 6)] >> (5 - (x % 6)) * 2) & 3) ^ 3); - break; - } - } - data = 0; - for (i = 0; i < 8; i++) - { - gfx_offset = ((code << 5) | i) & addr_mask; - char_pens_offset = code_and_palette >> 12 << 4; - for (j = 0; j < 8; j++) - { - if ((j & 0x01) != 0) - data = (byte)(data >> 4); - else - data = gfx_base[gfx_offset + pix_offsets[j >> 1]]; - if ((data & 0x0f) != 0) - { - ptr2 = ptr + (((y * 8) + i) * 384 + 30 + x * 8 + j) * 4; - *ptr2 = (byte)(pens[char_pens_offset + (data & 0x0f)] & 0xff); - *(ptr2 + 1) = (byte)((pens[char_pens_offset + (data & 0x0f)] & 0xff00) >> 8); - *(ptr2 + 2) = (byte)((pens[char_pens_offset + (data & 0x0f)] & 0xff0000) >> 16); - *(ptr2 + 3) = 0xff; - } - } - } - } - } - } - bm1.UnlockBits(bmData); - return bm1; - } - public static Bitmap GetAllGDI() - { - string[] ss1, ss2, ss3; - int i1, i2, i3, i4, n1, n2, width, height; - lSprite.Clear(); - ss1 = Machine.FORM.neogeoform.tbSprite.Split(sde2, StringSplitOptions.RemoveEmptyEntries); - n1 = ss1.Length; - for (i1 = 0; i1 < n1; i1++) - { - ss2 = ss1[i1].Split(sde6, StringSplitOptions.RemoveEmptyEntries); - n2 = ss2.Length; - if (n2 == 1) - { - i3 = Convert.ToInt32(ss2[0], 16); - i4 = i3; - } - else - { - i3 = Convert.ToInt32(ss2[0], 16); - i4 = Convert.ToInt32(ss2[1], 16); - } - for (i2 = i3; i2 <= i4; i2++) - { - lSprite.Add(i2); - } - } - ss3 = Machine.FORM.neogeoform.tbPoint.Split(sde2, StringSplitOptions.RemoveEmptyEntries); - width = int.Parse(ss3[0]); - height = int.Parse(ss3[1]); - Bitmap bm1 = new Bitmap(width, height), bm2; - m_ColorG = Color.FromArgb(unchecked((int)0xff000000) | pens[0xfff]); - Graphics g = Graphics.FromImage(bm1); - g.Clear(m_ColorG); - if (bRender0G) - { - bm2 = GetSprite(); - g.DrawImage(bm2, 0, 0); - } - if (bRender1G) - { - bm2 = GetFixedlayer(); - g.DrawImage(bm2, 0, 0); - } - g.Dispose(); - return bm1; - } - public static Bitmap DrawSprite(int SOffset,int pensoffset) - { - Bitmap bm1 = new Bitmap(32, 32), bm2; - m_ColorG = Color.FromArgb(unchecked((int)0xff000000) | pens[0xfff]); - Graphics g = Graphics.FromImage(bm1); - g.Clear(m_ColorG); - bm2 = GetSprite1(SOffset, pensoffset); - g.DrawImage(bm2, 0, 0); - g.Dispose(); - return bm1; - } - public static Bitmap GetSprite1(int gfx_offset, int line_pens_offset) - { - int i, j,col, n1, n2; - Bitmap bm1; - n1 = 32; - n2 = 32; - bm1 = new Bitmap(n1, n2); - 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 (j = 0; j < n2; j++) - { - for (i = 0; i < n1; i++) - { - col = i / 16; - ptr2 = ptr + (j * n1 + i) * 4; - *ptr2 = (byte)(pens[line_pens_offset + sprite_gfx[gfx_offset + 0x200 * col + j * 16 + i % 16]] & 0xff); - *(ptr2 + 1) = (byte)((pens[line_pens_offset + sprite_gfx[gfx_offset + 0x200 * col + j * 16 + i % 16]] & 0xff00) >> 8); - *(ptr2 + 2) = (byte)((pens[line_pens_offset + sprite_gfx[gfx_offset + 0x200 * col + j * 16 + i % 16]] & 0xff0000) >> 16); - *(ptr2 + 3) = 0xff; - } - } - } - bm1.UnlockBits(bmData); - return bm1; - } } } diff --git a/MAME.Core/mame/neogeo/Input.cs b/MAME.Core/mame/neogeo/Input.cs index ce6d580..cfa90d1 100644 --- a/MAME.Core/mame/neogeo/Input.cs +++ b/MAME.Core/mame/neogeo/Input.cs @@ -13,7 +13,7 @@ namespace mame else { short3 |= 0x0001; - } + } if (Keyboard.IsPressed(Key.D6)) { short3 &= ~0x0002; @@ -168,11 +168,11 @@ namespace mame } if (Keyboard.IsPressed(Key.NumPad3)) { - + } else { - + } if (Keyboard.IsPressed(Key.NumPad4)) { @@ -192,11 +192,11 @@ namespace mame } if (Keyboard.IsPressed(Key.NumPad6)) { - + } else { - + } if (Keyboard.IsPressed(Key.R)) { @@ -286,7 +286,7 @@ namespace mame } public static void record_port() { - if (short0 != short0_old || short1 != short1_old || short2 != short2_old||short3!=short3_old||short4!=short4_old) + if (short0 != short0_old || short1 != short1_old || short2 != short2_old || short3 != short3_old || short4 != short4_old) { short0_old = short0; short1_old = short1; @@ -320,7 +320,7 @@ namespace mame } Inptport.bReplayRead = false; } - if(Video.screenstate.frame_number==Video.frame_number_obj) + if (Video.screenstate.frame_number == Video.frame_number_obj) { short0 = short0_old; short1 = short1_old; diff --git a/MAME.Core/mame/neogeo/Memory.cs b/MAME.Core/mame/neogeo/Memory.cs index d7da410..8cea1b5 100644 --- a/MAME.Core/mame/neogeo/Memory.cs +++ b/MAME.Core/mame/neogeo/Memory.cs @@ -5,8 +5,8 @@ namespace mame { public partial class Neogeo { - public static short short0, short1, short2, short3, short4,short5,short6; - public static short short0_old, short1_old, short2_old, short3_old, short4_old,short5_old,short6_old; + public static short short0, short1, short2, short3, short4, short5, short6; + public static short short0_old, short1_old, short2_old, short3_old, short4_old, short5_old, short6_old; public static sbyte MReadOpByte(int address) { address &= 0xffffff; @@ -45,7 +45,7 @@ namespace mame return result; } public static sbyte MReadByte(int address) - { + { address &= 0xffffff; sbyte result = 0; if (address >= 0x000000 && address <= 0x00007f) @@ -218,7 +218,7 @@ namespace mame return result; } public static short MReadWord(int address) - { + { address &= 0xffffff; short result = 0; if (address >= 0x000000 && address + 1 <= 0x00007f) @@ -307,10 +307,10 @@ namespace mame return result; } public static int MReadOpLong(int address) - { + { address &= 0xffffff; int result = 0; - if(address>=0x000000&&address+3<0x00007f) + if (address >= 0x000000 && address + 3 < 0x00007f) { if (main_cpu_vector_table_source == 0) { @@ -348,7 +348,7 @@ namespace mame return result; } public static int MReadLong(int address) - { + { address &= 0xffffff; int result = 0; if (address >= 0x000000 && address + 3 <= 0x00007f) @@ -379,7 +379,7 @@ namespace mame result = Memory.mainrom[main_cpu_bank_address + (address & 0xfffff)] * 0x1000000 + Memory.mainrom[main_cpu_bank_address + (address & 0xfffff) + 1] * 0x10000 + Memory.mainrom[main_cpu_bank_address + (address & 0xfffff) + 2] * 0x100 + Memory.mainrom[main_cpu_bank_address + (address & 0xfffff) + 3]; } else if (address >= 0x300000 && address <= 0x31ffff) - { + { result = 0; } else if (address >= 0x320000 && address <= 0x33ffff) @@ -420,11 +420,11 @@ namespace mame public static void MWriteByte(int address, sbyte value) { address &= 0xffffff; - m68000Form.iWAddress = address; - m68000Form.iWOp = 0x01; + m68000Motion.iWAddress = address; + m68000Motion.iWOp = 0x01; if (address >= 0x100000 && address <= 0x1fffff) { - if (address == 0x100d0b&&value==0x06)//&&MC68000.m1.TotalExecutedCycles>0x3F6FC8C) + if (address == 0x100d0b && value == 0x06)//&&MC68000.m1.TotalExecutedCycles>0x3F6FC8C) { ulong l1 = MC68000.m1.TotalExecutedCycles; int i2 = 1; @@ -497,8 +497,8 @@ namespace mame public static void MWriteWord(int address, short value) { address &= 0xffffff; - m68000Form.iWAddress = address; - m68000Form.iWOp = 0x02; + m68000Motion.iWAddress = address; + m68000Motion.iWOp = 0x02; if (address >= 0x100000 && address + 1 <= 0x1fffff) { if (address == 0x1007c4 && value == unchecked((short)0xb102)) @@ -550,8 +550,8 @@ namespace mame public static void MWriteLong(int address, int value) { address &= 0xffffff; - m68000Form.iWAddress = address; - m68000Form.iWOp = 0x03; + m68000Motion.iWAddress = address; + m68000Motion.iWOp = 0x03; if (address >= 0x100000 && address + 3 <= 0x1fffff) { if (address == 0x1051e4 && value == 0x00130070) @@ -608,7 +608,7 @@ namespace mame { int i1 = 1; } - } + } public static sbyte MReadByte_fatfury2(int address) { address &= 0xffffff; @@ -663,7 +663,7 @@ namespace mame } else { - MWriteByte(address,value); + MWriteByte(address, value); } } public static void MWriteWord_fatfury2(int address, short value) @@ -676,7 +676,7 @@ namespace mame } else { - MWriteWord(address,value); + MWriteWord(address, value); } } public static void MWriteLong_fatfury2(int address, int value) @@ -1243,11 +1243,11 @@ namespace mame else if (offset >= 0xff8) pvc_write_bankswitch(); - if (offset+1 == 0xff0) + if (offset + 1 == 0xff0) pvc_prot1(); - else if (offset+1 >= 0xff4 && offset+1 <= 0xff5) + else if (offset + 1 >= 0xff4 && offset + 1 <= 0xff5) pvc_prot2(); - else if (offset+1 >= 0xff8) + else if (offset + 1 >= 0xff8) pvc_write_bankswitch(); } else @@ -1473,7 +1473,7 @@ namespace mame if (address >= 0x2fe000 && address + 1 <= 0x2fffff) { int offset = address - 0x2fe000; - extra_ram[offset] = (byte)(value>>8); + extra_ram[offset] = (byte)(value >> 8); extra_ram[offset + 1] = (byte)value; kof2003_w(offset / 2); } @@ -1493,7 +1493,7 @@ namespace mame extra_ram[offset + 2] = (byte)(value >> 8); extra_ram[offset + 3] = (byte)value; kof2003_w(offset / 2); - kof2003_w((offset+2) / 2); + kof2003_w((offset + 2) / 2); } else { @@ -1553,7 +1553,7 @@ namespace mame sbyte result = 0; if (address >= 0x00200 && address <= 0x001fff) { - int offset=address-0x200; + int offset = address - 0x200; result = (sbyte)sbp_protection_r(offset); } else @@ -1598,7 +1598,7 @@ namespace mame sbyte result = 0; if (address >= 0x2fe000 && address <= 0x2fffff) { - int offset=address-0x2fe000; + int offset = address - 0x2fe000; result = (sbyte)extra_ram[offset]; } else @@ -1703,7 +1703,7 @@ namespace mame int offset = address - 0x200000; kof10th_custom_w(offset, (ushort)value); } - else if (address >= 0x240000 && address+1 <= 0x2fffff) + else if (address >= 0x240000 && address + 1 <= 0x2fffff) { int offset = address - 0x240000; kof10th_bankswitch_w(offset, (ushort)value); @@ -1737,7 +1737,7 @@ namespace mame sbyte result = 0; if (address >= 0x200000 && address <= 0x201fff) { - int offset=address-0x200000; + int offset = address - 0x200000; result = (sbyte)extra_ram[offset]; } else @@ -1796,7 +1796,7 @@ namespace mame { int offset = address - 0x200000; extra_ram[offset] = (byte)(value >> 8); - extra_ram[offset+1] = (byte)(value); + extra_ram[offset + 1] = (byte)(value); } else { @@ -2049,7 +2049,7 @@ namespace mame public static byte ZReadHardware(ushort address) { byte result = 0; - int add1,add2; + int add1, add2; address &= 0xffff; add1 = address & 0xff; if (add1 == 0) diff --git a/MAME.Core/mame/neogeo/Neogeo.cs b/MAME.Core/mame/neogeo/Neogeo.cs index b66511b..876b666 100644 --- a/MAME.Core/mame/neogeo/Neogeo.cs +++ b/MAME.Core/mame/neogeo/Neogeo.cs @@ -1,10 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using MAME.Core.Common; +using System; using System.IO; -using MAME.Core.run_interface; -using MAME.Core.Common; namespace mame { @@ -45,10 +41,10 @@ namespace mame Memory.audioram = new byte[0x800]; Machine.bRom = true; dsw = 0xff; - fixedbiosrom = mainForm.resource.Get_sfix(); - zoomyrom = mainForm.resource.Get__000_lo(); - audiobiosrom = mainForm.resource.Get_sm1(); - mainbiosrom = mainForm.resource.Get_mainbios(); + fixedbiosrom = mainMotion.resource.Get_sfix(); + zoomyrom = mainMotion.resource.Get__000_lo(); + audiobiosrom = mainMotion.resource.Get_sm1(); + mainbiosrom = mainMotion.resource.Get_mainbios(); Memory.mainrom = Machine.GetRom("maincpu.rom"); Memory.audiorom = Machine.GetRom("audiocpu.rom"); fixedrom = Machine.GetRom("fixed.rom"); @@ -268,7 +264,7 @@ namespace mame { int bank_address; int len = Memory.mainrom.Length; - if ((len <= 0x100000) && ((data & 0x07)!=0)) + if ((len <= 0x100000) && ((data & 0x07) != 0)) { int i1 = 1; } diff --git a/MAME.Core/mame/neogeo/Neoprot.cs b/MAME.Core/mame/neogeo/Neoprot.cs index 2678c67..42261e0 100644 --- a/MAME.Core/mame/neogeo/Neoprot.cs +++ b/MAME.Core/mame/neogeo/Neoprot.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; namespace mame { @@ -104,16 +101,16 @@ namespace mame int bankaddress; int[] bankoffset = new int[] { - 0x000000, 0x100000, 0x200000, 0x300000, - 0x3cc000, 0x4cc000, 0x3f2000, 0x4f2000, - 0x407800, 0x507800, 0x40d000, 0x50d000, - 0x417800, 0x517800, 0x420800, 0x520800, - 0x424800, 0x524800, 0x429000, 0x529000, - 0x42e800, 0x52e800, 0x431800, 0x531800, - 0x54d000, 0x551000, 0x567000, 0x592800, - 0x588800, 0x581800, 0x599800, 0x594800, - 0x598000 - }; + 0x000000, 0x100000, 0x200000, 0x300000, + 0x3cc000, 0x4cc000, 0x3f2000, 0x4f2000, + 0x407800, 0x507800, 0x40d000, 0x50d000, + 0x417800, 0x517800, 0x420800, 0x520800, + 0x424800, 0x524800, 0x429000, 0x529000, + 0x42e800, 0x52e800, 0x431800, 0x531800, + 0x54d000, 0x551000, 0x567000, 0x592800, + 0x588800, 0x581800, 0x599800, 0x594800, + 0x598000 + }; data = (((data >> 14) & 1) << 0) + (((data >> 6) & 1) << 1) + @@ -122,14 +119,14 @@ namespace mame (((data >> 12) & 1) << 4) + (((data >> 5) & 1) << 5); bankaddress = 0x100000 + bankoffset[data]; - main_cpu_bank_address=bankaddress; + main_cpu_bank_address = bankaddress; } public static void garou_bankswitch_w(int data) { int bankaddress; int[] bankoffset = new int[] - { - 0x000000, 0x100000, 0x200000, 0x300000, // 00 + { + 0x000000, 0x100000, 0x200000, 0x300000, // 00 0x280000, 0x380000, 0x2d0000, 0x3d0000, // 04 0x2f0000, 0x3f0000, 0x400000, 0x500000, // 08 0x420000, 0x520000, 0x440000, 0x540000, // 12 @@ -143,7 +140,7 @@ namespace mame 0x488000, 0x588000, 0x490000, 0x590000, // 44 0x5d0000, 0x5d8000, 0x5e0000, 0x5e8000, // 48 0x5f0000, 0x5f8000, 0x600000 - }; + }; data = (((data >> 5) & 1) << 0) + (((data >> 9) & 1) << 1) + @@ -158,8 +155,8 @@ namespace mame { int bankaddress; int[] bankoffset = new int[] - { - 0x000000, 0x100000, 0x200000, 0x300000, // 00 + { + 0x000000, 0x100000, 0x200000, 0x300000, // 00 0x280000, 0x380000, 0x2d0000, 0x3d0000, // 04 0x2c8000, 0x3c8000, 0x400000, 0x500000, // 08 0x420000, 0x520000, 0x440000, 0x540000, // 12 @@ -190,8 +187,8 @@ namespace mame { int bankaddress; int[] bankoffset = new int[] - { - 0x000000, 0x020000, 0x040000, 0x060000, // 00 + { + 0x000000, 0x020000, 0x040000, 0x060000, // 00 0x070000, 0x090000, 0x0b0000, 0x0d0000, // 04 0x0e0000, 0x0f0000, 0x120000, 0x130000, // 08 0x140000, 0x150000, 0x180000, 0x190000, // 12 @@ -204,7 +201,7 @@ namespace mame 0x400000, 0x410000, 0x440000, 0x450000, // 40 0x460000, 0x470000, 0x4a0000, 0x4b0000, // 44 0x4c0000 - }; + }; data = (((data >> 14) & 1) << 0) + (((data >> 12) & 1) << 1) + @@ -219,8 +216,8 @@ namespace mame { int bankaddress; int[] bankoffset = new int[] - { - 0x000000, 0x100000, 0x200000, 0x300000, // 00 + { + 0x000000, 0x100000, 0x200000, 0x300000, // 00 0x3f7800, 0x4f7800, 0x3ff800, 0x4ff800, // 04 0x407800, 0x507800, 0x40f800, 0x50f800, // 08 0x416800, 0x516800, 0x41d800, 0x51d800, // 12 @@ -258,14 +255,14 @@ namespace mame b3 = pvc_cartridge_ram[0x1fea]; b4 = pvc_cartridge_ram[0x1feb]; pvc_cartridge_ram[0x1fec] = (byte)((b4 >> 1) | ((b2 & 1) << 4) | ((b1 & 1) << 5) | ((b4 & 1) << 6) | ((b3 & 1) << 7)); - pvc_cartridge_ram[0x1fed] = (byte)((b2 >> 1) | ((b1 >> 1) << 4)); + pvc_cartridge_ram[0x1fed] = (byte)((b2 >> 1) | ((b1 >> 1) << 4)); } public static void pvc_write_bankswitch() { int bankaddress; bankaddress = pvc_cartridge_ram[0xff8 * 2] + pvc_cartridge_ram[0xff9 * 2] * 0x10000 + pvc_cartridge_ram[0xff9 * 2 + 1] * 0x100; pvc_cartridge_ram[0x1ff0] &= 0xfe; - pvc_cartridge_ram[0x1ff1] = 0xa0; + pvc_cartridge_ram[0x1ff1] = 0xa0; pvc_cartridge_ram[0x1ff2] &= 0x7f; main_cpu_bank_address = bankaddress + 0x100000; } @@ -273,9 +270,9 @@ namespace mame { int bankaddress; int[] cthd2003_banks = new int[8] - { - 1,0,1,0,1,0,3,2, - }; + { + 1,0,1,0,1,0,3,2, + }; bankaddress = 0x100000 + cthd2003_banks[data & 7] * 0x100000; main_cpu_bank_address = bankaddress; } @@ -283,7 +280,7 @@ namespace mame { return 0xa0; } - public static void ms5plus_bankswitch_w(int offset,int data) + public static void ms5plus_bankswitch_w(int offset, int data) { int bankaddress; if ((offset == 0) && (data == 0xa0)) @@ -305,7 +302,7 @@ namespace mame int address = (extra_ram[0x1ff2] << 16) | (extra_ram[0x1ff3] << 8) | extra_ram[0x1ff0]; byte prt = extra_ram[0x1ff3]; extra_ram[0x1ff0] &= 0xfe; - extra_ram[0x1ff1] = 0xa0; + extra_ram[0x1ff1] = 0xa0; extra_ram[0x1ff2] &= 0x7f; main_cpu_bank_address = address + 0x100000; Memory.mainrom[0x58197] = prt; @@ -328,7 +325,7 @@ namespace mame byte origdata = Memory.mainrom[offset + 0x200]; byte data = (byte)BITSWAP8(origdata, 3, 2, 1, 0, 7, 6, 5, 4); int realoffset = 0x200 + offset; - if (realoffset == 0xd5e||realoffset==0xd5f) + if (realoffset == 0xd5e || realoffset == 0xd5f) return origdata; return data; } @@ -422,24 +419,26 @@ namespace mame (BIT(val, B1) << 1) | (BIT(val, B0) << 0)); } - public static int BITSWAP16(int val, int B15, int B14, int B13, int B12, int B11, int B10, int B9, int B8, int B7, int B6, int B5, int B4, int B3, int B2, int B1, int B0) - { - return ((BIT(val, B15) << 15) | - (BIT(val, B14) << 14) | - (BIT(val, B13) << 13) | - (BIT(val, B12) << 12) | - (BIT(val, B11) << 11) | - (BIT(val, B10) << 10) | - (BIT(val, B9) << 9) | - (BIT(val, B8) << 8) | - (BIT(val, B7) << 7) | - (BIT(val, B6) << 6) | - (BIT(val, B5) << 5) | - (BIT(val, B4) << 4) | - (BIT(val, B3) << 3) | - (BIT(val, B2) << 2) | - (BIT(val, B1) << 1) | - (BIT(val, B0) << 0)); - } + + //TODO 暂时注释 用不上 + //public static int BITSWAP16(int val, int B15, int B14, int B13, int B12, int B11, int B10, int B9, int B8, int B7, int B6, int B5, int B4, int B3, int B2, int B1, int B0) + //{ + // return ((BIT(val, B15) << 15) | + // (BIT(val, B14) << 14) | + // (BIT(val, B13) << 13) | + // (BIT(val, B12) << 12) | + // (BIT(val, B11) << 11) | + // (BIT(val, B10) << 10) | + // (BIT(val, B9) << 9) | + // (BIT(val, B8) << 8) | + // (BIT(val, B7) << 7) | + // (BIT(val, B6) << 6) | + // (BIT(val, B5) << 5) | + // (BIT(val, B4) << 4) | + // (BIT(val, B3) << 3) | + // (BIT(val, B2) << 2) | + // (BIT(val, B1) << 1) | + // (BIT(val, B0) << 0)); + //} } } diff --git a/MAME.Core/mame/neogeo/State.cs b/MAME.Core/mame/neogeo/State.cs index f89380d..3e65139 100644 --- a/MAME.Core/mame/neogeo/State.cs +++ b/MAME.Core/mame/neogeo/State.cs @@ -1,10 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using cpu.m68000; +using cpu.m68000; using cpu.z80; +using System.IO; namespace mame { diff --git a/MAME.Core/mame/neogeo/Video.cs b/MAME.Core/mame/neogeo/Video.cs index a060439..7b8bdb8 100644 --- a/MAME.Core/mame/neogeo/Video.cs +++ b/MAME.Core/mame/neogeo/Video.cs @@ -1,9 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using System.Runtime.InteropServices; namespace mame { @@ -176,7 +171,7 @@ namespace mame { break; } - } + } if (max_sprite_index != 95) { max_sprite_index = max_sprite_index + 1; @@ -373,18 +368,18 @@ namespace mame private static void start_sprite_line_timer() { neogeo_scanline_param = 0; - Timer.timer_adjust_periodic(sprite_line_timer, Video.video_screen_get_time_until_pos(0, 0),Attotime.ATTOTIME_NEVER); + Timer.timer_adjust_periodic(sprite_line_timer, Video.video_screen_get_time_until_pos(0, 0), Attotime.ATTOTIME_NEVER); } - private static void draw_fixed_layer(int iBitmap,int scanline) + private static void draw_fixed_layer(int iBitmap, int scanline) { - int i,j,x,y; - int[] garouoffsets=new int[32], pix_offsets = new int[] { 0x10, 0x18, 0x00, 0x08 }; + int i, j, x, y; + int[] garouoffsets = new int[32], pix_offsets = new int[] { 0x10, 0x18, 0x00, 0x08 }; byte[] gfx_base; int addr_mask; - int gfx_offset,char_pens_offset; + int gfx_offset, char_pens_offset; byte data; bool banked; - int garoubank,k,code; + int garoubank, k, code; ushort code_and_palette; if (fixed_layer_source != 0) { @@ -498,7 +493,7 @@ namespace mame videoram_offset = data; videoram_read_buffer = neogeo_videoram[videoram_offset]; break; - case 0x01: + case 0x01: if (videoram_offset == 0x842d && data == 0x0) { int i1 = 1; @@ -561,22 +556,22 @@ namespace mame rgb_weights_dark_bit15 = new double[5] { 76.322306339305158, 35.725334891159271, 16.790907407744047, 7.6322306490423326, 4.3053608862660706 }; zoom_x_tables = new int[,] { - { 0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0 }, - { 0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0 }, - { 0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0 }, - { 0,0,1,0,1,0,0,0,1,0,0,0,1,0,0,0 }, - { 0,0,1,0,1,0,0,0,1,0,0,0,1,0,1,0 }, - { 0,0,1,0,1,0,1,0,1,0,0,0,1,0,1,0 }, - { 0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0 }, - { 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0 }, - { 1,0,1,0,1,0,1,0,1,1,1,0,1,0,1,0 }, - { 1,0,1,1,1,0,1,0,1,1,1,0,1,0,1,0 }, - { 1,0,1,1,1,0,1,0,1,1,1,0,1,0,1,1 }, - { 1,0,1,1,1,0,1,1,1,1,1,0,1,0,1,1 }, - { 1,0,1,1,1,0,1,1,1,1,1,0,1,1,1,1 }, - { 1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1 }, - { 1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1 }, - { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 } + { 0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0 }, + { 0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0 }, + { 0,0,0,0,1,0,0,0,1,0,0,0,1,0,0,0 }, + { 0,0,1,0,1,0,0,0,1,0,0,0,1,0,0,0 }, + { 0,0,1,0,1,0,0,0,1,0,0,0,1,0,1,0 }, + { 0,0,1,0,1,0,1,0,1,0,0,0,1,0,1,0 }, + { 0,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0 }, + { 1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0 }, + { 1,0,1,0,1,0,1,0,1,1,1,0,1,0,1,0 }, + { 1,0,1,1,1,0,1,0,1,1,1,0,1,0,1,0 }, + { 1,0,1,1,1,0,1,0,1,1,1,0,1,0,1,1 }, + { 1,0,1,1,1,0,1,1,1,1,1,0,1,0,1,1 }, + { 1,0,1,1,1,0,1,1,1,1,1,0,1,1,1,1 }, + { 1,1,1,1,1,0,1,1,1,1,1,0,1,1,1,1 }, + { 1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1 }, + { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 } }; Array.Clear(palettes, 0, 0x2000); Array.Clear(pens, 0, 0x1000); diff --git a/MAME.Core/mame/pgm/Gdi.cs b/MAME.Core/mame/pgm/Gdi.cs index 235b98a..1ccd0e4 100644 --- a/MAME.Core/mame/pgm/Gdi.cs +++ b/MAME.Core/mame/pgm/Gdi.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Drawing; -using System.Drawing.Imaging; -using System.IO; - +using Color = MAME.Core.AxiBitmap.AxiColor; namespace mame { public partial class PGM @@ -15,227 +8,7 @@ namespace mame public static void GDIInit() { - m_ColorG = Color.Magenta; - } - public static void GetData() - { - - } - public static Bitmap GetTx() - { - int i1, i2, iOffset, i3, i4; - int rows, cols, width, height; - int tilewidth, tileheight; - tilewidth = 8; - tileheight = tilewidth; - rows = 0x20; - cols = 0x40; - width = tilewidth * cols; - height = width; - int iByte; - int tile_index, tileno, colour, 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 * PGM.pgm_tx_tilemap.cols + i3; - tileno = (PGM.pgm_tx_videoram[tile_index * 4] * 0x100 + PGM.pgm_tx_videoram[tile_index * 4 + 1]) & 0xffff; - colour = (PGM.pgm_tx_videoram[tile_index * 4 + 3] & 0x3e) >> 1; - flipyx = (PGM.pgm_tx_videoram[tile_index * 4 + 3] & 0xc0) >> 6; - if (tileno > 0xbfff) - { - tileno -= 0xc000; - tileno += 0x20000; - } - code = tileno % PGM.pgm_tx_tilemap.total_elements; - flags = (byte)(flipyx & 3); - palette_base = 0x800 + 0x10 * colour; - 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 = PGM.tiles1rom[iOffset]; - if (iByte == 0) - { - 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 GetBg() - { - int i1, i2, iOffset, i3, i4; - int rows, cols, width, height; - int tilewidth, tileheight; - tilewidth = 0x20; - tileheight = tilewidth; - rows = 0x40; - cols = rows; - width = tilewidth * cols; - height = width; - int iByte; - int tile_index, tileno, colour, 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 * PGM.pgm_bg_tilemap.cols + i3; - tileno = (PGM.pgm_bg_videoram[tile_index * 4] * 0x100 + PGM.pgm_bg_videoram[tile_index * 4 + 1]) & 0xffff; - if (tileno > 0x7ff) - { - tileno += 0x1000; - } - colour = (PGM.pgm_bg_videoram[tile_index * 4 + 3] & 0x3e) >> 1; - flipyx = (PGM.pgm_bg_videoram[tile_index * 4 + 3] & 0xc0) >> 6; - code = tileno % PGM.pgm_bg_tilemap.total_elements; - flags = (byte)(flipyx & 3); - palette_base = 0x400 + 0x20 * colour; - pen_data_offset = code * 0x400; - 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 * 0x20 + i1; - iByte = PGM.tiles2rom[iOffset]; - if (iByte == 0) - { - 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 GetAllGDI() - { - Bitmap bm1 = new Bitmap(0x200, 0x200), bm2; - Graphics g = Graphics.FromImage(bm1); - g.Clear(Color.Transparent); - if (bRender0G) - { - - } - if (bRender1G) - { - bm2 = GetBg(); - g.DrawImage(bm2, 0, 0); - } - if (bRender2G) - { - - } - if (bRender3G) - { - bm2 = GetTx(); - g.DrawImage(bm2, 0, 0); - } - return bm1; + //m_ColorG = Color.Magenta; } } } diff --git a/MAME.Core/mame/pgm/Input.cs b/MAME.Core/mame/pgm/Input.cs index 8760ddf..1c7f6cf 100644 --- a/MAME.Core/mame/pgm/Input.cs +++ b/MAME.Core/mame/pgm/Input.cs @@ -104,11 +104,11 @@ namespace mame } if (Keyboard.IsPressed(Key.I)) { - + } else { - + } if (Keyboard.IsPressed(Key.O)) { @@ -184,11 +184,11 @@ namespace mame } if (Keyboard.IsPressed(Key.NumPad5)) { - + } else { - + } if (Keyboard.IsPressed(Key.NumPad6)) { diff --git a/MAME.Core/mame/pgm/Machine.cs b/MAME.Core/mame/pgm/Machine.cs index 16ca736..c9c34c9 100644 --- a/MAME.Core/mame/pgm/Machine.cs +++ b/MAME.Core/mame/pgm/Machine.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace mame +namespace mame { public partial class PGM { @@ -15,134 +10,134 @@ namespace mame public static byte[][] kb_source_data; public static byte[][] drgw2_source_data = new byte[0x08][]//[0xec] { - new byte[]{ 0, }, // Region 0, not used + new byte[]{ 0, }, // Region 0, not used new byte[]{ // Region 1, $13A886 0x67, 0x51, 0xF3, 0x19, 0xA0, 0x11, 0xB1, 0x11, 0xB0, 0xEE, 0xE3, 0xF6, 0xBE, 0x81, 0x35, 0xE3, - 0xFB, 0xE6, 0xEF, 0xDF, 0x61, 0x01, 0xFA, 0x22, 0x5D, 0x43, 0x01, 0xA5, 0x3B, 0x17, 0xD4, 0x74, - 0xF0, 0xF4, 0xF3, 0x43, 0xB5, 0x19, 0x04, 0xD5, 0x84, 0xCE, 0x87, 0xFE, 0x35, 0x3E, 0xC4, 0x3C, - 0xC7, 0x85, 0x2A, 0x33, 0x00, 0x86, 0xD0, 0x4D, 0x65, 0x4B, 0xF9, 0xE9, 0xC0, 0xBA, 0xAA, 0x77, - 0x9E, 0x66, 0xF6, 0x0F, 0x4F, 0x3A, 0xB6, 0xF1, 0x64, 0x9A, 0xE9, 0x25, 0x1A, 0x5F, 0x22, 0xA3, - 0xA2, 0xBF, 0x4B, 0x77, 0x3F, 0x34, 0xC9, 0x6E, 0xDB, 0x12, 0x5C, 0x33, 0xA5, 0x8B, 0x6C, 0xB1, - 0x74, 0xC8, 0x40, 0x4E, 0x2F, 0xE7, 0x46, 0xAE, 0x99, 0xFC, 0xB0, 0x55, 0x54, 0xDF, 0xA7, 0xA1, - 0x0F, 0x5E, 0x49, 0xCF, 0x56, 0x3C, 0x90, 0x2B, 0xAC, 0x65, 0x6E, 0xDB, 0x58, 0x3E, 0xC9, 0x00, - 0xAE, 0x53, 0x4D, 0x92, 0xFA, 0x40, 0xB2, 0x6B, 0x65, 0x4B, 0x90, 0x8A, 0x0C, 0xE2, 0xA5, 0x9A, - 0xD0, 0x20, 0x29, 0x55, 0xA4, 0x44, 0xAC, 0x51, 0x87, 0x54, 0x53, 0x34, 0x24, 0x4B, 0x81, 0x67, - 0x34, 0x4C, 0x5F, 0x31, 0x4E, 0xF2, 0xF1, 0x19, 0x18, 0x1C, 0x34, 0x38, 0xE1, 0x81, 0x17, 0xCF, - 0x24, 0xB9, 0x9A, 0xCB, 0x34, 0x51, 0x50, 0x59, 0x44, 0xB1, 0x0B, 0x50, 0x95, 0x6C, 0x48, 0x7E, - 0x14, 0xA4, 0xC6, 0xD9, 0xD3, 0xA5, 0xD6, 0xD0, 0xC5, 0x97, 0xF0, 0x45, 0xD0, 0x98, 0x51, 0x91, - 0x9F, 0xA3, 0x43, 0x51, 0x05, 0x90, 0xEE, 0xCA, 0x7E, 0x5F, 0x72, 0x53, 0xB1, 0xD3, 0xAF, 0x36, - 0x08, 0x75, 0xB0, 0x9B, 0xE0, 0x0D, 0x43, 0x88, 0xAA, 0x27, 0x44, 0x11 - }, - new byte[]{ 0, }, // Region 2, not used + 0xFB, 0xE6, 0xEF, 0xDF, 0x61, 0x01, 0xFA, 0x22, 0x5D, 0x43, 0x01, 0xA5, 0x3B, 0x17, 0xD4, 0x74, + 0xF0, 0xF4, 0xF3, 0x43, 0xB5, 0x19, 0x04, 0xD5, 0x84, 0xCE, 0x87, 0xFE, 0x35, 0x3E, 0xC4, 0x3C, + 0xC7, 0x85, 0x2A, 0x33, 0x00, 0x86, 0xD0, 0x4D, 0x65, 0x4B, 0xF9, 0xE9, 0xC0, 0xBA, 0xAA, 0x77, + 0x9E, 0x66, 0xF6, 0x0F, 0x4F, 0x3A, 0xB6, 0xF1, 0x64, 0x9A, 0xE9, 0x25, 0x1A, 0x5F, 0x22, 0xA3, + 0xA2, 0xBF, 0x4B, 0x77, 0x3F, 0x34, 0xC9, 0x6E, 0xDB, 0x12, 0x5C, 0x33, 0xA5, 0x8B, 0x6C, 0xB1, + 0x74, 0xC8, 0x40, 0x4E, 0x2F, 0xE7, 0x46, 0xAE, 0x99, 0xFC, 0xB0, 0x55, 0x54, 0xDF, 0xA7, 0xA1, + 0x0F, 0x5E, 0x49, 0xCF, 0x56, 0x3C, 0x90, 0x2B, 0xAC, 0x65, 0x6E, 0xDB, 0x58, 0x3E, 0xC9, 0x00, + 0xAE, 0x53, 0x4D, 0x92, 0xFA, 0x40, 0xB2, 0x6B, 0x65, 0x4B, 0x90, 0x8A, 0x0C, 0xE2, 0xA5, 0x9A, + 0xD0, 0x20, 0x29, 0x55, 0xA4, 0x44, 0xAC, 0x51, 0x87, 0x54, 0x53, 0x34, 0x24, 0x4B, 0x81, 0x67, + 0x34, 0x4C, 0x5F, 0x31, 0x4E, 0xF2, 0xF1, 0x19, 0x18, 0x1C, 0x34, 0x38, 0xE1, 0x81, 0x17, 0xCF, + 0x24, 0xB9, 0x9A, 0xCB, 0x34, 0x51, 0x50, 0x59, 0x44, 0xB1, 0x0B, 0x50, 0x95, 0x6C, 0x48, 0x7E, + 0x14, 0xA4, 0xC6, 0xD9, 0xD3, 0xA5, 0xD6, 0xD0, 0xC5, 0x97, 0xF0, 0x45, 0xD0, 0x98, 0x51, 0x91, + 0x9F, 0xA3, 0x43, 0x51, 0x05, 0x90, 0xEE, 0xCA, 0x7E, 0x5F, 0x72, 0x53, 0xB1, 0xD3, 0xAF, 0x36, + 0x08, 0x75, 0xB0, 0x9B, 0xE0, 0x0D, 0x43, 0x88, 0xAA, 0x27, 0x44, 0x11 + }, + new byte[]{ 0, }, // Region 2, not used new byte[]{ 0, }, // Region 3, not used new byte[]{ 0, }, // Region 4, not used new byte[]{ // Region 5, $13ab42 (drgw2c) 0x7F, 0x41, 0xF3, 0x39, 0xA0, 0x11, 0xA1, 0x11, 0xB0, 0xA2, 0x4C, 0x23, 0x13, 0xE9, 0x25, 0x3D, - 0x0F, 0x72, 0x3A, 0x9D, 0xB5, 0x96, 0xD1, 0xDA, 0x07, 0x29, 0x41, 0x9A, 0xAD, 0x70, 0xBA, 0x46, - 0x63, 0x2B, 0x7F, 0x3D, 0xBE, 0x40, 0xAD, 0xD4, 0x4C, 0x73, 0x27, 0x58, 0xA7, 0x65, 0xDC, 0xD6, - 0xFD, 0xDE, 0xB5, 0x6E, 0xD6, 0x6C, 0x75, 0x1A, 0x32, 0x45, 0xD5, 0xE3, 0x6A, 0x14, 0x6D, 0x80, - 0x84, 0x15, 0xAF, 0xCC, 0x7B, 0x61, 0x51, 0x82, 0x40, 0x53, 0x7F, 0x38, 0xA0, 0xD6, 0x8F, 0x61, - 0x79, 0x19, 0xE5, 0x99, 0x84, 0xD8, 0x78, 0x27, 0x3F, 0x16, 0x97, 0x78, 0x4F, 0x7B, 0x0C, 0xA6, - 0x37, 0xDB, 0xC6, 0x0C, 0x24, 0xB4, 0xC7, 0x94, 0x9D, 0x92, 0xD2, 0x3B, 0xD5, 0x11, 0x6F, 0x0A, - 0xDB, 0x76, 0x66, 0xE7, 0xCD, 0x18, 0x2B, 0x66, 0xD8, 0x41, 0x40, 0x58, 0xA2, 0x01, 0x1E, 0x6D, - 0x44, 0x75, 0xE7, 0x19, 0x4F, 0xB2, 0xE8, 0xC4, 0x96, 0x77, 0x62, 0x02, 0xC9, 0xDC, 0x59, 0xF3, - 0x43, 0x8D, 0xC8, 0xFE, 0x9E, 0x2A, 0xBA, 0x32, 0x3B, 0x62, 0xE3, 0x92, 0x6E, 0xC2, 0x08, 0x4D, - 0x51, 0xCD, 0xF9, 0x3A, 0x3E, 0xC9, 0x50, 0x27, 0x21, 0x25, 0x97, 0xD7, 0x0E, 0xF8, 0x39, 0x38, - 0xF5, 0x86, 0x94, 0x93, 0xBF, 0xEB, 0x18, 0xA8, 0xFC, 0x24, 0xF5, 0xF9, 0x99, 0x20, 0x3D, 0xCD, - 0x2C, 0x94, 0x25, 0x79, 0x28, 0x77, 0x8F, 0x2F, 0x10, 0x69, 0x86, 0x30, 0x43, 0x01, 0xD7, 0x9A, - 0x17, 0xE3, 0x47, 0x37, 0xBD, 0x62, 0x75, 0x42, 0x78, 0xF4, 0x2B, 0x57, 0x4C, 0x0A, 0xDB, 0x53, - 0x4D, 0xA1, 0x0A, 0xD6, 0x3A, 0x16, 0x15, 0xAA, 0x2C, 0x6C, 0x39, 0x42 - }, - new byte[]{ // Region 6, $13ab42 (drgw2), $13ab2e (dw2v100x) + 0x0F, 0x72, 0x3A, 0x9D, 0xB5, 0x96, 0xD1, 0xDA, 0x07, 0x29, 0x41, 0x9A, 0xAD, 0x70, 0xBA, 0x46, + 0x63, 0x2B, 0x7F, 0x3D, 0xBE, 0x40, 0xAD, 0xD4, 0x4C, 0x73, 0x27, 0x58, 0xA7, 0x65, 0xDC, 0xD6, + 0xFD, 0xDE, 0xB5, 0x6E, 0xD6, 0x6C, 0x75, 0x1A, 0x32, 0x45, 0xD5, 0xE3, 0x6A, 0x14, 0x6D, 0x80, + 0x84, 0x15, 0xAF, 0xCC, 0x7B, 0x61, 0x51, 0x82, 0x40, 0x53, 0x7F, 0x38, 0xA0, 0xD6, 0x8F, 0x61, + 0x79, 0x19, 0xE5, 0x99, 0x84, 0xD8, 0x78, 0x27, 0x3F, 0x16, 0x97, 0x78, 0x4F, 0x7B, 0x0C, 0xA6, + 0x37, 0xDB, 0xC6, 0x0C, 0x24, 0xB4, 0xC7, 0x94, 0x9D, 0x92, 0xD2, 0x3B, 0xD5, 0x11, 0x6F, 0x0A, + 0xDB, 0x76, 0x66, 0xE7, 0xCD, 0x18, 0x2B, 0x66, 0xD8, 0x41, 0x40, 0x58, 0xA2, 0x01, 0x1E, 0x6D, + 0x44, 0x75, 0xE7, 0x19, 0x4F, 0xB2, 0xE8, 0xC4, 0x96, 0x77, 0x62, 0x02, 0xC9, 0xDC, 0x59, 0xF3, + 0x43, 0x8D, 0xC8, 0xFE, 0x9E, 0x2A, 0xBA, 0x32, 0x3B, 0x62, 0xE3, 0x92, 0x6E, 0xC2, 0x08, 0x4D, + 0x51, 0xCD, 0xF9, 0x3A, 0x3E, 0xC9, 0x50, 0x27, 0x21, 0x25, 0x97, 0xD7, 0x0E, 0xF8, 0x39, 0x38, + 0xF5, 0x86, 0x94, 0x93, 0xBF, 0xEB, 0x18, 0xA8, 0xFC, 0x24, 0xF5, 0xF9, 0x99, 0x20, 0x3D, 0xCD, + 0x2C, 0x94, 0x25, 0x79, 0x28, 0x77, 0x8F, 0x2F, 0x10, 0x69, 0x86, 0x30, 0x43, 0x01, 0xD7, 0x9A, + 0x17, 0xE3, 0x47, 0x37, 0xBD, 0x62, 0x75, 0x42, 0x78, 0xF4, 0x2B, 0x57, 0x4C, 0x0A, 0xDB, 0x53, + 0x4D, 0xA1, 0x0A, 0xD6, 0x3A, 0x16, 0x15, 0xAA, 0x2C, 0x6C, 0x39, 0x42 + }, + new byte[]{ // Region 6, $13ab42 (drgw2), $13ab2e (dw2v100x) 0x12, 0x09, 0xF3, 0x29, 0xA0, 0x11, 0xA0, 0x11, 0xB0, 0xD5, 0x66, 0xA1, 0x28, 0x4A, 0x21, 0xC0, - 0xD3, 0x9B, 0x86, 0x80, 0x57, 0x6F, 0x41, 0xC2, 0xE4, 0x2F, 0x0B, 0x91, 0xBD, 0x3A, 0x7A, 0xBA, - 0x00, 0xE5, 0x35, 0x02, 0x74, 0x7D, 0x8B, 0x21, 0x57, 0x10, 0x0F, 0xAE, 0x44, 0xBB, 0xE2, 0x37, - 0x18, 0x7B, 0x52, 0x3D, 0x8C, 0x59, 0x9E, 0x20, 0x1F, 0x0A, 0xCC, 0x1C, 0x8E, 0x6A, 0xD7, 0x95, - 0x2B, 0x34, 0xB0, 0x82, 0x6D, 0xFD, 0x25, 0x33, 0xAA, 0x3B, 0x2B, 0x70, 0x15, 0x87, 0x31, 0x5D, - 0xBB, 0x29, 0x19, 0x95, 0xD5, 0x8E, 0x24, 0x28, 0x5E, 0xD0, 0x20, 0x83, 0x46, 0x4A, 0x21, 0x70, - 0x5B, 0xCD, 0xAE, 0x7B, 0x61, 0xA1, 0xFA, 0xF4, 0x2B, 0x84, 0x15, 0x6E, 0x36, 0x5D, 0x1B, 0x24, - 0x0F, 0x09, 0x3A, 0x61, 0x38, 0x0F, 0x18, 0x35, 0x11, 0x38, 0xB4, 0xBD, 0xEE, 0xF7, 0xEC, 0x0F, - 0x1D, 0xB7, 0x48, 0x01, 0xAA, 0x09, 0x8F, 0x61, 0xB5, 0x0F, 0x1D, 0x26, 0x39, 0x2E, 0x8C, 0xD6, - 0x26, 0x5C, 0x3D, 0x23, 0x63, 0xE9, 0x6B, 0x97, 0xB4, 0x9F, 0x7B, 0xB6, 0xBA, 0xA0, 0x7C, 0xC6, - 0x25, 0xA1, 0x73, 0x36, 0x67, 0x7F, 0x74, 0x1E, 0x1D, 0xDA, 0x70, 0xBF, 0xA5, 0x63, 0x35, 0x39, - 0x24, 0x8C, 0x9F, 0x85, 0x16, 0xD8, 0x50, 0x95, 0x71, 0xC0, 0xF6, 0x1E, 0x6D, 0x80, 0xED, 0x15, - 0xEB, 0x63, 0xE9, 0x1B, 0xF6, 0x78, 0x31, 0xC6, 0x5C, 0xDD, 0x19, 0xBD, 0xDF, 0xA7, 0xEC, 0x50, - 0x22, 0xAD, 0xBB, 0xF6, 0xEB, 0xD6, 0xA3, 0x20, 0xC9, 0xE6, 0x9F, 0xCB, 0xF2, 0x97, 0xB9, 0x54, - 0x12, 0x66, 0xA6, 0xBE, 0x4A, 0x12, 0x43, 0xEC, 0x00, 0xEA, 0x49, 0x02 - }, - new byte[]{ 0, } // Region 7, not used + 0xD3, 0x9B, 0x86, 0x80, 0x57, 0x6F, 0x41, 0xC2, 0xE4, 0x2F, 0x0B, 0x91, 0xBD, 0x3A, 0x7A, 0xBA, + 0x00, 0xE5, 0x35, 0x02, 0x74, 0x7D, 0x8B, 0x21, 0x57, 0x10, 0x0F, 0xAE, 0x44, 0xBB, 0xE2, 0x37, + 0x18, 0x7B, 0x52, 0x3D, 0x8C, 0x59, 0x9E, 0x20, 0x1F, 0x0A, 0xCC, 0x1C, 0x8E, 0x6A, 0xD7, 0x95, + 0x2B, 0x34, 0xB0, 0x82, 0x6D, 0xFD, 0x25, 0x33, 0xAA, 0x3B, 0x2B, 0x70, 0x15, 0x87, 0x31, 0x5D, + 0xBB, 0x29, 0x19, 0x95, 0xD5, 0x8E, 0x24, 0x28, 0x5E, 0xD0, 0x20, 0x83, 0x46, 0x4A, 0x21, 0x70, + 0x5B, 0xCD, 0xAE, 0x7B, 0x61, 0xA1, 0xFA, 0xF4, 0x2B, 0x84, 0x15, 0x6E, 0x36, 0x5D, 0x1B, 0x24, + 0x0F, 0x09, 0x3A, 0x61, 0x38, 0x0F, 0x18, 0x35, 0x11, 0x38, 0xB4, 0xBD, 0xEE, 0xF7, 0xEC, 0x0F, + 0x1D, 0xB7, 0x48, 0x01, 0xAA, 0x09, 0x8F, 0x61, 0xB5, 0x0F, 0x1D, 0x26, 0x39, 0x2E, 0x8C, 0xD6, + 0x26, 0x5C, 0x3D, 0x23, 0x63, 0xE9, 0x6B, 0x97, 0xB4, 0x9F, 0x7B, 0xB6, 0xBA, 0xA0, 0x7C, 0xC6, + 0x25, 0xA1, 0x73, 0x36, 0x67, 0x7F, 0x74, 0x1E, 0x1D, 0xDA, 0x70, 0xBF, 0xA5, 0x63, 0x35, 0x39, + 0x24, 0x8C, 0x9F, 0x85, 0x16, 0xD8, 0x50, 0x95, 0x71, 0xC0, 0xF6, 0x1E, 0x6D, 0x80, 0xED, 0x15, + 0xEB, 0x63, 0xE9, 0x1B, 0xF6, 0x78, 0x31, 0xC6, 0x5C, 0xDD, 0x19, 0xBD, 0xDF, 0xA7, 0xEC, 0x50, + 0x22, 0xAD, 0xBB, 0xF6, 0xEB, 0xD6, 0xA3, 0x20, 0xC9, 0xE6, 0x9F, 0xCB, 0xF2, 0x97, 0xB9, 0x54, + 0x12, 0x66, 0xA6, 0xBE, 0x4A, 0x12, 0x43, 0xEC, 0x00, 0xEA, 0x49, 0x02 + }, + new byte[]{ 0, } // Region 7, not used }; public static byte[][] killbld_source_data = new byte[0x0c][]//[0xec] { - new byte[]{ // region 16, $178772 + new byte[]{ // region 16, $178772 0x5e, 0x09, 0xb3, 0x39, 0x60, 0x71, 0x71, 0x53, 0x11, 0xe5, 0x26, 0x34, 0x4c, 0x8c, 0x90, 0xee, - 0xed, 0xb5, 0x05, 0x95, 0x9e, 0x6b, 0xdd, 0x87, 0x0e, 0x7b, 0xed, 0x33, 0xaf, 0xc2, 0x62, 0x98, - 0xec, 0xc8, 0x2c, 0x2b, 0x57, 0x3d, 0x00, 0xbd, 0x12, 0xac, 0xba, 0x64, 0x81, 0x99, 0x16, 0x29, - 0xb4, 0x63, 0xa8, 0xd9, 0xc9, 0x5f, 0xfe, 0x21, 0xbb, 0xbf, 0x9b, 0xd1, 0x7b, 0x93, 0xc4, 0x82, - 0xef, 0x2b, 0xe8, 0xa6, 0xdc, 0x68, 0x3a, 0xd9, 0xc9, 0x23, 0xc7, 0x7b, 0x98, 0x5b, 0xe1, 0xc7, - 0xa3, 0xd4, 0x51, 0x0a, 0x86, 0x30, 0x20, 0x51, 0x6e, 0x04, 0x1c, 0xd4, 0xfb, 0xf5, 0x22, 0x8f, - 0x16, 0x6f, 0xb9, 0x59, 0x30, 0xcf, 0xab, 0x32, 0x1d, 0x6c, 0x84, 0xab, 0x23, 0x90, 0x94, 0xb1, - 0xe7, 0x4b, 0x6d, 0xc1, 0x84, 0xba, 0x32, 0x68, 0xa3, 0xf2, 0x47, 0x28, 0xe5, 0xcb, 0xbb, 0x47, - 0x14, 0x2c, 0xad, 0x4d, 0xa1, 0xd7, 0x18, 0x53, 0xf7, 0x6f, 0x05, 0x81, 0x8f, 0xbb, 0x29, 0xdc, - 0xbd, 0x17, 0x61, 0x92, 0x9b, 0x1d, 0x4e, 0x7a, 0x83, 0x14, 0x9f, 0x7b, 0x7a, 0x6a, 0xe1, 0x27, - 0x62, 0x52, 0x7e, 0x82, 0x45, 0xda, 0xed, 0xf1, 0x0a, 0x3b, 0x6c, 0x02, 0x5b, 0x6e, 0x45, 0x4e, - 0xf2, 0x65, 0x87, 0x1d, 0x80, 0xed, 0x6a, 0xc3, 0x77, 0xcb, 0xe8, 0x8d, 0x5a, 0xb8, 0xda, 0x89, - 0x88, 0x4b, 0x27, 0xd5, 0x57, 0x29, 0x91, 0x86, 0x12, 0xbb, 0xd3, 0x8c, 0xc7, 0x49, 0x84, 0x9c, - 0x96, 0x59, 0x30, 0x93, 0x92, 0xeb, 0x59, 0x2b, 0x93, 0x5b, 0x5f, 0xf9, 0x67, 0xac, 0x97, 0x8c, - 0x04, 0xda, 0x1b, 0x65, 0xd7, 0xef, 0x44, 0xca, 0xc4, 0x87, 0x18, 0x2b - }, - new byte[]{ // region 17, $178a36 + 0xed, 0xb5, 0x05, 0x95, 0x9e, 0x6b, 0xdd, 0x87, 0x0e, 0x7b, 0xed, 0x33, 0xaf, 0xc2, 0x62, 0x98, + 0xec, 0xc8, 0x2c, 0x2b, 0x57, 0x3d, 0x00, 0xbd, 0x12, 0xac, 0xba, 0x64, 0x81, 0x99, 0x16, 0x29, + 0xb4, 0x63, 0xa8, 0xd9, 0xc9, 0x5f, 0xfe, 0x21, 0xbb, 0xbf, 0x9b, 0xd1, 0x7b, 0x93, 0xc4, 0x82, + 0xef, 0x2b, 0xe8, 0xa6, 0xdc, 0x68, 0x3a, 0xd9, 0xc9, 0x23, 0xc7, 0x7b, 0x98, 0x5b, 0xe1, 0xc7, + 0xa3, 0xd4, 0x51, 0x0a, 0x86, 0x30, 0x20, 0x51, 0x6e, 0x04, 0x1c, 0xd4, 0xfb, 0xf5, 0x22, 0x8f, + 0x16, 0x6f, 0xb9, 0x59, 0x30, 0xcf, 0xab, 0x32, 0x1d, 0x6c, 0x84, 0xab, 0x23, 0x90, 0x94, 0xb1, + 0xe7, 0x4b, 0x6d, 0xc1, 0x84, 0xba, 0x32, 0x68, 0xa3, 0xf2, 0x47, 0x28, 0xe5, 0xcb, 0xbb, 0x47, + 0x14, 0x2c, 0xad, 0x4d, 0xa1, 0xd7, 0x18, 0x53, 0xf7, 0x6f, 0x05, 0x81, 0x8f, 0xbb, 0x29, 0xdc, + 0xbd, 0x17, 0x61, 0x92, 0x9b, 0x1d, 0x4e, 0x7a, 0x83, 0x14, 0x9f, 0x7b, 0x7a, 0x6a, 0xe1, 0x27, + 0x62, 0x52, 0x7e, 0x82, 0x45, 0xda, 0xed, 0xf1, 0x0a, 0x3b, 0x6c, 0x02, 0x5b, 0x6e, 0x45, 0x4e, + 0xf2, 0x65, 0x87, 0x1d, 0x80, 0xed, 0x6a, 0xc3, 0x77, 0xcb, 0xe8, 0x8d, 0x5a, 0xb8, 0xda, 0x89, + 0x88, 0x4b, 0x27, 0xd5, 0x57, 0x29, 0x91, 0x86, 0x12, 0xbb, 0xd3, 0x8c, 0xc7, 0x49, 0x84, 0x9c, + 0x96, 0x59, 0x30, 0x93, 0x92, 0xeb, 0x59, 0x2b, 0x93, 0x5b, 0x5f, 0xf9, 0x67, 0xac, 0x97, 0x8c, + 0x04, 0xda, 0x1b, 0x65, 0xd7, 0xef, 0x44, 0xca, 0xc4, 0x87, 0x18, 0x2b + }, + new byte[]{ // region 17, $178a36 0xd7, 0x49, 0xb3, 0x39, 0x60, 0x71, 0x70, 0x53, 0x11, 0x00, 0x27, 0xb2, 0x61, 0xd3, 0x8c, 0x8b, - 0xb2, 0xde, 0x6a, 0x78, 0x40, 0x5d, 0x4d, 0x88, 0xeb, 0x81, 0xd0, 0x2a, 0xbf, 0x8c, 0x22, 0x0d, - 0x89, 0x83, 0xc8, 0xef, 0x0d, 0x7a, 0xf6, 0xf0, 0x1d, 0x49, 0xa2, 0xd3, 0x1e, 0xef, 0x1c, 0xa2, - 0xce, 0x00, 0x5e, 0xa8, 0x7f, 0x4c, 0x41, 0x27, 0xa8, 0x6b, 0x92, 0x0a, 0xb8, 0x03, 0x2f, 0x7e, - 0xaf, 0x4a, 0xd0, 0x5c, 0xce, 0xeb, 0x0e, 0x8a, 0x4d, 0x0b, 0x73, 0xb3, 0xf3, 0x0c, 0x83, 0xaa, - 0xe5, 0xe4, 0x84, 0x06, 0xd7, 0xcc, 0xcb, 0x52, 0x8d, 0xbe, 0xa4, 0xdf, 0xd9, 0xab, 0x50, 0x59, - 0x53, 0x61, 0xa1, 0xc8, 0x6d, 0xbc, 0xde, 0xab, 0xaa, 0x5e, 0xc6, 0xf7, 0x83, 0xdc, 0x40, 0xcb, - 0x1b, 0xdd, 0x28, 0x3b, 0xee, 0xb1, 0x1f, 0x37, 0xdb, 0xe9, 0xbb, 0x74, 0x4b, 0xc2, 0x8a, 0xe8, - 0xec, 0x6e, 0x0e, 0x35, 0xe3, 0x2e, 0xbe, 0xef, 0xfd, 0x07, 0xbf, 0x8c, 0xfe, 0xf3, 0x5c, 0xbf, - 0x87, 0xe5, 0xbc, 0xcf, 0x60, 0xdc, 0x18, 0xf8, 0xfc, 0x51, 0x50, 0x86, 0xc6, 0x48, 0x3d, 0xb9, - 0x1d, 0x26, 0xf7, 0x7e, 0x87, 0x90, 0x12, 0xe8, 0x06, 0x0a, 0x45, 0xe9, 0xd9, 0xd8, 0x41, 0x68, - 0x21, 0x52, 0x92, 0x0f, 0xd6, 0xda, 0xa2, 0x97, 0xeb, 0x68, 0xd0, 0xb1, 0x15, 0x19, 0x8b, 0xd0, - 0x48, 0x1a, 0xeb, 0x90, 0x3f, 0x2a, 0x33, 0x1e, 0x5e, 0x30, 0x66, 0x01, 0x64, 0xef, 0x99, 0x52, - 0xba, 0x23, 0xbd, 0x53, 0xc0, 0x60, 0x87, 0x09, 0xcb, 0x4d, 0xd3, 0x87, 0x0e, 0x3a, 0x5c, 0x8d, - 0xc8, 0xb8, 0xb7, 0x34, 0x01, 0xeb, 0x72, 0x0d, 0xb1, 0x1f, 0x0f, 0xea - }, - new byte[]{ // region 18, $17dac4 + 0xb2, 0xde, 0x6a, 0x78, 0x40, 0x5d, 0x4d, 0x88, 0xeb, 0x81, 0xd0, 0x2a, 0xbf, 0x8c, 0x22, 0x0d, + 0x89, 0x83, 0xc8, 0xef, 0x0d, 0x7a, 0xf6, 0xf0, 0x1d, 0x49, 0xa2, 0xd3, 0x1e, 0xef, 0x1c, 0xa2, + 0xce, 0x00, 0x5e, 0xa8, 0x7f, 0x4c, 0x41, 0x27, 0xa8, 0x6b, 0x92, 0x0a, 0xb8, 0x03, 0x2f, 0x7e, + 0xaf, 0x4a, 0xd0, 0x5c, 0xce, 0xeb, 0x0e, 0x8a, 0x4d, 0x0b, 0x73, 0xb3, 0xf3, 0x0c, 0x83, 0xaa, + 0xe5, 0xe4, 0x84, 0x06, 0xd7, 0xcc, 0xcb, 0x52, 0x8d, 0xbe, 0xa4, 0xdf, 0xd9, 0xab, 0x50, 0x59, + 0x53, 0x61, 0xa1, 0xc8, 0x6d, 0xbc, 0xde, 0xab, 0xaa, 0x5e, 0xc6, 0xf7, 0x83, 0xdc, 0x40, 0xcb, + 0x1b, 0xdd, 0x28, 0x3b, 0xee, 0xb1, 0x1f, 0x37, 0xdb, 0xe9, 0xbb, 0x74, 0x4b, 0xc2, 0x8a, 0xe8, + 0xec, 0x6e, 0x0e, 0x35, 0xe3, 0x2e, 0xbe, 0xef, 0xfd, 0x07, 0xbf, 0x8c, 0xfe, 0xf3, 0x5c, 0xbf, + 0x87, 0xe5, 0xbc, 0xcf, 0x60, 0xdc, 0x18, 0xf8, 0xfc, 0x51, 0x50, 0x86, 0xc6, 0x48, 0x3d, 0xb9, + 0x1d, 0x26, 0xf7, 0x7e, 0x87, 0x90, 0x12, 0xe8, 0x06, 0x0a, 0x45, 0xe9, 0xd9, 0xd8, 0x41, 0x68, + 0x21, 0x52, 0x92, 0x0f, 0xd6, 0xda, 0xa2, 0x97, 0xeb, 0x68, 0xd0, 0xb1, 0x15, 0x19, 0x8b, 0xd0, + 0x48, 0x1a, 0xeb, 0x90, 0x3f, 0x2a, 0x33, 0x1e, 0x5e, 0x30, 0x66, 0x01, 0x64, 0xef, 0x99, 0x52, + 0xba, 0x23, 0xbd, 0x53, 0xc0, 0x60, 0x87, 0x09, 0xcb, 0x4d, 0xd3, 0x87, 0x0e, 0x3a, 0x5c, 0x8d, + 0xc8, 0xb8, 0xb7, 0x34, 0x01, 0xeb, 0x72, 0x0d, 0xb1, 0x1f, 0x0f, 0xea + }, + new byte[]{ // region 18, $17dac4 0x6a, 0x13, 0xb3, 0x09, 0x60, 0x79, 0x61, 0x53, 0x11, 0x33, 0x41, 0x31, 0x76, 0x34, 0x88, 0x0f, - 0x77, 0x08, 0xb6, 0x74, 0xc8, 0x36, 0xbc, 0x70, 0xe2, 0x87, 0x9a, 0x21, 0xe8, 0x56, 0xe1, 0x9a, - 0x26, 0x57, 0x7e, 0x9b, 0xdb, 0xb7, 0xd4, 0x3d, 0x0f, 0xfe, 0x8a, 0x2a, 0xba, 0x2d, 0x22, 0x03, - 0xcf, 0x9c, 0xfa, 0x77, 0x35, 0x39, 0x6a, 0x14, 0xae, 0x30, 0x89, 0x42, 0xdc, 0x59, 0xb2, 0x93, - 0x6f, 0x82, 0xd1, 0x12, 0xd9, 0x88, 0xfa, 0x3b, 0xb7, 0x0c, 0x1f, 0x05, 0x68, 0xa3, 0x0c, 0xa6, - 0x0f, 0xf4, 0x9e, 0x1b, 0x29, 0x82, 0x77, 0x3a, 0xac, 0x92, 0x2d, 0x04, 0xd0, 0x61, 0x65, 0x0a, - 0x77, 0x6c, 0x89, 0x38, 0xaa, 0xa9, 0xf8, 0x0c, 0x1f, 0x37, 0x09, 0x2b, 0xca, 0x29, 0x05, 0xe5, - 0x4e, 0x57, 0xfb, 0xcd, 0x40, 0xa8, 0x0c, 0x06, 0x2d, 0xe0, 0x30, 0xd9, 0x97, 0xb9, 0x59, 0x8a, - 0xde, 0xc9, 0x87, 0x1d, 0x3f, 0x84, 0x4c, 0x73, 0x04, 0x85, 0x61, 0xb0, 0x6e, 0x2c, 0x8f, 0xa2, - 0x6a, 0xcd, 0x31, 0xf3, 0x25, 0x83, 0xe1, 0x5e, 0x5d, 0xa7, 0xe7, 0xaa, 0x13, 0x26, 0xb1, 0x33, - 0xf0, 0x13, 0x58, 0x7a, 0xb0, 0x46, 0x1d, 0xdf, 0x02, 0xbf, 0x1e, 0xd1, 0x71, 0x43, 0x56, 0x82, - 0x4f, 0x58, 0x9d, 0x01, 0x2d, 0xc7, 0xda, 0x6b, 0x47, 0x05, 0xd1, 0xd5, 0xe8, 0x92, 0x3c, 0x18, - 0x21, 0xcf, 0xc9, 0x32, 0x0e, 0x12, 0xed, 0xb5, 0xaa, 0xa4, 0x12, 0x75, 0x01, 0x7d, 0xc7, 0x21, - 0xde, 0xec, 0x32, 0x13, 0xee, 0xd4, 0x9c, 0xe6, 0x04, 0x3f, 0x48, 0xfb, 0xb4, 0xc7, 0x21, 0x8e, - 0x8d, 0x7d, 0x54, 0x03, 0x11, 0xe7, 0xb9, 0x4f, 0x85, 0xb6, 0x1f, 0xaa - }, - new byte[]{ // region 19, $178eee + 0x77, 0x08, 0xb6, 0x74, 0xc8, 0x36, 0xbc, 0x70, 0xe2, 0x87, 0x9a, 0x21, 0xe8, 0x56, 0xe1, 0x9a, + 0x26, 0x57, 0x7e, 0x9b, 0xdb, 0xb7, 0xd4, 0x3d, 0x0f, 0xfe, 0x8a, 0x2a, 0xba, 0x2d, 0x22, 0x03, + 0xcf, 0x9c, 0xfa, 0x77, 0x35, 0x39, 0x6a, 0x14, 0xae, 0x30, 0x89, 0x42, 0xdc, 0x59, 0xb2, 0x93, + 0x6f, 0x82, 0xd1, 0x12, 0xd9, 0x88, 0xfa, 0x3b, 0xb7, 0x0c, 0x1f, 0x05, 0x68, 0xa3, 0x0c, 0xa6, + 0x0f, 0xf4, 0x9e, 0x1b, 0x29, 0x82, 0x77, 0x3a, 0xac, 0x92, 0x2d, 0x04, 0xd0, 0x61, 0x65, 0x0a, + 0x77, 0x6c, 0x89, 0x38, 0xaa, 0xa9, 0xf8, 0x0c, 0x1f, 0x37, 0x09, 0x2b, 0xca, 0x29, 0x05, 0xe5, + 0x4e, 0x57, 0xfb, 0xcd, 0x40, 0xa8, 0x0c, 0x06, 0x2d, 0xe0, 0x30, 0xd9, 0x97, 0xb9, 0x59, 0x8a, + 0xde, 0xc9, 0x87, 0x1d, 0x3f, 0x84, 0x4c, 0x73, 0x04, 0x85, 0x61, 0xb0, 0x6e, 0x2c, 0x8f, 0xa2, + 0x6a, 0xcd, 0x31, 0xf3, 0x25, 0x83, 0xe1, 0x5e, 0x5d, 0xa7, 0xe7, 0xaa, 0x13, 0x26, 0xb1, 0x33, + 0xf0, 0x13, 0x58, 0x7a, 0xb0, 0x46, 0x1d, 0xdf, 0x02, 0xbf, 0x1e, 0xd1, 0x71, 0x43, 0x56, 0x82, + 0x4f, 0x58, 0x9d, 0x01, 0x2d, 0xc7, 0xda, 0x6b, 0x47, 0x05, 0xd1, 0xd5, 0xe8, 0x92, 0x3c, 0x18, + 0x21, 0xcf, 0xc9, 0x32, 0x0e, 0x12, 0xed, 0xb5, 0xaa, 0xa4, 0x12, 0x75, 0x01, 0x7d, 0xc7, 0x21, + 0xde, 0xec, 0x32, 0x13, 0xee, 0xd4, 0x9c, 0xe6, 0x04, 0x3f, 0x48, 0xfb, 0xb4, 0xc7, 0x21, 0x8e, + 0x8d, 0x7d, 0x54, 0x03, 0x11, 0xe7, 0xb9, 0x4f, 0x85, 0xb6, 0x1f, 0xaa + }, + new byte[]{ // region 19, $178eee 0xe3, 0x53, 0xb3, 0x09, 0x60, 0x79, 0x60, 0x53, 0x11, 0x66, 0x5b, 0xc8, 0x8b, 0x94, 0x84, 0xab, - 0x3c, 0x18, 0x03, 0x57, 0x6a, 0x0f, 0x45, 0x58, 0xc0, 0x74, 0x64, 0x18, 0xf8, 0x39, 0xa1, 0x0f, - 0xc2, 0x2b, 0x1b, 0x60, 0xaa, 0x0e, 0xb2, 0x89, 0x01, 0x9b, 0x72, 0x80, 0x57, 0x83, 0x28, 0x63, - 0xe9, 0x39, 0x97, 0x46, 0xea, 0x3f, 0x93, 0x01, 0x9b, 0xf4, 0x80, 0x93, 0x01, 0xaf, 0x1d, 0x8f, - 0x16, 0xa1, 0xb9, 0xc7, 0xe4, 0x0c, 0xe7, 0xd2, 0x3b, 0xf3, 0xca, 0x3d, 0xc3, 0x54, 0xad, 0x89, - 0x51, 0x1e, 0xd1, 0x17, 0x7a, 0x1f, 0x23, 0x22, 0xcb, 0x4d, 0xce, 0x0f, 0xae, 0x30, 0x93, 0xd3, - 0x9b, 0x77, 0x71, 0xa7, 0xe7, 0x96, 0x2c, 0x85, 0xac, 0x29, 0x4b, 0x5e, 0x2b, 0x75, 0xb0, 0x00, - 0x81, 0xe9, 0xb6, 0x47, 0xaa, 0x9f, 0xdf, 0xd4, 0x7e, 0xd7, 0xa4, 0x3f, 0xe3, 0xb0, 0x41, 0x2c, - 0xb7, 0x0c, 0xe7, 0xeb, 0x9a, 0xda, 0xd9, 0x10, 0x23, 0x1d, 0x1c, 0xd4, 0xdd, 0x7d, 0xc2, 0x6c, - 0x4d, 0x9c, 0xa5, 0x18, 0xd0, 0x43, 0xab, 0xdc, 0xbd, 0xe4, 0x7f, 0xb5, 0x5f, 0x04, 0x0d, 0xac, - 0xab, 0xe6, 0xb8, 0x76, 0xf2, 0x15, 0x41, 0xef, 0x17, 0x8e, 0xf6, 0xb9, 0xef, 0x94, 0x52, 0x83, - 0x96, 0x45, 0x8f, 0xf2, 0x9c, 0xb4, 0x13, 0x3f, 0xbb, 0xa1, 0xd2, 0xf9, 0xa3, 0xf2, 0x06, 0x78, - 0xe0, 0x9e, 0xa7, 0xd3, 0xdc, 0x13, 0x8f, 0x4d, 0xf6, 0x19, 0xbd, 0x03, 0x9d, 0x24, 0xdc, 0xd6, - 0xe9, 0xcf, 0xa6, 0xd2, 0x1d, 0x49, 0xca, 0xc4, 0x55, 0x18, 0xbc, 0x70, 0x5b, 0x55, 0xfe, 0x8f, - 0x6b, 0x42, 0xf0, 0xd1, 0x21, 0xe3, 0xe7, 0x91, 0x59, 0x4e, 0x16, 0x83 - }, - new byte[]{ 0, }, // unused region 1a + 0x3c, 0x18, 0x03, 0x57, 0x6a, 0x0f, 0x45, 0x58, 0xc0, 0x74, 0x64, 0x18, 0xf8, 0x39, 0xa1, 0x0f, + 0xc2, 0x2b, 0x1b, 0x60, 0xaa, 0x0e, 0xb2, 0x89, 0x01, 0x9b, 0x72, 0x80, 0x57, 0x83, 0x28, 0x63, + 0xe9, 0x39, 0x97, 0x46, 0xea, 0x3f, 0x93, 0x01, 0x9b, 0xf4, 0x80, 0x93, 0x01, 0xaf, 0x1d, 0x8f, + 0x16, 0xa1, 0xb9, 0xc7, 0xe4, 0x0c, 0xe7, 0xd2, 0x3b, 0xf3, 0xca, 0x3d, 0xc3, 0x54, 0xad, 0x89, + 0x51, 0x1e, 0xd1, 0x17, 0x7a, 0x1f, 0x23, 0x22, 0xcb, 0x4d, 0xce, 0x0f, 0xae, 0x30, 0x93, 0xd3, + 0x9b, 0x77, 0x71, 0xa7, 0xe7, 0x96, 0x2c, 0x85, 0xac, 0x29, 0x4b, 0x5e, 0x2b, 0x75, 0xb0, 0x00, + 0x81, 0xe9, 0xb6, 0x47, 0xaa, 0x9f, 0xdf, 0xd4, 0x7e, 0xd7, 0xa4, 0x3f, 0xe3, 0xb0, 0x41, 0x2c, + 0xb7, 0x0c, 0xe7, 0xeb, 0x9a, 0xda, 0xd9, 0x10, 0x23, 0x1d, 0x1c, 0xd4, 0xdd, 0x7d, 0xc2, 0x6c, + 0x4d, 0x9c, 0xa5, 0x18, 0xd0, 0x43, 0xab, 0xdc, 0xbd, 0xe4, 0x7f, 0xb5, 0x5f, 0x04, 0x0d, 0xac, + 0xab, 0xe6, 0xb8, 0x76, 0xf2, 0x15, 0x41, 0xef, 0x17, 0x8e, 0xf6, 0xb9, 0xef, 0x94, 0x52, 0x83, + 0x96, 0x45, 0x8f, 0xf2, 0x9c, 0xb4, 0x13, 0x3f, 0xbb, 0xa1, 0xd2, 0xf9, 0xa3, 0xf2, 0x06, 0x78, + 0xe0, 0x9e, 0xa7, 0xd3, 0xdc, 0x13, 0x8f, 0x4d, 0xf6, 0x19, 0xbd, 0x03, 0x9d, 0x24, 0xdc, 0xd6, + 0xe9, 0xcf, 0xa6, 0xd2, 0x1d, 0x49, 0xca, 0xc4, 0x55, 0x18, 0xbc, 0x70, 0x5b, 0x55, 0xfe, 0x8f, + 0x6b, 0x42, 0xf0, 0xd1, 0x21, 0xe3, 0xe7, 0x91, 0x59, 0x4e, 0x16, 0x83 + }, + new byte[]{ 0, }, // unused region 1a new byte[]{ 0, }, // unused region 1b new byte[]{ 0, }, // unused region 1c new byte[]{ 0, }, // unused region 1d @@ -150,38 +145,38 @@ namespace mame new byte[]{ 0, }, // unused region 1f new byte[]{ // region 20, $17a322 0xb3, 0x10, 0xf3, 0x0b, 0xe0, 0x71, 0x60, 0x53, 0x11, 0x9a, 0x12, 0x70, 0x1f, 0x1e, 0x81, 0xda, - 0x9d, 0x1f, 0x4b, 0xd6, 0x71, 0x48, 0x83, 0xe1, 0x04, 0x6c, 0x1b, 0xf1, 0xcd, 0x09, 0xdf, 0x3e, - 0x0b, 0xaa, 0x95, 0xc1, 0x07, 0xec, 0x0f, 0x54, 0xd0, 0x16, 0xb0, 0xdc, 0x86, 0x7b, 0x52, 0x38, - 0x3c, 0x68, 0x2b, 0xed, 0xe2, 0xeb, 0xb3, 0xc6, 0x48, 0x24, 0x41, 0x36, 0x17, 0x25, 0x1f, 0xa5, - 0x22, 0xc6, 0x5c, 0xa6, 0x19, 0xef, 0x17, 0x5c, 0x56, 0x4b, 0x4a, 0x2b, 0x75, 0xab, 0xe6, 0x22, - 0xd5, 0xc0, 0xd3, 0x46, 0xcc, 0xe4, 0xd4, 0xc4, 0x8c, 0x9a, 0x8a, 0x75, 0x24, 0x73, 0xa4, 0x26, - 0xca, 0x79, 0xaf, 0xb3, 0x94, 0x2a, 0x15, 0xbe, 0x40, 0x7b, 0x4d, 0xf6, 0xb4, 0xa4, 0x7b, 0xcf, - 0xce, 0xa0, 0x1d, 0xcb, 0x2f, 0x60, 0x28, 0x63, 0x85, 0x98, 0xd3, 0xd2, 0x45, 0x3f, 0x02, 0x65, - 0xd7, 0xf4, 0xbc, 0x2a, 0xe7, 0x50, 0xd1, 0x3f, 0x7f, 0xf6, 0x05, 0xb8, 0xe9, 0x39, 0x10, 0x6e, - 0x68, 0xa8, 0x89, 0x60, 0x00, 0x68, 0xfd, 0x20, 0xc4, 0xdc, 0xef, 0x67, 0x75, 0xfb, 0xbe, 0xfe, - 0x2b, 0x16, 0xa6, 0x5a, 0x77, 0x0d, 0x0c, 0xe2, 0x2d, 0xd1, 0xe4, 0x11, 0xc9, 0x4b, 0x81, 0x3a, - 0x0c, 0x24, 0xaa, 0x77, 0x2b, 0x2f, 0x83, 0x23, 0xd1, 0xe9, 0xa7, 0x29, 0x0a, 0xf9, 0x26, 0x9d, - 0x51, 0xc8, 0x6d, 0x71, 0x9d, 0xce, 0x46, 0x72, 0x26, 0x48, 0x3d, 0x64, 0xe5, 0x67, 0xbb, 0x1a, - 0xb4, 0x6d, 0x21, 0x11, 0x79, 0x78, 0xc2, 0xd5, 0x11, 0x6a, 0xd2, 0xea, 0x03, 0x4d, 0x92, 0xaf, - 0x18, 0xd5, 0x07, 0x79, 0xaa, 0xf9, 0x44, 0x93, 0x6f, 0x41, 0x22, 0x0d - }, - new byte[]{ // region 21, $17b3b4 + 0x9d, 0x1f, 0x4b, 0xd6, 0x71, 0x48, 0x83, 0xe1, 0x04, 0x6c, 0x1b, 0xf1, 0xcd, 0x09, 0xdf, 0x3e, + 0x0b, 0xaa, 0x95, 0xc1, 0x07, 0xec, 0x0f, 0x54, 0xd0, 0x16, 0xb0, 0xdc, 0x86, 0x7b, 0x52, 0x38, + 0x3c, 0x68, 0x2b, 0xed, 0xe2, 0xeb, 0xb3, 0xc6, 0x48, 0x24, 0x41, 0x36, 0x17, 0x25, 0x1f, 0xa5, + 0x22, 0xc6, 0x5c, 0xa6, 0x19, 0xef, 0x17, 0x5c, 0x56, 0x4b, 0x4a, 0x2b, 0x75, 0xab, 0xe6, 0x22, + 0xd5, 0xc0, 0xd3, 0x46, 0xcc, 0xe4, 0xd4, 0xc4, 0x8c, 0x9a, 0x8a, 0x75, 0x24, 0x73, 0xa4, 0x26, + 0xca, 0x79, 0xaf, 0xb3, 0x94, 0x2a, 0x15, 0xbe, 0x40, 0x7b, 0x4d, 0xf6, 0xb4, 0xa4, 0x7b, 0xcf, + 0xce, 0xa0, 0x1d, 0xcb, 0x2f, 0x60, 0x28, 0x63, 0x85, 0x98, 0xd3, 0xd2, 0x45, 0x3f, 0x02, 0x65, + 0xd7, 0xf4, 0xbc, 0x2a, 0xe7, 0x50, 0xd1, 0x3f, 0x7f, 0xf6, 0x05, 0xb8, 0xe9, 0x39, 0x10, 0x6e, + 0x68, 0xa8, 0x89, 0x60, 0x00, 0x68, 0xfd, 0x20, 0xc4, 0xdc, 0xef, 0x67, 0x75, 0xfb, 0xbe, 0xfe, + 0x2b, 0x16, 0xa6, 0x5a, 0x77, 0x0d, 0x0c, 0xe2, 0x2d, 0xd1, 0xe4, 0x11, 0xc9, 0x4b, 0x81, 0x3a, + 0x0c, 0x24, 0xaa, 0x77, 0x2b, 0x2f, 0x83, 0x23, 0xd1, 0xe9, 0xa7, 0x29, 0x0a, 0xf9, 0x26, 0x9d, + 0x51, 0xc8, 0x6d, 0x71, 0x9d, 0xce, 0x46, 0x72, 0x26, 0x48, 0x3d, 0x64, 0xe5, 0x67, 0xbb, 0x1a, + 0xb4, 0x6d, 0x21, 0x11, 0x79, 0x78, 0xc2, 0xd5, 0x11, 0x6a, 0xd2, 0xea, 0x03, 0x4d, 0x92, 0xaf, + 0x18, 0xd5, 0x07, 0x79, 0xaa, 0xf9, 0x44, 0x93, 0x6f, 0x41, 0x22, 0x0d + }, + new byte[]{ // region 21, $17b3b4 0x2d, 0x50, 0xf3, 0x0b, 0xe0, 0x71, 0x61, 0x53, 0x11, 0xb4, 0x2c, 0xee, 0x34, 0x7e, 0x7d, 0x5e, - 0x62, 0x48, 0x97, 0xd2, 0xf9, 0x3a, 0xf2, 0xc9, 0xfa, 0x59, 0xe4, 0xe8, 0xf6, 0xd2, 0x9f, 0xb2, - 0xa7, 0x7e, 0x32, 0x86, 0xbc, 0x43, 0xec, 0xa0, 0xc2, 0xcb, 0x98, 0x33, 0x23, 0xd1, 0x58, 0x98, - 0x56, 0x05, 0xc7, 0xbc, 0x98, 0xd8, 0xdc, 0xb3, 0x35, 0xe8, 0x51, 0x6e, 0x3b, 0x7b, 0x89, 0xba, - 0xe1, 0xe5, 0x44, 0x5c, 0x24, 0x73, 0x04, 0x0d, 0xd9, 0x33, 0xf5, 0x63, 0xe9, 0x5c, 0x88, 0x05, - 0x18, 0xd0, 0x07, 0x5b, 0x1e, 0x81, 0x80, 0xac, 0x92, 0x6e, 0x13, 0x80, 0x1b, 0x29, 0xd2, 0xef, - 0x08, 0x84, 0x97, 0x23, 0xd1, 0x17, 0x2f, 0x38, 0xb4, 0x6d, 0x8f, 0x2a, 0x15, 0xf0, 0x40, 0xe9, - 0x02, 0x33, 0xd7, 0x5e, 0x99, 0x57, 0x15, 0x32, 0xbd, 0x8f, 0x48, 0x38, 0x91, 0x36, 0xe9, 0x07, - 0xc9, 0x37, 0x1d, 0x12, 0x2a, 0xbf, 0x5f, 0xdb, 0x85, 0x75, 0xbf, 0xdc, 0x59, 0x8a, 0x43, 0x51, - 0x4b, 0x77, 0xfd, 0x84, 0xc4, 0x28, 0xc7, 0x85, 0x25, 0x1a, 0x87, 0x8b, 0xc1, 0xd9, 0x1a, 0x78, - 0xe5, 0x03, 0x20, 0x56, 0xa0, 0xc2, 0x17, 0xf2, 0x29, 0xa0, 0xbd, 0xf8, 0x61, 0x9c, 0x7d, 0x54, - 0x3a, 0x11, 0xb5, 0x69, 0x9a, 0x1c, 0xbb, 0xf6, 0x2d, 0x86, 0xa8, 0x4d, 0xdd, 0x5a, 0xd6, 0xe4, - 0x11, 0x7e, 0x4b, 0x13, 0x6c, 0xb6, 0x01, 0x0a, 0x72, 0xbc, 0xe8, 0xf1, 0x82, 0x0e, 0xd0, 0xcf, - 0xbf, 0x50, 0x95, 0xb7, 0xa7, 0xec, 0xd7, 0xb3, 0x49, 0x5c, 0x47, 0x5f, 0xa9, 0xda, 0x70, 0xb0, - 0xdc, 0x9a, 0xa3, 0x48, 0xd3, 0xf5, 0x72, 0xd5, 0x43, 0xd8, 0x19, 0xcc - } + 0x62, 0x48, 0x97, 0xd2, 0xf9, 0x3a, 0xf2, 0xc9, 0xfa, 0x59, 0xe4, 0xe8, 0xf6, 0xd2, 0x9f, 0xb2, + 0xa7, 0x7e, 0x32, 0x86, 0xbc, 0x43, 0xec, 0xa0, 0xc2, 0xcb, 0x98, 0x33, 0x23, 0xd1, 0x58, 0x98, + 0x56, 0x05, 0xc7, 0xbc, 0x98, 0xd8, 0xdc, 0xb3, 0x35, 0xe8, 0x51, 0x6e, 0x3b, 0x7b, 0x89, 0xba, + 0xe1, 0xe5, 0x44, 0x5c, 0x24, 0x73, 0x04, 0x0d, 0xd9, 0x33, 0xf5, 0x63, 0xe9, 0x5c, 0x88, 0x05, + 0x18, 0xd0, 0x07, 0x5b, 0x1e, 0x81, 0x80, 0xac, 0x92, 0x6e, 0x13, 0x80, 0x1b, 0x29, 0xd2, 0xef, + 0x08, 0x84, 0x97, 0x23, 0xd1, 0x17, 0x2f, 0x38, 0xb4, 0x6d, 0x8f, 0x2a, 0x15, 0xf0, 0x40, 0xe9, + 0x02, 0x33, 0xd7, 0x5e, 0x99, 0x57, 0x15, 0x32, 0xbd, 0x8f, 0x48, 0x38, 0x91, 0x36, 0xe9, 0x07, + 0xc9, 0x37, 0x1d, 0x12, 0x2a, 0xbf, 0x5f, 0xdb, 0x85, 0x75, 0xbf, 0xdc, 0x59, 0x8a, 0x43, 0x51, + 0x4b, 0x77, 0xfd, 0x84, 0xc4, 0x28, 0xc7, 0x85, 0x25, 0x1a, 0x87, 0x8b, 0xc1, 0xd9, 0x1a, 0x78, + 0xe5, 0x03, 0x20, 0x56, 0xa0, 0xc2, 0x17, 0xf2, 0x29, 0xa0, 0xbd, 0xf8, 0x61, 0x9c, 0x7d, 0x54, + 0x3a, 0x11, 0xb5, 0x69, 0x9a, 0x1c, 0xbb, 0xf6, 0x2d, 0x86, 0xa8, 0x4d, 0xdd, 0x5a, 0xd6, 0xe4, + 0x11, 0x7e, 0x4b, 0x13, 0x6c, 0xb6, 0x01, 0x0a, 0x72, 0xbc, 0xe8, 0xf1, 0x82, 0x0e, 0xd0, 0xcf, + 0xbf, 0x50, 0x95, 0xb7, 0xa7, 0xec, 0xd7, 0xb3, 0x49, 0x5c, 0x47, 0x5f, 0xa9, 0xda, 0x70, 0xb0, + 0xdc, 0x9a, 0xa3, 0x48, 0xd3, 0xf5, 0x72, 0xd5, 0x43, 0xd8, 0x19, 0xcc + } }; public static void drgw_interrupt() { @@ -248,7 +243,7 @@ namespace mame } public static ushort killbld_igs025_prot_r(int offset) { - if (offset!=0) + if (offset != 0) { switch (kb_cmd) { diff --git a/MAME.Core/mame/pgm/Memory.cs b/MAME.Core/mame/pgm/Memory.cs index 5a9e0ad..9e82ba9 100644 --- a/MAME.Core/mame/pgm/Memory.cs +++ b/MAME.Core/mame/pgm/Memory.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace mame +namespace mame { public partial class PGM { @@ -52,7 +47,7 @@ namespace mame { result = 0; } - } + } else if (address >= 0x800000 && address <= 0x81ffff) { result = (sbyte)Memory.mainram[address - 0x800000]; @@ -127,7 +122,7 @@ namespace mame { address &= 0xffffff; short result = 0; - if (address >= 0 && address+1 <= 0x1ffff) + if (address >= 0 && address + 1 <= 0x1ffff) { result = (short)(mainbiosrom[address] * 0x100 + mainbiosrom[address + 1]); } @@ -142,7 +137,7 @@ namespace mame result = 0; } } - else if (address >= 0x800000 && address+1 <= 0x81ffff) + else if (address >= 0x800000 && address + 1 <= 0x81ffff) { result = (short)(Memory.mainram[address - 0x800000] * 0x100 + Memory.mainram[address - 0x800000 + 1]); } @@ -152,7 +147,7 @@ namespace mame { address &= 0xffffff; short result = 0; - if (address >= 0 && address+1 <= 0x1ffff) + if (address >= 0 && address + 1 <= 0x1ffff) { result = (short)(mainbiosrom[address] * 0x100 + mainbiosrom[address + 1]); } @@ -292,7 +287,7 @@ namespace mame } else if (address >= 0xa00000 && address + 3 <= 0xa011ff) { - int offset=(address-0xa00000)/2; + int offset = (address - 0xa00000) / 2; result = Generic.paletteram16[offset] * 0x10000 + Generic.paletteram16[offset + 1]; } else if (address >= 0xb00000 && address + 3 <= 0xb0ffff) @@ -351,7 +346,7 @@ namespace mame } else if (address >= 0x900000 && address <= 0x903fff) { - int offset=address-0x900000; + int offset = address - 0x900000; pgm_bg_videoram_w(offset, (byte)value); } else if (address >= 0x904000 && address <= 0x905fff) @@ -366,12 +361,12 @@ namespace mame } else if (address >= 0xa00000 && address <= 0xa011ff) { - int offset = (address - 0xa00000)/2; + int offset = (address - 0xa00000) / 2; if ((address % 2) == 0) { Generic.paletteram16[offset] = (ushort)(((byte)value << 8) | (Generic.paletteram16[offset] & 0xff)); } - else if((address%2)==1) + else if ((address % 2) == 1) { Generic.paletteram16[offset] = (ushort)((Generic.paletteram16[offset] & 0xff00) | (byte)value); } @@ -395,9 +390,9 @@ namespace mame } else if (address >= 0xc00006 && address <= 0xc00007) { - if(address==0xc00006) + if (address == 0xc00006) { - int i1=1; + int i1 = 1; } else if (address == 0xc00007) { @@ -436,17 +431,17 @@ namespace mame else if (address >= 0x800000 && address + 1 <= 0x81ffff) { int offset = address - 0x800000; - Memory.mainram[offset] = (byte)(value>>8); + Memory.mainram[offset] = (byte)(value >> 8); Memory.mainram[offset + 1] = (byte)value; } else if (address >= 0x900000 && address + 1 <= 0x903fff) { - int offset = (address - 0x900000)/2; + int offset = (address - 0x900000) / 2; pgm_bg_videoram_w(offset, (ushort)value); } else if (address >= 0x904000 && address + 1 <= 0x905fff) { - int offset = (address - 0x904000)/2; + int offset = (address - 0x904000) / 2; pgm_tx_videoram_w(offset, (ushort)value); } else if (address >= 0x907000 && address + 1 <= 0x9077ff) @@ -467,7 +462,7 @@ namespace mame pgm_videoregs[offset * 2] = (byte)(value >> 8); pgm_videoregs[offset * 2 + 1] = (byte)value; } - else if (address >= 0xc00002 && address+1 <= 0xc00003) + else if (address >= 0xc00002 && address + 1 <= 0xc00003) { m68k_l1_w((ushort)value); } @@ -494,7 +489,7 @@ namespace mame else if (address >= 0xc10000 && address + 1 <= 0xc1ffff) { int offset = address - 0xc10000; - z80_ram_w(offset, (byte)(value>>8)); + z80_ram_w(offset, (byte)(value >> 8)); z80_ram_w(offset + 1, (byte)value); } else diff --git a/MAME.Core/mame/pgm/Memory2.cs b/MAME.Core/mame/pgm/Memory2.cs index 70fcab8..3236998 100644 --- a/MAME.Core/mame/pgm/Memory2.cs +++ b/MAME.Core/mame/pgm/Memory2.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace mame +namespace mame { public partial class PGM { @@ -38,17 +33,17 @@ namespace mame public static void MPWriteByte_orlegend(int address, sbyte value) { address &= 0xffffff; - if(address==0xc04001) + if (address == 0xc04001) { pgm_asic3_reg_w((ushort)value); } - else if(address==0xc0400f) + else if (address == 0xc0400f) { pgm_asic3_w((ushort)value); } else { - MWriteByte(address,value); + MWriteByte(address, value); } } public static void MPWriteWord_orlegend(int address, short value) @@ -71,9 +66,9 @@ namespace mame { sbyte result; address &= 0xffffff; - if(address>=0xd80000&&address<=0xd80003) + if (address >= 0xd80000 && address <= 0xd80003) { - result=0; + result = 0; } else { @@ -85,9 +80,9 @@ namespace mame { short result; address &= 0xffffff; - if (address == 0xd80000&&address+1<=0xd80003) + if (address == 0xd80000 && address + 1 <= 0xd80003) { - int offset=(address-0xd80000)/2; + int offset = (address - 0xd80000) / 2; result = (short)killbld_igs025_prot_r(offset); } else @@ -128,12 +123,12 @@ namespace mame address &= 0xffffff; if (address == 0xd80000 && address + 1 <= 0xd80003) { - int offset=(address-0xd80000)/2; + int offset = (address - 0xd80000) / 2; drgw2_d80000_protection_w(offset, (ushort)value); } else { - MWriteWord(address,value); + MWriteWord(address, value); } } public static void MPWriteLong_drgw2(int address, int value) diff --git a/MAME.Core/mame/pgm/PGM.cs b/MAME.Core/mame/pgm/PGM.cs index 6c0f747..7470493 100644 --- a/MAME.Core/mame/pgm/PGM.cs +++ b/MAME.Core/mame/pgm/PGM.cs @@ -1,16 +1,14 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.IO; -using cpu.m68000; +using cpu.m68000; using MAME.Core.Common; +using System; +using System.IO; namespace mame { public partial class PGM { public static byte[] mainbiosrom, videobios, audiobios; - public static byte[] pgm_bg_videoram, pgm_tx_videoram, pgm_rowscrollram, pgm_videoregs, sprmaskrom, sprcolrom,tilesrom, tiles1rom, tiles2rom, pgm_sprite_a_region; + public static byte[] pgm_bg_videoram, pgm_tx_videoram, pgm_rowscrollram, pgm_videoregs, sprmaskrom, sprcolrom, tilesrom, tiles1rom, tiles2rom, pgm_sprite_a_region; public static byte CalVal, CalMask, CalCom = 0, CalCnt = 0; public static uint[] arm7_shareram; public static uint arm7_latch; @@ -18,13 +16,13 @@ namespace mame public static void PGMInit() { Machine.bRom = true; - mainbiosrom = mainForm.resource.Get_pgmmainbios(); - videobios = mainForm.resource.Get_pgmvideobios(); - audiobios = mainForm.resource.Get_pgmaudiobios(); + mainbiosrom = mainMotion.resource.Get_pgmmainbios(); + videobios = mainMotion.resource.Get_pgmvideobios(); + audiobios = mainMotion.resource.Get_pgmaudiobios(); ICS2115.icsrom = audiobios; - byte[] bb1,bb2; - int i3,n1,n2,n3; - bb1= Machine.GetRom("ics.rom"); + byte[] bb1, bb2; + int i3, n1, n2, n3; + bb1 = Machine.GetRom("ics.rom"); bb2 = Machine.GetRom("tiles.rom"); if (bb1 == null) { @@ -39,7 +37,7 @@ namespace mame Array.Copy(videobios, tilesrom, 0x200000); Array.Copy(bb2, 0, tilesrom, 0x400000, n2); n3 = tilesrom.Length; - tiles1rom = new byte[n3*2]; + tiles1rom = new byte[n3 * 2]; for (i3 = 0; i3 < n3; i3++) { tiles1rom[i3 * 2] = (byte)(tilesrom[i3] & 0x0f); @@ -49,7 +47,7 @@ namespace mame sprmaskrom = Machine.GetRom("sprmask.rom"); sprcolrom = Machine.GetRom("sprcol.rom"); expand_32x32x5bpp(); - expand_colourdata(); + expand_colourdata(); Memory.mainram = new byte[0x20000]; pgm_bg_videoram = new byte[0x4000]; pgm_tx_videoram = new byte[0x2000]; diff --git a/MAME.Core/mame/pgm/Pgmprot.cs b/MAME.Core/mame/pgm/Pgmprot.cs index 54ccab3..5745e06 100644 --- a/MAME.Core/mame/pgm/Pgmprot.cs +++ b/MAME.Core/mame/pgm/Pgmprot.cs @@ -1,14 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace mame +namespace mame { public partial class PGM { public static byte asic3_reg, asic3_x; - public static byte[] asic3_latch=new byte[3]; + public static byte[] asic3_latch = new byte[3]; public static ushort asic3_hold, asic3_hilo; public static int bt(uint v, int bit) { diff --git a/MAME.Core/mame/pgm/State.cs b/MAME.Core/mame/pgm/State.cs index 99c3bb4..92ee2eb 100644 --- a/MAME.Core/mame/pgm/State.cs +++ b/MAME.Core/mame/pgm/State.cs @@ -1,10 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using cpu.m68000; +using cpu.m68000; using cpu.z80; +using System.IO; namespace mame { @@ -23,7 +19,7 @@ namespace mame writer.Write(CalCnt); writer.Write(asic3_reg); writer.Write(asic3_x); - for(i=0;i<3;i++) + for (i = 0; i < 3; i++) { writer.Write(asic3_latch[i]); } diff --git a/MAME.Core/mame/pgm/Tilemap.cs b/MAME.Core/mame/pgm/Tilemap.cs index c249504..d20f69b 100644 --- a/MAME.Core/mame/pgm/Tilemap.cs +++ b/MAME.Core/mame/pgm/Tilemap.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; namespace mame { @@ -12,7 +8,7 @@ namespace mame public static void tilemap_init() { int i; - pgm_tx_tilemap = new Tmap(); + pgm_tx_tilemap = new Tmap(); pgm_tx_tilemap.rows = 32; pgm_tx_tilemap.cols = 64; pgm_tx_tilemap.tilewidth = 8; @@ -28,7 +24,7 @@ namespace mame pgm_tx_tilemap.tilemap_draw_instance3 = pgm_tx_tilemap.tilemap_draw_instancePgm; pgm_tx_tilemap.total_elements = 0x800000 / 0x20; pgm_tx_tilemap.pen_data = new byte[0x40]; - pgm_tx_tilemap.pen_to_flags = new byte[1, 16]; + pgm_tx_tilemap.pen_to_flags = new byte[1, 16]; for (i = 0; i < 15; i++) { pgm_tx_tilemap.pen_to_flags[0, i] = 0x10; @@ -121,7 +117,7 @@ namespace mame for (tx = 0; tx < width; tx++) { pen = pen_data[offset1]; - map = pen_to_flags[0,pen]; + map = pen_to_flags[0, pen]; offset1++; pixmap[offsety1 * 0x200 + x0 + xoffs] = (ushort)(palette_base + pen); flagsmap[offsety1, x0 + xoffs] = map; @@ -235,7 +231,7 @@ namespace mame int x0 = tilewidth * col; int y0 = tileheight * row; int tileno, colour, flipyx; - int code, tile_index,palette_base; + int code, tile_index, palette_base; byte flags; tile_index = row * PGM.pgm_bg_tilemap.cols + col; tileno = (PGM.pgm_bg_videoram[tile_index * 4] * 0x100 + PGM.pgm_bg_videoram[tile_index * 4 + 1]) & 0xffff; diff --git a/MAME.Core/mame/pgm/Video.cs b/MAME.Core/mame/pgm/Video.cs index 9d75095..bafdae8 100644 --- a/MAME.Core/mame/pgm/Video.cs +++ b/MAME.Core/mame/pgm/Video.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; namespace mame { @@ -61,7 +58,7 @@ namespace mame } } } - Tilemap.priority_bitmap[ydrawpos,xdrawpos] |= 1; + Tilemap.priority_bitmap[ydrawpos, xdrawpos] |= 1; } } private static void pgm_draw_pix_nopri(int xdrawpos, int ydrawpos, ushort srcdat) @@ -99,8 +96,8 @@ namespace mame xcnt = 0; xcntdraw = 0; while (xcnt < wide * 16) - { - if ((flip & 0x01)==0) + { + if ((flip & 0x01) == 0) xoffset = xcnt; else xoffset = (wide * 16) - xcnt - 1; @@ -109,14 +106,14 @@ namespace mame if (xzoombit == 1 && xgrow == 1) { xdrawpos = xpos + xcntdraw; - if ((srcdat & 0x8000)==0) + if ((srcdat & 0x8000) == 0) { if ((xdrawpos >= 0) && (xdrawpos < 448)) Video.bitmapbase[Video.curbitmap][ydrawpos * 0x200 + xdrawpos] = srcdat; } xcntdraw++; xdrawpos = xpos + xcntdraw; - if ((srcdat & 0x8000)==0) + if ((srcdat & 0x8000) == 0) { if ((xdrawpos >= 0) && (xdrawpos < 448)) Video.bitmapbase[Video.curbitmap][ydrawpos * 0x200 + xdrawpos] = srcdat; @@ -125,12 +122,12 @@ namespace mame } else if (xzoombit == 1 && xgrow == 0) { - + } else { xdrawpos = xpos + xcntdraw; - if ((srcdat & 0x8000)==0) + if ((srcdat & 0x8000) == 0) { if ((xdrawpos >= 0) && (xdrawpos < 448)) Video.bitmapbase[Video.curbitmap][ydrawpos * 0x200 + xdrawpos] = srcdat; diff --git a/MAME.Core/mame/suna8/Drawgfx.cs b/MAME.Core/mame/suna8/Drawgfx.cs index c62fc68..67d9441 100644 --- a/MAME.Core/mame/suna8/Drawgfx.cs +++ b/MAME.Core/mame/suna8/Drawgfx.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace mame +namespace mame { public partial class Drawgfx { diff --git a/MAME.Core/mame/suna8/Input.cs b/MAME.Core/mame/suna8/Input.cs index 541ff4e..13d8672 100644 --- a/MAME.Core/mame/suna8/Input.cs +++ b/MAME.Core/mame/suna8/Input.cs @@ -112,7 +112,7 @@ namespace mame } if (Keyboard.IsPressed(Key.Up)) { - byte2 &=unchecked((byte) ~0x01); + byte2 &= unchecked((byte)~0x01); } else { @@ -138,7 +138,7 @@ namespace mame public static void record_port_starfigh() { if (byte1 != byte1_old || byte2 != byte2_old) - { + { byte1_old = byte1; byte2_old = byte2; Mame.bwRecord.Write(Video.screenstate.frame_number); diff --git a/MAME.Core/mame/suna8/Memory.cs b/MAME.Core/mame/suna8/Memory.cs index e9c92f8..18be1ad 100644 --- a/MAME.Core/mame/suna8/Memory.cs +++ b/MAME.Core/mame/suna8/Memory.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using cpu.z80; +using cpu.z80; namespace mame { diff --git a/MAME.Core/mame/suna8/State.cs b/MAME.Core/mame/suna8/State.cs index 56d4afa..589b618 100644 --- a/MAME.Core/mame/suna8/State.cs +++ b/MAME.Core/mame/suna8/State.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using cpu.z80; +using System.IO; namespace mame { diff --git a/MAME.Core/mame/suna8/SunA8.cs b/MAME.Core/mame/suna8/SunA8.cs index 496d404..9bb8904 100644 --- a/MAME.Core/mame/suna8/SunA8.cs +++ b/MAME.Core/mame/suna8/SunA8.cs @@ -1,9 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.IO; -using System.Text; -using cpu.m68000; namespace mame { diff --git a/MAME.Core/mame/suna8/Video.cs b/MAME.Core/mame/suna8/Video.cs index 3c8ee11..7aeb108 100644 --- a/MAME.Core/mame/suna8/Video.cs +++ b/MAME.Core/mame/suna8/Video.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; namespace mame { @@ -11,10 +8,10 @@ namespace mame public static ushort[] uuFF; public enum GFXBANK_TYPE { - GFXBANK_TYPE_SPARKMAN=0, + GFXBANK_TYPE_SPARKMAN = 0, GFXBANK_TYPE_BRICKZN, GFXBANK_TYPE_STARFIGH - } + } public static byte suna8_banked_paletteram_r(int offset) { offset += m_palettebank * 0x200; @@ -71,7 +68,7 @@ namespace mame } public static void video_start_suna8_text() { - suna8_vh_start_common(1,GFXBANK_TYPE.GFXBANK_TYPE_SPARKMAN); + suna8_vh_start_common(1, GFXBANK_TYPE.GFXBANK_TYPE_SPARKMAN); } public static void video_start_suna8_sparkman() { diff --git a/MAME.Core/mame/taito/Bublbobl.cs b/MAME.Core/mame/taito/Bublbobl.cs index 12f59d5..7ec1875 100644 --- a/MAME.Core/mame/taito/Bublbobl.cs +++ b/MAME.Core/mame/taito/Bublbobl.cs @@ -1,16 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using cpu.m68000; - -namespace mame +namespace mame { public partial class Taito { public static byte dsw0, dsw1; - public static int bublbobl_video_enable, tokio_prot_count; + public static int bublbobl_video_enable, tokio_prot_count; public static int address, latch; public static int sound_nmi_enable, pending_nmi; public static byte ddr1, ddr2, ddr3, ddr4; @@ -20,19 +13,19 @@ namespace mame public static int ic43_a, ic43_b; public static byte[] tokio_prot_data = new byte[] { - 0x6c, - 0x7f,0x5f,0x7f,0x6f,0x5f,0x77,0x5f,0x7f,0x5f,0x7f,0x5f,0x7f,0x5b,0x7f,0x5f,0x7f, - 0x5f,0x77,0x59,0x7f,0x5e,0x7e,0x5f,0x6d,0x57,0x7f,0x5d,0x7d,0x5f,0x7e,0x5f,0x7f, - 0x5d,0x7d,0x5f,0x7e,0x5e,0x79,0x5f,0x7f,0x5f,0x7f,0x5d,0x7f,0x5f,0x7b,0x5d,0x7e, - 0x5f,0x7f,0x5d,0x7d,0x5f,0x7e,0x5e,0x7e,0x5f,0x7d,0x5f,0x7f,0x5f,0x7e,0x7f,0x5f, - 0x01,0x00,0x02,0x01,0x01,0x01,0x03,0x00,0x05,0x02,0x04,0x01,0x03,0x00,0x05,0x01, - 0x02,0x03,0x00,0x04,0x04,0x01,0x02,0x00,0x05,0x03,0x02,0x01,0x04,0x05,0x00,0x03, - 0x00,0x05,0x02,0x01,0x03,0x04,0x05,0x00,0x01,0x04,0x04,0x02,0x01,0x04,0x01,0x00, - 0x03,0x01,0x02,0x05,0x00,0x03,0x00,0x01,0x02,0x00,0x03,0x04,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x00,0x00,0x00,0x00,0x01,0x02,0x00,0x00,0x00, - 0x01,0x02,0x01,0x00,0x00,0x00,0x02,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x01,0x01, - 0x00,0x00,0x00,0x00,0x02,0x00,0x01,0x02,0x00,0x01,0x01,0x00,0x00,0x02,0x01,0x00, - 0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x01 + 0x6c, + 0x7f,0x5f,0x7f,0x6f,0x5f,0x77,0x5f,0x7f,0x5f,0x7f,0x5f,0x7f,0x5b,0x7f,0x5f,0x7f, + 0x5f,0x77,0x59,0x7f,0x5e,0x7e,0x5f,0x6d,0x57,0x7f,0x5d,0x7d,0x5f,0x7e,0x5f,0x7f, + 0x5d,0x7d,0x5f,0x7e,0x5e,0x79,0x5f,0x7f,0x5f,0x7f,0x5d,0x7f,0x5f,0x7b,0x5d,0x7e, + 0x5f,0x7f,0x5d,0x7d,0x5f,0x7e,0x5e,0x7e,0x5f,0x7d,0x5f,0x7f,0x5f,0x7e,0x7f,0x5f, + 0x01,0x00,0x02,0x01,0x01,0x01,0x03,0x00,0x05,0x02,0x04,0x01,0x03,0x00,0x05,0x01, + 0x02,0x03,0x00,0x04,0x04,0x01,0x02,0x00,0x05,0x03,0x02,0x01,0x04,0x05,0x00,0x03, + 0x00,0x05,0x02,0x01,0x03,0x04,0x05,0x00,0x01,0x04,0x04,0x02,0x01,0x04,0x01,0x00, + 0x03,0x01,0x02,0x05,0x00,0x03,0x00,0x01,0x02,0x00,0x03,0x04,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x01,0x02,0x00,0x00,0x00,0x00,0x01,0x02,0x00,0x00,0x00, + 0x01,0x02,0x01,0x00,0x00,0x00,0x02,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x01,0x01, + 0x00,0x00,0x00,0x00,0x02,0x00,0x01,0x02,0x00,0x01,0x01,0x00,0x00,0x02,0x01,0x00, + 0x00,0x00,0x00,0x00,0x02,0x00,0x00,0x01 }; public static void bublbobl_bankswitch_w(byte data) { diff --git a/MAME.Core/mame/taito/Drawgfx.cs b/MAME.Core/mame/taito/Drawgfx.cs index 57ca320..a6e74b6 100644 --- a/MAME.Core/mame/taito/Drawgfx.cs +++ b/MAME.Core/mame/taito/Drawgfx.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace mame +namespace mame { public partial class Drawgfx { diff --git a/MAME.Core/mame/taito/Gdi.cs b/MAME.Core/mame/taito/Gdi.cs index 75a9396..50c75b7 100644 --- a/MAME.Core/mame/taito/Gdi.cs +++ b/MAME.Core/mame/taito/Gdi.cs @@ -1,7 +1,4 @@ -using System.Drawing; -using System.Drawing.Imaging; - -namespace mame +namespace mame { public partial class Taito { @@ -15,630 +12,5 @@ namespace mame flagsmapFG = new byte[0x200, 0x200]; priority_bitmapG = new byte[0x140, 0x100]; } - public static Bitmap GetDraw_bublbobl() - { - int i, j,x0,y0,dx0,dy0,iOffset,iByte; - int offs; - int sx, sy, xc, yc; - int gfx_num, gfx_attr, gfx_offs; - int prom_line_offset; - Color c1 = new Color(); - Bitmap bm1; - bm1 = new Bitmap(256, 256); - 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; - if (bublbobl_video_enable != 0) - { - sx = 0; - for (offs = 0; offs < bublbobl_objectram_size; offs += 4) - { - if (bublbobl_objectram[offs] == 0 && bublbobl_objectram[offs + 1] == 0 && bublbobl_objectram[offs + 2] == 0 && bublbobl_objectram[offs + 3] == 0) - { - continue; - } - gfx_num = bublbobl_objectram[offs + 1]; - gfx_attr = bublbobl_objectram[offs + 3]; - prom_line_offset = 0x80 + ((gfx_num & 0xe0) >> 1); - gfx_offs = ((gfx_num & 0x1f) * 0x80); - if ((gfx_num & 0xa0) == 0xa0) - { - gfx_offs |= 0x1000; - } - sy = -bublbobl_objectram[offs + 0]; - for (yc = 0; yc < 32; yc++) - { - if ((prom[prom_line_offset + yc / 2] & 0x08) != 0) - { - continue; - } - if ((prom[prom_line_offset + yc / 2] & 0x04) == 0) - { - sx = bublbobl_objectram[offs + 2]; - if ((gfx_attr & 0x40) != 0) - { - sx -= 256; - } - } - for (xc = 0; xc < 2; xc++) - { - int goffs, code, color, flipx, flipy, x, y; - goffs = gfx_offs + xc * 0x40 + (yc & 7) * 0x02 + (prom[prom_line_offset + yc / 2] & 0x03) * 0x10; - code = videoram[goffs] + 256 * (videoram[goffs + 1] & 0x03) + 1024 * (gfx_attr & 0x0f); - color = (videoram[goffs + 1] & 0x3c) >> 2; - flipx = videoram[goffs + 1] & 0x40; - flipy = videoram[goffs + 1] & 0x80; - x = sx + xc * 8; - y = (sy + yc * 8) & 0xff; - if (Generic.flip_screen_get() != 0) - { - x = 248 - x; - y = 248 - y; - flipx = (flipx == 0) ? 1 : 0; - flipy = (flipy == 0) ? 1 : 0; - } - if (flipx != 0) - { - x0 = 7; - dx0 = -1; - } - else - { - x0 = 0; - dx0 = 1; - } - if (flipy != 0) - { - y0 = 7; - dy0 = -1; - } - else - { - y0 = 0; - dy0 = 1; - } - for (i = 0; i < 8; i++) - { - for (j = 0; j < 8; j++) - { - if (x + x0 + dx0 * i >= 0 && x + x0 + dx0 * i <= 255 && y + y0 + dy0 * j > 0 && y + y0 + dy0 * j < 255) - { - iOffset = code * 0x40 + j * 8 + i; - iByte = Taito.gfx1rom[iOffset]; - if (iByte != 0xf) - { - c1 = Color.FromArgb((int)Palette.entry_color[color * 0x10 + iByte]); - ptr2 = ptr + ((y + y0 + dy0 * j) * 0x100 + x + x0 + dx0 * i) * 4; - *ptr2 = c1.B; - *(ptr2 + 1) = c1.G; - *(ptr2 + 2) = c1.R; - *(ptr2 + 3) = c1.A; - } - } - } - } - } - } - sx += 16; - } - } - } - bm1.UnlockBits(bmData); - return bm1; - } - public static Bitmap GetBg_opwolf() - { - int i1, i2, iOffset, i3, i4,tile_index; - int rows, cols, width, height; - int tilewidth, tileheight; - tilewidth = 8; - tileheight = tilewidth; - rows = 0x40; - cols = rows; - width = tilewidth * cols; - height = width; - int iByte; - int code,attr, color,group,flags,attributes=0; - int pen_data_offset, palette_base; - int x0 = 0, y0 = 0, dx0 = 0, dy0 = 0; - byte map; - 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 = (Taito.PC080SN_ram[0][Taito.PC080SN_bg_ram_offset[0][0] + 2 * tile_index + 1] & 0x3fff); - attr = Taito.PC080SN_ram[0][Taito.PC080SN_bg_ram_offset[0][0] + 2 * tile_index]; - color = attr & 0x1ff; - code = code % Taito.PC080SN_tilemap[0][0].total_elements; - pen_data_offset = code * 0x40; - palette_base = 0x10 * color; - group = 0; - flags = (((attr & 0xc000) >> 14) & 3) ^ (attributes & 0x03); - 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 * tilewidth + i1; - iByte = Taito.gfx1rom[iOffset]; - if (iByte == 0) - { - c1 = Color.Black; - } - else - { - c1 = Color.FromArgb((int)Palette.entry_color[palette_base + iByte]); - } - ptr2 = ptr + (((-PC080SN_bgscrolly[0][0] + y0 + dy0 * i2) % 0x200) * width + (-0x10 - PC080SN_bgscrollx[0][0] + PC080SN_ram[0][PC080SN_bgscroll_ram_offset[0][0] - PC080SN_bgscrolly[0][0] + y0 + dy0 * i2] + x0 + dx0 * i1) % 0x200) * 4; - //ptr2 = ptr + ((y0 + dy0 * i2) * width + (x0 + dx0 * i1) % 0x200) * 4; - *ptr2 = c1.B; - *(ptr2 + 1) = c1.G; - *(ptr2 + 2) = c1.R; - *(ptr2 + 3) = c1.A; - } - } - } - } - } - bm1.UnlockBits(bmData); - return bm1; - } - public static void GetHighBg() - { - int i1, i2, iOffset, i3, i4, tile_index; - int rows, cols, width, height; - int tilewidth, tileheight; - tilewidth = 8; - tileheight = tilewidth; - rows = 0x40; - cols = rows; - width = tilewidth * cols; - height = width; - int iByte; - int code, attr, color, group, flags, attributes = 0; - int pen_data_offset, palette_base; - int x0 = 0, y0 = 0, dx0 = 0, dy0 = 0; - byte map; - for (i3 = 0; i3 < cols; i3++) - { - for (i4 = 0; i4 < rows; i4++) - { - tile_index = i4 * cols + i3; - code = (Taito.PC080SN_ram[0][Taito.PC080SN_bg_ram_offset[0][0] + 2 * tile_index + 1] & 0x3fff); - attr = Taito.PC080SN_ram[0][Taito.PC080SN_bg_ram_offset[0][0] + 2 * tile_index]; - color = attr & 0x1ff; - code = code % Taito.PC080SN_tilemap[0][0].total_elements; - pen_data_offset = code * 0x40; - palette_base = 0x10 * color; - group = 0; - flags = (((attr & 0xc000) >> 14) & 3) ^ (attributes & 0x03); - 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 * tilewidth + i1; - iByte = Taito.gfx1rom[iOffset]; - map = PC080SN_tilemap[0][0].pen_to_flags[group, iByte]; - //andmask &= map; - //ormask |= map; - flagsmapBG[x0 + dx0 * i1, y0 + dy0 * i2] = map; - } - } - } - } - int xpos, ypos, scrollx = 0, scrolly1 = (-PC080SN_bgscrolly[0][0]) & 0x1ff; - for (ypos = scrolly1 - height; ypos <= 0x1ff; ypos += height) - { - scrollx = PC080SN_bgscrollx[0][0] & 0x1ff; - for (xpos = -0x10 - PC080SN_bgscrollx[0][0] - width; xpos <= 0x1ff; xpos += width) - { - for (i1 = 0; i1 < 0x200; i1++) - { - for (i2 = 0; i2 <= 0x200; i2++) - { - if (xpos + i1 >= 0 && xpos + i1 < 0x140 && ypos + i2 >= 0 && ypos + i2 < 0x100) - { - priority_bitmapG[xpos + i1, ypos + i2] = flagsmapBG[(PC080SN_tilemap[0][0].rowscroll[(ypos + i2 - scrolly1) & 0x1ff] - scrollx + xpos + i1) & 0x1ff, (ypos + i2 - scrolly1) & 0x1ff]; - } - } - } - } - } - } - public static Bitmap GetFg_opwolf() - { - int i1, i2, iOffset, i3, i4, tile_index; - int rows, cols, width, height; - int tilewidth, tileheight; - tilewidth = 8; - tileheight = tilewidth; - rows = 0x40; - cols = rows; - width = tilewidth * cols; - height = width; - int iByte; - int code, attr, color, 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; - code = (Taito.PC080SN_ram[0][Taito.PC080SN_bg_ram_offset[0][1] + 2 * tile_index + 1] & 0x3fff); - attr = Taito.PC080SN_ram[0][Taito.PC080SN_bg_ram_offset[0][1] + 2 * tile_index]; - color = attr & 0x1ff; - code = code % Taito.PC080SN_tilemap[0][1].total_elements; - pen_data_offset = code * 0x40; - palette_base = 0x10 * color; - group = 0; - flags = (((attr & 0xc000) >> 14) & 3) ^ (attributes & 0x03); - 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 * tilewidth + i1; - iByte = Taito.gfx1rom[iOffset]; - if (iByte == 0) - { - c1 = Color.Transparent; - } - else - { - c1 = Color.FromArgb((int)Palette.entry_color[palette_base + iByte]); - } - ptr2 = ptr + (((-PC080SN_bgscrolly[0][1] + y0 + dy0 * i2) % 0x200) * width + (-0x10 - PC080SN_bgscrollx[0][1] + PC080SN_ram[0][PC080SN_bgscroll_ram_offset[0][1] + y0 + dy0 * i2 - PC080SN_bgscrolly[0][1]] + x0 + dx0 * i1) % 0x200) * 4; - *ptr2 = c1.B; - *(ptr2 + 1) = c1.G; - *(ptr2 + 2) = c1.R; - *(ptr2 + 3) = c1.A; - } - } - } - } - } - bm1.UnlockBits(bmData); - return bm1; - } - public static void GetHighFg() - { - int i1, i2, iOffset, i3, i4, tile_index; - int rows, cols, width, height; - int tilewidth, tileheight; - tilewidth = 8; - tileheight = tilewidth; - rows = 0x40; - cols = rows; - width = tilewidth * cols; - height = width; - int iByte; - int code, attr, color, group, flags, attributes = 0; - int pen_data_offset, palette_base; - int x0 = 0, y0 = 0, dx0 = 0, dy0 = 0; - byte map; - for (i3 = 0; i3 < cols; i3++) - { - for (i4 = 0; i4 < rows; i4++) - { - tile_index = i4 * cols + i3; - code = (Taito.PC080SN_ram[0][Taito.PC080SN_bg_ram_offset[0][1] + 2 * tile_index + 1] & 0x3fff); - attr = Taito.PC080SN_ram[0][Taito.PC080SN_bg_ram_offset[0][1] + 2 * tile_index]; - color = attr & 0x1ff; - code = code % Taito.PC080SN_tilemap[0][1].total_elements; - pen_data_offset = code * 0x40; - palette_base = 0x10 * color; - group = 0; - flags = (((attr & 0xc000) >> 14) & 3) ^ (attributes & 0x03); - 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 * tilewidth + i1; - iByte = Taito.gfx1rom[iOffset]; - map = PC080SN_tilemap[0][1].pen_to_flags[group, iByte]; - //andmask &= map; - //ormask |= map; - flagsmapFG[x0 + dx0 * i1, y0 + dy0 * i2] = map; - } - } - } - } - int xpos, ypos, scrollx = 0, scrolly1 = (-PC080SN_bgscrolly[0][1]) & 0x1ff; - for (ypos = scrolly1 - height; ypos <= 0x1ff; ypos += height) - { - scrollx = PC080SN_bgscrollx[0][1] & 0x1ff; - for (xpos = -0x10 - PC080SN_bgscrollx[0][1] - width; xpos <= 0x1ff; xpos += width) - { - for (i1 = 0; i1 < 0x200; i1++) - { - for (i2 = 0; i2 <= 0x200; i2++) - { - if (xpos + i1 >= 0 && xpos + i1 < 0x140 && ypos + i2 >= 0 && ypos + i2 < 0x100) - { - priority_bitmapG[xpos + i1, ypos + i2] = flagsmapFG[(PC080SN_tilemap[0][1].rowscroll[(ypos + i2 - scrolly1) & 0x1ff] - scrollx + xpos + i1) & 0x1ff, (ypos + i2 - scrolly1) & 0x1ff]; - } - } - } - } - } - } - public static Bitmap GetSprinte_opwolf() - { - Color c1 = new Color(); - Bitmap bm1; - bm1 = new Bitmap(0x140, 0x100); - 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; - int offs, x, y, i, j; - int flipx, flipy, offsetx, offsety, xdir, ydir; - int data, code, color; - int sprite_colbank = (PC090OJ_sprite_ctrl & 0xf) << 4; - //for (offs = 0; offs < 0x800 / 2; offs += 4) - for (offs = 0x7f8 / 2; offs >= 0; offs -= 4) - { - data = PC090OJ_ram_buffered[offs + 0]; - flipy = (data & 0x8000) >> 15; - flipx = (data & 0x4000) >> 14; - color = (data & 0x000f) | sprite_colbank; - code = PC090OJ_ram_buffered[offs + 2] & 0x1fff; - x = PC090OJ_ram_buffered[offs + 3] & 0x1ff; - y = PC090OJ_ram_buffered[offs + 1] & 0x1ff; - if (x > 0x140) - { - x -= 0x200; - } - if (y > 0x140) - { - y -= 0x200; - } - if ((PC090OJ_ctrl & 1) == 0) - { - x = 320 - x - 16; - y = 256 - y - 16; - flipx = (flipx == 0 ? 1 : 0); - flipy = (flipy == 0 ? 1 : 0); - } - x += PC090OJ_xoffs; - y += PC090OJ_yoffs; - if (flipx != 0) - { - offsetx = 0x0f; - xdir = -1; - } - else - { - offsetx = 0; - xdir = 1; - } - if (flipy != 0) - { - offsety = 0x0f; - ydir = -1; - } - else - { - offsety = 0; - ydir = 1; - } - for (i = 0; i < 0x10; i++) - { - for (j = 0; j < 0x10; j++) - { - if (x + offsetx + xdir * j >= 0 && x + offsetx + xdir * j < 0x140 && y + offsety + ydir * i >= 0 && y + offsety + ydir * i < 0x100 && priority_bitmapG[x + offsetx + xdir * j,y + offsety + ydir * i] == 0) - { - ushort c = gfx2rom[code * 0x100 + 0x10 * i + j]; - if (c != 0) - { - c1 = Color.FromArgb((int)Palette.entry_color[color * 0x10 + c]); - ptr2 = ptr + ((y + offsety + ydir * i) * 0x140 + (x + 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(0x200, 0x200), bm2 = null; - Graphics g = Graphics.FromImage(bm1); - g.Clear(Color.Transparent); - switch (Machine.sName) - { - case "tokio": - case "tokioo": - case "tokiou": - case "tokiob": - case "bublbobl": - case "bublbobl1": - case "bublboblr": - case "bublboblr1": - case "boblbobl": - case "sboblbobl": - case "sboblbobla": - case "sboblboblb": - case "sboblbobld": - case "sboblboblc": - case "bub68705": - case "dland": - case "bbredux": - case "bublboblb": - case "bublcave": - case "boblcave": - case "bublcave11": - case "bublcave10": - bm2 = GetDraw_bublbobl(); - g.DrawImage(bm2, 0, 0); - break; - case "opwolf": - case "opwolfa": - case "opwolfj": - case "opwolfu": - case "opwolfb": - case "opwolfp": - if (bBg) - { - bm2 = GetBg_opwolf(); - g.DrawImage(bm2, 0, 0); - GetHighBg(); - } - if (bFg) - { - bm2 = GetFg_opwolf(); - g.DrawImage(bm2, 0, 0); - GetHighFg(); - } - if (bSprite) - { - bm2 = GetSprinte_opwolf(); - g.DrawImage(bm2, 0, 0); - } - break; - } - return bm1; - } } } \ No newline at end of file diff --git a/MAME.Core/mame/taito/Input.cs b/MAME.Core/mame/taito/Input.cs index 9daac50..dc1a4b5 100644 --- a/MAME.Core/mame/taito/Input.cs +++ b/MAME.Core/mame/taito/Input.cs @@ -563,7 +563,7 @@ namespace mame { sbyte2 |= 0x01; }*/ - if (Keyboard.IsPressed(Key.J)|| Mouse.buttons[0] != 0) + if (Keyboard.IsPressed(Key.J) || Mouse.buttons[0] != 0) { sbyte1 &= ~0x01; } @@ -571,7 +571,7 @@ namespace mame { sbyte1 |= 0x01; } - if (Keyboard.IsPressed(Key.K)|| Mouse.buttons[1] != 0) + if (Keyboard.IsPressed(Key.K) || Mouse.buttons[1] != 0) { sbyte1 &= ~0x02; } diff --git a/MAME.Core/mame/taito/Memory.cs b/MAME.Core/mame/taito/Memory.cs index a96f870..5a547b1 100644 --- a/MAME.Core/mame/taito/Memory.cs +++ b/MAME.Core/mame/taito/Memory.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using cpu.z80; +using cpu.z80; namespace mame { @@ -161,41 +156,41 @@ namespace mame int offset = address - 0xe000; result = Memory.mainram[offset]; } - else if (address >= 0xfc00&&address<=0xfcff) + else if (address >= 0xfc00 && address <= 0xfcff) { - int offset=address-0xfc00; + int offset = address - 0xfc00; result = mainram2[offset]; } - else if (address >= 0xfd00&&address<=0xfdff) + else if (address >= 0xfd00 && address <= 0xfdff) { - int offset=address-0xfd00; + int offset = address - 0xfd00; result = mainram3[offset]; } - else if(address>=0xfe00&&address<=0xfe03) + else if (address >= 0xfe00 && address <= 0xfe03) { - int offset=address-0xfe00; - result=boblbobl_ic43_a_r(offset); + int offset = address - 0xfe00; + result = boblbobl_ic43_a_r(offset); } - else if(address>=0xfe80&&address<=0xfe83) + else if (address >= 0xfe80 && address <= 0xfe83) { - int offset=address-0xfe80; - result=boblbobl_ic43_b_r(offset); + int offset = address - 0xfe80; + result = boblbobl_ic43_b_r(offset); } - else if(address==0xff00) + else if (address == 0xff00) { - result=dsw0; + result = dsw0; } - else if(address==0xff01) + else if (address == 0xff01) { - result=dsw1; + result = dsw1; } - else if(address==0xff02) + else if (address == 0xff02) { - result=(byte)sbyte0; + result = (byte)sbyte0; } - else if(address==0xff03) + else if (address == 0xff03) { - result=(byte)sbyte1; + result = (byte)sbyte1; } else { @@ -236,7 +231,7 @@ namespace mame } else if (address == 0xfa00) { - Generic.watchdog_reset_w(); + Generic.watchdog_reset_w(); } else if (address == 0xfa80) { @@ -294,37 +289,37 @@ namespace mame { bublbobl_sound_command_w(value); } - else if(address==0xfa03) + else if (address == 0xfa03) { } else if (address == 0xfa80) { - + } else if (address == 0xfb40) { bublbobl_bankswitch_w(value); } - else if (address >= 0xfc00&&address<=0xfcff) + else if (address >= 0xfc00 && address <= 0xfcff) { - int offset=address-0xfc00; - mainram2[offset]=value; + int offset = address - 0xfc00; + mainram2[offset] = value; } - else if(address>=0xfd00&&address<=0xfdff) + else if (address >= 0xfd00 && address <= 0xfdff) { - int offset=address-0xfd00; - mainram3[offset]=value; + int offset = address - 0xfd00; + mainram3[offset] = value; } - else if(address>=0xfe00&&address<=0xfe03) + else if (address >= 0xfe00 && address <= 0xfe03) { - int offset=address-0xfe00; + int offset = address - 0xfe00; boblbobl_ic43_a_w(offset); } - else if(address>=0xfe80&&address<=0xfe83) + else if (address >= 0xfe80 && address <= 0xfe83) { - int offset=address-0xfe80; - boblbobl_ic43_b_w(offset,value); + int offset = address - 0xfe80; + boblbobl_ic43_b_w(offset, value); } else if (address == 0xff94) { @@ -422,7 +417,7 @@ namespace mame } else if (address == 0x9000) { - + } else if (address == 0xa000) { @@ -849,17 +844,17 @@ namespace mame { result = bublbobl_68705_portB_r(); } - else if(address==0x002) + else if (address == 0x002) { - result=(byte)sbyte0; + result = (byte)sbyte0; } - else if(address>=0x010&&address<=0x07f) + else if (address >= 0x010 && address <= 0x07f) { - result=mcuram[address]; + result = mcuram[address]; } - else if(address>=0x080&&address<=0x7ff) + else if (address >= 0x080 && address <= 0x7ff) { - result=mcurom[address]; + result = mcurom[address]; } return result; } @@ -874,25 +869,25 @@ namespace mame { bublbobl_68705_portB_w(value); } - else if(address==0x004) + else if (address == 0x004) { bublbobl_68705_ddrA_w(value); } - else if(address==0x005) + else if (address == 0x005) { bublbobl_68705_ddrB_w(value); } - else if(address==0x006) + else if (address == 0x006) { - + } - else if(address>=0x010&&address<=0x07f) + else if (address >= 0x010 && address <= 0x07f) { - mcuram[address]=value; + mcuram[address] = value; } - else if(address>=0x080&&address<=0x7ff) + else if (address >= 0x080 && address <= 0x7ff) { - mcurom[address]=value; + mcurom[address] = value; } } public static sbyte MReadOpByte_opwolf(int address) @@ -957,7 +952,7 @@ namespace mame } else if (address >= 0x100000 && address <= 0x107fff) { - int offset=address-0x100000; + int offset = address - 0x100000; result = (sbyte)Memory.mainram[offset]; } else if (address >= 0x200000 && address <= 0x200fff) @@ -1211,9 +1206,9 @@ namespace mame else if (address >= 0x0ff000 && address <= 0x0ff7ff) { int offset = (address - 0x0ff000) / 2; - if(address%2==0) + if (address % 2 == 0) { - + } else if (address % 2 == 1) { @@ -1233,7 +1228,7 @@ namespace mame } else if (address >= 0x100000 && address <= 0x107fff) { - int offset=address-0x100000; + int offset = address - 0x100000; Memory.mainram[offset] = (byte)value; } else if (address >= 0x200000 && address <= 0x200fff) @@ -1347,7 +1342,7 @@ namespace mame { if (address < Memory.mainrom.Length) { - Memory.mainrom[address] = (byte)(value>>8); + Memory.mainrom[address] = (byte)(value >> 8); Memory.mainrom[address + 1] = (byte)value; } } @@ -1367,7 +1362,7 @@ namespace mame else if (address >= 0x100000 && address + 1 <= 0x107fff) { int offset = address - 0x100000; - Memory.mainram[offset] = (byte)(value>>8); + Memory.mainram[offset] = (byte)(value >> 8); Memory.mainram[offset + 1] = (byte)value; } else if (address >= 0x200000 && address + 1 <= 0x200fff) @@ -1400,7 +1395,7 @@ namespace mame else if (address >= 0xc10000 && address + 1 <= 0xc1ffff) { int offset = address - 0xc10000; - mainram2[offset] = (byte)(value>>8); + mainram2[offset] = (byte)(value >> 8); mainram2[offset + 1] = (byte)value; } else if (address >= 0xc20000 && address + 1 <= 0xc20003) @@ -1514,7 +1509,7 @@ namespace mame int offset = (address - 0x0ff000) / 2; if (address % 2 == 0) { - result = (sbyte)(cchip_r(offset)>>8); + result = (sbyte)(cchip_r(offset) >> 8); } else if (address % 2 == 1) { @@ -1648,7 +1643,7 @@ namespace mame else if (address >= 0x100000 && address + 1 <= 0x107fff) { int offset = address - 0x100000; - result = (short)(Memory.mainram[offset]*0x100+Memory.mainram[offset+1]); + result = (short)(Memory.mainram[offset] * 0x100 + Memory.mainram[offset + 1]); } else if (address >= 0x200000 && address + 1 <= 0x200fff) { @@ -1773,9 +1768,9 @@ namespace mame else if (address >= 0x0ff000 && address <= 0x0fffff) { int offset = (address - 0x0ff000) / 2; - if(address%2==0) + if (address % 2 == 0) { - + } else if (address % 2 == 1) { @@ -2521,7 +2516,7 @@ namespace mame } else if (address >= 0x4000 && address <= 0x7fff) { - int offset=address-0x4000; + int offset = address - 0x4000; Memory.audiorom[basebanksnd + offset] = value; } else if (address >= 0x8000 && address <= 0x8fff) @@ -2547,7 +2542,7 @@ namespace mame } else if (address >= 0xb000 && address <= 0xb006) { - int offset=address-0xb000; + int offset = address - 0xb000; opwolf_adpcm_b_w(offset, value); } else if (address >= 0xc000 && address <= 0xc006) diff --git a/MAME.Core/mame/taito/Opwolf.cs b/MAME.Core/mame/taito/Opwolf.cs index f089db9..ba95a48 100644 --- a/MAME.Core/mame/taito/Opwolf.cs +++ b/MAME.Core/mame/taito/Opwolf.cs @@ -1,9 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using cpu.m68000; namespace mame { @@ -41,355 +36,355 @@ namespace mame public static byte m_triggeredLevel9; public static ushort[] level_data_00 = new ushort[] { - 0x0480, 0x1008, 0x0300, 0x5701, 0x0001, 0x0010, - 0x0480, 0x1008, 0x0300, 0x5701, 0x0001, 0x002b, - 0x0780, 0x0009, 0x0300, 0x4a01, 0x0004, 0x0020, - 0x0780, 0x1208, 0x0300, 0x5d01, 0x0004, 0x0030, - 0x0780, 0x0209, 0x0300, 0x4c01, 0x0004, 0x0038, - 0x0780, 0x0309, 0x0300, 0x4d01, 0x0004, 0x0048, - 0x0980, 0x1108, 0x0300, 0x5a01, 0xc005, 0x0018, - 0x0980, 0x0109, 0x0300, 0x4b01, 0xc005, 0x0028, - 0x0b80, 0x020a, 0x0000, 0x6401, 0x8006, 0x0004, - 0x0c80, 0x010b, 0x0000, 0xf201, 0x8006, 0x8002, - 0x0b80, 0x020a, 0x0000, 0x6401, 0x8006, 0x0017, - 0x0c80, 0x010b, 0x0000, 0xf201, 0x8006, 0x8015, - 0x0b80, 0x020a, 0x0000, 0x6401, 0x0007, 0x0034, - 0x0c80, 0x010b, 0x0000, 0xf201, 0x0007, 0x8032, - 0x0b80, 0x020a, 0x0000, 0x6401, 0x8006, 0x803e, - 0x0c80, 0x010b, 0x0000, 0xf201, 0x8006, 0x803d, - 0x0b80, 0x100a, 0x0000, 0x6001, 0x0007, 0x0008, - 0x0b80, 0x100a, 0x0000, 0x6001, 0x0007, 0x000b, - 0x0b80, 0x100a, 0x0000, 0x6001, 0x0007, 0x001b, - 0x0b80, 0x100a, 0x0000, 0x6001, 0x0007, 0x001e, - 0x0b80, 0x100a, 0x0000, 0x6001, 0x8007, 0x0038, - 0x0b80, 0x100a, 0x0000, 0x6001, 0x8007, 0x003b, - 0x0b80, 0x100a, 0x0000, 0x6001, 0x0007, 0x8042, - 0x0b80, 0x100a, 0x0000, 0x6001, 0x0007, 0x8045, - 0x0c80, 0x000b, 0x0000, 0xf101, 0x800b, 0x8007, - 0x0c80, 0x000b, 0x0000, 0xf101, 0x800b, 0x801a, - 0x0c80, 0x000b, 0x0000, 0xf101, 0x000c, 0x8037, - 0x0c80, 0x000b, 0x0000, 0xf101, 0x800b, 0x0042, - 0x0c80, 0xd04b, 0x0000, 0xf301, 0x8006, 0x8009, - 0x0c80, 0xd04b, 0x0000, 0xf301, 0x8006, 0x801c, - 0x0c80, 0xd04b, 0x0000, 0xf301, 0x8006, 0x0044, - 0x0c80, 0x030b, 0x0000, 0xf401, 0x0008, 0x0028, - 0x0c80, 0x030b, 0x0000, 0xf401, 0x0008, 0x804b, - 0x0c00, 0x040b, 0x0000, 0xf501, 0x0008, 0x8026, - 0xffff + 0x0480, 0x1008, 0x0300, 0x5701, 0x0001, 0x0010, + 0x0480, 0x1008, 0x0300, 0x5701, 0x0001, 0x002b, + 0x0780, 0x0009, 0x0300, 0x4a01, 0x0004, 0x0020, + 0x0780, 0x1208, 0x0300, 0x5d01, 0x0004, 0x0030, + 0x0780, 0x0209, 0x0300, 0x4c01, 0x0004, 0x0038, + 0x0780, 0x0309, 0x0300, 0x4d01, 0x0004, 0x0048, + 0x0980, 0x1108, 0x0300, 0x5a01, 0xc005, 0x0018, + 0x0980, 0x0109, 0x0300, 0x4b01, 0xc005, 0x0028, + 0x0b80, 0x020a, 0x0000, 0x6401, 0x8006, 0x0004, + 0x0c80, 0x010b, 0x0000, 0xf201, 0x8006, 0x8002, + 0x0b80, 0x020a, 0x0000, 0x6401, 0x8006, 0x0017, + 0x0c80, 0x010b, 0x0000, 0xf201, 0x8006, 0x8015, + 0x0b80, 0x020a, 0x0000, 0x6401, 0x0007, 0x0034, + 0x0c80, 0x010b, 0x0000, 0xf201, 0x0007, 0x8032, + 0x0b80, 0x020a, 0x0000, 0x6401, 0x8006, 0x803e, + 0x0c80, 0x010b, 0x0000, 0xf201, 0x8006, 0x803d, + 0x0b80, 0x100a, 0x0000, 0x6001, 0x0007, 0x0008, + 0x0b80, 0x100a, 0x0000, 0x6001, 0x0007, 0x000b, + 0x0b80, 0x100a, 0x0000, 0x6001, 0x0007, 0x001b, + 0x0b80, 0x100a, 0x0000, 0x6001, 0x0007, 0x001e, + 0x0b80, 0x100a, 0x0000, 0x6001, 0x8007, 0x0038, + 0x0b80, 0x100a, 0x0000, 0x6001, 0x8007, 0x003b, + 0x0b80, 0x100a, 0x0000, 0x6001, 0x0007, 0x8042, + 0x0b80, 0x100a, 0x0000, 0x6001, 0x0007, 0x8045, + 0x0c80, 0x000b, 0x0000, 0xf101, 0x800b, 0x8007, + 0x0c80, 0x000b, 0x0000, 0xf101, 0x800b, 0x801a, + 0x0c80, 0x000b, 0x0000, 0xf101, 0x000c, 0x8037, + 0x0c80, 0x000b, 0x0000, 0xf101, 0x800b, 0x0042, + 0x0c80, 0xd04b, 0x0000, 0xf301, 0x8006, 0x8009, + 0x0c80, 0xd04b, 0x0000, 0xf301, 0x8006, 0x801c, + 0x0c80, 0xd04b, 0x0000, 0xf301, 0x8006, 0x0044, + 0x0c80, 0x030b, 0x0000, 0xf401, 0x0008, 0x0028, + 0x0c80, 0x030b, 0x0000, 0xf401, 0x0008, 0x804b, + 0x0c00, 0x040b, 0x0000, 0xf501, 0x0008, 0x8026, + 0xffff }; public static ushort[] level_data_01 = new ushort[] { - 0x0780, 0x0209, 0x0300, 0x4c01, 0x0004, 0x0010, - 0x0780, 0x0209, 0x0300, 0x4c01, 0x4004, 0x0020, - 0x0780, 0x0309, 0x0300, 0x4d01, 0xe003, 0x0030, - 0x0780, 0x0309, 0x0300, 0x4d01, 0x8003, 0x0040, - 0x0780, 0x0209, 0x0300, 0x4c01, 0x8004, 0x0018, - 0x0780, 0x0309, 0x0300, 0x4d01, 0xc003, 0x0028, - 0x0b80, 0x000b, 0x0000, 0x0b02, 0x8009, 0x0029, - 0x0b80, 0x0409, 0x0000, 0x0f02, 0x8008, 0x8028, - 0x0b80, 0x040a, 0x0000, 0x3502, 0x000a, 0x8028, - 0x0b80, 0x050a, 0x0000, 0x1002, 0x8006, 0x8028, - 0x0b80, 0x120a, 0x0000, 0x3602, 0x0008, 0x004d, - 0x0b80, 0x120a, 0x0000, 0x3602, 0x0008, 0x004f, - 0x0b80, 0x120a, 0x0000, 0x3602, 0x0008, 0x0001, - 0x0b80, 0x120a, 0x0000, 0x3602, 0x0008, 0x0003, - 0x0b80, 0x130a, 0x0000, 0x3a02, 0x0007, 0x0023, - 0x0b80, 0x130a, 0x0000, 0x3a02, 0x0007, 0x8025, - 0x0b80, 0x130a, 0x0000, 0x3a02, 0x8009, 0x0023, - 0x0b80, 0x130a, 0x0000, 0x3a02, 0x8009, 0x8025, - 0x0b80, 0x140a, 0x0000, 0x3e02, 0x0007, 0x000d, - 0x0b80, 0x140a, 0x0000, 0x3e02, 0x0007, 0x800f, - 0x0b80, 0x000b, 0x0000, 0x0102, 0x0007, 0x804e, - 0x0b80, 0xd24b, 0x0000, 0x0302, 0x0007, 0x000e, - 0x0b80, 0x000b, 0x0000, 0x0402, 0x8006, 0x0020, - 0x0b80, 0xd34b, 0x0000, 0x0502, 0x8006, 0x0024, - 0x0b80, 0x000b, 0x0000, 0x0602, 0x8009, 0x0001, - 0x0b80, 0xd44b, 0x0000, 0x0702, 0x800b, 0x800b, - 0x0b80, 0xd54b, 0x0000, 0x0802, 0x800b, 0x000e, - 0x0b80, 0x000b, 0x0000, 0x0902, 0x800b, 0x0010, - 0x0b80, 0x000b, 0x0000, 0x0a02, 0x0009, 0x0024, - 0x0b80, 0xd64b, 0x0000, 0x0c02, 0x000c, 0x8021, - 0x0b80, 0x000b, 0x0000, 0x0d02, 0x000c, 0x0025, - 0x0b80, 0x000b, 0x0000, 0x0e02, 0x8009, 0x004e, - 0x0b80, 0x000b, 0x0300, 0x4e01, 0x8006, 0x8012, - 0x0b80, 0x000b, 0x0300, 0x4e01, 0x0007, 0x8007, - 0xffff + 0x0780, 0x0209, 0x0300, 0x4c01, 0x0004, 0x0010, + 0x0780, 0x0209, 0x0300, 0x4c01, 0x4004, 0x0020, + 0x0780, 0x0309, 0x0300, 0x4d01, 0xe003, 0x0030, + 0x0780, 0x0309, 0x0300, 0x4d01, 0x8003, 0x0040, + 0x0780, 0x0209, 0x0300, 0x4c01, 0x8004, 0x0018, + 0x0780, 0x0309, 0x0300, 0x4d01, 0xc003, 0x0028, + 0x0b80, 0x000b, 0x0000, 0x0b02, 0x8009, 0x0029, + 0x0b80, 0x0409, 0x0000, 0x0f02, 0x8008, 0x8028, + 0x0b80, 0x040a, 0x0000, 0x3502, 0x000a, 0x8028, + 0x0b80, 0x050a, 0x0000, 0x1002, 0x8006, 0x8028, + 0x0b80, 0x120a, 0x0000, 0x3602, 0x0008, 0x004d, + 0x0b80, 0x120a, 0x0000, 0x3602, 0x0008, 0x004f, + 0x0b80, 0x120a, 0x0000, 0x3602, 0x0008, 0x0001, + 0x0b80, 0x120a, 0x0000, 0x3602, 0x0008, 0x0003, + 0x0b80, 0x130a, 0x0000, 0x3a02, 0x0007, 0x0023, + 0x0b80, 0x130a, 0x0000, 0x3a02, 0x0007, 0x8025, + 0x0b80, 0x130a, 0x0000, 0x3a02, 0x8009, 0x0023, + 0x0b80, 0x130a, 0x0000, 0x3a02, 0x8009, 0x8025, + 0x0b80, 0x140a, 0x0000, 0x3e02, 0x0007, 0x000d, + 0x0b80, 0x140a, 0x0000, 0x3e02, 0x0007, 0x800f, + 0x0b80, 0x000b, 0x0000, 0x0102, 0x0007, 0x804e, + 0x0b80, 0xd24b, 0x0000, 0x0302, 0x0007, 0x000e, + 0x0b80, 0x000b, 0x0000, 0x0402, 0x8006, 0x0020, + 0x0b80, 0xd34b, 0x0000, 0x0502, 0x8006, 0x0024, + 0x0b80, 0x000b, 0x0000, 0x0602, 0x8009, 0x0001, + 0x0b80, 0xd44b, 0x0000, 0x0702, 0x800b, 0x800b, + 0x0b80, 0xd54b, 0x0000, 0x0802, 0x800b, 0x000e, + 0x0b80, 0x000b, 0x0000, 0x0902, 0x800b, 0x0010, + 0x0b80, 0x000b, 0x0000, 0x0a02, 0x0009, 0x0024, + 0x0b80, 0xd64b, 0x0000, 0x0c02, 0x000c, 0x8021, + 0x0b80, 0x000b, 0x0000, 0x0d02, 0x000c, 0x0025, + 0x0b80, 0x000b, 0x0000, 0x0e02, 0x8009, 0x004e, + 0x0b80, 0x000b, 0x0300, 0x4e01, 0x8006, 0x8012, + 0x0b80, 0x000b, 0x0300, 0x4e01, 0x0007, 0x8007, + 0xffff }; public static ushort[] level_data_02 = new ushort[] { - 0x0480, 0x000b, 0x0300, 0x4501, 0x0001, 0x0018, - 0x0480, 0x000b, 0x0300, 0x4501, 0x2001, 0x0030, - 0x0780, 0x1208, 0x0300, 0x5d01, 0x0004, 0x0010, - 0x0780, 0x1208, 0x0300, 0x5d01, 0x2004, 0x001c, - 0x0780, 0x1208, 0x0300, 0x5d01, 0xe003, 0x0026, - 0x0780, 0x1208, 0x0300, 0x5d01, 0x8003, 0x0034, - 0x0780, 0x1208, 0x0300, 0x5d01, 0x3004, 0x0040, - 0x0780, 0x010c, 0x0300, 0x4601, 0x4004, 0x0022, - 0x0780, 0x010c, 0x0300, 0x4601, 0x6004, 0x0042, - 0x0780, 0x000c, 0x0500, 0x7b01, 0x800b, 0x0008, - 0x0780, 0x010c, 0x0300, 0x4601, 0x2004, 0x0008, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0b80, 0x000b, 0x0000, 0x1902, 0x000b, 0x0004, - 0x0b80, 0x000b, 0x0000, 0x1a02, 0x0009, 0x8003, - 0x0b80, 0x000b, 0x0000, 0x1902, 0x000b, 0x000c, - 0x0b80, 0x000b, 0x0000, 0x1a02, 0x0009, 0x800b, - 0x0b80, 0x000b, 0x0000, 0x1902, 0x000b, 0x001c, - 0x0b80, 0x000b, 0x0000, 0x1a02, 0x0009, 0x801b, - 0x0b80, 0x000b, 0x0000, 0x1902, 0x000b, 0x002c, - 0x0b80, 0x000b, 0x0000, 0x1a02, 0x0009, 0x802b, - 0x0b80, 0x000b, 0x0000, 0x1902, 0x000b, 0x0044, - 0x0b80, 0x000b, 0x0000, 0x1a02, 0x0009, 0x8043, - 0x0b80, 0x000b, 0x0000, 0x1902, 0x000b, 0x004c, - 0x0b80, 0x000b, 0x0000, 0x1a02, 0x0009, 0x804b, - 0x0b80, 0x020c, 0x0300, 0x4801, 0xa009, 0x0010, - 0x0b80, 0x020c, 0x0300, 0x4801, 0xa009, 0x0028, - 0x0b80, 0x020c, 0x0300, 0x4801, 0xa009, 0x0036, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0xffff + 0x0480, 0x000b, 0x0300, 0x4501, 0x0001, 0x0018, + 0x0480, 0x000b, 0x0300, 0x4501, 0x2001, 0x0030, + 0x0780, 0x1208, 0x0300, 0x5d01, 0x0004, 0x0010, + 0x0780, 0x1208, 0x0300, 0x5d01, 0x2004, 0x001c, + 0x0780, 0x1208, 0x0300, 0x5d01, 0xe003, 0x0026, + 0x0780, 0x1208, 0x0300, 0x5d01, 0x8003, 0x0034, + 0x0780, 0x1208, 0x0300, 0x5d01, 0x3004, 0x0040, + 0x0780, 0x010c, 0x0300, 0x4601, 0x4004, 0x0022, + 0x0780, 0x010c, 0x0300, 0x4601, 0x6004, 0x0042, + 0x0780, 0x000c, 0x0500, 0x7b01, 0x800b, 0x0008, + 0x0780, 0x010c, 0x0300, 0x4601, 0x2004, 0x0008, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0b80, 0x000b, 0x0000, 0x1902, 0x000b, 0x0004, + 0x0b80, 0x000b, 0x0000, 0x1a02, 0x0009, 0x8003, + 0x0b80, 0x000b, 0x0000, 0x1902, 0x000b, 0x000c, + 0x0b80, 0x000b, 0x0000, 0x1a02, 0x0009, 0x800b, + 0x0b80, 0x000b, 0x0000, 0x1902, 0x000b, 0x001c, + 0x0b80, 0x000b, 0x0000, 0x1a02, 0x0009, 0x801b, + 0x0b80, 0x000b, 0x0000, 0x1902, 0x000b, 0x002c, + 0x0b80, 0x000b, 0x0000, 0x1a02, 0x0009, 0x802b, + 0x0b80, 0x000b, 0x0000, 0x1902, 0x000b, 0x0044, + 0x0b80, 0x000b, 0x0000, 0x1a02, 0x0009, 0x8043, + 0x0b80, 0x000b, 0x0000, 0x1902, 0x000b, 0x004c, + 0x0b80, 0x000b, 0x0000, 0x1a02, 0x0009, 0x804b, + 0x0b80, 0x020c, 0x0300, 0x4801, 0xa009, 0x0010, + 0x0b80, 0x020c, 0x0300, 0x4801, 0xa009, 0x0028, + 0x0b80, 0x020c, 0x0300, 0x4801, 0xa009, 0x0036, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0xffff }; public static ushort[] level_data_03 = new ushort[] { - 0x0480, 0x000b, 0x0300, 0x4501, 0x0001, 0x0018, - 0x0480, 0x000b, 0x0300, 0x4501, 0x2001, 0x002b, - 0x0780, 0x010c, 0x0300, 0x4601, 0x0004, 0x000d, - 0x0780, 0x000c, 0x0500, 0x7b01, 0x800b, 0x0020, - 0x0780, 0x010c, 0x0300, 0x4601, 0x2004, 0x0020, - 0x0780, 0x010c, 0x0300, 0x4601, 0x8003, 0x0033, - 0x0780, 0x010c, 0x0300, 0x4601, 0x0004, 0x003c, - 0x0780, 0x010c, 0x0300, 0x4601, 0xd003, 0x0045, - 0x0780, 0x000c, 0x0500, 0x7b01, 0x900b, 0x0041, - 0x0780, 0x010c, 0x0300, 0x4601, 0x3004, 0x0041, - 0x0b80, 0x020c, 0x0300, 0x4801, 0x0007, 0x0000, - 0x0b80, 0x410a, 0x0000, 0x2b02, 0xe006, 0x4049, - 0x0b80, 0x020c, 0x0300, 0x4801, 0x8007, 0x000b, - 0x0b80, 0x000b, 0x0000, 0x2702, 0x800a, 0x8005, - 0x0b80, 0x000b, 0x0000, 0x1e02, 0x0008, 0x800e, - 0x0b80, 0x000b, 0x0000, 0x1f02, 0x8007, 0x0011, - 0x0b80, 0x000b, 0x0000, 0x2802, 0x000b, 0x0012, - 0x0b80, 0x000b, 0x0000, 0x2002, 0x0007, 0x8015, - 0x0b80, 0x000b, 0x0000, 0x2102, 0x0007, 0x801b, - 0x0b80, 0x000b, 0x0000, 0x2902, 0x800a, 0x001a, - 0x0b80, 0x000b, 0x0000, 0x2202, 0x8007, 0x001e, - 0x0b80, 0x000b, 0x0000, 0x1e02, 0x0008, 0x0025, - 0x0b80, 0x000b, 0x0000, 0x2302, 0x8007, 0x802c, - 0x0b80, 0x000b, 0x0000, 0x2802, 0x000b, 0x8028, - 0x0b80, 0x020c, 0x0300, 0x4801, 0x0007, 0x0030, - 0x0b80, 0x400a, 0x0000, 0x2e02, 0x4007, 0x002d, - 0x0b80, 0x000b, 0x0000, 0x2702, 0x800a, 0x8035, - 0x0b80, 0x020c, 0x0300, 0x4801, 0x8007, 0x0022, - 0x0b80, 0x000b, 0x0000, 0x2402, 0x8007, 0x0047, - 0x0b80, 0x000b, 0x0000, 0x2a02, 0x800a, 0x004b, - 0x0b80, 0x000b, 0x0000, 0x2502, 0x0007, 0x804b, - 0x0b80, 0x000b, 0x0000, 0x2602, 0x0007, 0x004e, - 0x0b80, 0x020c, 0x0300, 0x4801, 0x0007, 0x8043, - 0x0b80, 0x020c, 0x0300, 0x4801, 0x8007, 0x803d, - 0xffff + 0x0480, 0x000b, 0x0300, 0x4501, 0x0001, 0x0018, + 0x0480, 0x000b, 0x0300, 0x4501, 0x2001, 0x002b, + 0x0780, 0x010c, 0x0300, 0x4601, 0x0004, 0x000d, + 0x0780, 0x000c, 0x0500, 0x7b01, 0x800b, 0x0020, + 0x0780, 0x010c, 0x0300, 0x4601, 0x2004, 0x0020, + 0x0780, 0x010c, 0x0300, 0x4601, 0x8003, 0x0033, + 0x0780, 0x010c, 0x0300, 0x4601, 0x0004, 0x003c, + 0x0780, 0x010c, 0x0300, 0x4601, 0xd003, 0x0045, + 0x0780, 0x000c, 0x0500, 0x7b01, 0x900b, 0x0041, + 0x0780, 0x010c, 0x0300, 0x4601, 0x3004, 0x0041, + 0x0b80, 0x020c, 0x0300, 0x4801, 0x0007, 0x0000, + 0x0b80, 0x410a, 0x0000, 0x2b02, 0xe006, 0x4049, + 0x0b80, 0x020c, 0x0300, 0x4801, 0x8007, 0x000b, + 0x0b80, 0x000b, 0x0000, 0x2702, 0x800a, 0x8005, + 0x0b80, 0x000b, 0x0000, 0x1e02, 0x0008, 0x800e, + 0x0b80, 0x000b, 0x0000, 0x1f02, 0x8007, 0x0011, + 0x0b80, 0x000b, 0x0000, 0x2802, 0x000b, 0x0012, + 0x0b80, 0x000b, 0x0000, 0x2002, 0x0007, 0x8015, + 0x0b80, 0x000b, 0x0000, 0x2102, 0x0007, 0x801b, + 0x0b80, 0x000b, 0x0000, 0x2902, 0x800a, 0x001a, + 0x0b80, 0x000b, 0x0000, 0x2202, 0x8007, 0x001e, + 0x0b80, 0x000b, 0x0000, 0x1e02, 0x0008, 0x0025, + 0x0b80, 0x000b, 0x0000, 0x2302, 0x8007, 0x802c, + 0x0b80, 0x000b, 0x0000, 0x2802, 0x000b, 0x8028, + 0x0b80, 0x020c, 0x0300, 0x4801, 0x0007, 0x0030, + 0x0b80, 0x400a, 0x0000, 0x2e02, 0x4007, 0x002d, + 0x0b80, 0x000b, 0x0000, 0x2702, 0x800a, 0x8035, + 0x0b80, 0x020c, 0x0300, 0x4801, 0x8007, 0x0022, + 0x0b80, 0x000b, 0x0000, 0x2402, 0x8007, 0x0047, + 0x0b80, 0x000b, 0x0000, 0x2a02, 0x800a, 0x004b, + 0x0b80, 0x000b, 0x0000, 0x2502, 0x0007, 0x804b, + 0x0b80, 0x000b, 0x0000, 0x2602, 0x0007, 0x004e, + 0x0b80, 0x020c, 0x0300, 0x4801, 0x0007, 0x8043, + 0x0b80, 0x020c, 0x0300, 0x4801, 0x8007, 0x803d, + 0xffff }; public static ushort[] level_data_04 = new ushort[] { - 0x0780, 0x0209, 0x0300, 0x4c01, 0x0004, 0x0010, - 0x0780, 0x0209, 0x0300, 0x4c01, 0x4004, 0x0020, - 0x0780, 0x0309, 0x0300, 0x4d01, 0xe003, 0x0030, - 0x0780, 0x0309, 0x0300, 0x4d01, 0x8003, 0x0040, - 0x0780, 0x0209, 0x0300, 0x4c01, 0x8004, 0x0018, - 0x0780, 0x0309, 0x0300, 0x4d01, 0xc003, 0x0028, - 0x0780, 0x000b, 0x0300, 0x5601, 0x8004, 0x0008, - 0x0780, 0x000b, 0x0300, 0x5601, 0x8004, 0x0038, - 0x0780, 0x000b, 0x0300, 0x5501, 0x8004, 0x0048, - 0x0980, 0x0509, 0x0f00, 0x0f01, 0x4005, 0x4007, - 0x0980, 0x0509, 0x0f00, 0x0f01, 0x4005, 0x4037, - 0x0b80, 0x030a, 0x0000, 0x1302, 0x8006, 0x0040, - 0x0b80, 0x110a, 0x0000, 0x1502, 0x8008, 0x8048, - 0x0b80, 0x110a, 0x0000, 0x1502, 0x8008, 0x8049, - 0x0b80, 0x000b, 0x0000, 0xf601, 0x0007, 0x8003, - 0x0b80, 0x000b, 0x0000, 0xf701, 0x0007, 0x0005, - 0x0b80, 0x000b, 0x0000, 0xf901, 0x0007, 0x8008, - 0x0b80, 0x000b, 0x0000, 0xf901, 0x0007, 0x0010, - 0x0b80, 0x000b, 0x0000, 0xfa01, 0x0007, 0x8013, - 0x0b80, 0x000b, 0x0000, 0xf801, 0x800b, 0x800b, - 0x0b80, 0x000b, 0x0000, 0x0002, 0x800b, 0x801a, - 0x0b80, 0x000b, 0x0000, 0xf901, 0x0007, 0x8017, - 0x0b80, 0x000b, 0x0000, 0xfa01, 0x0007, 0x001b, - 0x0b80, 0x000b, 0x0000, 0xf801, 0x800b, 0x0013, - 0x0b80, 0x000b, 0x0000, 0x4202, 0x800b, 0x0016, - 0x0b80, 0x000b, 0x0000, 0xfb01, 0x8007, 0x8020, - 0x0b80, 0x000b, 0x0000, 0xf601, 0x0007, 0x8023, - 0x0b80, 0x000b, 0x0000, 0x4202, 0x800b, 0x800e, - 0x0b80, 0x000b, 0x0000, 0x4302, 0x800b, 0x801d, - 0x0b80, 0x000b, 0x0000, 0xf701, 0x0007, 0x0025, - 0x0b80, 0x000b, 0x0000, 0xfd01, 0x8006, 0x003f, - 0x0b80, 0x000b, 0x0000, 0xfe01, 0x0007, 0x0046, - 0x0b80, 0x000b, 0x0000, 0xff01, 0x8007, 0x8049, - 0x0b80, 0x000b, 0x0000, 0xfc01, 0x8009, 0x0042, - 0xffff + 0x0780, 0x0209, 0x0300, 0x4c01, 0x0004, 0x0010, + 0x0780, 0x0209, 0x0300, 0x4c01, 0x4004, 0x0020, + 0x0780, 0x0309, 0x0300, 0x4d01, 0xe003, 0x0030, + 0x0780, 0x0309, 0x0300, 0x4d01, 0x8003, 0x0040, + 0x0780, 0x0209, 0x0300, 0x4c01, 0x8004, 0x0018, + 0x0780, 0x0309, 0x0300, 0x4d01, 0xc003, 0x0028, + 0x0780, 0x000b, 0x0300, 0x5601, 0x8004, 0x0008, + 0x0780, 0x000b, 0x0300, 0x5601, 0x8004, 0x0038, + 0x0780, 0x000b, 0x0300, 0x5501, 0x8004, 0x0048, + 0x0980, 0x0509, 0x0f00, 0x0f01, 0x4005, 0x4007, + 0x0980, 0x0509, 0x0f00, 0x0f01, 0x4005, 0x4037, + 0x0b80, 0x030a, 0x0000, 0x1302, 0x8006, 0x0040, + 0x0b80, 0x110a, 0x0000, 0x1502, 0x8008, 0x8048, + 0x0b80, 0x110a, 0x0000, 0x1502, 0x8008, 0x8049, + 0x0b80, 0x000b, 0x0000, 0xf601, 0x0007, 0x8003, + 0x0b80, 0x000b, 0x0000, 0xf701, 0x0007, 0x0005, + 0x0b80, 0x000b, 0x0000, 0xf901, 0x0007, 0x8008, + 0x0b80, 0x000b, 0x0000, 0xf901, 0x0007, 0x0010, + 0x0b80, 0x000b, 0x0000, 0xfa01, 0x0007, 0x8013, + 0x0b80, 0x000b, 0x0000, 0xf801, 0x800b, 0x800b, + 0x0b80, 0x000b, 0x0000, 0x0002, 0x800b, 0x801a, + 0x0b80, 0x000b, 0x0000, 0xf901, 0x0007, 0x8017, + 0x0b80, 0x000b, 0x0000, 0xfa01, 0x0007, 0x001b, + 0x0b80, 0x000b, 0x0000, 0xf801, 0x800b, 0x0013, + 0x0b80, 0x000b, 0x0000, 0x4202, 0x800b, 0x0016, + 0x0b80, 0x000b, 0x0000, 0xfb01, 0x8007, 0x8020, + 0x0b80, 0x000b, 0x0000, 0xf601, 0x0007, 0x8023, + 0x0b80, 0x000b, 0x0000, 0x4202, 0x800b, 0x800e, + 0x0b80, 0x000b, 0x0000, 0x4302, 0x800b, 0x801d, + 0x0b80, 0x000b, 0x0000, 0xf701, 0x0007, 0x0025, + 0x0b80, 0x000b, 0x0000, 0xfd01, 0x8006, 0x003f, + 0x0b80, 0x000b, 0x0000, 0xfe01, 0x0007, 0x0046, + 0x0b80, 0x000b, 0x0000, 0xff01, 0x8007, 0x8049, + 0x0b80, 0x000b, 0x0000, 0xfc01, 0x8009, 0x0042, + 0xffff }; public static ushort[] level_data_05 = new ushort[] { - 0x0480, 0x1008, 0x0300, 0x5701, 0x0001, 0x0010, - 0x0480, 0x1008, 0x0300, 0x5701, 0x0001, 0x002b, - 0x0780, 0x0009, 0x0300, 0x4a01, 0x0004, 0x0020, - 0x0780, 0x1208, 0x0300, 0x5d01, 0x0004, 0x0030, - 0x0780, 0x0209, 0x0300, 0x4c01, 0x0004, 0x0038, - 0x0780, 0x0309, 0x0300, 0x4d01, 0x0004, 0x0048, - 0x0980, 0x1108, 0x0300, 0x5a01, 0xc005, 0x0018, - 0x0980, 0x0109, 0x0300, 0x4b01, 0xc005, 0x0028, - 0x0b80, 0x020a, 0x0000, 0x6401, 0x8006, 0x0004, - 0x0c80, 0x010b, 0x0000, 0xf201, 0x8006, 0x8002, - 0x0b80, 0x020a, 0x0000, 0x6401, 0x8006, 0x0017, - 0x0c80, 0x010b, 0x0000, 0xf201, 0x8006, 0x8015, - 0x0b80, 0x020a, 0x0000, 0x6401, 0x0007, 0x0034, - 0x0c80, 0x010b, 0x0000, 0xf201, 0x0007, 0x8032, - 0x0b80, 0x020a, 0x0000, 0x6401, 0x8006, 0x803e, - 0x0c80, 0x010b, 0x0000, 0xf201, 0x8006, 0x803d, - 0x0b80, 0x100a, 0x0000, 0x6001, 0x0007, 0x0008, - 0x0b80, 0x100a, 0x0000, 0x6001, 0x0007, 0x000b, - 0x0b80, 0x100a, 0x0000, 0x6001, 0x0007, 0x001b, - 0x0b80, 0x100a, 0x0000, 0x6001, 0x0007, 0x001e, - 0x0b80, 0x100a, 0x0000, 0x6001, 0x8007, 0x0038, - 0x0b80, 0x100a, 0x0000, 0x6001, 0x8007, 0x003b, - 0x0b80, 0x100a, 0x0000, 0x6001, 0x0007, 0x8042, - 0x0b80, 0x100a, 0x0000, 0x6001, 0x0007, 0x8045, - 0x0c80, 0x000b, 0x0000, 0xf101, 0x800b, 0x8007, - 0x0c80, 0x000b, 0x0000, 0xf101, 0x800b, 0x801a, - 0x0c80, 0x000b, 0x0000, 0xf101, 0x000c, 0x8037, - 0x0c80, 0x000b, 0x0000, 0xf101, 0x800b, 0x0042, - 0x0c80, 0xd04b, 0x0000, 0xf301, 0x8006, 0x8009, - 0x0c80, 0xd04b, 0x0000, 0xf301, 0x8006, 0x801c, - 0x0c80, 0xd04b, 0x0000, 0xf301, 0x8006, 0x0044, - 0x0c80, 0x030b, 0x0000, 0xf401, 0x0008, 0x0028, - 0x0c80, 0x030b, 0x0000, 0xf401, 0x0008, 0x804b, - 0x0c00, 0x040b, 0x0000, 0xf501, 0x0008, 0x8026, - 0xffff + 0x0480, 0x1008, 0x0300, 0x5701, 0x0001, 0x0010, + 0x0480, 0x1008, 0x0300, 0x5701, 0x0001, 0x002b, + 0x0780, 0x0009, 0x0300, 0x4a01, 0x0004, 0x0020, + 0x0780, 0x1208, 0x0300, 0x5d01, 0x0004, 0x0030, + 0x0780, 0x0209, 0x0300, 0x4c01, 0x0004, 0x0038, + 0x0780, 0x0309, 0x0300, 0x4d01, 0x0004, 0x0048, + 0x0980, 0x1108, 0x0300, 0x5a01, 0xc005, 0x0018, + 0x0980, 0x0109, 0x0300, 0x4b01, 0xc005, 0x0028, + 0x0b80, 0x020a, 0x0000, 0x6401, 0x8006, 0x0004, + 0x0c80, 0x010b, 0x0000, 0xf201, 0x8006, 0x8002, + 0x0b80, 0x020a, 0x0000, 0x6401, 0x8006, 0x0017, + 0x0c80, 0x010b, 0x0000, 0xf201, 0x8006, 0x8015, + 0x0b80, 0x020a, 0x0000, 0x6401, 0x0007, 0x0034, + 0x0c80, 0x010b, 0x0000, 0xf201, 0x0007, 0x8032, + 0x0b80, 0x020a, 0x0000, 0x6401, 0x8006, 0x803e, + 0x0c80, 0x010b, 0x0000, 0xf201, 0x8006, 0x803d, + 0x0b80, 0x100a, 0x0000, 0x6001, 0x0007, 0x0008, + 0x0b80, 0x100a, 0x0000, 0x6001, 0x0007, 0x000b, + 0x0b80, 0x100a, 0x0000, 0x6001, 0x0007, 0x001b, + 0x0b80, 0x100a, 0x0000, 0x6001, 0x0007, 0x001e, + 0x0b80, 0x100a, 0x0000, 0x6001, 0x8007, 0x0038, + 0x0b80, 0x100a, 0x0000, 0x6001, 0x8007, 0x003b, + 0x0b80, 0x100a, 0x0000, 0x6001, 0x0007, 0x8042, + 0x0b80, 0x100a, 0x0000, 0x6001, 0x0007, 0x8045, + 0x0c80, 0x000b, 0x0000, 0xf101, 0x800b, 0x8007, + 0x0c80, 0x000b, 0x0000, 0xf101, 0x800b, 0x801a, + 0x0c80, 0x000b, 0x0000, 0xf101, 0x000c, 0x8037, + 0x0c80, 0x000b, 0x0000, 0xf101, 0x800b, 0x0042, + 0x0c80, 0xd04b, 0x0000, 0xf301, 0x8006, 0x8009, + 0x0c80, 0xd04b, 0x0000, 0xf301, 0x8006, 0x801c, + 0x0c80, 0xd04b, 0x0000, 0xf301, 0x8006, 0x0044, + 0x0c80, 0x030b, 0x0000, 0xf401, 0x0008, 0x0028, + 0x0c80, 0x030b, 0x0000, 0xf401, 0x0008, 0x804b, + 0x0c00, 0x040b, 0x0000, 0xf501, 0x0008, 0x8026, + 0xffff }; public static ushort[] level_data_06 = new ushort[] { - 0x0000, 0x1008, 0x0300, 0x5701, 0x0001, 0x0010, - 0x0000, 0x1008, 0x0300, 0x5701, 0x0001, 0x002b, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0700, 0x0009, 0x0300, 0x4a01, 0x0004, 0x0020, - 0x0700, 0x1208, 0x0300, 0x5d01, 0x0004, 0x0030, - 0x0700, 0x0209, 0x0300, 0x4c01, 0x0004, 0x0038, - 0x0700, 0x0309, 0x0300, 0x4d01, 0x0004, 0x0048, - 0x0900, 0x1108, 0x0300, 0x5a01, 0xc005, 0x0018, - 0x0900, 0x0109, 0x0300, 0x4b01, 0xc005, 0x0028, - 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, - 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, - 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, - 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, - 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, - 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, - 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, - 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, - 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, - 0x0980, 0xdb4c, 0x0000, 0x3202, 0x0006, 0x0004, - 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, - 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, - 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, - 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, - 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, - 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, - 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, - 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, - 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, - 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, - 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, - 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, - 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, - 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, - 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, - 0xffff + 0x0000, 0x1008, 0x0300, 0x5701, 0x0001, 0x0010, + 0x0000, 0x1008, 0x0300, 0x5701, 0x0001, 0x002b, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0700, 0x0009, 0x0300, 0x4a01, 0x0004, 0x0020, + 0x0700, 0x1208, 0x0300, 0x5d01, 0x0004, 0x0030, + 0x0700, 0x0209, 0x0300, 0x4c01, 0x0004, 0x0038, + 0x0700, 0x0309, 0x0300, 0x4d01, 0x0004, 0x0048, + 0x0900, 0x1108, 0x0300, 0x5a01, 0xc005, 0x0018, + 0x0900, 0x0109, 0x0300, 0x4b01, 0xc005, 0x0028, + 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, + 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, + 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, + 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, + 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, + 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, + 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, + 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, + 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, + 0x0980, 0xdb4c, 0x0000, 0x3202, 0x0006, 0x0004, + 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, + 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, + 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, + 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, + 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, + 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, + 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, + 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, + 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, + 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, + 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, + 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, + 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, + 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, + 0x0000, 0x000b, 0x0000, 0x0000, 0x0018, 0x0000, + 0xffff }; public static ushort[] level_data_07 = new ushort[]{ - 0x0480, 0x000b, 0x0300, 0x4501, 0x0001, 0x0001, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0780, 0x0109, 0x0300, 0x4a01, 0x0004, 0x0004, - 0x0780, 0x0009, 0x0300, 0x4a01, 0x0004, 0x000d, - 0x0780, 0x000c, 0x0500, 0x7b01, 0x000c, 0x0005, - 0x0780, 0x000c, 0x0540, 0x7b01, 0x000c, 0x0005, - 0x0780, 0x010c, 0x0300, 0x4601, 0x0005, 0x0005, - 0x0780, 0x000c, 0x0500, 0x7b01, 0x800b, 0xc00d, - 0x0780, 0x000c, 0x0540, 0x7b01, 0x800b, 0xc00d, - 0x0780, 0x010c, 0x0300, 0x4601, 0x8004, 0xc00d, - 0x0900, 0x0109, 0x0340, 0x4b01, 0x2006, 0x400c, - 0x0780, 0x020c, 0x0300, 0x4801, 0x8007, 0x0008, - 0x0780, 0x020c, 0x0300, 0x4801, 0x4007, 0xc00b, - 0x0980, 0x0109, 0x0300, 0x4b01, 0xc006, 0x8007, - 0x0980, 0x0109, 0x0300, 0x4b01, 0x8007, 0x8008, - 0x0980, 0x0109, 0x0300, 0x4b01, 0xc006, 0x800c, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0xffff + 0x0480, 0x000b, 0x0300, 0x4501, 0x0001, 0x0001, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0780, 0x0109, 0x0300, 0x4a01, 0x0004, 0x0004, + 0x0780, 0x0009, 0x0300, 0x4a01, 0x0004, 0x000d, + 0x0780, 0x000c, 0x0500, 0x7b01, 0x000c, 0x0005, + 0x0780, 0x000c, 0x0540, 0x7b01, 0x000c, 0x0005, + 0x0780, 0x010c, 0x0300, 0x4601, 0x0005, 0x0005, + 0x0780, 0x000c, 0x0500, 0x7b01, 0x800b, 0xc00d, + 0x0780, 0x000c, 0x0540, 0x7b01, 0x800b, 0xc00d, + 0x0780, 0x010c, 0x0300, 0x4601, 0x8004, 0xc00d, + 0x0900, 0x0109, 0x0340, 0x4b01, 0x2006, 0x400c, + 0x0780, 0x020c, 0x0300, 0x4801, 0x8007, 0x0008, + 0x0780, 0x020c, 0x0300, 0x4801, 0x4007, 0xc00b, + 0x0980, 0x0109, 0x0300, 0x4b01, 0xc006, 0x8007, + 0x0980, 0x0109, 0x0300, 0x4b01, 0x8007, 0x8008, + 0x0980, 0x0109, 0x0300, 0x4b01, 0xc006, 0x800c, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0xffff }; public static ushort[] level_data_08 = new ushort[]{ - 0xffff + 0xffff }; public static ushort[] level_data_09 = new ushort[]{ - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0780, 0x0109, 0x0300, 0x4a01, 0x8003, 0x8003, - 0x0780, 0x0009, 0x0300, 0x4a01, 0x0004, 0x800e, - 0x0780, 0x000c, 0x0500, 0x7b01, 0x000c, 0x0005, - 0x0780, 0x000c, 0x0540, 0x7b01, 0x000c, 0x0005, - 0x0780, 0x010c, 0x0300, 0x4601, 0x0005, 0x0005, - 0x0780, 0x000c, 0x0500, 0x7b01, 0x800b, 0xc00d, - 0x0780, 0x000c, 0x0540, 0x7b01, 0x800b, 0xc00d, - 0x0780, 0x010c, 0x0300, 0x4601, 0x8004, 0xc00d, - 0x0900, 0x0109, 0x0340, 0x4b01, 0x2006, 0x400c, - 0x0780, 0x020c, 0x0300, 0x4801, 0x8007, 0x0008, - 0x0780, 0x020c, 0x0300, 0x4801, 0x4007, 0xc00b, - 0x0980, 0x0109, 0x0300, 0x4b01, 0xc006, 0x8007, - 0x0980, 0x0109, 0x0300, 0x4b01, 0x8007, 0x8008, - 0x0980, 0x0109, 0x0300, 0x4b01, 0xc006, 0x800c, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, - 0xffff + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0780, 0x0109, 0x0300, 0x4a01, 0x8003, 0x8003, + 0x0780, 0x0009, 0x0300, 0x4a01, 0x0004, 0x800e, + 0x0780, 0x000c, 0x0500, 0x7b01, 0x000c, 0x0005, + 0x0780, 0x000c, 0x0540, 0x7b01, 0x000c, 0x0005, + 0x0780, 0x010c, 0x0300, 0x4601, 0x0005, 0x0005, + 0x0780, 0x000c, 0x0500, 0x7b01, 0x800b, 0xc00d, + 0x0780, 0x000c, 0x0540, 0x7b01, 0x800b, 0xc00d, + 0x0780, 0x010c, 0x0300, 0x4601, 0x8004, 0xc00d, + 0x0900, 0x0109, 0x0340, 0x4b01, 0x2006, 0x400c, + 0x0780, 0x020c, 0x0300, 0x4801, 0x8007, 0x0008, + 0x0780, 0x020c, 0x0300, 0x4801, 0x4007, 0xc00b, + 0x0980, 0x0109, 0x0300, 0x4b01, 0xc006, 0x8007, + 0x0980, 0x0109, 0x0300, 0x4b01, 0x8007, 0x8008, + 0x0980, 0x0109, 0x0300, 0x4b01, 0xc006, 0x800c, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0xf001, 0x0000, 0x0000, + 0xffff }; public static ushort[][] level_data_lookup = new ushort[][] { - level_data_00, - level_data_01, - level_data_02, - level_data_03, - level_data_04, - level_data_05, - level_data_06, - level_data_07, - level_data_08, - level_data_09 + level_data_00, + level_data_01, + level_data_02, + level_data_03, + level_data_04, + level_data_05, + level_data_06, + level_data_07, + level_data_08, + level_data_09 }; public static byte cchip_r(int offset) { @@ -443,11 +438,11 @@ namespace mame ushort result = 0; if (offset == 0) { - result = (ushort)((sbyte2<<8) | opwolf_gun_x_r()); + result = (ushort)((sbyte2 << 8) | opwolf_gun_x_r()); } else if (offset == 1) { - result = (ushort)((sbyte3<<8) | opwolf_gun_y_r()); + result = (ushort)((sbyte3 << 8) | opwolf_gun_y_r()); } return result; } @@ -463,7 +458,7 @@ namespace mame result = (byte)sbyte0; return result; } - public static void sound_bankswitch_w(int offset,byte data) + public static void sound_bankswitch_w(int offset, byte data) { basebanksnd = 0x10000 + 0x4000 * ((data - 1) & 0x03); } diff --git a/MAME.Core/mame/taito/State.cs b/MAME.Core/mame/taito/State.cs index 8051078..324b579 100644 --- a/MAME.Core/mame/taito/State.cs +++ b/MAME.Core/mame/taito/State.cs @@ -1,12 +1,8 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; +using cpu.m6800; using cpu.m68000; -using cpu.z80; -using cpu.m6800; using cpu.m6805; +using cpu.z80; +using System.IO; namespace mame { diff --git a/MAME.Core/mame/taito/Taito.cs b/MAME.Core/mame/taito/Taito.cs index 36eceb6..5ad1181 100644 --- a/MAME.Core/mame/taito/Taito.cs +++ b/MAME.Core/mame/taito/Taito.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using cpu.m68000; namespace mame { @@ -188,7 +184,7 @@ namespace mame gfx2rom[i * 2 + 1] = (byte)(gfx22rom[i] & 0x0f); } adpcmrom = Machine.GetRom("adpcm.rom"); - Taitosnd.taitosnd_start(); + Taitosnd.taitosnd_start(); if (Memory.mainrom == null || Memory.audiorom == null || gfx1rom == null || gfx2rom == null || adpcmrom == null) { Machine.bRom = false; diff --git a/MAME.Core/mame/taito/Taitoic.cs b/MAME.Core/mame/taito/Taitoic.cs index b245de6..d110f6a 100644 --- a/MAME.Core/mame/taito/Taitoic.cs +++ b/MAME.Core/mame/taito/Taitoic.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; namespace mame { @@ -15,9 +12,9 @@ namespace mame public static int PC080SN_xoffs, PC080SN_yoffs; public static Tmap[][] PC080SN_tilemap; public static int PC080SN_yinvert, PC080SN_dblwidth; - public static ushort PC090OJ_ctrl,PC090OJ_buffer,PC090OJ_gfxnum; + public static ushort PC090OJ_ctrl, PC090OJ_buffer, PC090OJ_gfxnum; public static ushort PC090OJ_sprite_ctrl; - public static ushort[] PC090OJ_ram,PC090OJ_ram_buffered; + public static ushort[] PC090OJ_ram, PC090OJ_ram_buffered; public static int PC090OJ_xoffs, PC090OJ_yoffs; public static void taitoic_init() { @@ -448,9 +445,9 @@ namespace mame } } } - public static void PC080SN_xscroll_word_0_w(int offset,ushort data) + public static void PC080SN_xscroll_word_0_w(int offset, ushort data) { - PC080SN_xscroll_word_w(0,offset,data); + PC080SN_xscroll_word_w(0, offset, data); } public static void PC080SN_xscroll_word_0_w1(int offset, byte data) { @@ -460,9 +457,9 @@ namespace mame { PC080SN_xscroll_word_w2(0, offset, data); } - public static void PC080SN_xscroll_word_1_w(int offset,ushort data) + public static void PC080SN_xscroll_word_1_w(int offset, ushort data) { - PC080SN_xscroll_word_w(1,offset,data); + PC080SN_xscroll_word_w(1, offset, data); } public static void PC080SN_xscroll_word_1_w1(int offset, byte data) { @@ -472,9 +469,9 @@ namespace mame { PC080SN_xscroll_word_w2(1, offset, data); } - public static void PC080SN_yscroll_word_0_w(int offset,ushort data) + public static void PC080SN_yscroll_word_0_w(int offset, ushort data) { - PC080SN_yscroll_word_w(0,offset,data); + PC080SN_yscroll_word_w(0, offset, data); } public static void PC080SN_yscroll_word_0_w1(int offset, byte data) { @@ -484,9 +481,9 @@ namespace mame { PC080SN_yscroll_word_w2(0, offset, data); } - public static void PC080SN_yscroll_word_1_w(int offset,ushort data) + public static void PC080SN_yscroll_word_1_w(int offset, ushort data) { - PC080SN_yscroll_word_w(1,offset,data); + PC080SN_yscroll_word_w(1, offset, data); } public static void PC080SN_yscroll_word_1_w1(int offset, byte data) { @@ -510,7 +507,7 @@ namespace mame } public static void PC080SN_ctrl_word_1_w(int offset, ushort data) { - PC080SN_ctrl_word_w(1,offset,data); + PC080SN_ctrl_word_w(1, offset, data); } public static void PC080SN_ctrl_word_1_w1(int offset, byte data) { @@ -588,7 +585,7 @@ namespace mame } if (offset == 0xdff) { - PC090OJ_ctrl = (ushort)((data << 8) | (PC090OJ_ctrl&0xff)); + PC090OJ_ctrl = (ushort)((data << 8) | (PC090OJ_ctrl & 0xff)); } } public static void PC090OJ_word_w2(int offset, byte data) @@ -660,7 +657,7 @@ namespace mame } x += PC090OJ_xoffs; y += PC090OJ_yoffs; - Drawgfx.common_drawgfx_opwolf(gfx2rom, code, color, flipx, flipy, x, y, cliprect,(uint)((priority != 0 ? 0xfc : 0xf0) | (1 << 31))); + Drawgfx.common_drawgfx_opwolf(gfx2rom, code, color, flipx, flipy, x, y, cliprect, (uint)((priority != 0 ? 0xfc : 0xf0) | (1 << 31))); } } } diff --git a/MAME.Core/mame/taito/Tilemap.cs b/MAME.Core/mame/taito/Tilemap.cs index f3373aa..19ddb56 100644 --- a/MAME.Core/mame/taito/Tilemap.cs +++ b/MAME.Core/mame/taito/Tilemap.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; namespace mame { @@ -116,7 +113,7 @@ namespace mame int y0 = tileheight * row; int flags; int tile_index; - int code, color,attr; + int code, color, attr; int pen_data_offset, palette_base, group; tile_index = row * cols + col; if (Taito.PC080SN_dblwidth == 0) diff --git a/MAME.Core/mame/taito/Video.cs b/MAME.Core/mame/taito/Video.cs index c5a430b..298d4ca 100644 --- a/MAME.Core/mame/taito/Video.cs +++ b/MAME.Core/mame/taito/Video.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; namespace mame { @@ -58,7 +55,7 @@ namespace mame sy = -bublbobl_objectram[offs + 0]; for (yc = 0; yc < 32; yc++) { - if ((prom[prom_line_offset+ yc / 2] & 0x08) != 0) + if ((prom[prom_line_offset + yc / 2] & 0x08) != 0) { continue; } diff --git a/MAME.Core/mame/taitob/Drawgfx.cs b/MAME.Core/mame/taitob/Drawgfx.cs index 2a27090..21bc81e 100644 --- a/MAME.Core/mame/taitob/Drawgfx.cs +++ b/MAME.Core/mame/taitob/Drawgfx.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace mame +namespace mame { public partial class Drawgfx { @@ -172,9 +167,9 @@ namespace mame int colorbase = color; blockmove_8toN_transpen_raw16_taitob(bb1, code, sw, sh, 0x10, ls, ts, flipx, flipy, dw, dh, colorbase, sx, sy); } - public static void blockmove_8toN_transpen_raw16_taitob(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 sx, int sy) + public static void blockmove_8toN_transpen_raw16_taitob(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 sx, int sy) { - int ydir, xdir, col, i, j,offsetx,offsety; + int ydir, xdir, col, i, j, offsetx, offsety; int srcdata_offset = code * 0x100; offsetx = sx; offsety = sy; diff --git a/MAME.Core/mame/taitob/Gdi.cs b/MAME.Core/mame/taitob/Gdi.cs index 9c19fd0..c9c5ce1 100644 --- a/MAME.Core/mame/taitob/Gdi.cs +++ b/MAME.Core/mame/taitob/Gdi.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Drawing; -using System.Drawing.Imaging; - -namespace mame +namespace mame { public partial class Taitob { @@ -14,350 +7,5 @@ namespace mame { } - public static Bitmap GetBg() - { - int i1, i2, iOffset, i3, i4, iOffset3 = 0; - int rows, cols, width, height; - int tilewidth, tileheight; - tilewidth = 16; - tileheight = tilewidth; - rows = 0x40; - cols = rows; - width = tilewidth * cols; - height = width; - int iByte; - int iCode, iCode1, iColor; - int iTile, iFlag; - 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++) - { - iOffset3 = i4 * cols + i3; - iTile = Taitob.TC0180VCU_ram[iOffset3 + Taitob.bg_rambank[0]]; - iCode = iTile; - iCode1 = iCode % Taitob.bg_tilemap.total_elements; - iColor = Taitob.TC0180VCU_ram[iOffset3 + Taitob.bg_rambank[1]]; - pen_data_offset = iCode1 * 0x100; - palette_base = 0x10 * (Taitob.b_bg_color_base + (iColor & 0x3f)); - iFlag = (((iColor & 0x00c0) >> 6) & 0x03) ^ (Taitob.bg_tilemap.attributes & 0x03); - if (iFlag == 0) - { - x0 = tilewidth * i3; - y0 = tileheight * i4; - dx0 = 1; - dy0 = 1; - } - else if (iFlag == 1) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4; - dx0 = -1; - dy0 = 1; - } - else if (iFlag == 2) - { - x0 = tilewidth * i3; - y0 = tileheight * i4 + tileheight - 1; - dx0 = 1; - dy0 = -1; - } - else if (iFlag == 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 = Taitob.gfx1rom[iOffset]; - if (palette_base == 0 && iByte == 0) - { - 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() - { - int i1, i2, iOffset, i3, i4, iOffset3 = 0; - int rows, cols, width, height; - int tilewidth, tileheight; - tilewidth = 16; - tileheight = tilewidth; - rows = 0x40; - cols = rows; - width = tilewidth * cols; - height = width; - int iByte; - int iCode, iCode1, iColor; - int iTile, iFlag; - 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++) - { - iOffset3 = i4 * cols + i3; - iTile = Taitob.TC0180VCU_ram[iOffset3 + Taitob.fg_rambank[0]]; - iCode = iTile; - iCode1 = iCode % Taitob.bg_tilemap.total_elements; - iColor = Taitob.TC0180VCU_ram[iOffset3 + Taitob.fg_rambank[1]]; - pen_data_offset = iCode1 * 0x100; - palette_base = 0x10 * (Taitob.b_fg_color_base + (iColor & 0x3f)); - iFlag = (((iColor & 0x00c0) >> 6) & 0x03) ^ (Taitob.fg_tilemap.attributes & 0x03); - if (iFlag == 0) - { - x0 = tilewidth * i3; - y0 = tileheight * i4; - dx0 = 1; - dy0 = 1; - } - else if (iFlag == 1) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4; - dx0 = -1; - dy0 = 1; - } - else if (iFlag == 2) - { - x0 = tilewidth * i3; - y0 = tileheight * i4 + tileheight - 1; - dx0 = 1; - dy0 = -1; - } - else if (iFlag == 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 = Taitob.gfx1rom[iOffset]; - if (iByte == 0) - { - 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() - { - int i1, i2, iOffset, i3, i4, iOffset3 = 0; - int rows, cols, width, height; - int tilewidth, tileheight; - tilewidth = 8; - tileheight = tilewidth; - rows = 0x20; - cols = 0x40; - width = tilewidth * cols; - height = tileheight * rows; - int iByte; - int iCode, iCode1, iColor; - int iTile, iFlag; - 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++) - { - iOffset3 = i4 * cols + i3; - iTile = Taitob.TC0180VCU_ram[iOffset3 + Taitob.tx_rambank]; - iCode = (iTile & 0x07ff) | ((Taitob.TC0180VCU_ctrl[4 + ((iTile & 0x800) >> 11)] >> 8) << 11); - iCode1 = iCode % Taitob.tx_tilemap.total_elements; - iColor = Taitob.b_tx_color_base + ((iTile >> 12) & 0x0f); - pen_data_offset = iCode1 * 0x40; - palette_base = 0x10 * iColor; - iFlag = Taitob.tx_tilemap.attributes & 0x03; - if (iFlag == 0) - { - x0 = tilewidth * i3; - y0 = tileheight * i4; - dx0 = 1; - dy0 = 1; - } - else if (iFlag == 1) - { - x0 = tilewidth * i3 + tilewidth - 1; - y0 = tileheight * i4; - dx0 = -1; - dy0 = 1; - } - else if (iFlag == 2) - { - x0 = tilewidth * i3; - y0 = tileheight * i4 + tileheight - 1; - dx0 = 1; - dy0 = -1; - } - else if (iFlag == 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 = Taitob.gfx0rom[iOffset]; - if (iByte == 0) - { - 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 GetSprinte() - { - Color c1 = new Color(); - Bitmap bm1; - bm1 = new Bitmap(512,256); - 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; - int x, y; - for (y = 0x10; y <= 0xef; y++) - { - for (x = 0; x <= 0x13f; x++) - { - ushort c = framebuffer[framebuffer_page][y * 512 + x]; - if (c == 0) - { - c1 = Color.Transparent; - } - else - { - c1 = Color.FromArgb((int)Palette.entry_color[b_sp_color_base + c]); - ptr2 = ptr + (y * 0x200 + 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() - { - Bitmap bm1 = new Bitmap(0x200, 0x100), bm2; - Graphics g = Graphics.FromImage(bm1); - g.Clear(Color.Transparent); - if (bBg) - { - bm2 = GetBg(); - short scrollx, scrolly; - scrollx = (short)taitob_scroll[0x200]; - scrolly = (short)taitob_scroll[0x201]; - g.DrawImage(bm2, 0, 0x10); - } - if (bFg) - { - bm2 = GetFg(); - short scrollx, scrolly; - scrollx = (short)taitob_scroll[0]; - scrolly = (short)taitob_scroll[1]; - g.DrawImage(bm2, scrollx, scrolly); - } - if (bTx) - { - bm2 = GetTx(); - g.DrawImage(bm2, 0, 0); - } - if (bSprite) - { - bm2 = GetSprinte(); - g.DrawImage(bm2, 0, 0); - } - return bm1; - } } } diff --git a/MAME.Core/mame/taitob/Mb87078.cs b/MAME.Core/mame/taitob/Mb87078.cs index 1667b7c..bc66773 100644 --- a/MAME.Core/mame/taitob/Mb87078.cs +++ b/MAME.Core/mame/taitob/Mb87078.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; - -namespace mame +namespace mame { public partial class Taitob { @@ -16,7 +10,7 @@ namespace mame public byte reset_comp; }; public static MB87078[] c; - public static int[] MB87078_gain_percent=new int[66]{ + public static int[] MB87078_gain_percent = new int[66]{ 100,94,89,84,79,74,70,66, 63,59,56,53,50,47,44,42, 39,37,35,33,31,29,28,26, @@ -61,7 +55,7 @@ namespace mame c[which].gain[i] = calc_gain_index(c[which].latch[i], c[which].latch[4 + i]); if (old_index != c[which].gain[i]) { - mb87078_gain_changed(i,MB87078_gain_percent[c[which].gain[i]]); + mb87078_gain_changed(i, MB87078_gain_percent[c[which].gain[i]]); } } } diff --git a/MAME.Core/mame/taitob/Memory.cs b/MAME.Core/mame/taitob/Memory.cs index eca316a..ed46d44 100644 --- a/MAME.Core/mame/taitob/Memory.cs +++ b/MAME.Core/mame/taitob/Memory.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using cpu.z80; +using cpu.z80; namespace mame { @@ -76,7 +71,7 @@ namespace mame result = (sbyte)taitob_spriteram[offset]; } } - else if (address>=0x411980&&address<= 0x4137ff) + else if (address >= 0x411980 && address <= 0x4137ff) { result = (sbyte)mainram2[address - 0x411980]; } @@ -121,7 +116,7 @@ namespace mame int offset = (address - 0x500000) / 2; if (address % 2 == 0) { - result = (sbyte)(pbobble_input_bypass_r(offset)>>8); + result = (sbyte)(pbobble_input_bypass_r(offset) >> 8); } else if (address % 2 == 1) { @@ -235,20 +230,20 @@ namespace mame result = 0; } } - else if (address >= 0x400000 && address+ 1 <= 0x40ffff) + else if (address >= 0x400000 && address + 1 <= 0x40ffff) { int offset = (address - 0x400000) / 2; result = (short)TC0180VCU_word_r(offset); } - else if (address >= 0x410000 && address+ 1 <=0x41197f) + else if (address >= 0x410000 && address + 1 <= 0x41197f) { - int offset=(address-0x410000)/2; - result=(short)taitob_spriteram[offset]; + int offset = (address - 0x410000) / 2; + result = (short)taitob_spriteram[offset]; } - else if(address>=0x411980&&address+1<=0x4137ff) + else if (address >= 0x411980 && address + 1 <= 0x4137ff) { - int offset=address-0x410000; - result=(short)(mainram2[offset]*0x100+mainram2[offset+1]); + int offset = address - 0x410000; + result = (short)(mainram2[offset] * 0x100 + mainram2[offset + 1]); } else if (address >= 0x413800 && address <= 0x413fff) { @@ -349,15 +344,15 @@ namespace mame } else if (address >= 0x410000 && address + 1 <= 0x41197f) { - int offset=(address-0x410000)/2; - result=(int)(taitob_spriteram[offset]*0x10000+taitob_spriteram[offset+1]); + int offset = (address - 0x410000) / 2; + result = (int)(taitob_spriteram[offset] * 0x10000 + taitob_spriteram[offset + 1]); } - else if(address>=0x411980&&address<=0x4137ff) + else if (address >= 0x411980 && address <= 0x4137ff) { - int offset=address-0x411980; + int offset = address - 0x411980; result = (int)(mainram2[offset] * 0x1000000 + mainram2[offset + 1] * 0x10000 + mainram2[offset + 2] * 0x100 + mainram2[offset + 3]); } - else if(address>=0x413800&&address<=0x413fff) + else if (address >= 0x413800 && address <= 0x413fff) { int offset = (address - 0x413800) / 2; result = (int)(taitob_scroll[offset] * 0x10000 + taitob_scroll[offset + 1]); @@ -400,7 +395,7 @@ namespace mame } else if (address >= 0x400000 && address <= 0x40ffff) { - int offset = (address - 0x400000)/2; + int offset = (address - 0x400000) / 2; if (address % 2 == 0) { TC0180VCU_word_w1(offset, (byte)value); @@ -492,7 +487,7 @@ namespace mame } } else if (address >= 0x700000 && address <= 0x700001) - { + { if (address % 2 == 0) { Taitosnd.taitosound_port16_msb_w1((byte)value); @@ -611,7 +606,7 @@ namespace mame if (address + 3 < Memory.mainrom.Length) { Memory.mainrom[address] = (byte)(value >> 24); - Memory.mainrom[address + 1] = (byte)(value>>16); + Memory.mainrom[address + 1] = (byte)(value >> 16); Memory.mainrom[address + 2] = (byte)(value >> 8); Memory.mainrom[address + 3] = (byte)value; } @@ -619,7 +614,7 @@ namespace mame else if (address >= 0x400000 && address + 3 <= 0x40ffff) { int offset = (address - 0x400000) / 2; - TC0180VCU_word_w(offset, (ushort)(value>>16)); + TC0180VCU_word_w(offset, (ushort)(value >> 16)); TC0180VCU_word_w(offset + 1, (ushort)value); } else if (address >= 0x410000 && address + 3 <= 0x41197f) @@ -632,51 +627,51 @@ namespace mame { int offset = address - 0x411980; mainram2[offset] = (byte)(value >> 24); - mainram2[offset + 1] = (byte)(value>>16); + mainram2[offset + 1] = (byte)(value >> 16); mainram2[offset + 2] = (byte)(value >> 8); mainram2[offset + 3] = (byte)value; } else if (address >= 0x413800 && address + 3 <= 0x413fff) { int offset = (address - 0x413800) / 2; - taitob_scroll[offset] = (ushort)(value>>16); + taitob_scroll[offset] = (ushort)(value >> 16); taitob_scroll[offset + 1] = (ushort)value; } else if (address >= 0x418000 && address + 3 <= 0x41801f) { int offset = (address - 0x418000) / 2; - taitob_v_control_w(offset, (ushort)(value>>16)); + taitob_v_control_w(offset, (ushort)(value >> 16)); taitob_v_control_w(offset + 1, (ushort)value); } else if (address >= 0x440000 && address + 3 <= 0x47ffff) { int offset = (address - 0x440000) / 2; - TC0180VCU_framebuffer_word_w(offset, (ushort)(value>>16)); + TC0180VCU_framebuffer_word_w(offset, (ushort)(value >> 16)); TC0180VCU_framebuffer_word_w(offset + 1, (ushort)value); } else if (address >= 0x500000 && address + 3 <= 0x50000f) { int offset = (address - 0x500000) / 2; - TC0640FIO_halfword_byteswap_w(offset, (ushort)(value>>16)); + TC0640FIO_halfword_byteswap_w(offset, (ushort)(value >> 16)); TC0640FIO_halfword_byteswap_w(offset + 1, (ushort)value); } else if (address >= 0x600000 && address + 3 <= 0x600003) { int offset = (address - 0x600000) / 2; - gain_control_w(offset, (ushort)(value>>16)); + gain_control_w(offset, (ushort)(value >> 16)); gain_control_w(offset + 1, (ushort)value); } else if (address >= 0x800000 && address + 3 <= 0x801fff) { int offset = (address - 0x800000) / 2; - Generic.paletteram16_RRRRGGGGBBBBRGBx_word_w(offset, (ushort)(value>>16)); + Generic.paletteram16_RRRRGGGGBBBBRGBx_word_w(offset, (ushort)(value >> 16)); Generic.paletteram16_RRRRGGGGBBBBRGBx_word_w(offset + 1, (ushort)value); } else if (address >= 0x900000 && address + 3 <= 0x90ffff) { int offset = address - 0x900000; Memory.mainram[offset] = (byte)(value >> 24); - Memory.mainram[offset + 1] = (byte)(value>>16); + Memory.mainram[offset + 1] = (byte)(value >> 16); Memory.mainram[offset + 2] = (byte)(value >> 8); Memory.mainram[offset + 3] = (byte)value; } @@ -797,7 +792,7 @@ namespace mame } public static void ZWriteHardware(ushort address, byte value) { - + } public static int ZIRQCallback() { diff --git a/MAME.Core/mame/taitob/Memory2.cs b/MAME.Core/mame/taitob/Memory2.cs index 87c628b..7f06614 100644 --- a/MAME.Core/mame/taitob/Memory2.cs +++ b/MAME.Core/mame/taitob/Memory2.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace mame +namespace mame { public partial class Taitob { @@ -212,12 +207,12 @@ namespace mame result = 0; } } - else if (address >= 0x300000 && address+1 <= 0x301fff) + else if (address >= 0x300000 && address + 1 <= 0x301fff) { int offset = (address - 0x300000) / 2; result = (short)Generic.paletteram16[offset]; } - else if (address >= 0x400000 && address+1 <= 0x403fff) + else if (address >= 0x400000 && address + 1 <= 0x403fff) { result = (short)(Memory.mainram[address - 0x400000] * 0x100 + Memory.mainram[address - 0x400000 + 1]); } @@ -261,7 +256,7 @@ namespace mame } else if (address >= 0x230000 && address + 1 <= 0x230001) { - result = (short) sbyte5; + result = (short)sbyte5; } else if (address >= 0x300000 && address + 1 <= 0x301fff) { @@ -270,7 +265,7 @@ namespace mame } else if (address >= 0x400000 && address + 1 <= 0x403fff) { - result = (short)(Memory.mainram[address - 0x400000]*0x100+Memory.mainram[address-0x400000+1]); + result = (short)(Memory.mainram[address - 0x400000] * 0x100 + Memory.mainram[address - 0x400000 + 1]); } else if (address >= 0x500000 && address + 1 <= 0x50ffff) { @@ -284,7 +279,7 @@ namespace mame } else if (address >= 0x511980 && address + 1 <= 0x5137ff) { - result = (short)(mainram2[address - 0x511980]*0x100+mainram2[address-0x511980+1]); + result = (short)(mainram2[address - 0x511980] * 0x100 + mainram2[address - 0x511980 + 1]); } else if (address >= 0x513800 && address + 1 <= 0x513fff) { @@ -351,7 +346,7 @@ namespace mame } else if (address >= 0x300000 && address + 1 <= 0x301fff) { - int offset=(address-0x300000)/2; + int offset = (address - 0x300000) / 2; result = (int)(Generic.paletteram16[offset] * 0x10000 + Generic.paletteram16[offset + 1]); } else if (address >= 0x400000 && address + 1 <= 0x403fff) @@ -361,12 +356,12 @@ namespace mame else if (address >= 0x500000 && address + 1 <= 0x50ffff) { int offset = (address - 0x500000) / 2; - result = (int)(TC0180VCU_word_r(offset)*0x10000+TC0180VCU_word_r(offset+1)); + result = (int)(TC0180VCU_word_r(offset) * 0x10000 + TC0180VCU_word_r(offset + 1)); } else if (address >= 0x510000 && address + 1 <= 0x51197f) { int offset = (address - 0x510000) / 2; - result = (int)(taitob_spriteram[offset]*0x10000+taitob_spriteram[offset+1]); + result = (int)(taitob_spriteram[offset] * 0x10000 + taitob_spriteram[offset + 1]); } else if (address >= 0x511980 && address + 1 <= 0x5137ff) { @@ -375,12 +370,12 @@ namespace mame else if (address >= 0x513800 && address + 1 <= 0x513fff) { int offset = (address - 0x513800) / 2; - result = (int)(taitob_scroll[offset]*0x10000+taitob_scroll[offset+1]); + result = (int)(taitob_scroll[offset] * 0x10000 + taitob_scroll[offset + 1]); } else if (address >= 0x518000 && address + 1 <= 0x51801f) { int offset = (address - 0x518000) / 2; - result = (int)(taitob_v_control_r(offset)*0x10000+taitob_v_control_r(offset+1)); + result = (int)(taitob_v_control_r(offset) * 0x10000 + taitob_v_control_r(offset + 1)); } else if (address >= 0x540000 && address + 1 <= 0x57ffff) { diff --git a/MAME.Core/mame/taitob/State.cs b/MAME.Core/mame/taitob/State.cs index 44ff459..001a349 100644 --- a/MAME.Core/mame/taitob/State.cs +++ b/MAME.Core/mame/taitob/State.cs @@ -1,10 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using cpu.m68000; +using cpu.m68000; using cpu.z80; +using System.IO; namespace mame { diff --git a/MAME.Core/mame/taitob/Taitob.cs b/MAME.Core/mame/taitob/Taitob.cs index 5c42178..d6d8f13 100644 --- a/MAME.Core/mame/taitob/Taitob.cs +++ b/MAME.Core/mame/taitob/Taitob.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace mame +namespace mame { public partial class Taitob { diff --git a/MAME.Core/mame/taitob/Tilemap.cs b/MAME.Core/mame/taitob/Tilemap.cs index f8d153d..9dde262 100644 --- a/MAME.Core/mame/taitob/Tilemap.cs +++ b/MAME.Core/mame/taitob/Tilemap.cs @@ -1,12 +1,9 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; namespace mame { public partial class Taitob - { + { public static Tmap bg_tilemap, fg_tilemap, tx_tilemap; public static void tilemap_init() { @@ -20,7 +17,7 @@ namespace mame bg_tilemap.cols = 64; bg_tilemap.rows = 64; bg_tilemap.tilewidth = 16; - bg_tilemap.tileheight = 16; + bg_tilemap.tileheight = 16; bg_tilemap.width = 0x400; bg_tilemap.height = 0x400; bg_tilemap.enable = true; @@ -41,7 +38,7 @@ namespace mame bg_tilemap.colscroll = new int[bg_tilemap.scrollcols]; bg_tilemap.tilemap_draw_instance3 = bg_tilemap.tilemap_draw_instanceTaitob; bg_tilemap.tile_update3 = bg_tilemap.tile_updateTaitobbg; - + fg_tilemap = new Tmap(); fg_tilemap.cols = 64; fg_tilemap.rows = 64; @@ -68,7 +65,7 @@ namespace mame fg_tilemap.colscroll = new int[fg_tilemap.scrollcols]; fg_tilemap.tilemap_draw_instance3 = fg_tilemap.tilemap_draw_instanceTaitob; fg_tilemap.tile_update3 = fg_tilemap.tile_updateTaitobfg; - + tx_tilemap = new Tmap(); tx_tilemap.cols = 64; @@ -95,7 +92,7 @@ namespace mame tx_tilemap.rowscroll = new int[tx_tilemap.scrollrows]; tx_tilemap.colscroll = new int[tx_tilemap.scrollcols]; tx_tilemap.tilemap_draw_instance3 = tx_tilemap.tilemap_draw_instanceTaitob; - tx_tilemap.tile_update3 = tx_tilemap.tile_updateTaitobtx; + tx_tilemap.tile_update3 = tx_tilemap.tile_updateTaitobtx; } } public partial class Tmap @@ -218,7 +215,7 @@ namespace mame pen_data_offset = code * 0x100; palette_base = 0x10 * (Taitob.b_bg_color_base + (color & 0x3f)); group = 0; - flags = (((color & 0x00c0) >> 6) & 0x03)^(attributes&0x03); + flags = (((color & 0x00c0) >> 6) & 0x03) ^ (attributes & 0x03); tileflags[row, col] = tile_drawTaitob(Taitob.gfx1rom, pen_data_offset, x0, y0, palette_base, group, flags); } public void tile_updateTaitobfg(int col, int row) @@ -236,7 +233,7 @@ namespace mame pen_data_offset = code * 0x100; palette_base = 0x10 * (Taitob.b_fg_color_base + (color & 0x3f)); group = 0; - flags = (((color & 0x00c0)>>6)&0x03)^(attributes & 0x03); + flags = (((color & 0x00c0) >> 6) & 0x03) ^ (attributes & 0x03); tileflags[row, col] = tile_drawTaitob(Taitob.gfx1rom, pen_data_offset, x0, y0, palette_base, group, flags); } public void tile_updateTaitobtx(int col, int row) @@ -286,7 +283,7 @@ namespace mame { pen = pen_data[offset1]; map = pen_to_flags[group, pen]; - offset1++; + offset1++; pixmap[(offsety1 % width) * width + x0 + xoffs] = (ushort)(palette_base + pen); flagsmap[offsety1 % width, x0 + xoffs] = map; andmask &= map; diff --git a/MAME.Core/mame/taitob/Video.cs b/MAME.Core/mame/taitob/Video.cs index 95b630a..2bc80ee 100644 --- a/MAME.Core/mame/taitob/Video.cs +++ b/MAME.Core/mame/taitob/Video.cs @@ -1,14 +1,11 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; namespace mame { public partial class Taitob { public static ushort[][] framebuffer; - public static ushort[] taitob_scroll,TC0180VCU_ram, taitob_spriteram, taitob_pixelram; + public static ushort[] taitob_scroll, TC0180VCU_ram, taitob_spriteram, taitob_pixelram; public static ushort[] bg_rambank, fg_rambank, pixel_scroll, TC0180VCU_ctrl; public static ushort tx_rambank; public static byte framebuffer_page, video_control; @@ -22,7 +19,7 @@ namespace mame video_control = data; if ((video_control & 0x80) != 0) { - framebuffer_page = (byte)((~video_control & 0x40) >> 6); + framebuffer_page = (byte)((~video_control & 0x40) >> 6); } //tilemap_set_flip(ALL_TILEMAPS, (video_control & 0x10) ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0 ); } @@ -83,7 +80,7 @@ namespace mame public static void TC0180VCU_word_w(int offset, ushort data) { int row, col; - TC0180VCU_ram[offset]=data; + TC0180VCU_ram[offset] = data; if ((offset & 0x7000) == fg_rambank[0] || (offset & 0x7000) == fg_rambank[1]) { row = (offset & 0x0fff) / 64; @@ -184,13 +181,13 @@ namespace mame result = (byte)sbyte1; break; case 0x04: /* coin counters and lockout */ - result= TC0220IOC_regs[4]; + result = TC0220IOC_regs[4]; break; case 0x07: /* INB0-7 (coin) */ result = (byte)sbyte2; break; default: - result= 0xff; + result = 0xff; break; } return result; @@ -355,7 +352,7 @@ namespace mame } return result; } - public static void TC0640FIO_w(int offset,byte data) + public static void TC0640FIO_w(int offset, byte data) { TC0640FIO_regs[offset] = data; switch (offset) @@ -381,9 +378,9 @@ namespace mame { TC0640FIO_w(offset, data); } - public static void TC0640FIO_halfword_byteswap_w(int offset,ushort data) + public static void TC0640FIO_halfword_byteswap_w(int offset, ushort data) { - TC0640FIO_w(offset,(byte)((data >> 8) & 0xff)); + TC0640FIO_w(offset, (byte)((data >> 8) & 0xff)); } public static RECT sect_rect(RECT dst, RECT src) { @@ -510,7 +507,7 @@ namespace mame ushort c = framebuffer[framebuffer_page][y * 512 + x]; if (c != 0) { - Video.bitmapbase[Video.curbitmap][(255 - y) * 512 + 319-x] = (ushort)(b_sp_color_base + c); + Video.bitmapbase[Video.curbitmap][(255 - y) * 512 + 319 - x] = (ushort)(b_sp_color_base + c); } } } diff --git a/MAME.Core/mame/tehkan/Drawgfx.cs b/MAME.Core/mame/tehkan/Drawgfx.cs index 231350c..140e4c0 100644 --- a/MAME.Core/mame/tehkan/Drawgfx.cs +++ b/MAME.Core/mame/tehkan/Drawgfx.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace mame +namespace mame { public partial class Drawgfx { diff --git a/MAME.Core/mame/tehkan/Gdi.cs b/MAME.Core/mame/tehkan/Gdi.cs index 4518d6e..54d2f2b 100644 --- a/MAME.Core/mame/tehkan/Gdi.cs +++ b/MAME.Core/mame/tehkan/Gdi.cs @@ -1,11 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Drawing; -using System.Drawing.Imaging; - -namespace mame +namespace mame { public partial class Tehkan { @@ -14,349 +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; - attr = Generic.colorram[tile_index]; - code = Generic.videoram[tile_index] + 0x10 * (attr & 0x70); - color = attr & 0x07; - flags = (attr & 0x80) != 0 ? Tilemap.TILE_FLIPY : 0; - palette_base = 0x80 + 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 = Tehkan.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() - { - 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; - attr = Tehkan.pbaction_colorram2[tile_index]; - code = Tehkan.pbaction_videoram2[tile_index] + 0x10 * (attr & 0x30); - color = attr & 0x0f; - flags = ((attr & 0x40) != 0 ? Tilemap.TILE_FLIPX : 0) | ((attr & 0x80) != 0 ? Tilemap.TILE_FLIPY : 0); - palette_base = 0x08 * 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 = Tehkan.gfx1rom[iOffset]; - if (iByte == 0) - { - 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() - { - 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 = 0x80 - 4; offs >= 0; offs -= 4) - { - int sx, sy, flipx, flipy; - if (offs > 0 && (Generic.spriteram[offs - 4] & 0x80) != 0) - { - continue; - } - sx = Generic.spriteram[offs + 3]; - if ((Generic.spriteram[offs] & 0x80) != 0) - { - sy = 225 - Generic.spriteram[offs + 2]; - } - else - { - sy = 241 - Generic.spriteram[offs + 2]; - } - flipx = Generic.spriteram[offs + 1] & 0x40; - flipy = Generic.spriteram[offs + 1] & 0x80; - if (Generic.flip_screen_get() != 0) - { - if ((Generic.spriteram[offs] & 0x80) != 0) - { - sx = 224 - sx; - sy = 225 - sy; - } - else - { - sx = 240 - sx; - sy = 241 - sy; - } - flipx = (flipx == 0 ? 1 : 0); - flipy = (flipy == 0 ? 1 : 0); - } - if ((Generic.spriteram[offs] & 0x80) != 0) - { - if (flipx != 0) - { - offsetx = 0x1f; - xdir = -1; - } - else - { - offsetx = 0; - xdir = 1; - } - if (flipy != 0) - { - offsety = 0x1f; - ydir = -1; - } - else - { - offsety = 0; - ydir = 1; - } - sx1 = sx + (Generic.flip_screen_get() != 0 ? scroll : -scroll); - code = Generic.spriteram[offs] % 0x20; - color = Generic.spriteram[offs + 1] & 0x0f; - for (i = 0; i < 0x20; i++) - { - for (j = 0; j < 0x20; j++) - { - if (sx1 + offsetx + xdir * j >= 0 && sx1 + offsetx + xdir * j < 0x100 && sy + offsety + ydir * i >= 0 && sy + offsety + ydir * i < 0x100) - { - ushort c = gfx32rom[code * 0x400 + 0x20 * i + j]; - if (c != 0) - { - c1 = Color.FromArgb((int)Palette.entry_color[color * 8 + 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; - } - } - } - } - } - else - { - if (flipx != 0) - { - offsetx = 0x1f; - xdir = -1; - } - else - { - offsetx = 0; - xdir = 1; - } - if (flipy != 0) - { - offsety = 0x1f; - ydir = -1; - } - else - { - offsety = 0; - ydir = 1; - } - sx1 = sx + (Generic.flip_screen_get() != 0 ? scroll : -scroll); - code = Generic.spriteram[offs] % 0x80; - color = Generic.spriteram[offs + 1] & 0x0f; - 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 = gfx3rom[code * 0x100 + 0x10 * i + j]; - if (c != 0) - { - c1 = Color.FromArgb((int)Palette.entry_color[color * 8 + 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); - } - if (bFg) - { - bm2 = GetFg(); - g.DrawImage(bm2, 0, 0); - } - switch (Machine.sDirection) - { - case "": - break; - case "90": - bm1.RotateFlip(RotateFlipType.Rotate90FlipNone); - break; - } - return bm1; - } } } diff --git a/MAME.Core/mame/tehkan/Memory.cs b/MAME.Core/mame/tehkan/Memory.cs index 674455f..9f09a6d 100644 --- a/MAME.Core/mame/tehkan/Memory.cs +++ b/MAME.Core/mame/tehkan/Memory.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using cpu.z80; +using cpu.z80; namespace mame { @@ -219,7 +214,7 @@ namespace mame } else if (address == 0x8000) { - result =(byte)Sound.soundlatch_r(); + result = (byte)Sound.soundlatch_r(); } return result; } diff --git a/MAME.Core/mame/tehkan/Pbaction.cs b/MAME.Core/mame/tehkan/Pbaction.cs index 33b8aa9..825a061 100644 --- a/MAME.Core/mame/tehkan/Pbaction.cs +++ b/MAME.Core/mame/tehkan/Pbaction.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using cpu.z80; +using cpu.z80; namespace mame { @@ -13,7 +8,7 @@ namespace mame public static byte[] mainromop, gfx1rom, gfx2rom, gfx3rom, gfx32rom; public static void PbactionInit() { - int i,n; + int i, n; Machine.bRom = true; switch (Machine.sName) { @@ -32,7 +27,7 @@ namespace mame Generic.colorram = new byte[0x400]; pbaction_colorram2 = new byte[0x400]; Generic.spriteram = new byte[0x80]; - Generic.paletteram = new byte[0x200]; + Generic.paletteram = new byte[0x200]; if (Memory.mainrom == null || Memory.audiorom == null || gfx1rom == null || gfx2rom == null || gfx3rom == null || gfx32rom == null) { Machine.bRom = false; @@ -101,7 +96,7 @@ namespace mame } public static void machine_reset_tehkan() { - + } } } diff --git a/MAME.Core/mame/tehkan/State.cs b/MAME.Core/mame/tehkan/State.cs index 0458590..397aeaa 100644 --- a/MAME.Core/mame/tehkan/State.cs +++ b/MAME.Core/mame/tehkan/State.cs @@ -1,9 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using cpu.z80; using System.IO; -using cpu.z80; namespace mame { diff --git a/MAME.Core/mame/tehkan/Tilemap.cs b/MAME.Core/mame/tehkan/Tilemap.cs index bfd67d1..aa3263d 100644 --- a/MAME.Core/mame/tehkan/Tilemap.cs +++ b/MAME.Core/mame/tehkan/Tilemap.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; namespace mame { diff --git a/MAME.Core/mame/tehkan/Video.cs b/MAME.Core/mame/tehkan/Video.cs index fef64c7..9bb0ebf 100644 --- a/MAME.Core/mame/tehkan/Video.cs +++ b/MAME.Core/mame/tehkan/Video.cs @@ -1,15 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; - -namespace mame +namespace mame { public partial class Tehkan { public static byte[] pbaction_videoram2, pbaction_colorram2; - public static int scroll; + public static int scroll; public static RECT cliprect; public static void pbaction_videoram_w(int offset, byte data) { diff --git a/MAME.Core/run_interface/ILog.cs b/MAME.Core/run_interface/ILog.cs new file mode 100644 index 0000000..c1fc649 --- /dev/null +++ b/MAME.Core/run_interface/ILog.cs @@ -0,0 +1,7 @@ +namespace MAME.Core.run_interface +{ + public interface ILog + { + void Log(string msg); + } +} diff --git a/MAME.Core/run_interface/IResources.cs b/MAME.Core/run_interface/IResources.cs index de18e3c..96b708e 100644 --- a/MAME.Core/run_interface/IResources.cs +++ b/MAME.Core/run_interface/IResources.cs @@ -10,7 +10,6 @@ byte[] Get_pgmvideobios(); byte[] Get_pgmaudiobios(); byte[] Get_mcu(); - string Get_mame_xml(); } } diff --git a/MAME.Core/run_interface/ISoundPlayer.cs b/MAME.Core/run_interface/ISoundPlayer.cs index 6d30791..7814554 100644 --- a/MAME.Core/run_interface/ISoundPlayer.cs +++ b/MAME.Core/run_interface/ISoundPlayer.cs @@ -3,6 +3,7 @@ public interface ISoundPlayer { void BufferWirte(int Off, byte[] Data); + void SubmitSamples(byte[] buffer, int samples_a); void SetVolume(int Vol); void GetCurrentPosition(out int play_position, out int write_position); } diff --git a/MAME.Core/run_interface/IVideoPlayer.cs b/MAME.Core/run_interface/IVideoPlayer.cs index fd3efdd..1d99441 100644 --- a/MAME.Core/run_interface/IVideoPlayer.cs +++ b/MAME.Core/run_interface/IVideoPlayer.cs @@ -1,9 +1,8 @@ -using System.Drawing; - -namespace MAME.Core.run_interface +namespace MAME.Core.run_interface { public interface IVideoPlayer { - void SubmitVideo(Bitmap Bitmap); + + void SubmitVideo(int[] data); } } diff --git a/MAME.Core/sound/AY8910.cs b/MAME.Core/sound/AY8910.cs index ba2a814..c9dd075 100644 --- a/MAME.Core/sound/AY8910.cs +++ b/MAME.Core/sound/AY8910.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; +using System.IO; namespace mame { @@ -18,7 +14,7 @@ namespace mame public struct ay8910_context { public int streams; - public int ready; + public int ready; public int register_latch; public byte[] regs; public int last_enable; @@ -51,7 +47,7 @@ namespace mame public write8handler portBwrite; } public delegate byte read8handler(int offset); - public delegate void write8handler(int offset,byte value); + public delegate void write8handler(int offset, byte value); public static _ay_ym_param ay_ym_param, ay_ym_param_env; public ay8910_context ay8910info; public static AY8910[] AA8910 = new AY8910[3]; @@ -95,7 +91,7 @@ namespace mame ym2149_param.res_count = 16; ym2149_param.res = new double[] { 73770, 37586, 27458, 21451, 15864, 12371, 8922, 6796, - 4763, 3521, 2403, 1737, 1123, 762, 438, 251, + 4763, 3521, 2403, 1737, 1123, 762, 438, 251, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}; ym2149_param_env.r_up = 630; @@ -110,7 +106,7 @@ namespace mame ay8910_param.r_down = 300; ay8910_param.res_count = 16; ay8910_param.res = new double[] - { 118996, 42698, 33105, 24770, 17925, 12678, 9331, 5807, + { 118996, 42698, 33105, 24770, 17925, 12678, 9331, 5807, 4936, 3038, 2129, 1658, 1271, 969, 781, 623, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,}; @@ -339,21 +335,21 @@ namespace mame ay8910info.env_volume = (ay8910info.env_step ^ ay8910info.attack); break; case 14: - if ((ay8910info.regs[7] & 0x40)!=0) + if ((ay8910info.regs[7] & 0x40) != 0) { - if (ay8910_intf.portAwrite!=null) + if (ay8910_intf.portAwrite != null) { ay8910_intf.portAwrite(0, ay8910info.regs[14]); } } break; case 15: - if ((ay8910info.regs[7] & 0x80)!=0) + if ((ay8910info.regs[7] & 0x80) != 0) { if (ay8910_intf.portBwrite != null) { ay8910_intf.portBwrite(0, ay8910info.regs[15]); - } + } } break; } diff --git a/MAME.Core/sound/DAC.cs b/MAME.Core/sound/DAC.cs index 1b64774..d53d7d9 100644 --- a/MAME.Core/sound/DAC.cs +++ b/MAME.Core/sound/DAC.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; +using System.IO; namespace mame { @@ -17,7 +13,8 @@ namespace mame }; public static dac_info dac1; public static void DAC_update(int offset, int length) - {; + { + ; short out1 = dac1.output; int i; for (i = 0; i < length; i++) diff --git a/MAME.Core/sound/FM.cs b/MAME.Core/sound/FM.cs index 47efb9d..336f15f 100644 --- a/MAME.Core/sound/FM.cs +++ b/MAME.Core/sound/FM.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; namespace mame { @@ -163,7 +159,7 @@ namespace mame Atime expiry_period = Attotime.attotime_mul(Attotime.ATTOTIME_IN_HZ(ST.clock), (uint)(busyclock * ST.timer_prescaler)); ST.busy_expiry_time = Attotime.attotime_add(Timer.get_current_time(), expiry_period); } - private void FM_KEYON(int type,int c, int s) + private void FM_KEYON(int type, int c, int s) { if (CH[c].SLOT[s].key == 0) { @@ -616,7 +612,7 @@ namespace mame CH[c].SLOT[2].phase += (uint)CH[c].SLOT[2].Incr; CH[c].SLOT[1].phase += (uint)CH[c].SLOT[1].Incr; CH[c].SLOT[3].phase += (uint)CH[c].SLOT[3].Incr; - } + } } public void refresh_fc_eg_slot(int type, int c, int s, int fc, int kc) { @@ -721,7 +717,7 @@ namespace mame public void OPNSetPres(int pres, int timer_prescaler, int SSGpres) { int i; - ST.freqbase = (ST.rate!=0) ? ((double)ST.clock / ST.rate) / pres : 0; + ST.freqbase = (ST.rate != 0) ? ((double)ST.clock / ST.rate) / pres : 0; eg_timer_add = (uint)((1 << 16) * ST.freqbase); eg_timer_overflow = (3) * (1 << 16); ST.timer_prescaler = timer_prescaler; @@ -776,7 +772,7 @@ namespace mame c = (byte)(v & 0x03); if (c == 3) break; - if ((v & 0x04) != 0 && (type & TYPE_6CH)!=0) + if ((v & 0x04) != 0 && (type & TYPE_6CH) != 0) c += 3; if ((v & 0x10) != 0) FM_KEYON(type, c, 0); @@ -1012,7 +1008,7 @@ namespace mame public read_handler read; public reset_handler reset; } - + public static int TYPE_SSG = 0x01, TYPE_LFOPAN = 0x02, TYPE_6CH = 0x04, TYPE_DAC = 0x08, TYPE_ADPCM = 0x10, TYPE_2610 = 0x20; public static int TYPE_YM2203 = (TYPE_SSG), TYPE_YM2608 = (TYPE_SSG | TYPE_LFOPAN | TYPE_6CH | TYPE_ADPCM), TYPE_YM2610 = (TYPE_SSG | TYPE_LFOPAN | TYPE_6CH | TYPE_ADPCM | TYPE_2610), TYPE_YM2612 = (TYPE_DAC | TYPE_LFOPAN | TYPE_6CH); public static int[] ipan = new int[6]; @@ -1145,17 +1141,17 @@ namespace mame ( 0),( 0),( 0),( 0),( 0),( 0),( 0),( 0) }; public static byte[] dt_tab = new byte[4 * 32]{ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, - 2, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6, 7, 8, 8, 8, 8, + 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, + 2, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6, 7, 8, 8, 8, 8, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, - 5, 6, 6, 7, 8, 8, 9,10,11,12,13,14,16,16,16,16, + 5, 6, 6, 7, 8, 8, 9,10,11,12,13,14,16,16,16,16, 2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 6, 6, 7, - 8 , 8, 9,10,11,12,13,14,16,17,19,20,22,22,22,22 + 8 , 8, 9,10,11,12,13,14,16,17,19,20,22,22,22,22 }; private static byte[] opn_fktable = new byte[16] { 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 3, 3, 3, 3, 3, 3 }; private static uint[] lfo_samples_per_step = new uint[8] { 108, 77, 71, 67, 62, 44, 8, 5 }; @@ -1226,20 +1222,20 @@ namespace mame }; private static int[] steps = new int[49] { - 16, 17, 19, 21, 23, 25, 28, - 31, 34, 37, 41, 45, 50, 55, - 60, 66, 73, 80, 88, 97, 107, - 118, 130, 143, 157, 173, 190, 209, - 230, 253, 279, 307, 337, 371, 408, - 449, 494, 544, 598, 658, 724, 796, - 876, 963, 1060, 1166, 1282, 1411, 1552 + 16, 17, 19, 21, 23, 25, 28, + 31, 34, 37, 41, 45, 50, 55, + 60, 66, 73, 80, 88, 97, 107, + 118, 130, 143, 157, 173, 190, 209, + 230, 253, 279, 307, 337, 371, 408, + 449, 494, 544, 598, 658, 724, 796, + 876, 963, 1060, 1166, 1282, 1411, 1552 }; public static int[] step_inc = new int[8] { -1 * 16, -1 * 16, -1 * 16, -1 * 16, 2 * 16, 5 * 16, 7 * 16, 9 * 16 }; public static int[] jedi_table = new int[49 * 16]; public delegate void FM_TIMERHANDLER(int c, int cnt, int clock); public delegate void FM_IRQHANDLER(int irq); public delegate void set_clock_handler(int clock); - public delegate void write_handler(int address,byte data); + public delegate void write_handler(int address, byte data); public delegate byte read_handler(); public delegate void reset_handler(); private static int[] lfo_pm_table = new int[128 * 8 * 32]; @@ -1269,7 +1265,7 @@ namespace mame { return val; } - } + } private static int op_calc(uint phase, uint env, int pm) { uint p; @@ -1381,6 +1377,6 @@ namespace mame jedi_table[step * 16 + nib] = ((nib & 0x08) != 0) ? -value : value; } } - } + } } } diff --git a/MAME.Core/sound/FMOpl.cs b/MAME.Core/sound/FMOpl.cs index 84d8986..a173694 100644 --- a/MAME.Core/sound/FMOpl.cs +++ b/MAME.Core/sound/FMOpl.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; namespace mame { @@ -46,39 +43,39 @@ namespace mame public struct OPL_CH { public OPL_SLOT[] SLOT; - public uint block_fnum; - public uint fc; - public uint ksl_base; - public byte kcode; + public uint block_fnum; + public uint fc; + public uint ksl_base; + public byte kcode; } public class FM_OPL { - public OPL_CH[] P_CH; + public OPL_CH[] P_CH; - public uint eg_cnt; - public uint eg_timer; - public uint eg_timer_add; - public uint eg_timer_overflow; + public uint eg_cnt; + public uint eg_timer; + public uint eg_timer_add; + public uint eg_timer_overflow; - public byte rhythm; + public byte rhythm; - public uint[] fn_tab; + public uint[] fn_tab; - public byte lfo_am_depth; - public byte lfo_pm_depth_range; - public uint lfo_am_cnt; - public uint lfo_am_inc; - public uint lfo_pm_cnt; - public uint lfo_pm_inc; + public byte lfo_am_depth; + public byte lfo_pm_depth_range; + public uint lfo_am_cnt; + public uint lfo_am_inc; + public uint lfo_pm_cnt; + public uint lfo_pm_inc; - public uint noise_rng; - public uint noise_p; - public uint noise_f; + public uint noise_rng; + public uint noise_p; + public uint noise_f; - public byte wavesel; + public byte wavesel; - public uint[] T; - public byte[] st; + public uint[] T; + public byte[] st; public YMDeltat.YM_DELTAT deltat; @@ -89,7 +86,7 @@ namespace mame public OPL_PORTHANDLER_R keyboardhandler_r; public OPL_PORTHANDLER_W keyboardhandler_w; - public OPL_TIMERHANDLER timer_handler; + public OPL_TIMERHANDLER timer_handler; public OPL_IRQHANDLER IRQHandler; public OPL_UPDATEHANDLER UpdateHandler; @@ -99,9 +96,9 @@ namespace mame public byte statusmask; public byte mode; - public int clock; - public int rate; - public double freqbase; + public int clock; + public int rate; + public double freqbase; public Atime TimerBase; public void OPLResetChip() { @@ -508,7 +505,7 @@ namespace mame } else { - + } P_CH[chan].SLOT[0].op1_out[1] = 0; if (env < 0x180) @@ -824,61 +821,61 @@ namespace mame } } public static FM_OPL YM3812, YM3526; - public static int[] slot_array=new int[32] + public static int[] slot_array = new int[32] { - 0, 2, 4, 1, 3, 5,-1,-1, - 6, 8,10, 7, 9,11,-1,-1, - 12,14,16,13,15,17,-1,-1, - -1,-1,-1,-1,-1,-1,-1,-1 + 0, 2, 4, 1, 3, 5,-1,-1, + 6, 8,10, 7, 9,11,-1,-1, + 12,14,16,13,15,17,-1,-1, + -1,-1,-1,-1,-1,-1,-1,-1 }; - public static uint[] ksl_tab=new uint[8*16] + public static uint[] ksl_tab = new uint[8 * 16] { - 0,0,0,0, - 0,0,0,0, - 0,0,0,0, - 0,0,0,0, + 0,0,0,0, + 0,0,0,0, + 0,0,0,0, + 0,0,0,0, - 0,0,0,0, - 0,0,0,0, - 0,8,12,16, - 20,24,28,32, + 0,0,0,0, + 0,0,0,0, + 0,8,12,16, + 20,24,28,32, - 0,0,0,0, - 0,12,20,28, - 32,40,44,48, - 52,56,60,64, + 0,0,0,0, + 0,12,20,28, + 32,40,44,48, + 52,56,60,64, - 0,0,0,20, - 32,44,52,60, - 64,72,76,80, - 84,88,92,96, + 0,0,0,20, + 32,44,52,60, + 64,72,76,80, + 84,88,92,96, - 0,0,32,52, - 64,76,84,92, - 96,104,108,112, - 116,120,124,128, + 0,0,32,52, + 64,76,84,92, + 96,104,108,112, + 116,120,124,128, - 0,32,64,84, - 96,108,116,124, - 128,136,140,144, - 148,152,156,160, + 0,32,64,84, + 96,108,116,124, + 128,136,140,144, + 148,152,156,160, - 0,64,96,116, - 128,140,148,156, - 160,168,172,176, - 180,184,188,192, + 0,64,96,116, + 128,140,148,156, + 160,168,172,176, + 180,184,188,192, - 0,96,128,148, - 160,172,180,188, - 192,200,204,208, - 212,216,220,224 + 0,96,128,148, + 160,172,180,188, + 192,200,204,208, + 212,216,220,224 }; - public static uint[] sl_tab=new uint[16] + public static uint[] sl_tab = new uint[16] { 0*16, 1*16, 2*16,3 *16,4 *16,5 *16,6 *16, 7*16, 8*16, 9*16,10*16,11*16,12*16,13*16,14*16,31*16 }; - public static byte[] eg_inc=new byte[15*8] + public static byte[] eg_inc = new byte[15 * 8] { 0,1, 0,1, 0,1, 0,1, 0,1, 0,1, 1,1, 0,1, @@ -899,7 +896,7 @@ namespace mame 8,8, 8,8, 8,8, 8,8, 0,0, 0,0, 0,0, 0,0, }; - public static byte[] eg_rate_select=new byte[16+64+16] + public static byte[] eg_rate_select = new byte[16 + 64 + 16] { 14*8,14*8,14*8,14*8,14*8,14*8,14*8,14*8, 14*8,14*8,14*8,14*8,14*8,14*8,14*8,14*8, @@ -927,7 +924,7 @@ namespace mame 12*8,12*8,12*8,12*8,12*8,12*8,12*8,12*8, 12*8,12*8,12*8,12*8,12*8,12*8,12*8,12*8, }; - public static byte[] eg_rate_shift=new byte[16+64+16] + public static byte[] eg_rate_shift = new byte[16 + 64 + 16] { 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, @@ -955,14 +952,14 @@ namespace mame 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; - public static byte[] mul_tab=new byte[16] + public static byte[] mul_tab = new byte[16] { 1, 2, 4, 6, 8, 10, 12, 14, 16, 18,20,20,24,24,30,30 }; public static int[] tl_tab; public static uint[] sin_tab; - public static byte[] lfo_am_table=new byte[210] + public static byte[] lfo_am_table = new byte[210] { 0,0,0,0,0,0,0, 1,1,1,1, @@ -1017,7 +1014,7 @@ namespace mame 2,2,2,2, 1,1,1,1 }; - public static sbyte[] lfo_pm_table=new sbyte[8*8*2] + public static sbyte[] lfo_pm_table = new sbyte[8 * 8 * 2] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1067,7 +1064,7 @@ namespace mame { return val; } - } + } private static int op_calc(uint phase, int env, int pm, int wave_tab) { uint p; @@ -1077,7 +1074,7 @@ namespace mame return 0; } return tl_tab[p]; - } + } private static int init_tables() { int i, x; @@ -1150,7 +1147,7 @@ namespace mame } } return 1; - } + } private static int OPL_LockTable() { num_lock++; @@ -1158,7 +1155,7 @@ namespace mame { return 0; } - if (init_tables()==0) + if (init_tables() == 0) { num_lock--; return -1; @@ -1171,7 +1168,7 @@ namespace mame { num_lock--; } - } + } private static FM_OPL OPLCreate(int type, int clock, int rate) { int i; @@ -1197,7 +1194,7 @@ namespace mame private static void OPLDestroy() { OPL_UnLockTable(); - } + } public static void ym3812_init(int sndindex, int clock, int rate) { YM3812 = OPLCreate(1, clock, rate); @@ -1208,7 +1205,7 @@ namespace mame OPLDestroy(); } public static void ym3812_reset_chip() - { + { YM3812.OPLResetChip(); num_lock = 0; } @@ -1226,7 +1223,7 @@ namespace mame } public static void ym3812_set_timer_handler(OPL_TIMERHANDLER timer_handler) { - YM3812.OPLSetTimerHandler(timer_handler); + YM3812.OPLSetTimerHandler(timer_handler); } public static void ym3812_set_irq_handler(OPL_IRQHANDLER IRQHandler) { @@ -1275,20 +1272,20 @@ namespace mame } private static void ym3526_shutdown() { - OPLDestroy(); + OPLDestroy(); } public static void ym3526_reset_chip() { - YM3526.OPLResetChip(); + YM3526.OPLResetChip(); num_lock = 0; } public static int ym3526_write(int a, int v) { - return YM3526.OPLWrite(a, v); + return YM3526.OPLWrite(a, v); } public static byte ym3526_read(int a) { - return (byte)(YM3526.OPLRead(a) | 0x06); + return (byte)(YM3526.OPLRead(a) | 0x06); } public static void ym3526_set_timer_handler(OPL_TIMERHANDLER timer_handler) { @@ -1304,7 +1301,7 @@ namespace mame } public static int ym3526_timer_over(int c) { - return YM3526.OPLTimerOver(c); + return YM3526.OPLTimerOver(c); } public static void ym3526_update_one(int offset, int length) { diff --git a/MAME.Core/sound/ICS2115.cs b/MAME.Core/sound/ICS2115.cs index 5187dc7..63eb11f 100644 --- a/MAME.Core/sound/ICS2115.cs +++ b/MAME.Core/sound/ICS2115.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; +using System.IO; namespace mame { @@ -12,7 +8,7 @@ namespace mame public static voice_struct[] voice2; public static timer_struct[] timer; public static byte[] icsrom; - public static short[] ulaw=new short[256]; + public static short[] ulaw = new short[256]; public static byte osc_select; public static byte reg_select; public static byte irq_enabled, irq_pending; @@ -76,7 +72,7 @@ namespace mame public static void ics2115_update(int offset, int length) { int osc, i; - bool irq_invalid = false; + bool irq_invalid = false; for (i = 0; i < length; i++) { Sound.ics2115stream.streamoutput[0][offset + i] = 0; @@ -134,7 +130,7 @@ namespace mame public static void keyon() { voice2[osc_select].state |= V_ON; - } + } public static void recalc_timer(int i) { long period = (long)(1000000000 * timer[i].scale * timer[i].preset / 33868800); @@ -375,19 +371,19 @@ namespace mame } break; case 1: - ret= reg_select; + ret = reg_select; break; case 2: - ret= (byte)(reg_read()); + ret = (byte)(reg_read()); break; case 3: - ret= (byte)(reg_read() >> 8); + ret = (byte)(reg_read() >> 8); break; default: break; } return ret; - } + } public static void ics2115_reset() { int i; diff --git a/MAME.Core/sound/K053260.cs b/MAME.Core/sound/K053260.cs index 8909154..3a649d3 100644 --- a/MAME.Core/sound/K053260.cs +++ b/MAME.Core/sound/K053260.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; +using System.IO; namespace mame { @@ -15,20 +11,20 @@ namespace mame public uint start; public uint bank; public uint volume; - public int play; + public int play; public uint pan; public uint pos; - public int loop; - public int ppcm; - public int ppcm_data; + public int loop; + public int ppcm; + public int ppcm_data; }; public struct k053260_chip_def { - public int mode; - public int[] regs; - public int rom_size; - public uint[] delta_table; - public k053260_channel_def[] channels; + public int mode; + public int[] regs; + public int rom_size; + public uint[] delta_table; + public k053260_channel_def[] channels; }; public static byte[] k053260rom; public static k053260_chip_def ic1; @@ -43,7 +39,7 @@ namespace mame double v = (double)(0x1000 - i); double target = (max) / v; double fixed1 = (double)(1 << 16); - if ((target!=0) && (base1!=0)) + if ((target != 0) && (base1 != 0)) { target = fixed1 / (base1 / target); val = (uint)target; @@ -79,7 +75,7 @@ namespace mame } public static byte k053260_read(int chip, int offset) { - byte result=0; + byte result = 0; switch (offset) { case 0x29: @@ -115,27 +111,27 @@ namespace mame { return k053260_read(0, offset); } - public static void k053260_update(int offset,int length) + public static void k053260_update(int offset, int length) { - long[] dpcmcnv =new long[] { 0,1,2,4,8,16,32,64, -128, -64, -32, -16, -8, -4, -2, -1}; + long[] dpcmcnv = new long[] { 0, 1, 2, 4, 8, 16, 32, 64, -128, -64, -32, -16, -8, -4, -2, -1 }; int i, j; uint[] rom_offset; - int[] lvol,rvol,play,loop,ppcm_data,ppcm; + int[] lvol, rvol, play, loop, ppcm_data, ppcm; rom_offset = new uint[4]; - lvol=new int[4]; - rvol=new int[4]; - play=new int[4]; - loop=new int[4]; - ppcm_data=new int[4]; - ppcm=new int[4]; + lvol = new int[4]; + rvol = new int[4]; + play = new int[4]; + loop = new int[4]; + ppcm_data = new int[4]; + ppcm = new int[4]; byte[] rom; rom = new byte[4]; - uint[] delta,end,pos; - delta=new uint[4]; + uint[] delta, end, pos; + delta = new uint[4]; end = new uint[4]; - pos=new uint[4]; - int dataL, dataR; - sbyte d; + pos = new uint[4]; + int dataL, dataR; + sbyte d; for (i = 0; i < 4; i++) { rom_offset[i] = ic1.channels[i].start + (ic1.channels[i].bank << 16); @@ -153,15 +149,16 @@ namespace mame delta[i] /= 2; } } - for ( j = 0; j < length; j++ ) + for (j = 0; j < length; j++) { - dataL = dataR = 0; - for ( i = 0; i < 4; i++ ) + dataL = dataR = 0; + for (i = 0; i < 4; i++) { - if ( play[i]!=0 ) { - if ( ( pos[i] >> 16 ) >= end[i] ) + if (play[i] != 0) + { + if ((pos[i] >> 16) >= end[i]) { - ppcm_data[i] = 0; + ppcm_data[i] = 0; if (loop[i] != 0) { pos[i] = 0; @@ -171,48 +168,48 @@ namespace mame play[i] = 0; continue; } - } - if ( ppcm[i]!=0 ) + } + if (ppcm[i] != 0) { - if ( pos[i] == 0 || ( ( pos[i] ^ ( pos[i] - delta[i] ) ) & 0x8000 ) == 0x8000 ) - { - int newdata; - if ( (pos[i] & 0x8000)!=0 ) + if (pos[i] == 0 || ((pos[i] ^ (pos[i] - delta[i])) & 0x8000) == 0x8000) + { + int newdata; + if ((pos[i] & 0x8000) != 0) { - newdata = (k053260rom[rom_offset[i]+(pos[i] >> 16)] >> 4) & 0x0f; - } - else - { - newdata = k053260rom[rom_offset[i]+(pos[i] >> 16)] & 0x0f; - } - ppcm_data[i] = (int)(( ( ppcm_data[i] * 62 ) >> 6 ) + dpcmcnv[newdata]); - if ( ppcm_data[i] > 127 ) - { - ppcm_data[i] = 127; + newdata = (k053260rom[rom_offset[i] + (pos[i] >> 16)] >> 4) & 0x0f; } - else + else + { + newdata = k053260rom[rom_offset[i] + (pos[i] >> 16)] & 0x0f; + } + ppcm_data[i] = (int)(((ppcm_data[i] * 62) >> 6) + dpcmcnv[newdata]); + if (ppcm_data[i] > 127) + { + ppcm_data[i] = 127; + } + else { if (ppcm_data[i] < -128) { ppcm_data[i] = -128; } } - } - d = (sbyte)ppcm_data[i]; - pos[i] += delta[i]; - } + } + d = (sbyte)ppcm_data[i]; + pos[i] += delta[i]; + } else { - d = (sbyte)k053260rom[rom_offset[i]+(pos[i] >> 16)]; - pos[i] += delta[i]; - } - if ((ic1.mode & 2)!=0) + d = (sbyte)k053260rom[rom_offset[i] + (pos[i] >> 16)]; + pos[i] += delta[i]; + } + if ((ic1.mode & 2) != 0) { - dataL += ( d * lvol[i] ) >> 2; - dataR += ( d * rvol[i] ) >> 2; - } - } - } + dataL += (d * lvol[i]) >> 2; + dataR += (d * rvol[i]) >> 2; + } + } + } if (dataL < -32768) { dataL = -32768; @@ -231,13 +228,13 @@ namespace mame } Sound.k053260stream.streamoutput[1][offset + j] = dataL; Sound.k053260stream.streamoutput[0][offset + j] = dataR; - } - for ( i = 0; i < 4; i++ ) + } + for (i = 0; i < 4; i++) { - ic1.channels[i].pos = pos[i]; + ic1.channels[i].pos = pos[i]; ic1.channels[i].play = play[i]; ic1.channels[i].ppcm_data = ppcm_data[i]; - } + } } public static void k053260_start(int clock) { diff --git a/MAME.Core/sound/K054539.cs b/MAME.Core/sound/K054539.cs index a3637c1..ea2a2ce 100644 --- a/MAME.Core/sound/K054539.cs +++ b/MAME.Core/sound/K054539.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using System.IO; namespace mame @@ -65,9 +62,9 @@ namespace mame public static void k054539_update(int offset, int length) { short[] dpcm = new short[16] { - 0<<8, 1<<8, 4<<8, 9<<8, 16<<8, 25<<8, 36<<8, 49<<8, - -64<<8, -49<<8, -36<<8, -25<<8, -16<<8, -9<<8, -4<<8, -1<<8 - }; + 0<<8, 1<<8, 4<<8, 9<<8, 16<<8, 25<<8, 36<<8, 49<<8, + -64<<8, -49<<8, -36<<8, -25<<8, -16<<8, -9<<8, -4<<8, -1<<8 + }; int j, ch, reverb_pos; byte[] samples; int rom_mask; diff --git a/MAME.Core/sound/MSM5205.cs b/MAME.Core/sound/MSM5205.cs index 9fab1f8..49c4d3a 100644 --- a/MAME.Core/sound/MSM5205.cs +++ b/MAME.Core/sound/MSM5205.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using System.IO; namespace mame @@ -27,17 +24,17 @@ namespace mame public static int[] diff_lookup; public static int[] index_shift = new int[8] { -1, -1, -1, -1, 2, 4, 6, 8 }; public MSM5205Voice voice; - public static Timer.emu_timer[] timer=new Timer.emu_timer[2]; - public static MSM5205[] mm1=new MSM5205[2]; + public static Timer.emu_timer[] timer = new Timer.emu_timer[2]; + public static MSM5205[] mm1 = new MSM5205[2]; public static void ComputeTables() { int[,] nbl2bit = new int[16, 4] - { - { 1, 0, 0, 0}, { 1, 0, 0, 1}, { 1, 0, 1, 0}, { 1, 0, 1, 1}, - { 1, 1, 0, 0}, { 1, 1, 0, 1}, { 1, 1, 1, 0}, { 1, 1, 1, 1}, - {-1, 0, 0, 0}, {-1, 0, 0, 1}, {-1, 0, 1, 0}, {-1, 0, 1, 1}, - {-1, 1, 0, 0}, {-1, 1, 0, 1}, {-1, 1, 1, 0}, {-1, 1, 1, 1} - }; + { + { 1, 0, 0, 0}, { 1, 0, 0, 1}, { 1, 0, 1, 0}, { 1, 0, 1, 1}, + { 1, 1, 0, 0}, { 1, 1, 0, 1}, { 1, 1, 1, 0}, { 1, 1, 1, 1}, + {-1, 0, 0, 0}, {-1, 0, 0, 1}, {-1, 0, 1, 0}, {-1, 0, 1, 1}, + {-1, 1, 0, 0}, {-1, 1, 0, 1}, {-1, 1, 1, 0}, {-1, 1, 1, 1} + }; int step, nib; diff_lookup = new int[49 * 16]; for (step = 0; step <= 48; step++) @@ -203,7 +200,7 @@ namespace mame if (mm1[num].voice.vclk != vclk) { mm1[num].voice.vclk = vclk; - if (vclk==0) + if (vclk == 0) { if (num == 0) { diff --git a/MAME.Core/sound/Namco.cs b/MAME.Core/sound/Namco.cs index 22cd101..817020d 100644 --- a/MAME.Core/sound/Namco.cs +++ b/MAME.Core/sound/Namco.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; +using System.IO; namespace mame { @@ -67,7 +63,7 @@ namespace mame nam1.waveform[v] = new short[32 * 16]; } for (offset = 0; offset < 256; offset++) - update_namco_waveform(offset, namco_wavedata[offset]); + update_namco_waveform(offset, namco_wavedata[offset]); } public static uint namco_update_one(int[] buffer, int length, short[] wave, uint counter, uint freq) { @@ -89,11 +85,11 @@ namespace mame Sound.namcostream.streamoutput[0][offset + i] = 0; Sound.namcostream.streamoutput[1][offset + i] = 0; } - for (voice =0;voice<8;voice++) + for (voice = 0; voice < 8; voice++) { int lv = nam1.channel_list[voice].volume[0]; int rv = nam1.channel_list[voice].volume[1]; - if (nam1.channel_list[voice].noise_sw!=0) + if (nam1.channel_list[voice].noise_sw != 0) { int f = nam1.channel_list[voice].frequency & 0xff; if ((lv != 0 || rv != 0) && f != 0) @@ -107,7 +103,7 @@ namespace mame for (i = 0; i < length; i++) { int cnt; - if (nam1.channel_list[voice].noise_state!=0) + if (nam1.channel_list[voice].noise_state != 0) { Sound.namcostream.streamoutput[0][offset + i] += l_noise_data; Sound.namcostream.streamoutput[1][offset + i] += r_noise_data; @@ -117,7 +113,7 @@ namespace mame Sound.namcostream.streamoutput[0][offset + i] += l_noise_data; Sound.namcostream.streamoutput[1][offset + i] += r_noise_data; } - if (hold!=0) + if (hold != 0) { hold--; continue; @@ -128,9 +124,9 @@ namespace mame c &= (1 << 12) - 1; for (; cnt > 0; cnt--) { - if (((nam1.channel_list[voice].noise_seed + 1) & 2)!=0) + if (((nam1.channel_list[voice].noise_seed + 1) & 2) != 0) nam1.channel_list[voice].noise_state ^= 1; - if ((nam1.channel_list[voice].noise_seed & 1)!=0) + if ((nam1.channel_list[voice].noise_seed & 1) != 0) nam1.channel_list[voice].noise_seed ^= 0x28000; nam1.channel_list[voice].noise_seed >>= 1; } @@ -141,7 +137,7 @@ namespace mame } else { - if (nam1.channel_list[voice].frequency!=0) + if (nam1.channel_list[voice].frequency != 0) { int c = nam1.channel_list[voice].counter; if (lv != 0) @@ -172,7 +168,7 @@ namespace mame public static void namco_start() { int voice; - nam1.num_voices=8; + nam1.num_voices = 8; nam1.namco_clock = 192000; nam1.f_fracbits = 4 + 15; nam1.sample_rate = nam1.namco_clock; @@ -195,48 +191,48 @@ namespace mame } public static void namcos1_sound_w(int offset, byte data) { - int ch,ch1; + int ch, ch1; int nssw; if (offset > 63) { return; } - if (namco_wavedata[0x100+offset] == data) + if (namco_wavedata[0x100 + offset] == data) return; Sound.namcostream.stream_update(); namco_wavedata[0x100 + offset] = data; ch = offset / 8; if (ch >= nam1.num_voices) return; - ch1=ch; + ch1 = ch; switch (offset - ch * 8) { - case 0x00: - nam1.channel_list[ch1].volume[0] = data & 0x0f; - break; + case 0x00: + nam1.channel_list[ch1].volume[0] = data & 0x0f; + break; - case 0x01: - nam1.channel_list[ch1].waveform_select = (data >> 4) & 15; - nam1.channel_list[ch1].frequency = (namco_wavedata[0x100 + ch * 8 + 0x01] & 15) << 16; - nam1.channel_list[ch1].frequency += namco_wavedata[0x100 + ch * 8 + 0x02] << 8; - nam1.channel_list[ch1].frequency += namco_wavedata[0x100 + ch * 8 + 0x03]; - break; - case 0x02: - case 0x03: - nam1.channel_list[ch1].frequency = (namco_wavedata[0x100 + ch * 8 + 0x01] & 15) << 16; - nam1.channel_list[ch1].frequency += namco_wavedata[0x100 + ch * 8 + 0x02] << 8; - nam1.channel_list[ch1].frequency += namco_wavedata[0x100 + ch * 8 + 0x03]; - break; + case 0x01: + nam1.channel_list[ch1].waveform_select = (data >> 4) & 15; + nam1.channel_list[ch1].frequency = (namco_wavedata[0x100 + ch * 8 + 0x01] & 15) << 16; + nam1.channel_list[ch1].frequency += namco_wavedata[0x100 + ch * 8 + 0x02] << 8; + nam1.channel_list[ch1].frequency += namco_wavedata[0x100 + ch * 8 + 0x03]; + break; + case 0x02: + case 0x03: + nam1.channel_list[ch1].frequency = (namco_wavedata[0x100 + ch * 8 + 0x01] & 15) << 16; + nam1.channel_list[ch1].frequency += namco_wavedata[0x100 + ch * 8 + 0x02] << 8; + nam1.channel_list[ch1].frequency += namco_wavedata[0x100 + ch * 8 + 0x03]; + break; - case 0x04: - nam1.channel_list[ch1].volume[1] = data & 0x0f; - nssw = ((data & 0x80) >> 7); - if(ch1==7) - { - ch1=0; - } - nam1.channel_list[ch1].noise_sw = nssw; - break; + case 0x04: + nam1.channel_list[ch1].volume[1] = data & 0x0f; + nssw = ((data & 0x80) >> 7); + if (ch1 == 7) + { + ch1 = 0; + } + nam1.channel_list[ch1].noise_sw = nssw; + break; } } public static void namcos1_cus30_w(int offset, byte data) @@ -251,7 +247,7 @@ namespace mame } } else if (offset < 0x140) - namcos1_sound_w(offset - 0x100,data); + namcos1_sound_w(offset - 0x100, data); else namco_wavedata[offset] = data; } diff --git a/MAME.Core/sound/OKI6295.cs b/MAME.Core/sound/OKI6295.cs index 05c5a87..d6c4684 100644 --- a/MAME.Core/sound/OKI6295.cs +++ b/MAME.Core/sound/OKI6295.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using System.IO; namespace mame @@ -38,12 +35,12 @@ namespace mame private static void compute_tables() { int[,] nbl2bit = new int[16, 4] - { - { 1, 0, 0, 0}, { 1, 0, 0, 1}, { 1, 0, 1, 0}, { 1, 0, 1, 1}, - { 1, 1, 0, 0}, { 1, 1, 0, 1}, { 1, 1, 1, 0}, { 1, 1, 1, 1}, - {-1, 0, 0, 0}, {-1, 0, 0, 1}, {-1, 0, 1, 0}, {-1, 0, 1, 1}, - {-1, 1, 0, 0}, {-1, 1, 0, 1}, {-1, 1, 1, 0}, {-1, 1, 1, 1} - }; + { + { 1, 0, 0, 0}, { 1, 0, 0, 1}, { 1, 0, 1, 0}, { 1, 0, 1, 1}, + { 1, 1, 0, 0}, { 1, 1, 0, 1}, { 1, 1, 1, 0}, { 1, 1, 1, 1}, + {-1, 0, 0, 0}, {-1, 0, 0, 1}, {-1, 0, 1, 0}, {-1, 0, 1, 1}, + {-1, 1, 0, 0}, {-1, 1, 0, 1}, {-1, 1, 1, 0}, {-1, 1, 1, 1} + }; int step, nib; for (step = 0; step <= 48; step++) { @@ -148,7 +145,7 @@ namespace mame compute_tables(); OKI.command = -1; OKI.bank_offset = 0; - OKI.master_clock = 1000000; + OKI.master_clock = 1000000; OKI.voice = new ADPCMVoice[4]; adpcm = new adpcm_state[4]; for (voice = 0; voice < 4; voice++) diff --git a/MAME.Core/sound/QSound.cs b/MAME.Core/sound/QSound.cs index 334e418..d1655c0 100644 --- a/MAME.Core/sound/QSound.cs +++ b/MAME.Core/sound/QSound.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using System.IO; namespace mame @@ -47,7 +44,7 @@ namespace mame for (i = 0; i < 33; i++) { QChip.pan_table[i] = (int)((256 / Math.Sqrt(32)) * Math.Sqrt(i)); - } + } } public static void qsound_data_h_w(byte data) { diff --git a/MAME.Core/sound/Sample.cs b/MAME.Core/sound/Sample.cs index ad7e55e..edab527 100644 --- a/MAME.Core/sound/Sample.cs +++ b/MAME.Core/sound/Sample.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using System.IO; namespace mame @@ -127,7 +124,7 @@ namespace mame } public static void samples_start() { - int i; + int i; info.numchannels = 1; info.channel = new sample_channel[info.numchannels]; for (i = 0; i < info.numchannels; i++) @@ -162,7 +159,7 @@ namespace mame info.starthandler = null; break; } - if (info.starthandler!=null) + if (info.starthandler != null) { info.starthandler(); } @@ -170,7 +167,7 @@ namespace mame public static void SaveStateBinary(BinaryWriter writer) { int i; - for (i = 0; i < info.numchannels;i++) + for (i = 0; i < info.numchannels; i++) { writer.Write(info.channel[i].source_length); writer.Write(info.channel[i].source_num); diff --git a/MAME.Core/sound/Sound.cs b/MAME.Core/sound/Sound.cs index d8da969..65a6982 100644 --- a/MAME.Core/sound/Sound.cs +++ b/MAME.Core/sound/Sound.cs @@ -17,6 +17,7 @@ namespace mame #region 抽象出去 static Action Act_BufferWirte; static Action Act_SetVolume; + static Action Act_SubmitSamples; public delegate void DGetCurrentPosition(out int play_position, out int write_position); public static event DGetCurrentPosition Act_DGetCurrentPosition; @@ -24,11 +25,13 @@ namespace mame { Act_BufferWirte -= Act_BufferWirte; Act_SetVolume -= Act_SetVolume; + Act_SubmitSamples -= Act_SubmitSamples; Act_DGetCurrentPosition -= Act_DGetCurrentPosition; Act_BufferWirte += Isp.BufferWirte; Act_SetVolume += Isp.SetVolume; + Act_SubmitSamples += Isp.SubmitSamples; Act_DGetCurrentPosition += Isp.GetCurrentPosition; } @@ -36,6 +39,12 @@ namespace mame { Act_BufferWirte?.Invoke(Off, Data); } + + static void SubmitSamples(byte[] buffer, int samples_a) + { + Act_SubmitSamples?.Invoke(buffer, samples_a); + } + public static void SetVolume(int Vol) { Act_SetVolume?.Invoke(Vol); @@ -194,7 +203,7 @@ namespace mame ICS2115.ics2115_start(); ics2115stream = new sound_stream(33075, 0, 2, ICS2115.ics2115_update); mixerstream = new sound_stream(48000, 2, 0, null); - break; + break; } break; case "PGM": @@ -239,7 +248,7 @@ namespace mame utempdata = new ushort[2]; sound_update = sound_updateTaito_tokio; sound_update_timer = Timer.timer_alloc_common(sound_update, "sound_update", false); - YM2203.ym2203_start(0,3000000); + YM2203.ym2203_start(0, 3000000); mixerstream = new sound_stream(48000, 4, 0, null); break; case "bublbobl": @@ -1197,7 +1206,7 @@ namespace mame finalmixb[sampindex * 4 + 2] = (byte)samp; finalmixb[sampindex * 4 + 3] = (byte)((samp & 0xff00) >> 8); } - osd_update_audio_stream(finalmixb, 0x3c0); + osd_update_audio_stream(finalmixb, 0x3c0); streams_updateTaito_bublbobl(); } public static void sound_updateTaito_opwolf() @@ -1727,6 +1736,12 @@ namespace mame } private static void osd_update_audio_stream(byte[] buffer, int samples_this_frame) { + ////只需要这部分逻辑 + //SubmitSamples(buffer, samples_this_frame); + //return; + + //TODO后面才考虑原样的处理 + int play_position, write_position; int stream_in; byte[] buffer1, buffer2; diff --git a/MAME.Core/sound/Streams.cs b/MAME.Core/sound/Streams.cs index f0e49e6..a717274 100644 --- a/MAME.Core/sound/Streams.cs +++ b/MAME.Core/sound/Streams.cs @@ -13,7 +13,7 @@ namespace mame public int outputs; public int output_sampindex; public int output_base_sampindex; - public int[][] streaminput,streamoutput; + public int[][] streaminput, streamoutput; private updatedelegate updatecallback; public delegate void updatedelegate(int offset, int length); public sound_stream(int _sample_rate, int _inputs, int _outputs, updatedelegate callback) @@ -93,7 +93,7 @@ namespace mame sample_rate = new_sample_rate; new_sample_rate = 0; attoseconds_per_sample = (long)1e18 / sample_rate; - max_samples_per_update = (int)((Sound.update_attoseconds + attoseconds_per_sample - 1) /attoseconds_per_sample); + max_samples_per_update = (int)((Sound.update_attoseconds + attoseconds_per_sample - 1) / attoseconds_per_sample); output_sampindex = (int)((long)output_sampindex * (long)sample_rate / old_rate); output_base_sampindex = output_sampindex - max_samples_per_update; for (i = 0; i < outputs; i++) @@ -105,13 +105,13 @@ namespace mame }; public partial class Sound { - public static int last_update_second; + public static int last_update_second; public static sound_stream ym2151stream, okistream, mixerstream; public static sound_stream qsoundstream; public static sound_stream ym2610stream; - public static sound_stream namcostream,dacstream; + public static sound_stream namcostream, dacstream; public static sound_stream ics2115stream; - public static sound_stream ym3812stream,ym3526stream,ym2413stream; + public static sound_stream ym3812stream, ym3526stream, ym2413stream; public static sound_stream iremga20stream; public static sound_stream k053260stream; public static sound_stream upd7759stream; @@ -120,9 +120,9 @@ namespace mame public static sound_stream k054539stream; public static long update_attoseconds = Attotime.ATTOSECONDS_PER_SECOND / 50; private static void generate_resampled_dataY5(int gain) - { + { int offset; - int sample0,sample1; + int sample0, sample1; long basetime; int basesample; uint basefrac; @@ -200,7 +200,7 @@ namespace mame } private static void generate_resampled_dataQ() { - int offset; + int offset; long basetime; int basesample; uint basefrac; @@ -371,7 +371,7 @@ namespace mame } } } - private static void generate_resampled_dataYM2203(int c,int gain,int minput) + private static void generate_resampled_dataYM2203(int c, int gain, int minput) { int offset; long basetime; @@ -756,7 +756,7 @@ namespace mame } } } - public static void generate_resampled_dataK053260(int gain,int minput1,int minput2) + public static void generate_resampled_dataK053260(int gain, int minput1, int minput2) { int offset; int sample0, sample1; @@ -878,7 +878,7 @@ namespace mame } } } - public static void generate_resampled_dataSample(int gain,int minput) + public static void generate_resampled_dataSample(int gain, int minput) { int offset; long basetime; @@ -1017,7 +1017,7 @@ namespace mame } public static void streams_updateC() { - Atime curtime =Timer.global_basetime; + Atime curtime = Timer.global_basetime; bool second_tick = false; if (curtime.seconds != last_update_second) { @@ -1283,7 +1283,7 @@ namespace mame k053260stream.adjuststream(second_tick); mixerstream.adjuststream(second_tick); last_update_second = curtime.seconds; - } + } private static void streams_updateKonami68000_ssriders() { Atime curtime = Timer.global_basetime; @@ -1319,7 +1319,7 @@ namespace mame } AY8910.AA8910[0].stream.adjuststream(second_tick); AY8910.AA8910[1].stream.adjuststream(second_tick); - YM2203.FF2203[0].stream.adjuststream(second_tick); + YM2203.FF2203[0].stream.adjuststream(second_tick); YM2203.FF2203[1].stream.adjuststream(second_tick); mixerstream.adjuststream(second_tick); last_update_second = curtime.seconds; diff --git a/MAME.Core/sound/Taitosnd.cs b/MAME.Core/sound/Taitosnd.cs index ca0a59f..6cd2e69 100644 --- a/MAME.Core/sound/Taitosnd.cs +++ b/MAME.Core/sound/Taitosnd.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; +using System.IO; namespace mame { @@ -30,16 +26,16 @@ namespace mame tc0140syt.status = 0; tc0140syt.nmi_enabled = 0; tc0140syt.nmi_req = 0; - TC0140SYT_PORT01_FULL=0x01; - TC0140SYT_PORT23_FULL=0x02; - TC0140SYT_PORT01_FULL_MASTER=0x04; - TC0140SYT_PORT23_FULL_MASTER=0x08; + TC0140SYT_PORT01_FULL = 0x01; + TC0140SYT_PORT23_FULL = 0x02; + TC0140SYT_PORT01_FULL_MASTER = 0x04; + TC0140SYT_PORT23_FULL_MASTER = 0x08; } public static void Interrupt_Controller() { - if ((tc0140syt.nmi_req!=0) && (tc0140syt.nmi_enabled!= 0)) + if ((tc0140syt.nmi_req != 0) && (tc0140syt.nmi_enabled != 0)) { - Cpuint.cpunum_set_input_line(1,(int)LineState.INPUT_LINE_NMI,LineState.PULSE_LINE); + Cpuint.cpunum_set_input_line(1, (int)LineState.INPUT_LINE_NMI, LineState.PULSE_LINE); tc0140syt.nmi_req = 0; } } @@ -91,24 +87,24 @@ namespace mame switch (tc0140syt.mainmode) { case 0x00: // mode #0 - result= tc0140syt.masterdata[tc0140syt.mainmode++]; + result = tc0140syt.masterdata[tc0140syt.mainmode++]; break; case 0x01: // mode #1 tc0140syt.status &= (byte)(~TC0140SYT_PORT01_FULL_MASTER); - result= tc0140syt.masterdata[tc0140syt.mainmode++]; + result = tc0140syt.masterdata[tc0140syt.mainmode++]; break; case 0x02: // mode #2 - result= tc0140syt.masterdata[tc0140syt.mainmode++]; + result = tc0140syt.masterdata[tc0140syt.mainmode++]; break; case 0x03: // mode #3 tc0140syt.status &= (byte)(~TC0140SYT_PORT23_FULL_MASTER); - result= tc0140syt.masterdata[tc0140syt.mainmode++]; + result = tc0140syt.masterdata[tc0140syt.mainmode++]; break; case 0x04: // port status - result= tc0140syt.status; + result = tc0140syt.status; break; default: - result= 0; + result = 0; break; } return result; @@ -180,17 +176,17 @@ namespace mame } Interrupt_Controller(); return res; - } + } public static void taitosound_port16_msb_w(ushort data) { //if (ACCESSING_BITS_8_15) - taitosound_port_w(0, (byte)(data >> 8)); + taitosound_port_w(0, (byte)(data >> 8)); } public static void taitosound_port16_msb_w1(byte data) { //if (ACCESSING_BITS_8_15) taitosound_port_w(0, data); - } + } public static void taitosound_comm16_msb_w(ushort data) { //if (ACCESSING_BITS_8_15) diff --git a/MAME.Core/sound/Upd7759.cs b/MAME.Core/sound/Upd7759.cs index 70d79f4..f4e2ee4 100644 --- a/MAME.Core/sound/Upd7759.cs +++ b/MAME.Core/sound/Upd7759.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; +using System.IO; namespace mame { @@ -44,22 +40,22 @@ namespace mame } public static int[,] upd7759_step = new int[16, 16] { - { 0, 0, 1, 2, 3, 5, 7, 10, 0, 0, -1, -2, -3, -5, -7, -10 }, - { 0, 1, 2, 3, 4, 6, 8, 13, 0, -1, -2, -3, -4, -6, -8, -13 }, - { 0, 1, 2, 4, 5, 7, 10, 15, 0, -1, -2, -4, -5, -7, -10, -15 }, - { 0, 1, 3, 4, 6, 9, 13, 19, 0, -1, -3, -4, -6, -9, -13, -19 }, - { 0, 2, 3, 5, 8, 11, 15, 23, 0, -2, -3, -5, -8, -11, -15, -23 }, - { 0, 2, 4, 7, 10, 14, 19, 29, 0, -2, -4, -7, -10, -14, -19, -29 }, - { 0, 3, 5, 8, 12, 16, 22, 33, 0, -3, -5, -8, -12, -16, -22, -33 }, - { 1, 4, 7, 10, 15, 20, 29, 43, -1, -4, -7, -10, -15, -20, -29, -43 }, - { 1, 4, 8, 13, 18, 25, 35, 53, -1, -4, -8, -13, -18, -25, -35, -53 }, - { 1, 6, 10, 16, 22, 31, 43, 64, -1, -6, -10, -16, -22, -31, -43, -64 }, - { 2, 7, 12, 19, 27, 37, 51, 76, -2, -7, -12, -19, -27, -37, -51, -76 }, - { 2, 9, 16, 24, 34, 46, 64, 96, -2, -9, -16, -24, -34, -46, -64, -96 }, - { 3, 11, 19, 29, 41, 57, 79, 117, -3, -11, -19, -29, -41, -57, -79, -117 }, - { 4, 13, 24, 36, 50, 69, 96, 143, -4, -13, -24, -36, -50, -69, -96, -143 }, - { 4, 16, 29, 44, 62, 85, 118, 175, -4, -16, -29, -44, -62, -85, -118, -175 }, - { 6, 20, 36, 54, 76, 104, 144, 214, -6, -20, -36, -54, -76, -104, -144, -214 }, + { 0, 0, 1, 2, 3, 5, 7, 10, 0, 0, -1, -2, -3, -5, -7, -10 }, + { 0, 1, 2, 3, 4, 6, 8, 13, 0, -1, -2, -3, -4, -6, -8, -13 }, + { 0, 1, 2, 4, 5, 7, 10, 15, 0, -1, -2, -4, -5, -7, -10, -15 }, + { 0, 1, 3, 4, 6, 9, 13, 19, 0, -1, -3, -4, -6, -9, -13, -19 }, + { 0, 2, 3, 5, 8, 11, 15, 23, 0, -2, -3, -5, -8, -11, -15, -23 }, + { 0, 2, 4, 7, 10, 14, 19, 29, 0, -2, -4, -7, -10, -14, -19, -29 }, + { 0, 3, 5, 8, 12, 16, 22, 33, 0, -3, -5, -8, -12, -16, -22, -33 }, + { 1, 4, 7, 10, 15, 20, 29, 43, -1, -4, -7, -10, -15, -20, -29, -43 }, + { 1, 4, 8, 13, 18, 25, 35, 53, -1, -4, -8, -13, -18, -25, -35, -53 }, + { 1, 6, 10, 16, 22, 31, 43, 64, -1, -6, -10, -16, -22, -31, -43, -64 }, + { 2, 7, 12, 19, 27, 37, 51, 76, -2, -7, -12, -19, -27, -37, -51, -76 }, + { 2, 9, 16, 24, 34, 46, 64, 96, -2, -9, -16, -24, -34, -46, -64, -96 }, + { 3, 11, 19, 29, 41, 57, 79, 117, -3, -11, -19, -29, -41, -57, -79, -117 }, + { 4, 13, 24, 36, 50, 69, 96, 143, -4, -13, -24, -36, -50, -69, -96, -143 }, + { 4, 16, 29, 44, 62, 85, 118, 175, -4, -16, -29, -44, -62, -85, -118, -175 }, + { 6, 20, 36, 54, 76, 104, 144, 214, -6, -20, -36, -54, -76, -104, -144, -214 }, }; public static int[] upd7759_state = new int[16] { -1, -1, 0, 0, 1, 2, 2, 3, -1, -1, 0, 0, 1, 2, 2, 3 }; public static upd7759_chip chip; diff --git a/MAME.Core/sound/WavWrite.cs b/MAME.Core/sound/WavWrite.cs index 4c423e0..e7d66f0 100644 --- a/MAME.Core/sound/WavWrite.cs +++ b/MAME.Core/sound/WavWrite.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; +using System.IO; namespace mame { diff --git a/MAME.Core/sound/YM2151.cs b/MAME.Core/sound/YM2151.cs index e5f6882..626838b 100644 --- a/MAME.Core/sound/YM2151.cs +++ b/MAME.Core/sound/YM2151.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using System.IO; namespace mame @@ -111,7 +108,7 @@ namespace mame public int sampfreq; public irqhandler irqhandler; public porthandler porthandler; - }; + }; private static int[] iconnect = new int[32], imem = new int[32];//m2=8,c1=9,c2=10,mem=11,null=12 private static int[] tl_tab = new int[13 * 2 * 0x100]; private static uint[] sin_tab = new uint[0x400]; @@ -142,7 +139,7 @@ namespace mame 16,16,16,16,16,16,16,16, 0,0, 0,0, 0,0, 0,0, }; - + private static uint[] dt2_tab = new uint[4] { 0, 384, 500, 608 }; private static ushort[] phaseinc_rom = new ushort[768]{ @@ -220,7 +217,7 @@ namespace mame public static int[] chanout = new int[12]; public delegate void irqhandler(int irq); public delegate void porthandler(int offset, byte data); - + private static void init_tables() { int i, x, n; @@ -420,7 +417,7 @@ namespace mame int oldstate = PSG.irqlinestate; PSG.irqlinestate |= 1; if (oldstate == 0) - { + { PSG.irqhandler(1); } } diff --git a/MAME.Core/sound/YM2203.cs b/MAME.Core/sound/YM2203.cs index 1f40e95..085fd6e 100644 --- a/MAME.Core/sound/YM2203.cs +++ b/MAME.Core/sound/YM2203.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; +using System.IO; namespace mame { @@ -52,7 +48,7 @@ namespace mame FF2203[sndindex].OPN.type = FM.TYPE_YM2203; FF2203[sndindex].OPN.ST.clock = clock; FF2203[sndindex].OPN.ST.rate = rate; - FF2203[sndindex].OPN.ST.timer_handler = FF2203[sndindex].timer_handler; + FF2203[sndindex].OPN.ST.timer_handler = FF2203[sndindex].timer_handler; switch (Machine.sBoard) { case "Data East": @@ -100,7 +96,7 @@ namespace mame FF2203[sndindex].OPN.ST.IRQ_Handler = Taito.irqhandler; FF2203[sndindex].OPN.ST.SSG.set_clock = AY8910.AA8910[sndindex].ay8910_set_clock_ym; FF2203[sndindex].OPN.ST.SSG.write = AY8910.AA8910[sndindex].ay8910_write_ym; - FF2203[sndindex].OPN.ST.SSG.read= AY8910.AA8910[sndindex].ay8910_read_ym; + FF2203[sndindex].OPN.ST.SSG.read = AY8910.AA8910[sndindex].ay8910_read_ym; FF2203[sndindex].OPN.ST.SSG.reset = AY8910.AA8910[sndindex].ay8910_reset_ym; break; } @@ -160,11 +156,11 @@ namespace mame } public static byte ym2203_status_port_0_r() { - return FF2203[0].ym2203_read(0,0); + return FF2203[0].ym2203_read(0, 0); } public static byte ym2203_read_port_0_r() { - return FF2203[0].ym2203_read(0,1); + return FF2203[0].ym2203_read(0, 1); } public static void ym2203_control_port_0_w(byte data) { @@ -217,7 +213,7 @@ namespace mame OPN.FM_BUSY_SET(1); } } - public byte ym2203_read(int chip,int a) + public byte ym2203_read(int chip, int a) { int addr = OPN.ST.address; byte ret = 0; diff --git a/MAME.Core/sound/YM2413.cs b/MAME.Core/sound/YM2413.cs index a4f6a17..c0a68ab 100644 --- a/MAME.Core/sound/YM2413.cs +++ b/MAME.Core/sound/YM2413.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; namespace mame { @@ -94,45 +91,45 @@ namespace mame } private static uint[] ksl_tab = new uint[8 * 16] { - 0,0,0,0, - 0,0,0,0, - 0,0,0,0, - 0,0,0,0, + 0,0,0,0, + 0,0,0,0, + 0,0,0,0, + 0,0,0,0, - 0,0,0,0, - 0,0,0,0, - 0,4,6,8, - 10,12,14,16, + 0,0,0,0, + 0,0,0,0, + 0,4,6,8, + 10,12,14,16, - 0,0,0,0, - 0,6,10,14, - 16,20,22,24, - 26,28,30,32, + 0,0,0,0, + 0,6,10,14, + 16,20,22,24, + 26,28,30,32, 0,0,0,10, - 16,22,26,30, - 32,36,38,40, - 42,44,46,48, + 16,22,26,30, + 32,36,38,40, + 42,44,46,48, - 0,0,16,26, - 32,38,42,46, - 48,52,54,56, - 58,60,62,64, + 0,0,16,26, + 32,38,42,46, + 48,52,54,56, + 58,60,62,64, - 0,16,32,42, - 48,54,58,62, - 64,68,70,72, - 74,76,78,80, + 0,16,32,42, + 48,54,58,62, + 64,68,70,72, + 74,76,78,80, - 0,32,48,58, - 64,70,74,78, - 80,84,86,88, - 90,92,94,96, + 0,32,48,58, + 64,70,74,78, + 80,84,86,88, + 90,92,94,96, - 0,48,64,74, - 80,86,90,94, - 96,100,102,104, - 106,108,110,112 + 0,48,64,74, + 80,86,90,94, + 96,100,102,104, + 106,108,110,112 }; private static uint[] sl_tab = new uint[16] { @@ -1177,7 +1174,7 @@ namespace mame chan_calc(3); chan_calc(4); chan_calc(5); - if (rhythm==0) + if (rhythm == 0) { chan_calc(6); chan_calc(7); diff --git a/MAME.Core/sound/YM2610.cs b/MAME.Core/sound/YM2610.cs index 1faaefd..5328fd0 100644 --- a/MAME.Core/sound/YM2610.cs +++ b/MAME.Core/sound/YM2610.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; +using System.IO; namespace mame { @@ -12,7 +8,7 @@ namespace mame public FM.FM_OPN OPN; public byte addr_A1; public byte[] pcmbuf; - public int pcm_size; + public int pcm_size; public byte adpcmTL; public FM.ADPCM_CH[] adpcm; public byte[] adpcmreg; diff --git a/MAME.Core/sound/YM3812.cs b/MAME.Core/sound/YM3812.cs index d9eb875..b515498 100644 --- a/MAME.Core/sound/YM3812.cs +++ b/MAME.Core/sound/YM3812.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.IO; -using System.Text; +using System.IO; namespace mame { diff --git a/MAME.Core/sound/YMDeltat.cs b/MAME.Core/sound/YMDeltat.cs index f082161..74a463d 100644 --- a/MAME.Core/sound/YMDeltat.cs +++ b/MAME.Core/sound/YMDeltat.cs @@ -1,10 +1,5 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace mame -{ +namespace mame +{ public class YMDeltat { public struct YM_DELTAT @@ -50,7 +45,7 @@ namespace mame private static int YM_DELTAT_DELTA_DEF = 127; private static int YM_DELTAT_DECODE_RANGE = 32768; private static int YM_DELTAT_DECODE_MIN = -YM_DELTAT_DECODE_RANGE; - private static int YM_DELTAT_DECODE_MAX = YM_DELTAT_DECODE_RANGE - 1; + private static int YM_DELTAT_DECODE_MAX = YM_DELTAT_DECODE_RANGE - 1; private static int[] ym_deltat_decode_tableB1 = new int[16]{ 1, 3, 5, 7, 9, 11, 13, 15, -1, -3, -5, -7, -9, -11, -13, -15, @@ -337,9 +332,9 @@ namespace mame DELTAT.now_addr &= ((1 << (24 + 1)) - 1); DELTAT.prev_acc = DELTAT.acc; DELTAT.acc += (ym_deltat_decode_tableB1[data] * DELTAT.adpcmd / 8); - DELTAT.acc=Limit(DELTAT.acc, YM_DELTAT_DECODE_MAX, YM_DELTAT_DECODE_MIN); + DELTAT.acc = Limit(DELTAT.acc, YM_DELTAT_DECODE_MAX, YM_DELTAT_DECODE_MIN); DELTAT.adpcmd = (DELTAT.adpcmd * ym_deltat_decode_tableB2[data]) / 64; - DELTAT.adpcmd=Limit(DELTAT.adpcmd, YM_DELTAT_DELTA_MAX, YM_DELTAT_DELTA_MIN); + DELTAT.adpcmd = Limit(DELTAT.adpcmd, YM_DELTAT_DELTA_MAX, YM_DELTAT_DELTA_MIN); } while ((--step) != 0); } DELTAT.adpcml = DELTAT.prev_acc * (int)((1 << 16) - DELTAT.now_step); @@ -362,8 +357,8 @@ namespace mame { data = DELTAT.now_data & 0x0f; DELTAT.now_data = DELTAT.CPU_data; - if(DELTAT.status_set_handler!=null) - if(DELTAT.status_change_BRDY_bit!=0) + if (DELTAT.status_set_handler != null) + if (DELTAT.status_change_BRDY_bit != 0) DELTAT.status_set_handler(DELTAT.status_change_BRDY_bit); } else @@ -373,9 +368,9 @@ namespace mame DELTAT.now_addr++; DELTAT.prev_acc = DELTAT.acc; DELTAT.acc += (ym_deltat_decode_tableB1[data] * DELTAT.adpcmd / 8); - DELTAT.acc=Limit(DELTAT.acc, YM_DELTAT_DECODE_MAX, YM_DELTAT_DECODE_MIN); + DELTAT.acc = Limit(DELTAT.acc, YM_DELTAT_DECODE_MAX, YM_DELTAT_DECODE_MIN); DELTAT.adpcmd = (DELTAT.adpcmd * ym_deltat_decode_tableB2[data]) / 64; - DELTAT.adpcmd=Limit(DELTAT.adpcmd, YM_DELTAT_DELTA_MAX, YM_DELTAT_DELTA_MIN); + DELTAT.adpcmd = Limit(DELTAT.adpcmd, YM_DELTAT_DELTA_MAX, YM_DELTAT_DELTA_MIN); } while ((--step) != 0); } DELTAT.adpcml = DELTAT.prev_acc * (int)((1 << 16) - DELTAT.now_step);