trunk/src/mame/drivers/ttchamp.c
| r245116 | r245117 | |
| 99 | 99 | DECLARE_WRITE16_MEMBER(ttchamp_mem_w); |
| 100 | 100 | |
| 101 | 101 | UINT16 m_videoram0[0x10000 / 2]; |
| 102 | | UINT16 m_videoram1[0x10000 / 2]; |
| 102 | // UINT16 m_videoram1[0x10000 / 2]; |
| 103 | 103 | UINT16 m_videoram2[0x10000 / 2]; |
| 104 | 104 | |
| 105 | 105 | |
| r245116 | r245117 | |
| 141 | 141 | static const int xxx=320,yyy=204; |
| 142 | 142 | |
| 143 | 143 | bitmap.fill(m_palette->black_pen()); |
| 144 | UINT8 *videoramfg; |
| 145 | UINT8* videorambg; |
| 146 | |
| 147 | count=0; |
| 148 | videorambg = (UINT8*)m_videoram0; |
| 149 | videoramfg = (UINT8*)m_videoram2; |
| 144 | 150 | |
| 145 | | count=0; |
| 146 | | UINT8 *videoram = (UINT8*)m_videoram0; |
| 147 | 151 | for (y=0;y<yyy;y++) |
| 148 | 152 | { |
| 149 | 153 | for(x=0;x<xxx;x++) |
| 150 | 154 | { |
| 151 | | /*if(hotblock_port0&0x40)*/bitmap.pix16(y, x) = videoram[BYTE_XOR_LE(count)]+0x300; |
| 155 | bitmap.pix16(y, x) = videorambg[BYTE_XOR_LE(count)]+0x300; |
| 152 | 156 | count++; |
| 153 | 157 | } |
| 154 | 158 | } |
| 155 | | |
| 159 | |
| 160 | /* |
| 156 | 161 | count=0; |
| 157 | 162 | videoram = (UINT8*)m_videoram1; |
| 158 | 163 | for (y=0;y<yyy;y++) |
| r245116 | r245117 | |
| 164 | 169 | count++; |
| 165 | 170 | } |
| 166 | 171 | } |
| 167 | | |
| 172 | */ |
| 173 | |
| 168 | 174 | count=0; |
| 169 | | videoram = (UINT8*)m_videoram2; |
| 170 | 175 | for (y=0;y<yyy;y++) |
| 171 | 176 | { |
| 172 | 177 | for(x=0;x<xxx;x++) |
| 173 | 178 | { |
| 174 | | UINT8 pix = videoram[BYTE_XOR_LE(count)]; |
| 175 | | if (pix) bitmap.pix16(y, x) = pix+0x000; |
| 179 | UINT8 pix = videoramfg[BYTE_XOR_LE(count)]; |
| 180 | if (pix) |
| 181 | { |
| 182 | // first pen values seem to be special |
| 183 | // see char select and shadows ingame |
| 184 | // pen 0 = transparent |
| 185 | // pen 1 = blend 1 |
| 186 | // pen 2 = blend 2 |
| 187 | // pen 3 = ?? |
| 188 | |
| 189 | if (pix == 0x01) // blend mode 1 |
| 190 | { |
| 191 | UINT8 pix = videorambg[BYTE_XOR_LE(count)]; |
| 192 | bitmap.pix16(y, x) = pix + 0x200; |
| 193 | } |
| 194 | else if (pix == 0x02) // blend mode 2 |
| 195 | { |
| 196 | UINT8 pix = videorambg[BYTE_XOR_LE(count)]; |
| 197 | bitmap.pix16(y, x) = pix + 0x100; |
| 198 | } |
| 199 | else |
| 200 | { |
| 201 | bitmap.pix16(y, x) = pix + 0x000; |
| 202 | } |
| 203 | } |
| 176 | 204 | count++; |
| 177 | 205 | } |
| 178 | 206 | } |
| 207 | |
| 179 | 208 | |
| 180 | 209 | for (int i = 0; i < 0x8000; i++) |
| 181 | 210 | { |
| r245116 | r245117 | |
| 183 | 212 | // I think it actually does more blit operations with |
| 184 | 213 | // different bits of m_port10 set to redraw the backgrounds using the video ram data as a source rather than ROM - notice the garbage you see behind 'sprites' right now |
| 185 | 214 | // this method also removes the text layer, which we don't want |
| 186 | | m_videoram1[i] = 0x0000; |
| 187 | | m_videoram2[i] = 0x0000; |
| 215 | // m_videoram1[i] = 0x0000; |
| 216 | // m_videoram2[i] = 0x0000; |
| 188 | 217 | } |
| 189 | 218 | |
| 190 | 219 | return 0; |
| r245116 | r245117 | |
| 199 | 228 | |
| 200 | 229 | WRITE16_MEMBER(ttchamp_state::paldat_w) |
| 201 | 230 | { |
| 202 | | // maybe 4 layers of 0x100 each? |
| 203 | | // middle palettes seem to have special meaning tho, maybe blending? it's a darker copy ingame, and red/blue shades on char select |
| 204 | | // based on screenshot references the highlighted player portraits should be appear in shades of red/blue |
| 205 | | |
| 206 | 231 | // 0x8000 of offset is sometimes set |
| 207 | 232 | m_palette->set_pen_color(m_paloff & 0x3ff,pal5bit(data>>0),pal5bit(data>>5),pal5bit(data>>10)); |
| 208 | 233 | } |
| r245116 | r245117 | |
| 216 | 241 | if ((m_port10&0xf) == 0x00) |
| 217 | 242 | vram = m_videoram0; |
| 218 | 243 | else if ((m_port10&0xf) == 0x01) |
| 219 | | vram = m_videoram1; |
| 244 | vram = m_videoram2; |
| 220 | 245 | else if ((m_port10&0xf) == 0x03) |
| 221 | 246 | vram = m_videoram2; |
| 222 | 247 | else |
| r245116 | r245117 | |
| 251 | 276 | if ((m_port10&0xf) == 0x00) |
| 252 | 277 | vram = m_videoram0; |
| 253 | 278 | else if ((m_port10&0xf) == 0x01) |
| 254 | | vram = m_videoram1; |
| 279 | vram = m_videoram2; |
| 255 | 280 | else if ((m_port10&0xf) == 0x03) |
| 256 | 281 | vram = m_videoram2; |
| 257 | 282 | else |
| r245116 | r245117 | |
| 272 | 297 | { |
| 273 | 298 | // printf("%06x: spider_blitter_w %08x %04x %04x (init2) (width?)\n", space.device().safe_pc(), offset * 2, data, mem_mask); |
| 274 | 299 | m_spriteswidth = offset & 0xff; |
| 275 | | if (m_spriteswidth == 0) |
| 276 | | m_spriteswidth = 80; |
| 277 | 300 | |
| 278 | 301 | m_spritesinit = 0; |
| 279 | 302 | |
| r245116 | r245117 | |
| 303 | 326 | |
| 304 | 327 | for (int i = 0; i < m_spriteswidth; i++) |
| 305 | 328 | { |
| 306 | | UINT8 data; |
| 307 | | |
| 308 | | data = (src[(m_spritesaddr * 2) + 1]); |
| 309 | | |
| 310 | | if (data) |
| 311 | | vram[offset] = (vram[offset] & 0x00ff) | data << 8; |
| 329 | if ((m_port10 & 0xf) == 0x01) // this is set when moving objects are cleared, although not screen clears? |
| 330 | { |
| 331 | vram[offset] = 0x0000; |
| 332 | offset++; |
| 333 | } |
| 334 | else |
| 335 | { |
| 336 | UINT8 data; |
| 312 | 337 | |
| 338 | data = (src[(m_spritesaddr * 2) + 1]); |
| 313 | 339 | |
| 314 | | data = src[(m_spritesaddr*2)]; |
| 315 | | |
| 316 | | if (data) |
| 317 | | vram[offset] = (vram[offset] & 0xff00) | data; |
| 340 | if (data) |
| 341 | vram[offset] = (vram[offset] & 0x00ff) | data << 8; |
| 318 | 342 | |
| 319 | 343 | |
| 320 | | m_spritesaddr ++; |
| 321 | | offset++; |
| 344 | data = src[(m_spritesaddr * 2)]; |
| 322 | 345 | |
| 346 | if (data) |
| 347 | vram[offset] = (vram[offset] & 0xff00) | data; |
| 348 | |
| 349 | |
| 350 | m_spritesaddr++; |
| 351 | offset++; |
| 352 | } |
| 353 | |
| 323 | 354 | offset &= 0x7fff; |
| 324 | 355 | } |
| 325 | 356 | } |
| r245116 | r245117 | |
| 356 | 387 | WRITE16_MEMBER(ttchamp_state::port20_w) |
| 357 | 388 | { |
| 358 | 389 | printf("%06x: port20_w %04x %04x\n", space.device().safe_pc(), data, mem_mask); |
| 390 | // seems to somehow be tied to layer clear |
| 391 | // might also depend on layer selected with 0x10 tho? written after it |
| 392 | for (int i = 0; i < 0x8000; i++) |
| 393 | { |
| 394 | // m_videoram0[i] = 0x0000; |
| 395 | m_videoram2[i] = 0x0000; |
| 396 | } |
| 397 | |
| 359 | 398 | } |
| 360 | 399 | |
| 361 | 400 | WRITE16_MEMBER(ttchamp_state::port62_w) |