trunk/src/mame/drivers/deco_mlc.c
| r21930 | r21931 | |
| 196 | 196 | // logerror("irqw %04x %04x (%d)\n", offset * 4, data&0xffff, scanline); |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | | READ32_MEMBER(deco_mlc_state::mlc_spriteram_r) |
| 200 | | { |
| 201 | | return m_spriteram[offset]&0xffff; |
| 202 | | } |
| 203 | 199 | |
| 200 | |
| 204 | 201 | READ32_MEMBER(deco_mlc_state::mlc_vram_r) |
| 205 | 202 | { |
| 206 | 203 | return m_mlc_vram[offset]&0xffff; |
| r21930 | r21931 | |
| 238 | 235 | printf("%08x: Write prot %04x %08x\n", space.device().safe_pc(), offset, data); |
| 239 | 236 | } |
| 240 | 237 | |
| 238 | READ32_MEMBER( deco_mlc_state::mlc_spriteram_r ) |
| 239 | { |
| 240 | UINT32 retdata = 0; |
| 241 | |
| 242 | if (mem_mask & 0xffff0000) |
| 243 | { |
| 244 | retdata |= 0xffff0000; |
| 245 | } |
| 246 | |
| 247 | if (mem_mask & 0x0000ffff) |
| 248 | { |
| 249 | retdata |= m_mlc_spriteram[offset]; |
| 250 | } |
| 251 | |
| 252 | return retdata; |
| 253 | } |
| 254 | |
| 255 | |
| 256 | WRITE32_MEMBER( deco_mlc_state::mlc_spriteram_w ) |
| 257 | { |
| 258 | if (mem_mask & 0xffff0000) |
| 259 | { |
| 260 | |
| 261 | } |
| 262 | |
| 263 | if (mem_mask & 0x0000ffff) |
| 264 | { |
| 265 | data &=0x0000ffff; |
| 266 | COMBINE_DATA(&m_mlc_spriteram[offset]); |
| 267 | } |
| 268 | } |
| 241 | 269 | /******************************************************************************/ |
| 242 | 270 | |
| 243 | 271 | static ADDRESS_MAP_START( decomlc_map, AS_PROGRAM, 32, deco_mlc_state ) |
| r21930 | r21931 | |
| 249 | 277 | AM_RANGE(0x0200078, 0x020007f) AM_READ(test2_r) AM_MIRROR(0xff000000) |
| 250 | 278 | AM_RANGE(0x0200000, 0x020007f) AM_WRITE(mlc_irq_w) AM_SHARE("irq_ram") AM_MIRROR(0xff000000) |
| 251 | 279 | AM_RANGE(0x0200080, 0x02000ff) AM_RAM AM_SHARE("mlc_clip_ram") AM_MIRROR(0xff000000) |
| 252 | | AM_RANGE(0x0204000, 0x0206fff) AM_RAM_READ(mlc_spriteram_r) AM_SHARE("spriteram") AM_MIRROR(0xff000000) |
| 253 | | AM_RANGE(0x0280000, 0x029ffff) AM_RAM_READ(mlc_vram_r) AM_SHARE("mlc_vram") AM_MIRROR(0xff000000) |
| 280 | AM_RANGE(0x0204000, 0x0206fff) AM_READWRITE( mlc_spriteram_r, mlc_spriteram_w ) AM_MIRROR(0xff000000) |
| 281 | AM_RANGE(0x0280000, 0x029ffff) AM_RAM AM_SHARE("mlc_vram") AM_MIRROR(0xff000000) |
| 254 | 282 | AM_RANGE(0x0300000, 0x0307fff) AM_RAM_WRITE(avengrs_palette_w) AM_SHARE("paletteram") AM_MIRROR(0xff000000) |
| 255 | 283 | AM_RANGE(0x0400000, 0x0400003) AM_READ_PORT("INPUTS") AM_MIRROR(0xff000000) |
| 256 | 284 | AM_RANGE(0x0440000, 0x044001f) AM_READ(test3_r) AM_MIRROR(0xff000000) |
trunk/src/mame/video/deco_mlc.c
| r21930 | r21931 | |
| 23 | 23 | m_colour_mask=0x1f; |
| 24 | 24 | |
| 25 | 25 | // temp_bitmap = auto_bitmap_rgb32_alloc( machine(), 512, 512 ); |
| 26 | | m_mlc_buffered_spriteram = auto_alloc_array(machine(), UINT32, 0x3000/4); |
| 26 | m_mlc_buffered_spriteram = auto_alloc_array(machine(), UINT16, 0x3000/2); |
| 27 | m_mlc_spriteram_spare = auto_alloc_array(machine(), UINT16, 0x3000/2); |
| 28 | m_mlc_spriteram = auto_alloc_array(machine(), UINT16, 0x3000/2); |
| 29 | |
| 30 | |
| 31 | save_pointer(NAME(m_mlc_spriteram), 0x3000/2); |
| 32 | save_pointer(NAME(m_mlc_spriteram_spare), 0x3000/2); |
| 33 | save_pointer(NAME(m_mlc_buffered_spriteram), 0x3000/2); |
| 34 | |
| 27 | 35 | } |
| 28 | 36 | |
| 29 | 37 | |
| r21930 | r21931 | |
| 144 | 152 | |
| 145 | 153 | int clipper=0; |
| 146 | 154 | rectangle user_clip; |
| 147 | | UINT32* mlc_spriteram=m_mlc_buffered_spriteram; // spriteram32 |
| 155 | UINT16* mlc_spriteram=m_mlc_buffered_spriteram; // spriteram32 |
| 148 | 156 | |
| 149 | 157 | //printf("%d - (%08x %08x %08x) (%08x %08x %08x) (%08x %08x %08x)\n", scanline, m_irq_ram[6], m_irq_ram[7], m_irq_ram[8], m_irq_ram[9], m_irq_ram[10], m_irq_ram[11] , m_irq_ram[12] , m_irq_ram[13] , m_irq_ram[14]); |
| 150 | 158 | |
| r21930 | r21931 | |
| 167 | 175 | 0x1000 - If set combine this 4bpp sprite & next one, into 8bpp sprite |
| 168 | 176 | 0x0800 - This is set ingame on Stadium Hero 96, on graphics which otherwise obscure the playfield? |
| 169 | 177 | 0x0400 - Use raster IRQ lookup table when drawing object |
| 170 | | 0x0300 - Selects clipping window to use |
| 171 | | 0x00ff - Colour/alpha shadow enable |
| 178 | 0x0300 - Selects clipping window to use - and upper bits of raster select (stadhr96) |
| 179 | 0x0080 - seems to be both the lower bit of the raster select (stadhr96) AND the upper bit of colour / alpha (avngrgs?) - might depend on other bits? |
| 180 | 0x007f - Colour/alpha shadow enable |
| 172 | 181 | Word 2: 0x07ff - Y position |
| 173 | 182 | Word 3: 0x07ff - X position |
| 174 | 183 | Word 4: 0x03ff - X scale |
| r21930 | r21931 | |
| 203 | 212 | fy = mlc_spriteram[offs+1]&0x4000; |
| 204 | 213 | color = mlc_spriteram[offs+1]&0xff; |
| 205 | 214 | |
| 215 | int raster_select = (mlc_spriteram[offs+1]&0x0180)>>7; |
| 216 | |
| 217 | |
| 206 | 218 | // there are 3 different sets of raster values, must be a way to selects |
| 207 | 219 | // between them? furthermore avengrgs doesn't even enable this |
| 208 | 220 | // although it doesn't seem to set the scroll values very often either |
| r21930 | r21931 | |
| 289 | 301 | yoffs=index_ptr8[0]&0xff; |
| 290 | 302 | xoffs=index_ptr8[2]&0xff; |
| 291 | 303 | |
| 292 | | fy1=(index_ptr8[1]&0xf0)>>4; |
| 293 | | fx1=(index_ptr8[3]&0xf0)>>4; |
| 304 | fy1=(index_ptr8[1]&0x10)>>4; |
| 305 | fx1=(index_ptr8[3]&0x10)>>4; |
| 294 | 306 | |
| 295 | 307 | tileFormat=index_ptr8[4]&0x80; |
| 296 | 308 | |
| r21930 | r21931 | |
| 329 | 341 | yoffs=index_ptr[0]&0xff; |
| 330 | 342 | xoffs=index_ptr[1]&0xff; |
| 331 | 343 | |
| 332 | | fy1=(index_ptr[0]&0xf000)>>12; |
| 333 | | fx1=(index_ptr[1]&0xf000)>>12; |
| 344 | fy1=(index_ptr[0]&0x1000)>>12; |
| 345 | fx1=(index_ptr[1]&0x1000)>>12; |
| 334 | 346 | } |
| 335 | 347 | |
| 336 | | if(fx1&1) fx^=0x8000; |
| 337 | | if(fy1&1) fy^=0x4000; |
| 348 | if(fx1) fx^=0x8000; |
| 349 | if(fy1) fy^=0x4000; |
| 338 | 350 | |
| 339 | 351 | int extra_x_scale = 0x100; |
| 340 | 352 | |
| r21930 | r21931 | |
| 344 | 356 | // (although as previously noted, it isn't writing valid per-scanline values either) |
| 345 | 357 | if (rasterMode) |
| 346 | 358 | { |
| 347 | | // use of these is a bit weird. |
| 348 | | // -ZZZ -YYY ---- -xxx -yyy -zzz |
| 359 | // use of these is a bit weird. (it's probably just 16-bit .. like spriteram so the upper dupes are ignored?) |
| 360 | // -ZZZ -yyy ---- -xxx -YYY -zzz |
| 349 | 361 | |
| 350 | 362 | // xxx = x offset? |
| 351 | 363 | // yyy = y offset? |
| 352 | 364 | // zzz = xzoom (confirmed? stadium hero) |
| 353 | 365 | // 0x100 = no zoom |
| 354 | 366 | // |
| 355 | | // XXX = duplicate bits of xxx? |
| 367 | // YYY = duplicate bits of yyy? |
| 356 | 368 | // ZZZ = (sometimes) duplicate bits of zzz |
| 357 | 369 | |
| 358 | | if ((clipper==0x0) || (clipper==0x2)) |
| 370 | if (raster_select==1 || raster_select==2 || raster_select==3) |
| 359 | 371 | { |
| 360 | 372 | |
| 361 | 373 | int irq_base_reg; /* 6, 9, 12 are possible */ |
| 362 | | if (clipper== 0) irq_base_reg = 6; // OK upper screen.. left? |
| 363 | | else if (clipper== 2) irq_base_reg = 9; // OK upper screen.. main / center |
| 374 | if (raster_select== 1) irq_base_reg = 6; // OK upper screen.. left? |
| 375 | else if (raster_select== 2) irq_base_reg = 9; // OK upper screen.. main / center |
| 364 | 376 | else irq_base_reg = 12; |
| 365 | 377 | |
| 366 | 378 | int extra_y_off = m_irq_ram[irq_base_reg+0] & 0x7ff; |
| r21930 | r21931 | |
| 374 | 386 | x += extra_x_off; |
| 375 | 387 | y += extra_y_off; |
| 376 | 388 | } |
| 377 | | else if (clipper==0x1) |
| 389 | else if (raster_select==0x0) |
| 378 | 390 | { |
| 379 | | // right? |
| 391 | // possibly disabled? |
| 380 | 392 | } |
| 381 | | else if (clipper==0x3) |
| 382 | | { |
| 383 | | // bottom? |
| 384 | | } |
| 385 | 393 | |
| 386 | 394 | } |
| 387 | 395 | |
| r21930 | r21931 | |
| 537 | 545 | lookup table. Without buffering incorrect one frame glitches are seen |
| 538 | 546 | in several places, especially in Hoops. |
| 539 | 547 | */ |
| 540 | | memcpy(m_mlc_buffered_spriteram, m_spriteram, 0x3000); |
| 548 | memcpy(m_mlc_buffered_spriteram, m_mlc_spriteram, 0x3000/2); |
| 541 | 549 | } |
| 542 | 550 | } |
| 543 | 551 | |
trunk/src/mame/includes/deco_mlc.h
| r21930 | r21931 | |
| 6 | 6 | m_mlc_ram(*this, "mlc_ram"), |
| 7 | 7 | m_irq_ram(*this, "irq_ram"), |
| 8 | 8 | m_mlc_clip_ram(*this, "mlc_clip_ram"), |
| 9 | | m_spriteram(*this, "spriteram"), |
| 10 | | m_mlc_vram(*this, "mlc_vram"){ } |
| 9 | m_mlc_vram(*this, "mlc_vram") |
| 10 | |
| 11 | { } |
| 11 | 12 | |
| 12 | 13 | required_shared_ptr<UINT32> m_mlc_ram; |
| 13 | 14 | required_shared_ptr<UINT32> m_irq_ram; |
| 14 | 15 | required_shared_ptr<UINT32> m_mlc_clip_ram; |
| 15 | | required_shared_ptr<UINT32> m_spriteram; |
| 16 | 16 | required_shared_ptr<UINT32> m_mlc_vram; |
| 17 | 17 | timer_device *m_raster_irq_timer; |
| 18 | 18 | int m_mainCpuIsArm; |
| r21930 | r21931 | |
| 22 | 22 | UINT32 m_vbl_i; |
| 23 | 23 | int m_lastScanline[9]; |
| 24 | 24 | UINT32 m_colour_mask; |
| 25 | | UINT32 *m_mlc_buffered_spriteram; |
| 25 | |
| 26 | UINT16 *m_mlc_spriteram; |
| 27 | UINT16 *m_mlc_spriteram_spare; |
| 28 | UINT16 *m_mlc_buffered_spriteram; |
| 26 | 29 | DECLARE_READ32_MEMBER(test2_r); |
| 27 | 30 | DECLARE_READ32_MEMBER(test3_r); |
| 28 | 31 | DECLARE_WRITE32_MEMBER(avengrs_palette_w); |
| 29 | 32 | DECLARE_READ32_MEMBER(decomlc_vbl_r); |
| 30 | 33 | DECLARE_READ32_MEMBER(mlc_scanline_r); |
| 31 | 34 | DECLARE_WRITE32_MEMBER(mlc_irq_w); |
| 32 | | DECLARE_READ32_MEMBER(mlc_spriteram_r); |
| 33 | 35 | DECLARE_READ32_MEMBER(mlc_vram_r); |
| 34 | 36 | DECLARE_READ32_MEMBER(stadhr96_prot_146_r); |
| 35 | 37 | DECLARE_WRITE32_MEMBER(stadhr96_prot_146_w); |
| 36 | 38 | DECLARE_READ32_MEMBER(avengrgs_speedup_r); |
| 37 | 39 | DECLARE_WRITE32_MEMBER(avengrs_eprom_w); |
| 40 | DECLARE_READ32_MEMBER(mlc_spriteram_r); |
| 41 | DECLARE_WRITE32_MEMBER(mlc_spriteram_w); |
| 42 | |
| 43 | |
| 44 | |
| 38 | 45 | DECLARE_DRIVER_INIT(mlc); |
| 39 | 46 | DECLARE_DRIVER_INIT(avengrgs); |
| 40 | 47 | DECLARE_MACHINE_RESET(mlc); |