src/mess/machine/pokemini.c
| r2806 | r2807 | |
| 1362 | 1362 | { |
| 1363 | 1363 | prc.count = 0; |
| 1364 | 1364 | prc.frame_count++; |
| 1365 | | |
| 1366 | | if ( prc.frame_count >= prc.max_frame_count ) |
| 1365 | } |
| 1366 | else |
| 1367 | { |
| 1368 | if ( prc.count == 0x18 && prc.frame_count >= prc.max_frame_count ) |
| 1367 | 1369 | { |
| 1368 | 1370 | prc.frame_count = 0; |
| 1369 | 1371 | |
| r2806 | r2807 | |
| 1385 | 1387 | /* Check if the sprites should be drawn */ |
| 1386 | 1388 | if ( prc.sprites_enabled ) |
| 1387 | 1389 | { |
| 1390 | UINT16 spr; |
| 1391 | |
| 1392 | for ( spr = 0x35C; spr >= 0x300; spr -= 4 ) |
| 1393 | { |
| 1394 | int spr_x = ( pokemini_ram[ spr + 0 ] & 0x7F ) - 16; |
| 1395 | int spr_y = ( pokemini_ram[ spr + 1 ] & 0x7F ) - 16; |
| 1396 | UINT8 spr_tile = pokemini_ram[ spr + 2 ]; |
| 1397 | UINT8 spr_flag = pokemini_ram[ spr + 3 ]; |
| 1398 | |
| 1399 | if ( spr_flag & 0x08 ) |
| 1400 | { |
| 1401 | UINT16 gfx, mask; |
| 1402 | UINT32 spr_base = prc.spr_tiles + spr_tile * 64; |
| 1403 | int i, j; |
| 1404 | |
| 1405 | for ( i = 0; i < 16; i++ ) |
| 1406 | { |
| 1407 | if ( spr_x + i >= 0 && spr_x + i < 96 ) |
| 1408 | { |
| 1409 | int rel_x = ( spr_flag & 0x01 ) ? 15 - i : i; |
| 1410 | UINT32 s = spr_base + ( ( rel_x & 0x08 ) << 2 ) + ( rel_x & 0x07 ); |
| 1411 | |
| 1412 | mask = ~ ( program_read_byte( s ) | ( program_read_byte( s + 8 ) << 8 ) ); |
| 1413 | gfx = program_read_byte( s + 16 ) | ( program_read_byte( s + 24 ) << 8 ); |
| 1414 | |
| 1415 | /* Are the colors inverted? */ |
| 1416 | if ( spr_flag & 0x04 ) |
| 1417 | { |
| 1418 | gfx = ~gfx; |
| 1419 | } |
| 1420 | |
| 1421 | for ( j = 0; j < 16; j++ ) |
| 1422 | { |
| 1423 | if ( spr_y + j >= 0 && spr_y + j < 64 ) |
| 1424 | { |
| 1425 | UINT16 ram_addr = ( ( ( spr_y + j ) >> 3 ) * 96 ) + spr_x + i; |
| 1426 | |
| 1427 | if ( spr_flag & 0x02 ) |
| 1428 | { |
| 1429 | if ( mask & 0x8000 || 1 ) |
| 1430 | { |
| 1431 | pokemini_ram[ ram_addr ] &= ~ ( 1 << ( ( spr_y + j ) & 0x07 ) ); |
| 1432 | if ( gfx & 0x8000 ) |
| 1433 | { |
| 1434 | pokemini_ram[ ram_addr ] |= ( 1 << ( ( spr_y + j ) & 0x07 ) ); |
| 1435 | } |
| 1436 | } |
| 1437 | mask <<= 1; |
| 1438 | gfx <<= 1; |
| 1439 | } |
| 1440 | else |
| 1441 | { |
| 1442 | if ( mask & 0x0001 || 1 ) |
| 1443 | { |
| 1444 | pokemini_ram[ ram_addr ] &= ~ ( 1 << ( ( spr_y + j ) & 0x07 ) ); |
| 1445 | if ( gfx & 0x0001 ) |
| 1446 | { |
| 1447 | pokemini_ram[ ram_addr ] |= ( 1 << ( ( spr_y + j ) & 0x07 ) ); |
| 1448 | } |
| 1449 | } |
| 1450 | mask >>= 1; |
| 1451 | gfx >>= 1; |
| 1452 | } |
| 1453 | } |
| 1454 | } |
| 1455 | } |
| 1456 | } |
| 1457 | } |
| 1458 | } |
| 1388 | 1459 | } |
| 1389 | 1460 | |
| 1390 | 1461 | /* Set PRC Render interrupt */ |
| r2806 | r2807 | |
| 1410 | 1481 | *BITMAP_ADDR16(tmpbitmap, y + 7, x) = ( data & 0x80 ) ? 3 : 0; |
| 1411 | 1482 | } |
| 1412 | 1483 | } |
| 1484 | |
| 1485 | /* Set PRC Copy interrupt */ |
| 1486 | pm_reg[0x27] |= 0x80; |
| 1487 | pokemini_check_irqs( machine ); |
| 1413 | 1488 | } |
| 1414 | | |
| 1415 | | /* Set PRC Copy interrupt */ |
| 1416 | | pm_reg[0x27] |= 0x80; |
| 1417 | | pokemini_check_irqs( machine ); |
| 1418 | 1489 | } |
| 1419 | 1490 | |
| 1420 | 1491 | /* Set possible input irqs */ |