trunk/src/mame/drivers/deco_mlc.c
| r21887 | r21888 | |
| 175 | 175 | |
| 176 | 176 | WRITE32_MEMBER(deco_mlc_state::mlc_irq_w) |
| 177 | 177 | { |
| 178 | | int scanline=machine().primary_screen->vpos(); |
| 179 | | m_irq_ram[offset]=data&0xffff; |
| 178 | // int scanline=machine().primary_screen->vpos(); |
| 179 | COMBINE_DATA(&m_irq_ram[offset]); |
| 180 | 180 | |
| 181 | |
| 181 | 182 | switch (offset*4) |
| 182 | 183 | { |
| 183 | 184 | case 0x10: /* IRQ ack. Value written doesn't matter */ |
| r21887 | r21888 | |
| 187 | 188 | m_raster_irq_timer->adjust(machine().primary_screen->time_until_pos(m_irq_ram[0x14/4])); |
| 188 | 189 | //logerror("prepare scanline to fire at %d (currently on %d)\n", m_irq_ram[0x14/4], machine().primary_screen->vpos()); |
| 189 | 190 | return; |
| 190 | | case 0x18: |
| 191 | | case 0x1c: |
| 192 | | case 0x20: |
| 193 | | case 0x24: |
| 194 | | case 0x28: |
| 195 | | case 0x2c: |
| 196 | | case 0x30: |
| 197 | | case 0x34: |
| 198 | | case 0x38: |
| 199 | | if (scanline > 255) |
| 200 | | scanline = 255; |
| 201 | | /* Update scanlines up to present line */ |
| 202 | | while (m_lastScanline[offset-6]<scanline) |
| 203 | | { |
| 204 | | m_mlc_raster_table[offset-6][m_lastScanline[offset-6]+1]=m_mlc_raster_table[offset-6][m_lastScanline[offset-6]]; |
| 205 | | m_lastScanline[offset-6]++; |
| 206 | | } |
| 207 | 191 | |
| 208 | | if (m_lastScanline[offset-6] > scanline) |
| 209 | | m_lastScanline[offset-6]=0; |
| 210 | | |
| 211 | | /* Set current scanline value */ |
| 212 | | m_mlc_raster_table[offset-6][scanline]=data&0xffff; |
| 213 | | break; |
| 214 | | |
| 215 | 192 | default: |
| 216 | 193 | break; |
| 217 | 194 | }; |
trunk/src/mame/video/deco_mlc.c
| r21887 | r21888 | |
| 11 | 11 | #include "emu.h" |
| 12 | 12 | #include "includes/deco_mlc.h" |
| 13 | 13 | |
| 14 | | //extern int mlc_raster_table[9][256]; |
| 15 | | //extern UINT32 mlc_clipper[32]; |
| 16 | | //static bitmap_rgb32 *temp_bitmap; |
| 17 | | |
| 18 | 14 | /******************************************************************************/ |
| 19 | 15 | |
| 20 | 16 | VIDEO_START_MEMBER(deco_mlc_state,mlc) |
| r21887 | r21888 | |
| 30 | 26 | m_mlc_buffered_spriteram = auto_alloc_array(machine(), UINT32, 0x3000/4); |
| 31 | 27 | } |
| 32 | 28 | |
| 33 | | #ifdef UNUSED_FUNCTION |
| 34 | | void deco_mlc_state::blitRaster(bitmap_rgb32 &bitmap, int rasterMode) |
| 35 | | { |
| 36 | | int x,y; |
| 37 | | for (y=0; y<256; y++) //todo |
| 38 | | { |
| 39 | | UINT32* src=&temp_bitmap->pix32(y&0x1ff); |
| 40 | | UINT32* dst=&bitmap.pix32(y); |
| 41 | | UINT32 xptr=(m_mlc_raster_table[0][y]<<13); |
| 42 | 29 | |
| 43 | | if (machine().input().code_pressed(KEYCODE_X)) |
| 44 | | xptr=0; |
| 45 | | |
| 46 | | for (x=0; x<320; x++) |
| 47 | | { |
| 48 | | if (src[x]) |
| 49 | | dst[x]=src[(xptr>>16)&0x1ff]; |
| 50 | | |
| 51 | | //if (machine().input().code_pressed(KEYCODE_X)) |
| 52 | | // xptr+=0x10000; |
| 53 | | //else if(rasterHackTest[0][y]<0) |
| 54 | | xptr+=0x10000 - ((m_mlc_raster_table[2][y]&0x3ff)<<5); |
| 55 | | //else |
| 56 | | // xptr+=0x10000 + (m_mlc_raster_table[0][y]<<5); |
| 57 | | } |
| 58 | | } |
| 59 | | } |
| 60 | | #endif |
| 61 | | |
| 62 | 30 | static void mlc_drawgfxzoomline( |
| 63 | 31 | UINT32* dest,const rectangle &clip,gfx_element *gfx, |
| 64 | 32 | UINT32 code1,UINT32 code2, UINT32 color,int flipx,int sx, |
| r21887 | r21888 | |
| 78 | 46 | /* KW 991012 -- Added code to force clip to bitmap boundary */ |
| 79 | 47 | |
| 80 | 48 | |
| 81 | | const pen_t *pal = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; |
| 82 | | const UINT8 *code_base1 = gfx->get_data(code1 % gfx->elements()); |
| 83 | | const UINT8 *code_base2 = gfx->get_data(code2 % gfx->elements()); |
| 84 | 49 | |
| 85 | 50 | int sprite_screen_width = (scalex*16+(sx&0xffff))>>16; |
| 86 | 51 | |
| r21887 | r21888 | |
| 121 | 86 | |
| 122 | 87 | if( ex>sx ) |
| 123 | 88 | { /* skip if inner loop doesn't draw anything */ |
| 89 | const pen_t *pal = &gfx->machine().pens[gfx->colorbase() + gfx->granularity() * (color % gfx->colors())]; |
| 90 | const UINT8 *code_base1 = gfx->get_data(code1 % gfx->elements()); |
| 124 | 91 | |
| 125 | 92 | /* no alpha */ |
| 126 | 93 | if (alpha == 0xff) |
| 127 | | { |
| 94 | { |
| 95 | const UINT8 *code_base2 = gfx->get_data(code2 % gfx->elements()); |
| 128 | 96 | const UINT8 *source1 = code_base1 + (srcline) * gfx->rowbytes(); |
| 129 | 97 | const UINT8 *source2 = code_base2 + (srcline) * gfx->rowbytes(); |
| 130 | 98 | |
| r21887 | r21888 | |
| 172 | 140 | int useIndicesInRom=0; |
| 173 | 141 | int hibits=0; |
| 174 | 142 | int tileFormat=0; |
| 175 | | // int rasterMode=0; |
| 176 | | // int lastRasterMode=0; |
| 177 | | // int rasterDirty=0; |
| 143 | int rasterMode=0; |
| 144 | |
| 178 | 145 | int clipper=0; |
| 179 | 146 | rectangle user_clip; |
| 180 | 147 | UINT32* mlc_spriteram=m_mlc_buffered_spriteram; // spriteram32 |
| 181 | 148 | |
| 149 | //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 | |
| 182 | 151 | for (offs = (0x3000/4)-8; offs>=0; offs-=8) |
| 183 | 152 | { |
| 184 | 153 | if ((mlc_spriteram[offs+0]&0x8000)==0) |
| r21887 | r21888 | |
| 233 | 202 | fx = mlc_spriteram[offs+1]&0x8000; |
| 234 | 203 | fy = mlc_spriteram[offs+1]&0x4000; |
| 235 | 204 | color = mlc_spriteram[offs+1]&0xff; |
| 236 | | // rasterMode = (mlc_spriteram[offs+1]>>10)&0x1; |
| 205 | |
| 206 | // there are 3 different sets of raster values, must be a way to selects |
| 207 | // between them? furthermore avengrgs doesn't even enable this |
| 208 | // although it doesn't seem to set the scroll values very often either |
| 209 | // so the irq mechanism might be wrong |
| 210 | rasterMode = (mlc_spriteram[offs+1]>>10)&0x1; |
| 211 | |
| 212 | |
| 213 | |
| 237 | 214 | clipper = (mlc_spriteram[offs+1]>>8)&0x3; |
| 238 | 215 | indx = mlc_spriteram[offs+0]&0x3fff; |
| 239 | 216 | yscale = mlc_spriteram[offs+4]&0x3ff; |
| r21887 | r21888 | |
| 344 | 321 | if(fx1&1) fx^=0x8000; |
| 345 | 322 | if(fy1&1) fy^=0x4000; |
| 346 | 323 | |
| 324 | if (rasterMode) |
| 325 | { |
| 326 | int irq_base_reg = 6 /* 6, 9, 12 */; |
| 327 | |
| 328 | int extra_y_off = m_irq_ram[irq_base_reg+0] & 0x7ff; |
| 329 | int extra_x_off = m_irq_ram[irq_base_reg+1] & 0x7ff; |
| 330 | int extra_y_scale = (m_irq_ram[irq_base_reg+2]>>16) & 0x7ff; |
| 331 | int extra_x_scale = (m_irq_ram[irq_base_reg+2]>>0) & 0x7ff; |
| 332 | |
| 333 | if (extra_x_off & 0x400) extra_x_off -= 0x800; |
| 334 | if (extra_y_off & 0x400) extra_y_off -= 0x800; |
| 335 | |
| 336 | x += extra_x_off; |
| 337 | y += extra_x_off; |
| 338 | |
| 339 | xscale = extra_x_scale; |
| 340 | yscale = extra_y_scale; |
| 341 | |
| 342 | } |
| 343 | |
| 347 | 344 | int ybase=y<<16; |
| 348 | 345 | int yinc=(yscale<<8)*16; |
| 349 | 346 | |
| r21887 | r21888 | |
| 510 | 507 | { |
| 511 | 508 | UINT32 *dest = &bitmap.pix32(i); |
| 512 | 509 | |
| 510 | /* |
| 511 | printf("%d -", i); |
| 512 | for (int j=0;j<0x20;j++) |
| 513 | { |
| 514 | printf("%08x, ",m_irq_ram[j]); |
| 515 | } |
| 516 | printf("\n"); |
| 517 | */ |
| 513 | 518 | draw_sprites(cliprect, i, dest); |
| 514 | 519 | } |
| 515 | 520 | return 0; |