diff options
author | Ryan Holtz <rholtz@batcountryentertainment.com> | 2009-08-26 21:20:40 +0000 |
---|---|---|
committer | Ryan Holtz <rholtz@batcountryentertainment.com> | 2009-08-26 21:20:40 +0000 |
commit | a74320aeca9b794d683eef5c90f58434dee2181b (patch) | |
tree | f647be73e32561bf06c66baefd58a405b1d3c8c7 | |
parent | 0813bcd771b8a5ed0c6498c4512ccc25055987ea (diff) |
Removing CX4 support until the license situation can be verified and corrected as necessary. [no whatsnew]
-rw-r--r-- | .gitattributes | 6 | ||||
-rw-r--r-- | src/mame/machine/cx4data.c | 192 | ||||
-rw-r--r-- | src/mame/machine/cx4fn.c | 322 | ||||
-rw-r--r-- | src/mame/machine/cx4oam.c | 299 | ||||
-rw-r--r-- | src/mame/machine/cx4ops.c | 270 | ||||
-rw-r--r-- | src/mame/machine/snescx4.c | 235 | ||||
-rw-r--r-- | src/mame/machine/snescx4.h | 82 | ||||
-rw-r--r-- | src/mame/mame.mak | 7 |
8 files changed, 1 insertions, 1412 deletions
diff --git a/.gitattributes b/.gitattributes index c52556788ca..077945ff3a8 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2743,10 +2743,6 @@ src/mame/machine/chaknpop.c svneol=native#text/plain src/mame/machine/copsnrob.c svneol=native#text/plain src/mame/machine/cps2crpt.c svneol=native#text/plain src/mame/machine/cubocd32.c svneol=native#text/plain -src/mame/machine/cx4data.c svneol=native#text/plain -src/mame/machine/cx4fn.c svneol=native#text/plain -src/mame/machine/cx4oam.c svneol=native#text/plain -src/mame/machine/cx4ops.c svneol=native#text/plain src/mame/machine/daikaiju.c svneol=native#text/plain src/mame/machine/dc.c svneol=native#text/plain src/mame/machine/dec0.c svneol=native#text/plain @@ -2873,8 +2869,6 @@ src/mame/machine/slapfght.c svneol=native#text/plain src/mame/machine/slapstic.c svneol=native#text/plain src/mame/machine/slikshot.c svneol=native#text/plain src/mame/machine/snes.c svneol=native#text/plain -src/mame/machine/snescx4.c svneol=native#text/plain -src/mame/machine/snescx4.h svneol=native#text/plain src/mame/machine/snesdsp1.c svneol=native#text/plain src/mame/machine/snesdsp2.c svneol=native#text/plain src/mame/machine/snesobc1.c svneol=native#text/plain diff --git a/src/mame/machine/cx4data.c b/src/mame/machine/cx4data.c deleted file mode 100644 index 0d6d4ce564b..00000000000 --- a/src/mame/machine/cx4data.c +++ /dev/null @@ -1,192 +0,0 @@ -#ifdef CX4_C - -const UINT8 CX4_immediate_data[48] = -{ - 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0xff, - 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x80, 0xff, 0xff, 0x7f, - 0x00, 0x80, 0x00, 0xff, 0x7f, 0x00, 0xff, 0x7f, 0xff, 0x7f, 0xff, 0xff, - 0x00, 0x00, 0x01, 0xff, 0xff, 0xfe, 0x00, 0x01, 0x00, 0xff, 0xfe, 0x00 -}; - -const UINT16 CX4_wave_data[40] = -{ - 0x0000, 0x0002, 0x0004, 0x0006, 0x0008, 0x000a, 0x000c, 0x000e, - 0x0200, 0x0202, 0x0204, 0x0206, 0x0208, 0x020a, 0x020c, 0x020e, - 0x0400, 0x0402, 0x0404, 0x0406, 0x0408, 0x040a, 0x040c, 0x040e, - 0x0600, 0x0602, 0x0604, 0x0606, 0x0608, 0x060a, 0x060c, 0x060e, - 0x0800, 0x0802, 0x0804, 0x0806, 0x0808, 0x080a, 0x080c, 0x080e -}; - -const UINT32 CX4_sin_table[256] = -{ - 0x000000, 0x000324, 0x000648, 0x00096c, 0x000c8f, 0x000fb2, 0x0012d5, 0x0015f6, - 0x001917, 0x001c37, 0x001f56, 0x002273, 0x002590, 0x0028aa, 0x002bc4, 0x002edb, - 0x0031f1, 0x003505, 0x003817, 0x003b26, 0x003e33, 0x00413e, 0x004447, 0x00474d, - 0x004a50, 0x004d50, 0x00504d, 0x005347, 0x00563e, 0x005931, 0x005c22, 0x005f0e, - 0x0061f7, 0x0064dc, 0x0067bd, 0x006a9b, 0x006d74, 0x007049, 0x007319, 0x0075e5, - 0x0078ad, 0x007b70, 0x007e2e, 0x0080e7, 0x00839c, 0x00864b, 0x0088f5, 0x008b9a, - 0x008e39, 0x0090d3, 0x009368, 0x0095f6, 0x00987f, 0x009b02, 0x009d7f, 0x009ff6, - 0x00a267, 0x00a4d2, 0x00a736, 0x00a994, 0x00abeb, 0x00ae3b, 0x00b085, 0x00b2c8, - 0x00b504, 0x00b73a, 0x00b968, 0x00bb8f, 0x00bdae, 0x00bfc7, 0x00c1d8, 0x00c3e2, - 0x00c5e4, 0x00c7de, 0x00c9d1, 0x00cbbb, 0x00cd9f, 0x00cf7a, 0x00d14d, 0x00d318, - 0x00d4db, 0x00d695, 0x00d848, 0x00d9f2, 0x00db94, 0x00dd2d, 0x00debe, 0x00e046, - 0x00e1c5, 0x00e33c, 0x00e4aa, 0x00e60f, 0x00e76b, 0x00e8bf, 0x00ea09, 0x00eb4b, - 0x00ec83, 0x00edb2, 0x00eed8, 0x00eff5, 0x00f109, 0x00f213, 0x00f314, 0x00f40b, - 0x00f4fa, 0x00f5de, 0x00f6ba, 0x00f78b, 0x00f853, 0x00f912, 0x00f9c7, 0x00fa73, - 0x00fb14, 0x00fbac, 0x00fc3b, 0x00fcbf, 0x00fd3a, 0x00fdab, 0x00fe13, 0x00fe70, - 0x00fec4, 0x00ff0e, 0x00ff4e, 0x00ff84, 0x00ffb1, 0x00ffd3, 0x00ffec, 0x00fffb, - 0x000000, 0xfffcdb, 0xfff9b7, 0xfff693, 0xfff370, 0xfff04d, 0xffed2a, 0xffea09, - 0xffe6e8, 0xffe3c8, 0xffe0a9, 0xffdd8c, 0xffda6f, 0xffd755, 0xffd43b, 0xffd124, - 0xffce0e, 0xffcafa, 0xffc7e8, 0xffc4d9, 0xffc1cc, 0xffbec1, 0xffbbb8, 0xffb8b2, - 0xffb5af, 0xffb2af, 0xffafb2, 0xffacb8, 0xffa9c1, 0xffa6ce, 0xffa3dd, 0xffa0f1, - 0xff9e08, 0xff9b23, 0xff9842, 0xff9564, 0xff928b, 0xff8fb6, 0xff8ce6, 0xff8a1a, - 0xff8752, 0xff848f, 0xff81d1, 0xff7f18, 0xff7c63, 0xff79b4, 0xff770a, 0xff7465, - 0xff71c6, 0xff6f2c, 0xff6c97, 0xff6a09, 0xff6780, 0xff64fd, 0xff6280, 0xff6009, - 0xff5d98, 0xff5b2d, 0xff58c9, 0xff566b, 0xff5414, 0xff51c4, 0xff4f7a, 0xff4d37, - 0xff4afb, 0xff48c5, 0xff4697, 0xff4470, 0xff4251, 0xff4038, 0xff3e27, 0xff3c1e, - 0xff3a1b, 0xff3821, 0xff362e, 0xff3444, 0xff3260, 0xff3085, 0xff2eb2, 0xff2ce7, - 0xff2b24, 0xff296a, 0xff27b7, 0xff260d, 0xff246b, 0xff22d2, 0xff2141, 0xff1fb9, - 0xff1e3a, 0xff1cc3, 0xff1b55, 0xff19f0, 0xff1894, 0xff1740, 0xff15f6, 0xff14b4, - 0xff137c, 0xff124d, 0xff1127, 0xff100a, 0xff0ef6, 0xff0dec, 0xff0ceb, 0xff0bf4, - 0xff0b05, 0xff0a21, 0xff0945, 0xff0874, 0xff07ac, 0xff06ed, 0xff0638, 0xff058d, - 0xff04eb, 0xff0453, 0xff03c4, 0xff0340, 0xff02c5, 0xff0254, 0xff01ec, 0xff018f, - 0xff013b, 0xff00f1, 0xff00b1, 0xff007b, 0xff004e, 0xff002c, 0xff0013, 0xff0004 -}; - -const INT16 CX4_SinTable[512] = -{ - 0, 402, 804, 1206, 1607, 2009, 2410, 2811, - 3211, 3611, 4011, 4409, 4808, 5205, 5602, 5997, - 6392, 6786, 7179, 7571, 7961, 8351, 8739, 9126, - 9512, 9896, 10278, 10659, 11039, 11416, 11793, 12167, - 12539, 12910, 13278, 13645, 14010, 14372, 14732, 15090, - 15446, 15800, 16151, 16499, 16846, 17189, 17530, 17869, - 18204, 18537, 18868, 19195, 19519, 19841, 20159, 20475, - 20787, 21097, 21403, 21706, 22005, 22301, 22594, 22884, - 23170, 23453, 23732, 24007, 24279, 24547, 24812, 25073, - 25330, 25583, 25832, 26077, 26319, 26557, 26790, 27020, - 27245, 27466, 27684, 27897, 28106, 28310, 28511, 28707, - 28898, 29086, 29269, 29447, 29621, 29791, 29956, 30117, - 30273, 30425, 30572, 30714, 30852, 30985, 31114, 31237, - 31357, 31471, 31581, 31685, 31785, 31881, 31971, 32057, - 32138, 32214, 32285, 32351, 32413, 32469, 32521, 32568, - 32610, 32647, 32679, 32706, 32728, 32745, 32758, 32765, - 32767, 32765, 32758, 32745, 32728, 32706, 32679, 32647, - 32610, 32568, 32521, 32469, 32413, 32351, 32285, 32214, - 32138, 32057, 31971, 31881, 31785, 31685, 31581, 31471, - 31357, 31237, 31114, 30985, 30852, 30714, 30572, 30425, - 30273, 30117, 29956, 29791, 29621, 29447, 29269, 29086, - 28898, 28707, 28511, 28310, 28106, 27897, 27684, 27466, - 27245, 27020, 26790, 26557, 26319, 26077, 25832, 25583, - 25330, 25073, 24812, 24547, 24279, 24007, 23732, 23453, - 23170, 22884, 22594, 22301, 22005, 21706, 21403, 21097, - 20787, 20475, 20159, 19841, 19519, 19195, 18868, 18537, - 18204, 17869, 17530, 17189, 16846, 16499, 16151, 15800, - 15446, 15090, 14732, 14372, 14010, 13645, 13278, 12910, - 12539, 12167, 11793, 11416, 11039, 10659, 10278, 9896, - 9512, 9126, 8739, 8351, 7961, 7571, 7179, 6786, - 6392, 5997, 5602, 5205, 4808, 4409, 4011, 3611, - 3211, 2811, 2410, 2009, 1607, 1206, 804, 402, - 0, -402, -804, -1206, -1607, -2009, -2410, -2811, - -3211, -3611, -4011, -4409, -4808, -5205, -5602, -5997, - -6392, -6786, -7179, -7571, -7961, -8351, -8739, -9126, - -9512, -9896, -10278, -10659, -11039, -11416, -11793, -12167, - -12539, -12910, -13278, -13645, -14010, -14372, -14732, -15090, - -15446, -15800, -16151, -16499, -16846, -17189, -17530, -17869, - -18204, -18537, -18868, -19195, -19519, -19841, -20159, -20475, - -20787, -21097, -21403, -21706, -22005, -22301, -22594, -22884, - -23170, -23453, -23732, -24007, -24279, -24547, -24812, -25073, - -25330, -25583, -25832, -26077, -26319, -26557, -26790, -27020, - -27245, -27466, -27684, -27897, -28106, -28310, -28511, -28707, - -28898, -29086, -29269, -29447, -29621, -29791, -29956, -30117, - -30273, -30425, -30572, -30714, -30852, -30985, -31114, -31237, - -31357, -31471, -31581, -31685, -31785, -31881, -31971, -32057, - -32138, -32214, -32285, -32351, -32413, -32469, -32521, -32568, - -32610, -32647, -32679, -32706, -32728, -32745, -32758, -32765, - -32767, -32765, -32758, -32745, -32728, -32706, -32679, -32647, - -32610, -32568, -32521, -32469, -32413, -32351, -32285, -32214, - -32138, -32057, -31971, -31881, -31785, -31685, -31581, -31471, - -31357, -31237, -31114, -30985, -30852, -30714, -30572, -30425, - -30273, -30117, -29956, -29791, -29621, -29447, -29269, -29086, - -28898, -28707, -28511, -28310, -28106, -27897, -27684, -27466, - -27245, -27020, -26790, -26557, -26319, -26077, -25832, -25583, - -25330, -25073, -24812, -24547, -24279, -24007, -23732, -23453, - -23170, -22884, -22594, -22301, -22005, -21706, -21403, -21097, - -20787, -20475, -20159, -19841, -19519, -19195, -18868, -18537, - -18204, -17869, -17530, -17189, -16846, -16499, -16151, -15800, - -15446, -15090, -14732, -14372, -14010, -13645, -13278, -12910, - -12539, -12167, -11793, -11416, -11039, -10659, -10278, -9896, - -9512, -9126, -8739, -8351, -7961, -7571, -7179, -6786, - -6392, -5997, -5602, -5205, -4808, -4409, -4011, -3611, - -3211, -2811, -2410, -2009, -1607, -1206, -804, -402 -}; - -const INT16 CX4_CosTable[512] = -{ - 32767, 32765, 32758, 32745, 32728, 32706, 32679, 32647, - 32610, 32568, 32521, 32469, 32413, 32351, 32285, 32214, - 32138, 32057, 31971, 31881, 31785, 31685, 31581, 31471, - 31357, 31237, 31114, 30985, 30852, 30714, 30572, 30425, - 30273, 30117, 29956, 29791, 29621, 29447, 29269, 29086, - 28898, 28707, 28511, 28310, 28106, 27897, 27684, 27466, - 27245, 27020, 26790, 26557, 26319, 26077, 25832, 25583, - 25330, 25073, 24812, 24547, 24279, 24007, 23732, 23453, - 23170, 22884, 22594, 22301, 22005, 21706, 21403, 21097, - 20787, 20475, 20159, 19841, 19519, 19195, 18868, 18537, - 18204, 17869, 17530, 17189, 16846, 16499, 16151, 15800, - 15446, 15090, 14732, 14372, 14010, 13645, 13278, 12910, - 12539, 12167, 11793, 11416, 11039, 10659, 10278, 9896, - 9512, 9126, 8739, 8351, 7961, 7571, 7179, 6786, - 6392, 5997, 5602, 5205, 4808, 4409, 4011, 3611, - 3211, 2811, 2410, 2009, 1607, 1206, 804, 402, - 0, -402, -804, -1206, -1607, -2009, -2410, -2811, - -3211, -3611, -4011, -4409, -4808, -5205, -5602, -5997, - -6392, -6786, -7179, -7571, -7961, -8351, -8739, -9126, - -9512, -9896, -10278, -10659, -11039, -11416, -11793, -12167, - -12539, -12910, -13278, -13645, -14010, -14372, -14732, -15090, - -15446, -15800, -16151, -16499, -16846, -17189, -17530, -17869, - -18204, -18537, -18868, -19195, -19519, -19841, -20159, -20475, - -20787, -21097, -21403, -21706, -22005, -22301, -22594, -22884, - -23170, -23453, -23732, -24007, -24279, -24547, -24812, -25073, - -25330, -25583, -25832, -26077, -26319, -26557, -26790, -27020, - -27245, -27466, -27684, -27897, -28106, -28310, -28511, -28707, - -28898, -29086, -29269, -29447, -29621, -29791, -29956, -30117, - -30273, -30425, -30572, -30714, -30852, -30985, -31114, -31237, - -31357, -31471, -31581, -31685, -31785, -31881, -31971, -32057, - -32138, -32214, -32285, -32351, -32413, -32469, -32521, -32568, - -32610, -32647, -32679, -32706, -32728, -32745, -32758, -32765, - -32767, -32765, -32758, -32745, -32728, -32706, -32679, -32647, - -32610, -32568, -32521, -32469, -32413, -32351, -32285, -32214, - -32138, -32057, -31971, -31881, -31785, -31685, -31581, -31471, - -31357, -31237, -31114, -30985, -30852, -30714, -30572, -30425, - -30273, -30117, -29956, -29791, -29621, -29447, -29269, -29086, - -28898, -28707, -28511, -28310, -28106, -27897, -27684, -27466, - -27245, -27020, -26790, -26557, -26319, -26077, -25832, -25583, - -25330, -25073, -24812, -24547, -24279, -24007, -23732, -23453, - -23170, -22884, -22594, -22301, -22005, -21706, -21403, -21097, - -20787, -20475, -20159, -19841, -19519, -19195, -18868, -18537, - -18204, -17869, -17530, -17189, -16846, -16499, -16151, -15800, - -15446, -15090, -14732, -14372, -14010, -13645, -13278, -12910, - -12539, -12167, -11793, -11416, -11039, -10659, -10278, -9896, - -9512, -9126, -8739, -8351, -7961, -7571, -7179, -6786, - -6392, -5997, -5602, -5205, -4808, -4409, -4011, -3611, - -3211, -2811, -2410, -2009, -1607, -1206, -804, -402, - 0, 402, 804, 1206, 1607, 2009, 2410, 2811, - 3211, 3611, 4011, 4409, 4808, 5205, 5602, 5997, - 6392, 6786, 7179, 7571, 7961, 8351, 8739, 9126, - 9512, 9896, 10278, 10659, 11039, 11416, 11793, 12167, - 12539, 12910, 13278, 13645, 14010, 14372, 14732, 15090, - 15446, 15800, 16151, 16499, 16846, 17189, 17530, 17869, - 18204, 18537, 18868, 19195, 19519, 19841, 20159, 20475, - 20787, 21097, 21403, 21706, 22005, 22301, 22594, 22884, - 23170, 23453, 23732, 24007, 24279, 24547, 24812, 25073, - 25330, 25583, 25832, 26077, 26319, 26557, 26790, 27020, - 27245, 27466, 27684, 27897, 28106, 28310, 28511, 28707, - 28898, 29086, 29269, 29447, 29621, 29791, 29956, 30117, - 30273, 30425, 30572, 30714, 30852, 30985, 31114, 31237, - 31357, 31471, 31581, 31685, 31785, 31881, 31971, 32057, - 32138, 32214, 32285, 32351, 32413, 32469, 32521, 32568, - 32610, 32647, 32679, 32706, 32728, 32745, 32758, 32765 -}; - -#endif diff --git a/src/mame/machine/cx4fn.c b/src/mame/machine/cx4fn.c deleted file mode 100644 index 7d5de1a18bd..00000000000 --- a/src/mame/machine/cx4fn.c +++ /dev/null @@ -1,322 +0,0 @@ -#ifdef CX4_C - -#include <math.h> -#define CX4_Tan(a) (CX4_CosTable[a] ? ((((INT32)CX4_SinTable[a]) << 16) / CX4_CosTable[a]) : 0x80000000) -#define CX4_sar(b, n) ((b) >> (n)) -#ifdef PI -#undef PI -#endif -#define PI 3.1415926535897932384626433832795 - -//Wireframe Helpers -void CX4_C4TransfWireFrame(void) -{ - cx4.c4x = (double)cx4.C4WFXVal; - cx4.c4y = (double)cx4.C4WFYVal; - cx4.c4z = (double)cx4.C4WFZVal - 0x95; - - //Rotate X - cx4.tanval = -(double)cx4.C4WFX2Val * PI * 2 / 128; - cx4.c4y2 = cx4.c4y * CX4_cos(cx4.tanval) - cx4.c4z * CX4_sin(cx4.tanval); - cx4.c4z2 = cx4.c4y * CX4_sin(cx4.tanval) + cx4.c4z * CX4_cos(cx4.tanval); - - //Rotate Y - cx4.tanval = -(double)cx4.C4WFY2Val * PI * 2 / 128; - cx4.c4x2 = cx4.c4x * CX4_cos(cx4.tanval) + cx4.c4z2 * CX4_sin(cx4.tanval); - cx4.c4z = cx4.c4x * -CX4_sin(cx4.tanval) + cx4.c4z2 * CX4_cos(cx4.tanval); - - //Rotate Z - cx4.tanval = -(double)cx4.C4WFDist * PI * 2 / 128; - cx4.c4x = cx4.c4x2 * CX4_cos(cx4.tanval) - cx4.c4y2 * CX4_sin(cx4.tanval); - cx4.c4y = cx4.c4x2 * CX4_sin(cx4.tanval) + cx4.c4y2 * CX4_cos(cx4.tanval); - - //Scale - cx4.C4WFXVal = (INT16)(cx4.c4x * cx4.C4WFScale / (0x90 * (cx4.c4z + 0x95)) * 0x95); - cx4.C4WFYVal = (INT16)(cx4.c4y * cx4.C4WFScale / (0x90 * (cx4.c4z + 0x95)) * 0x95); -} - -void CX4_C4CalcWireFrame(void) -{ - cx4.C4WFXVal = cx4.C4WFX2Val - cx4.C4WFXVal; - cx4.C4WFYVal = cx4.C4WFY2Val - cx4.C4WFYVal; - - if(abs(cx4.C4WFXVal) > abs(cx4.C4WFYVal)) - { - cx4.C4WFDist = abs(cx4.C4WFXVal) + 1; - cx4.C4WFYVal = (256 * (long)cx4.C4WFYVal) / abs(cx4.C4WFXVal); - cx4.C4WFXVal = (cx4.C4WFXVal < 0) ? -256 : 256; - } - else if(cx4.C4WFYVal != 0) - { - cx4.C4WFDist = abs(cx4.C4WFYVal) + 1; - cx4.C4WFXVal = (256 * (long)cx4.C4WFXVal) / abs(cx4.C4WFYVal); - cx4.C4WFYVal = (cx4.C4WFYVal < 0) ? -256 : 256; - } - else - { - cx4.C4WFDist = 0; - } -} - -void CX4_C4TransfWireFrame2(void) -{ - cx4.c4x = (double)cx4.C4WFXVal; - cx4.c4y = (double)cx4.C4WFYVal; - cx4.c4z = (double)cx4.C4WFZVal; - - //Rotate X - cx4.tanval = -(double)cx4.C4WFX2Val * PI * 2 / 128; - cx4.c4y2 = cx4.c4y * CX4_cos(cx4.tanval) - cx4.c4z * CX4_sin(cx4.tanval); - cx4.c4z2 = cx4.c4y * CX4_sin(cx4.tanval) + cx4.c4z * CX4_cos(cx4.tanval); - - //Rotate Y - cx4.tanval = -(double)cx4.C4WFY2Val * PI * 2 / 128; - cx4.c4x2 = cx4.c4x * CX4_cos(cx4.tanval) + cx4.c4z2 * CX4_sin(cx4.tanval); - cx4.c4z = cx4.c4x * -CX4_sin(cx4.tanval) + cx4.c4z2 * CX4_cos(cx4.tanval); - - //Rotate Z - cx4.tanval = -(double)cx4.C4WFDist * PI * 2 / 128; - cx4.c4x = cx4.c4x2 * CX4_cos(cx4.tanval) - cx4.c4y2 * CX4_sin(cx4.tanval); - cx4.c4y = cx4.c4x2 * CX4_sin(cx4.tanval) + cx4.c4y2 * CX4_cos(cx4.tanval); - - //Scale - cx4.C4WFXVal = (INT16)(cx4.c4x * cx4.C4WFScale / 0x100); - cx4.C4WFYVal = (INT16)(cx4.c4y * cx4.C4WFScale / 0x100); -} - -void CX4_C4DrawWireFrame(running_machine *machine) -{ - UINT32 line = CX4_readl(0x1f80); - UINT32 point1, point2; - INT16 X1, Y1, Z1; - INT16 X2, Y2, Z2; - UINT8 Color; - INT32 i; - - for(i = cx4.ram[0x0295]; i > 0; i--, line += 5) - { - if(memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), line) == 0xff && - memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), line + 1) == 0xff) - { - INT32 tmp = line - 5; - while(memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), tmp + 2) == 0xff && - memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), tmp + 3) == 0xff && - (tmp + 2) >= 0) - { - tmp -= 5; - } - point1 = (CX4_read(0x1f82) << 16) | - (memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), tmp + 2) << 8) | - memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), tmp + 3); - } - else - { - point1 = (CX4_read(0x1f82) << 16) | - (memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), line) << 8) | - memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), line + 1); - } - point2 = (CX4_read(0x1f82) << 16) | - (memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), line + 2) << 8) | - memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), line + 3); - - X1=(memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), point1 + 0) << 8) | - memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), point1 + 1); - Y1=(memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), point1 + 2) << 8) | - memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), point1 + 3); - Z1=(memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), point1 + 4) << 8) | - memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), point1 + 5); - X2=(memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), point2 + 0) << 8) | - memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), point2 + 1); - Y2=(memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), point2 + 2) << 8) | - memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), point2 + 3); - Z2=(memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), point2 + 4) << 8) | - memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), point2 + 5); - Color = memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), line + 4); - CX4_C4DrawLine(X1, Y1, Z1, X2, Y2, Z2, Color); - } -} - -void CX4_C4DrawLine(INT32 X1, INT32 Y1, INT16 Z1, INT32 X2, INT32 Y2, INT16 Z2, UINT8 Color) -{ - INT32 i; - - //Transform coordinates - cx4.C4WFXVal = (INT16)X1; - cx4.C4WFYVal = (INT16)Y1; - cx4.C4WFZVal = Z1; - cx4.C4WFScale = CX4_read(0x1f90); - cx4.C4WFX2Val = CX4_read(0x1f86); - cx4.C4WFY2Val = CX4_read(0x1f87); - cx4.C4WFDist = CX4_read(0x1f88); - CX4_C4TransfWireFrame2(); - X1 = (cx4.C4WFXVal + 48) << 8; - Y1 = (cx4.C4WFYVal + 48) << 8; - - cx4.C4WFXVal = (INT16)X2; - cx4.C4WFYVal = (INT16)Y2; - cx4.C4WFZVal = Z2; - CX4_C4TransfWireFrame2(); - X2 = (cx4.C4WFXVal + 48) << 8; - Y2 = (cx4.C4WFYVal + 48) << 8; - - //Get line info - cx4.C4WFXVal = (INT16)(X1 >> 8); - cx4.C4WFYVal = (INT16)(Y1 >> 8); - cx4.C4WFX2Val = (INT16)(X2 >> 8); - cx4.C4WFY2Val = (INT16)(Y2 >> 8); - CX4_C4CalcWireFrame(); - X2 = (INT16)cx4.C4WFXVal; - Y2 = (INT16)cx4.C4WFYVal; - - //Render line - for(i = cx4.C4WFDist ? cx4.C4WFDist : 1; i > 0; i--) - { - if(X1 > 0xff && Y1 > 0xff && X1 < 0x6000 && Y1 < 0x6000) - { - UINT16 addr = (((Y1 >> 8) >> 3) << 8) - (((Y1 >> 8) >> 3) << 6) + (((X1 >> 8) >> 3) << 4) + ((Y1 >> 8) & 7) * 2; - UINT8 bit = 0x80 >> ((X1 >> 8) & 7); - cx4.ram[addr + 0x300] &= ~bit; - cx4.ram[addr + 0x301] &= ~bit; - if(Color & 1) - { - cx4.ram[addr + 0x300] |= bit; - } - if(Color & 2) - { - cx4.ram[addr + 0x301] |= bit; - } - } - X1 += X2; - Y1 += Y2; - } -} - -void CX4_C4DoScaleRotate(int row_padding) -{ - INT16 A, B, C, D; - INT32 x, y; - - //Calculate Pixel Resolution - UINT8 w = CX4_read(0x1f89) & ~7; - UINT8 h = CX4_read(0x1f8c) & ~7; - - INT32 Cx = (INT16)CX4_readw(0x1f83); - INT32 Cy = (INT16)CX4_readw(0x1f86); - - INT32 LineX, LineY; - UINT32 X, Y; - UINT8 byte; - INT32 outidx = 0; - UINT8 bit = 0x80; - - //Calculate matrix - INT32 XScale = CX4_readw(0x1f8f); - INT32 YScale = CX4_readw(0x1f92); - - if(XScale & 0x8000) - { - XScale = 0x7fff; - } - if(YScale & 0x8000) - { - YScale = 0x7fff; - } - - if(CX4_readw(0x1f80) == 0) - { //no rotation - A = (INT16)XScale; - B = 0; - C = 0; - D = (INT16)YScale; - } - else if(CX4_readw(0x1f80) == 128) - { //90 degree rotation - A = 0; - B = (INT16)(-YScale); - C = (INT16)XScale; - D = 0; - } - else if(CX4_readw(0x1f80) == 256) - { //180 degree rotation - A = (INT16)(-XScale); - B = 0; - C = 0; - D = (INT16)(-YScale); - } - else if(CX4_readw(0x1f80) == 384) - { //270 degree rotation - A = 0; - B = (INT16)YScale; - C = (INT16)(-XScale); - D = 0; - } - else - { - A = (INT16) CX4_sar(CX4_CosTable[CX4_readw(0x1f80) & 0x1ff] * XScale, 15); - B = (INT16)(-CX4_sar(CX4_SinTable[CX4_readw(0x1f80) & 0x1ff] * YScale, 15)); - C = (INT16) CX4_sar(CX4_SinTable[CX4_readw(0x1f80) & 0x1ff] * XScale, 15); - D = (INT16) CX4_sar(CX4_CosTable[CX4_readw(0x1f80) & 0x1ff] * YScale, 15); - } - - //Clear the output RAM - memset(cx4.ram, 0, (w + row_padding / 4) * h / 2); - - //Calculate start position (i.e. (Ox, Oy) = (0, 0)) - //The low 12 bits are fractional, so (Cx<<12) gives us the Cx we want in - //the function. We do Cx*A etc normally because the matrix parameters - //already have the fractional parts. - LineX = (Cx << 12) - Cx * A - Cx * B; - LineY = (Cy << 12) - Cy * C - Cy * D; - - //Start loop - for(y = 0; y < h; y++) - { - X = LineX; - Y = LineY; - for(x = 0; x < w; x++) - { - if((X >> 12) >= w || (Y >> 12) >= h) - { - byte = 0; - } - else - { - UINT32 addr = (Y >> 12) * w + (X >> 12); - byte = CX4_read(0x600 + (addr >> 1)); - if(addr & 1) - { - byte >>= 4; - } - } - - //De-bitplanify - if(byte & 1) { cx4.ram[outidx ] |= bit; } - if(byte & 2) { cx4.ram[outidx + 1] |= bit; } - if(byte & 4) { cx4.ram[outidx + 16] |= bit; } - if(byte & 8) { cx4.ram[outidx + 17] |= bit; } - - bit >>= 1; - if(!bit) - { - bit = 0x80; - outidx += 32; - } - - X += A; //Add 1 to output x => add an A and a C - Y += C; - } - outidx += 2 + row_padding; - if(outidx & 0x10) - { - outidx &= ~0x10; - } - else - { - outidx -= w * 4 + row_padding; - } - LineX += B; //Add 1 to output y => add a B and a D - LineY += D; - } -} - -#endif diff --git a/src/mame/machine/cx4oam.c b/src/mame/machine/cx4oam.c deleted file mode 100644 index 5415426de6b..00000000000 --- a/src/mame/machine/cx4oam.c +++ /dev/null @@ -1,299 +0,0 @@ -#ifdef CX4_C - -//Build OAM -void CX4_op00_00(running_machine *machine) -{ - INT32 i; - - UINT32 oamptr = cx4.ram[0x626] << 2; - UINT16 globalx, globaly; - UINT32 oamptr2; - INT16 sprx, spry; - UINT8 sprname, sprattr; - UINT8 sprcount; - UINT8 offset; - UINT32 srcptr; - - for(i = 0x1fd; i > oamptr && i >= 0; i -= 4) - { - //clear oam-to-be - if(i >= 0) - { - cx4.ram[i] = 0xe0; - } - } - - globalx = CX4_readw(0x621); - globaly = CX4_readw(0x623); - oamptr2 = 0x200 + (cx4.ram[0x626] >> 2); - - if(!cx4.ram[0x620]) - { - return; - } - - sprcount = 128 - cx4.ram[0x626]; - offset = (cx4.ram[0x626] & 3) * 2; - srcptr = 0x220; - - for(i = cx4.ram[0x620]; i > 0 && sprcount > 0; i--, srcptr += 16) - { - UINT32 spraddr = CX4_readl(srcptr + 7); - - sprx = CX4_readw(srcptr) - globalx; - spry = CX4_readw(srcptr + 2) - globaly; - sprname = cx4.ram[srcptr + 5]; - sprattr = cx4.ram[srcptr + 4] | cx4.ram[srcptr + 6]; - - if(memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), spraddr)) - { - INT16 x, y; - INT32 sprcnt; - for(sprcnt = memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), spraddr++); sprcnt > 0 && sprcount > 0; sprcnt--, spraddr += 4) - { - x = (INT8)memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), spraddr + 1); - if(sprattr & 0x40) - { - x = -x - ((memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), spraddr) & 0x20) ? 16 : 8); - } - x += sprx; - if(x >= -16 && x <= 272) - { - y = (INT8)memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), spraddr + 2); - if(sprattr & 0x80) - { - y = -y - ((memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), spraddr) & 0x20) ? 16 : 8); - } - y += spry; - if(y >= -16 && y <= 224) - { - cx4.ram[oamptr ] = (UINT8)x; - cx4.ram[oamptr + 1] = (UINT8)y; - cx4.ram[oamptr + 2] = sprname + memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), spraddr + 3); - cx4.ram[oamptr + 3] = sprattr ^ (memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), spraddr) & 0xc0); - cx4.ram[oamptr2] &= ~(3 << offset); - if(x & 0x100) - { - cx4.ram[oamptr2] |= 1 << offset; - } - if(memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), spraddr) & 0x20) - { - cx4.ram[oamptr2] |= 2 << offset; - } - oamptr += 4; - sprcount--; - offset = (offset + 2) & 6; - if(!offset) - { - oamptr2++; - } - } - } - } - } - else if(sprcount > 0) - { - cx4.ram[oamptr ] = (UINT8)sprx; - cx4.ram[oamptr + 1] = (UINT8)spry; - cx4.ram[oamptr + 2] = sprname; - cx4.ram[oamptr + 3] = sprattr; - cx4.ram[oamptr2] &= ~(3 << offset); - if(sprx & 0x100) - { - cx4.ram[oamptr2] |= 3 << offset; - } - else - { - cx4.ram[oamptr2] |= 2 << offset; - } - oamptr += 4; - sprcount--; - offset = (offset + 2) & 6; - if(!offset) - { - oamptr2++; - } - } - } -} - -//Scale and Rotate -void CX4_op00_03() -{ - CX4_C4DoScaleRotate(0); -} - -//Transform Lines -void CX4_op00_05(running_machine *machine) -{ - INT32 i; - UINT32 ptr = 0, ptr2 = 0; - - cx4.C4WFX2Val = CX4_read(0x1f83); - cx4.C4WFY2Val = CX4_read(0x1f86); - cx4.C4WFDist = CX4_read(0x1f89); - cx4.C4WFScale = CX4_read(0x1f8c); - - //Transform Vertices - for(i = CX4_readw(0x1f80); i > 0; i--, ptr += 0x10) - { - cx4.C4WFXVal = CX4_readw(ptr + 1); - cx4.C4WFYVal = CX4_readw(ptr + 5); - cx4.C4WFZVal = CX4_readw(ptr + 9); - CX4_C4TransfWireFrame(); - - //Displace - CX4_writew(machine, ptr + 1, cx4.C4WFXVal + 0x80); - CX4_writew(machine, ptr + 5, cx4.C4WFYVal + 0x50); - } - - CX4_writew(machine, 0x600, 23); - CX4_writew(machine, 0x602, 0x60); - CX4_writew(machine, 0x605, 0x40); - CX4_writew(machine, 0x600 + 8, 23); - CX4_writew(machine, 0x602 + 8, 0x60); - CX4_writew(machine, 0x605 + 8, 0x40); - - ptr = 0xb02; - - for(i = CX4_readw(0xb00); i > 0; i--, ptr += 2, ptr2 += 8) - { - cx4.C4WFXVal = CX4_readw((CX4_read(ptr + 0) << 4) + 1); - cx4.C4WFYVal = CX4_readw((CX4_read(ptr + 0) << 4) + 5); - cx4.C4WFX2Val = CX4_readw((CX4_read(ptr + 1) << 4) + 1); - cx4.C4WFY2Val = CX4_readw((CX4_read(ptr + 1) << 4) + 5); - CX4_C4CalcWireFrame(); - CX4_writew(machine, ptr2 + 0x600, cx4.C4WFDist ? cx4.C4WFDist : 1); - CX4_writew(machine, ptr2 + 0x602, cx4.C4WFXVal); - CX4_writew(machine, ptr2 + 0x605, cx4.C4WFYVal); - } -} - -//Scale and Rotate -void CX4_op00_07() -{ - CX4_C4DoScaleRotate(64); -} - -//Draw Wireframe -void CX4_op00_08(running_machine *machine) -{ - CX4_C4DrawWireFrame(machine); -} - -//Disintegrate -void CX4_op00_0b(running_machine *machine) -{ - UINT8 width, height; - UINT32 startx, starty; - UINT32 srcptr; - UINT32 x, y; - INT32 scalex, scaley; - INT32 cx, cy; - INT32 i, j; - - width = CX4_read(0x1f89); - height = CX4_read(0x1f8c); - cx = CX4_readw(0x1f80); - cy = CX4_readw(0x1f83); - - scalex = (INT16)CX4_readw(0x1f86); - scaley = (INT16)CX4_readw(0x1f8f); - startx = -cx * scalex + (cx << 8); - starty = -cy * scaley + (cy << 8); - srcptr = 0x600; - - for(i = 0; i < (width * height) >> 1; i++) - { - CX4_write(machine, i, 0); - } - - for(y = starty, i = 0;i < height; i++, y += scaley) - { - for(x = startx, j = 0;j < width; j++, x += scalex) - { - if((x >> 8) < width && (y >> 8) < height && (y >> 8) * width + (x >> 8) < 0x2000) - { - UINT8 pixel = (j & 1) ? (cx4.ram[srcptr] >> 4) : (cx4.ram[srcptr]); - INT32 index = (y >> 11) * width * 4 + (x >> 11) * 32 + ((y >> 8) & 7) * 2; - UINT8 mask = 0x80 >> ((x >> 8) & 7); - - if(pixel & 1) cx4.ram[index ] |= mask; - if(pixel & 2) cx4.ram[index + 1] |= mask; - if(pixel & 4) cx4.ram[index + 16] |= mask; - if(pixel & 8) cx4.ram[index + 17] |= mask; - } - if(j & 1) - { - srcptr++; - } - } - } -} - -//Bitplane Wave -void CX4_op00_0c(running_machine *machine) -{ - int i, j; - UINT32 destptr = 0; - UINT32 waveptr = CX4_read(0x1f83); - UINT16 mask1 = 0xc0c0; - UINT16 mask2 = 0x3f3f; - - for(j = 0; j < 0x10; j++) - { - do - { - INT16 height = -((INT8)CX4_read(waveptr + 0xb00)) - 16; - for(i = 0; i < 40; i++) - { - UINT16 temp = CX4_readw(destptr + CX4_wave_data[i]) & mask2; - if(height >= 0) - { - if(height < 8) - { - temp |= mask1 & CX4_readw(0xa00 + height * 2); - } - else - { - temp |= mask1 & 0xff00; - } - } - CX4_writew(machine, destptr + CX4_wave_data[i], temp); - height++; - } - waveptr = (waveptr + 1) & 0x7f; - mask1 = (mask1 >> 2) | (mask1 << 6); - mask2 = (mask2 >> 2) | (mask2 << 6); - } while(mask1 != 0xc0c0); - destptr += 16; - - do - { - INT16 height = -((INT8)CX4_read(waveptr + 0xb00)) - 16; - for(i = 0; i < 40; i++) - { - UINT16 temp = CX4_readw(destptr + CX4_wave_data[i]) & mask2; - if(height >= 0) - { - if(height < 8) - { - temp |= mask1 & CX4_readw(0xa10 + height * 2); - } - else - { - temp |= mask1 & 0xff00; - } - } - CX4_writew(machine, destptr + CX4_wave_data[i], temp); - height++; - } - waveptr = (waveptr + 1) & 0x7f; - mask1 = (mask1 >> 2) | (mask1 << 6); - mask2 = (mask2 >> 2) | (mask2 << 6); - } while(mask1 != 0xc0c0); - destptr += 16; - } -} - -#endif diff --git a/src/mame/machine/cx4ops.c b/src/mame/machine/cx4ops.c deleted file mode 100644 index c1c5fc147be..00000000000 --- a/src/mame/machine/cx4ops.c +++ /dev/null @@ -1,270 +0,0 @@ -#ifdef CX4_C - -//Sprite Functions -void CX4_op00(running_machine* machine) -{ - switch(cx4.reg[0x4d]) - { - case 0x00: CX4_op00_00(machine); break; - case 0x03: CX4_op00_03(); break; - case 0x05: CX4_op00_05(machine); break; - case 0x07: CX4_op00_07(); break; - case 0x08: CX4_op00_08(machine); break; - case 0x0b: CX4_op00_0b(machine); break; - case 0x0c: CX4_op00_0c(machine); break; - } -} - -//Draw Wireframe -void CX4_op01(running_machine* machine) -{ - memset(cx4.ram + 0x300, 0, 2304); - CX4_C4DrawWireFrame(machine); -} - -//Propulsion -void CX4_op05(running_machine *machine) -{ - INT32 temp = 0x10000; - if(CX4_readw(0x1f83)) - { - temp = CX4_sar((temp / CX4_readw(0x1f83)) * CX4_readw(0x1f81), 8); - } - CX4_writew(machine, 0x1f80, temp); -} - -//Set Vector length -void CX4_op0d(running_machine *machine) -{ - cx4.C41FXVal = CX4_readw(0x1f80); - cx4.C41FYVal = CX4_readw(0x1f83); - cx4.C41FDistVal = CX4_readw(0x1f86); - cx4.tanval = sqrt(((double)cx4.C41FYVal) * ((double)cx4.C41FYVal) + ((double)cx4.C41FXVal) * ((double)cx4.C41FXVal)); - cx4.tanval = (double)cx4.C41FDistVal / cx4.tanval; - cx4.C41FYVal = (INT16)(((double)cx4.C41FYVal * cx4.tanval) * 0.99); - cx4.C41FXVal = (INT16)(((double)cx4.C41FXVal * cx4.tanval) * 0.98); - CX4_writew(machine, 0x1f89, cx4.C41FXVal); - CX4_writew(machine, 0x1f8c, cx4.C41FYVal); -} - -//Triangle -void CX4_op10() -{ - cx4.r0 = CX4_ldr(0); - cx4.r1 = CX4_ldr(1); - - cx4.r4 = cx4.r0 & 0x1ff; - if(cx4.r1 & 0x8000) - { - cx4.r1 |= ~0x7fff; - } - - CX4_mul(CX4_cos(cx4.r4), cx4.r1, &cx4.r5, &cx4.r2); - cx4.r5 = (cx4.r5 >> 16) & 0xff; - cx4.r2 = (cx4.r2 << 8) + cx4.r5; - - CX4_mul(CX4_sin(cx4.r4), cx4.r1, &cx4.r5, &cx4.r3); - cx4.r5 = (cx4.r5 >> 16) & 0xff; - cx4.r3 = (cx4.r3 << 8) + cx4.r5; - - CX4_str(0, cx4.r0); - CX4_str(1, cx4.r1); - CX4_str(2, cx4.r2); - CX4_str(3, cx4.r3); - CX4_str(4, cx4.r4); - CX4_str(5, cx4.r5); -} - -//Triangle -void CX4_op13() -{ - cx4.r0 = CX4_ldr(0); - cx4.r1 = CX4_ldr(1); - - cx4.r4 = cx4.r0 & 0x1ff; - - CX4_mul(CX4_cos(cx4.r4), cx4.r1, &cx4.r5, &cx4.r2); - cx4.r5 = (cx4.r5 >> 8) & 0xffff; - cx4.r2 = (cx4.r2 << 16) + cx4.r5; - - CX4_mul(CX4_sin(cx4.r4), cx4.r1, &cx4.r5, &cx4.r3); - cx4.r5 = (cx4.r5 >> 8) & 0xffff; - cx4.r3 = (cx4.r3 << 16) + cx4.r5; - - CX4_str(0, cx4.r0); - CX4_str(1, cx4.r1); - CX4_str(2, cx4.r2); - CX4_str(3, cx4.r3); - CX4_str(4, cx4.r4); - CX4_str(5, cx4.r5); -} - -//Pythagorean -void CX4_op15(running_machine *machine) -{ - double temp = 0.0; - cx4.C41FXVal = CX4_readw(0x1f80); - cx4.C41FYVal = CX4_readw(0x1f83); - temp = sqrt((double)cx4.C41FXVal * (double)cx4.C41FXVal + (double)cx4.C41FYVal * (double)cx4.C41FYVal); - cx4.C41FDist = (INT16)temp; - CX4_writew(machine, 0x1f80, cx4.C41FDist); -} - -//Calculate distance -void CX4_op1f(running_machine *machine) -{ - cx4.C41FXVal = CX4_readw(0x1f80); - cx4.C41FYVal = CX4_readw(0x1f83); - if(!cx4.C41FXVal) - { - cx4.C41FAngleRes = (cx4.C41FYVal > 0) ? 0x080 : 0x180; - } - else - { - cx4.tanval = ((double)cx4.C41FYVal) / ((double)cx4.C41FXVal); - cx4.C41FAngleRes = (INT16)(atan(cx4.tanval) / (PI * 2) * 512); - cx4.C41FAngleRes = cx4.C41FAngleRes; - if(cx4.C41FXVal < 0) - { - cx4.C41FAngleRes += 0x100; - } - cx4.C41FAngleRes &= 0x1ff; - } - CX4_writew(machine, 0x1f86, cx4.C41FAngleRes); -} - -//Trapezoid -void CX4_op22() -{ - INT16 angle1 = CX4_readw(0x1f8c) & 0x1ff; - INT16 angle2 = CX4_readw(0x1f8f) & 0x1ff; - INT32 tan1 = CX4_Tan(angle1); - INT32 tan2 = CX4_Tan(angle2); - INT16 y = CX4_readw(0x1f83) - CX4_readw(0x1f89); - INT16 left, right; - INT32 j; - - for(j = 0; j < 225; j++, y++) - { - if(y >= 0) - { - left = CX4_sar((INT32)tan1 * y, 16) - CX4_readw(0x1f80) + CX4_readw(0x1f86); - right = CX4_sar((INT32)tan2 * y, 16) - CX4_readw(0x1f80) + CX4_readw(0x1f86) + CX4_readw(0x1f93); - - if(left < 0 && right < 0) - { - left = 1; - right = 0; - } - else if(left < 0) - { - left = 0; - } - else if(right < 0) - { - right = 0; - } - - if(left > 255 && right > 255) - { - left = 255; - right = 254; - } - else if(left > 255) - { - left = 255; - } - else if(right > 255) - { - right = 255; - } - } - else - { - left = 1; - right = 0; - } - cx4.ram[j + 0x800] = (UINT8)left; - cx4.ram[j + 0x900] = (UINT8)right; - } -} - -//Multiply -void CX4_op25() -{ - cx4.r0 = CX4_ldr(0); - cx4.r1 = CX4_ldr(1); - CX4_mul(cx4.r0, cx4.r1, &cx4.r0, &cx4.r1); - CX4_str(0, cx4.r0); - CX4_str(1, cx4.r1); -} - -//Transform Coords -void CX4_op2d(running_machine *machine) -{ - cx4.C4WFXVal = CX4_readw(0x1f81); - cx4.C4WFYVal = CX4_readw(0x1f84); - cx4.C4WFZVal = CX4_readw(0x1f87); - cx4.C4WFX2Val = CX4_read (0x1f89); - cx4.C4WFY2Val = CX4_read (0x1f8a); - cx4.C4WFDist = CX4_read (0x1f8b); - cx4.C4WFScale = CX4_readw(0x1f90); - CX4_C4TransfWireFrame2(); - CX4_writew(machine, 0x1f80, cx4.C4WFXVal); - CX4_writew(machine, 0x1f83, cx4.C4WFYVal); -} - -//Sum -void CX4_op40() -{ - UINT32 i; - cx4.r0 = 0; - for(i=0;i<0x800;i++) - { - cx4.r0 += cx4.ram[i]; - } - CX4_str(0, cx4.r0); -} - -//Square -void CX4_op54() -{ - cx4.r0 = CX4_ldr(0); - CX4_mul(cx4.r0, cx4.r0, &cx4.r1, &cx4.r2); - CX4_str(1, cx4.r1); - CX4_str(2, cx4.r2); -} - -//Immediate Register -void CX4_op5c() -{ - CX4_str(0, 0x000000); - CX4_immediate_reg(0); -} - -//Immediate Register (Multiple) -void CX4_op5e() { CX4_immediate_reg( 0); } -void CX4_op60() { CX4_immediate_reg( 3); } -void CX4_op62() { CX4_immediate_reg( 6); } -void CX4_op64() { CX4_immediate_reg( 9); } -void CX4_op66() { CX4_immediate_reg(12); } -void CX4_op68() { CX4_immediate_reg(15); } -void CX4_op6a() { CX4_immediate_reg(18); } -void CX4_op6c() { CX4_immediate_reg(21); } -void CX4_op6e() { CX4_immediate_reg(24); } -void CX4_op70() { CX4_immediate_reg(27); } -void CX4_op72() { CX4_immediate_reg(30); } -void CX4_op74() { CX4_immediate_reg(33); } -void CX4_op76() { CX4_immediate_reg(36); } -void CX4_op78() { CX4_immediate_reg(39); } -void CX4_op7a() { CX4_immediate_reg(42); } -void CX4_op7c() { CX4_immediate_reg(45); } - -//Immediate ROM -void CX4_op89() -{ - CX4_str(0, 0x054336); - CX4_str(1, 0xffffff); -} - -#endif diff --git a/src/mame/machine/snescx4.c b/src/mame/machine/snescx4.c deleted file mode 100644 index c2d83463e34..00000000000 --- a/src/mame/machine/snescx4.c +++ /dev/null @@ -1,235 +0,0 @@ -/*************************************************************************** - - snescx4.c - - File to handle emulation of the SNES "CX4" add-on chip. - - Original C++ "cx4*.cpp" by byuu - - This is up to date with source version 0.49. - -***************************************************************************/ - -#define CX4_C - -#include "snescx4.h" -#include "cx4data.c" -#include "cx4fn.c" -#include "cx4oam.c" -#include "cx4ops.c" - -UINT32 CX4_ldr(UINT8 r) -{ - UINT16 addr = 0x0080 + (r * 3); - return (cx4.reg[addr + 0] << 0) - | (cx4.reg[addr + 1] << 8) - | (cx4.reg[addr + 2] << 16); -} - -void CX4_str(UINT8 r, UINT32 data) -{ - UINT16 addr = 0x0080 + (r * 3); - cx4.reg[addr + 0] = (data >> 0); - cx4.reg[addr + 1] = (data >> 8); - cx4.reg[addr + 2] = (data >> 16); -} - -void CX4_mul(UINT32 x, UINT32 y, UINT32 *rl, UINT32 *rh) -{ - INT64 rx = x & 0xffffff; - INT64 ry = y & 0xffffff; - if(rx & 0x800000)rx |= ~0x7fffff; - if(ry & 0x800000)ry |= ~0x7fffff; - - rx *= ry; - - *rl = (rx) & 0xffffff; - *rh = (rx >> 24) & 0xffffff; -} - -UINT32 CX4_sin(UINT32 rx) -{ - cx4.r0 = rx & 0x1ff; - if(cx4.r0 & 0x100) - { - cx4.r0 ^= 0x1ff; - } - if(cx4.r0 & 0x080) - { - cx4.r0 ^= 0x0ff; - } - if(rx & 0x100) - { - return CX4_sin_table[cx4.r0 + 0x80]; - } - else - { - return CX4_sin_table[cx4.r0]; - } -} - -UINT32 CX4_cos(UINT32 rx) -{ - return sin(rx + 0x080); -} - -void CX4_immediate_reg(UINT32 start) -{ - UINT32 i = 0; - cx4.r0 = CX4_ldr(0); - for(i = start; i < 48; i++) - { - if((cx4.r0 & 0x0fff) < 0x0c00) - { - cx4.ram[cx4.r0 & 0x0fff] = CX4_immediate_data[i]; - } - cx4.r0++; - } - CX4_str(0, cx4.r0); -} - -void CX4_transfer_data(running_machine *machine) -{ - UINT32 src; - UINT16 dest, count; - UINT32 i; - - src = (cx4.reg[0x40]) | (cx4.reg[0x41] << 8) | (cx4.reg[0x42] << 16); - count = (cx4.reg[0x43]) | (cx4.reg[0x44] << 8); - dest = (cx4.reg[0x45]) | (cx4.reg[0x46] << 8); - - for(i=0;i<count;i++) - { - CX4_write(machine, dest++, memory_read_byte(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), src++)); - } -} - -void CX4_write(running_machine *machine, UINT32 addr, UINT8 data) -{ - addr &= 0x1fff; - - if(addr < 0x0c00) - { - //ram - cx4.ram[addr] = data; - return; - } - - if(addr < 0x1f00) - { - //unmapped - return; - } - - //command register - cx4.reg[addr & 0xff] = data; - - if(addr == 0x1f47) - { - //memory transfer - CX4_transfer_data(machine); - return; - } - - if(addr == 0x1f4f) - { - //c4 command - if(cx4.reg[0x4d] == 0x0e && !(data & 0xc3)) - { - //c4 test command - cx4.reg[0x80] = data >> 2; - return; - } - - switch(data) - { - case 0x00: CX4_op00(machine); break; - case 0x01: CX4_op01(machine); break; - case 0x05: CX4_op05(machine); break; - case 0x0d: CX4_op0d(machine); break; - case 0x10: CX4_op10(); break; - case 0x13: CX4_op13(); break; - case 0x15: CX4_op15(machine); break; - case 0x1f: CX4_op1f(machine); break; - case 0x22: CX4_op22(); break; - case 0x25: CX4_op25(); break; - case 0x2d: CX4_op2d(machine); break; - case 0x40: CX4_op40(); break; - case 0x54: CX4_op54(); break; - case 0x5c: CX4_op5c(); break; - case 0x5e: CX4_op5e(); break; - case 0x60: CX4_op60(); break; - case 0x62: CX4_op62(); break; - case 0x64: CX4_op64(); break; - case 0x66: CX4_op66(); break; - case 0x68: CX4_op68(); break; - case 0x6a: CX4_op6a(); break; - case 0x6c: CX4_op6c(); break; - case 0x6e: CX4_op6e(); break; - case 0x70: CX4_op70(); break; - case 0x72: CX4_op72(); break; - case 0x74: CX4_op74(); break; - case 0x76: CX4_op76(); break; - case 0x78: CX4_op78(); break; - case 0x7a: CX4_op7a(); break; - case 0x7c: CX4_op7c(); break; - case 0x89: CX4_op89(); break; - } - } -} - -void CX4_writeb(running_machine *machine, UINT16 addr, UINT8 data) -{ - CX4_write(machine, addr, data); -} - -void CX4_writew(running_machine *machine, UINT16 addr, UINT16 data) -{ - CX4_write(machine, addr + 0, data >> 0); - CX4_write(machine, addr + 1, data >> 8); -} - -void CX4_writel(running_machine *machine, UINT16 addr, UINT32 data) -{ - CX4_write(machine, addr + 0, data >> 0); - CX4_write(machine, addr + 1, data >> 8); - CX4_write(machine, addr + 2, data >> 16); -} - -UINT8 CX4_read(UINT32 addr) -{ - addr &= 0x1fff; - - if(addr < 0x0c00) - { - return cx4.ram[addr]; - } - - if(addr >= 0x1f00) - { - return cx4.reg[addr & 0xff]; - } - - return 0xff; -} - -UINT8 CX4_readb(UINT16 addr) -{ - return CX4_read(addr); -} - -UINT16 CX4_readw(UINT16 addr) -{ - return CX4_read(addr) | (CX4_read(addr + 1) << 8); -} - -UINT32 CX4_readl(UINT16 addr) -{ - return CX4_read(addr) | (CX4_read(addr + 1) << 8) | (CX4_read(addr + 2) << 16); -} - -void CX4_reset() -{ - memset(cx4.ram, 0, 0x0c00); - memset(cx4.reg, 0, 0x0100); -} diff --git a/src/mame/machine/snescx4.h b/src/mame/machine/snescx4.h deleted file mode 100644 index 034c06755cd..00000000000 --- a/src/mame/machine/snescx4.h +++ /dev/null @@ -1,82 +0,0 @@ -#include "driver.h" - -typedef struct -{ - UINT8 ram[0x0c00]; - UINT8 reg[0x0100]; - UINT32 r0, r1, r2, r3, r4, r5, r6, r7, - r8, r9, r10, r11, r12, r13, r14, r15; - - INT16 C4WFXVal, C4WFYVal, C4WFZVal, C4WFX2Val, C4WFY2Val, C4WFDist, C4WFScale; - INT16 C41FXVal, C41FYVal, C41FAngleRes, C41FDist, C41FDistVal; - - double tanval; - double c4x, c4y, c4z; - double c4x2, c4y2, c4z2; -} CX4; - -static CX4 cx4; - -UINT32 CX4_ldr(UINT8 r); -void CX4_str(UINT8 r, UINT32 data); -void CX4_mul(UINT32 x, UINT32 y, UINT32 *rl, UINT32 *rh); -UINT32 CX4_sin(UINT32 rx); -UINT32 CX4_cos(UINT32 rx); - -void CX4_transfer_data(running_machine *machine); -void CX4_immediate_reg(UINT32 num); - -void CX4_op00_00(running_machine *machine); -void CX4_op00_03(void); -void CX4_op00_05(running_machine *machine); -void CX4_op00_07(void); -void CX4_op00_08(running_machine *machine); -void CX4_op00_0b(running_machine *machine); -void CX4_op00_0c(running_machine *machine); - -void CX4_op00(running_machine* machine); -void CX4_op01(running_machine* machine); -void CX4_op05(running_machine *machine); -void CX4_op0d(running_machine *machine); -void CX4_op10(void); -void CX4_op13(void); -void CX4_op15(running_machine *machine); -void CX4_op1f(running_machine *machine); -void CX4_op22(void); -void CX4_op25(void); -void CX4_op2d(running_machine *machine); -void CX4_op40(void); -void CX4_op54(void); -void CX4_op5c(void); -void CX4_op5e(void); -void CX4_op60(void); -void CX4_op62(void); -void CX4_op64(void); -void CX4_op66(void); -void CX4_op68(void); -void CX4_op6a(void); -void CX4_op6c(void); -void CX4_op6e(void); -void CX4_op70(void); -void CX4_op72(void); -void CX4_op74(void); -void CX4_op76(void); -void CX4_op78(void); -void CX4_op7a(void); -void CX4_op7c(void); -void CX4_op89(void); - -UINT8 CX4_readb(UINT16 addr); -UINT16 CX4_readw(UINT16 addr); -UINT32 CX4_readl(UINT16 addr); - -void CX4_writeb(running_machine *machine, UINT16 addr, UINT8 data); -void CX4_writew(running_machine *machine, UINT16 addr, UINT16 data); -void CX4_writel(running_machine *machine, UINT16 addr, UINT32 data); - -void CX4_reset(void); - -UINT8 CX4_read(UINT32 addr); -void CX4_write(running_machine *machine, UINT32 addr, UINT8 data); - -void CX4_C4DrawLine(INT32 X1, INT32 Y1, INT16 Z1, INT32 X2, INT32 Y2, INT16 Z2, UINT8 Color); diff --git a/src/mame/mame.mak b/src/mame/mame.mak index 2abdf0dc3b0..bbb9cd64fcc 100644 --- a/src/mame/mame.mak +++ b/src/mame/mame.mak @@ -1844,9 +1844,4 @@ $(DRIVERS)/mpu4.o: $(MAMESRC)/drivers/mpu4drvr.c $(DRIVERS)/neogeo.o: $(MAMESRC)/drivers/neodrvr.c $(MACHINE)/snes.o: $(MAMESRC)/machine/snesdsp1.c \ $(MAMESRC)/machine/snesdsp2.c \ - $(MAMESRC)/machine/snesobc1.c \ - $(MAMESRC)/machine/snescx4.c \ - $(MAMESRC)/machine/cx4ops.c \ - $(MAMESRC)/machine/cx4oam.c \ - $(MAMESRC)/machine/cx4fn.c \ - $(MAMESRC)/machine/cx4data.c + $(MAMESRC)/machine/snesobc1.c |