@@ -53,8 +53,8 @@ uint16_t konamigx_state::K055550_word_r(offs_t offset)
53
53
void konamigx_state::K055550_word_w (offs_t offset, uint16_t data, uint16_t mem_mask)
54
54
{
55
55
auto &mspace = m_maincpu->space (AS_PROGRAM);
56
- uint32_t adr, bsize, count, i, lim;
57
- int src, tgt, srcend, tgtend, skip, cx1, sx1, wx1, cy1, sy1, wy1, cz1, sz1, wz1, c2, s2, w2;
56
+ uint32_t adr, bsize, count, i, lim, src, dst ;
57
+ int tgt, srcend, tgtend, skip, cx1, sx1, wx1, cy1, sy1, wy1, cz1, sz1, wz1, c2, s2, w2;
58
58
int dx, dy, angle;
59
59
60
60
COMBINE_DATA (m_prot_data+offset);
@@ -71,10 +71,25 @@ void konamigx_state::K055550_word_w(offs_t offset, uint16_t data, uint16_t mem_m
71
71
count = (m_prot_data[0 ] & 0xff ) + 1 ;
72
72
73
73
lim = adr+bsize*count;
74
- for (i= adr; i< lim; i+= 2 )
74
+ for (i = adr; i < lim; i += 2 )
75
75
mspace.write_word (i, m_prot_data[0x1a /2 ]);
76
76
break ;
77
77
78
+ case 0x98 : // memcpy of some kind. incomplete
79
+ // known use cases:
80
+ // viostorm: transfer "color check" palette
81
+
82
+ dst = (m_prot_data[7 ] << 16 ) | m_prot_data[8 ];
83
+ src = (m_prot_data[2 ] << 16 ) | m_prot_data[3 ];
84
+ count = (m_prot_data[10 ] << 16 | m_prot_data[11 ]) >> 2 ;
85
+
86
+ for (int x = 0 ; x < count; ++x)
87
+ {
88
+ const u32 src_data = mspace.read_dword (src + x * 8 );
89
+ mspace.write_dword (dst + x * 4 , src_data);
90
+ }
91
+ break ;
92
+
78
93
// WARNING: The following cases are speculation based with questionable accuracy!(AAT)
79
94
80
95
case 0x87 : // unknown memory write (Violent Storm at 0x00b6ea)
@@ -101,7 +116,7 @@ void konamigx_state::K055550_word_w(offs_t offset, uint16_t data, uint16_t mem_m
101
116
tgtend = srcend + bsize;
102
117
103
118
// let's hope GCC will inline the mem24bew calls
104
- for (src= adr; src< srcend; src+= bsize)
119
+ for (src = adr; src < srcend; src += bsize)
105
120
{
106
121
cx1 = (short )mspace.read_word (src);
107
122
sx1 = (short )mspace.read_word (src + 2 );
@@ -118,24 +133,24 @@ void konamigx_state::K055550_word_w(offs_t offset, uint16_t data, uint16_t mem_m
118
133
count = i = src + skip;
119
134
tgt = src + bsize;
120
135
121
- for (; count< tgt; count++) mspace.write_byte (count, 0 );
136
+ for (; count < tgt; count++) mspace.write_byte (count, 0 );
122
137
123
- for (; tgt< tgtend; i++, tgt+= bsize)
138
+ for (; tgt < tgtend; i++, tgt += bsize)
124
139
{
125
140
c2 = (short )mspace.read_word (tgt);
126
141
s2 = (short )mspace.read_word (tgt + 2 );
127
142
w2 = (short )mspace.read_word (tgt + 4 );
128
- if (abs ((cx1+ sx1)- (c2+ s2))>= wx1+ w2) continue ; // X rejection
143
+ if (abs ((cx1 + sx1) - (c2 + s2)) >= wx1 + w2) continue ; // X rejection
129
144
130
145
c2 = (short )mspace.read_word (tgt + 6 );
131
146
s2 = (short )mspace.read_word (tgt + 8 );
132
147
w2 = (short )mspace.read_word (tgt +10 );
133
- if (abs ((cy1+ sy1)- (c2+ s2))>= wy1+ w2) continue ; // Y rejection
148
+ if (abs ((cy1 + sy1) - (c2 + s2)) >= wy1 + w2) continue ; // Y rejection
134
149
135
150
c2 = (short )mspace.read_word (tgt +12 );
136
151
s2 = (short )mspace.read_word (tgt +14 );
137
152
w2 = (short )mspace.read_word (tgt +16 );
138
- if (abs ((cz1+ sz1)- (c2+ s2))>= wz1+ w2) continue ; // Z rejection
153
+ if (abs ((cz1 + sz1) - (c2 + s2)) >= wz1 + w2) continue ; // Z rejection
139
154
140
155
mspace.write_byte (i, 0x80 ); // collision confirmed
141
156
}
@@ -211,13 +226,13 @@ void konamigx_state::K053990_martchmp_word_w(offs_t offset, uint16_t data, uint1
211
226
dst_skip += element_size;
212
227
213
228
if (element_size == 1 )
214
- for (i= src_count; i; i--)
229
+ for (i = src_count; i; i--)
215
230
{
216
231
mspace.write_byte (dst_addr, mspace.read_byte (src_addr));
217
232
src_addr += src_skip;
218
233
dst_addr += dst_skip;
219
234
}
220
- else for (i= src_count; i; i--)
235
+ else for (i = src_count; i; i--)
221
236
{
222
237
mspace.write_word (dst_addr, mspace.read_word (src_addr));
223
238
src_addr += src_skip;
@@ -387,7 +402,7 @@ if((data1=obj[0])&0x80000000)\
387
402
case 0x11010010 : i = 5 ; vmask = 0x1ff ; break ;
388
403
case 0x01111018 : i = 4 ; break ;
389
404
case 0x10010011 : i = 3 ;
390
- if ((srcbase[0x1c75 ]& 0xff )== 32 ) m_k055555->K055555_write_reg (K55_BLEND_ENABLES,36 ); // (TEMPORARY)
405
+ if ((srcbase[0x1c75 ] & 0xff ) == 32 ) m_k055555->K055555_write_reg (K55_BLEND_ENABLES,36 ); // (TEMPORARY)
391
406
break ;
392
407
case 0x11010811 : i = 2 ; break ;
393
408
case 0x10000010 : i = 1 ; break ;
@@ -424,8 +439,8 @@ if((data1=obj[0])&0x80000000)\
424
439
// decode Lord British (the designer must be a Richard Garriot fan too:)
425
440
if (srcbase[0x0848 /4 ] & 0x0000ffff )
426
441
{
427
- hoffs = srcbase[0x08b0 /4 ]>> 16 ;
428
- voffs = srcbase[0x08b4 /4 ]>> 16 ;
442
+ hoffs = srcbase[0x08b0 /4 ] >> 16 ;
443
+ voffs = srcbase[0x08b4 /4 ] >> 16 ;
429
444
hoffs -= hcorr;
430
445
voffs -= vcorr;
431
446
obj = &srcbase[0x084c /4 ];
@@ -445,8 +460,8 @@ if((data1=obj[0])&0x80000000)\
445
460
i = src[7 ] & 0xf ;
446
461
if (!i) continue ; // reject retired or zero-element groups
447
462
i <<= 2 ;
448
- hoffs = src[5 ]>> 16 ;
449
- voffs = src[6 ]>> 16 ;
463
+ hoffs = src[5 ] >> 16 ;
464
+ voffs = src[6 ] >> 16 ;
450
465
hoffs -= hcorr;
451
466
voffs -= vcorr;
452
467
obj = src + 8 ;
@@ -456,9 +471,9 @@ if((data1=obj[0])&0x80000000)\
456
471
{
457
472
EXTRACT_EVEN
458
473
}
459
- while ((obj+= 4 )< objend);
474
+ while ((obj += 4 ) < objend);
460
475
}
461
- while ((src+= 0x30 )< srcend);
476
+ while ((src += 0x30 ) < srcend);
462
477
463
478
// clear residual data
464
479
if (j) do { *dst = 0 ; dst += 8 ; } while (--j);
@@ -480,7 +495,7 @@ void konamigx_state::fantjour_dma_w(offs_t offset, uint32_t data, uint32_t mem_m
480
495
{
481
496
auto &mspace = m_maincpu->space (AS_PROGRAM);
482
497
COMBINE_DATA (m_fantjour_dma + offset);
483
- if (!offset && ACCESSING_BITS_24_31) {
498
+ if (!offset && ACCESSING_BITS_24_31) {
484
499
uint32_t sa = m_fantjour_dma[1 ];
485
500
// uint16_t ss = (m_fantjour_dma[2] & 0xffff0000) >> 16;
486
501
// uint32_t sb = ((m_fantjour_dma[2] & 0xffff) << 16) | ((m_fantjour_dma[3] & 0xffff0000) >> 16);
@@ -496,16 +511,18 @@ void konamigx_state::fantjour_dma_w(offs_t offset, uint32_t data, uint32_t mem_m
496
511
uint32_t x = m_fantjour_dma[6 ];
497
512
uint32_t i1, i2;
498
513
499
- if (mode == 0x93 )
500
- for (i1=0 ; i1 <= sz2; i1++)
501
- for (i2=0 ; i2 < db; i2+=4 ) {
514
+ if (mode == 0x93 )
515
+ for (i1 = 0 ; i1 <= sz2; i1++)
516
+ for (i2 = 0 ; i2 < db; i2 += 4 )
517
+ {
502
518
mspace.write_dword (da, mspace.read_dword (sa) ^ x);
503
519
da += 4 ;
504
520
sa += 4 ;
505
521
}
506
- else if (mode == 0x8f )
507
- for (i1=0 ; i1 <= sz2; i1++)
508
- for (i2=0 ; i2 < db; i2+=4 ) {
522
+ else if (mode == 0x8f )
523
+ for (i1 = 0 ; i1 <= sz2; i1++)
524
+ for (i2 = 0 ; i2 < db; i2 += 4 )
525
+ {
509
526
mspace.write_dword (da, x);
510
527
da += 4 ;
511
528
}
0 commit comments