trunk/src/mame/drivers/model2.c
| r29649 | r29650 | |
| 13 | 13 | - desert: several 3d bugs, presumably down to FIFO; |
| 14 | 14 | - dynamcop: stalls at stage select screen; |
| 15 | 15 | - fvipers: enables timers, but then irq register is empty, hence it crashes with an "interrupt halt" at POST (regression); |
| 16 | - lastbrnx: uses external DMA port 0 for uploading SHARC program, hook-up might not be 100% right; |
| 17 | - lastbrnx: uses a shitload of unsupported SHARC opcodes (compute_fmul_avg, shift operation 0x11, ALU operation 0x89); |
| 16 | 18 | - manxtt: missing 3d; |
| 17 | 19 | - motoraid: stalls after course select; |
| 18 | 20 | - pltkidsa: after few secs of gameplay, background 3d disappears and everything reports a collision against the player; |
| r29649 | r29650 | |
| 732 | 734 | } |
| 733 | 735 | else |
| 734 | 736 | { |
| 737 | // if(m_coprocnt == 0) |
| 738 | // return; |
| 739 | |
| 735 | 740 | //mame_printf_debug("copro_fifo_w: %08X, %08X, %08X at %08X\n", data, offset, mem_mask, space.device().safe_pc()); |
| 736 | 741 | if (m_dsp_type == DSP_TYPE_SHARC) |
| 737 | 742 | copro_fifoin_push(machine().device("dsp"), data); |
| r29649 | r29650 | |
| 742 | 747 | |
| 743 | 748 | WRITE32_MEMBER(model2_state::copro_sharc_iop_w) |
| 744 | 749 | { |
| 745 | | /* FIXME: clean this up */ |
| 750 | /* FIXME: clean this mess */ |
| 746 | 751 | if ((strcmp(machine().system().name, "schamp" ) == 0) || |
| 747 | 752 | (strcmp(machine().system().name, "sfight" ) == 0) || |
| 748 | 753 | (strcmp(machine().system().name, "fvipers" ) == 0) || |
| r29649 | r29650 | |
| 751 | 756 | (strcmp(machine().system().name, "gunblade" ) == 0) || |
| 752 | 757 | (strcmp(machine().system().name, "von" ) == 0) || |
| 753 | 758 | (strcmp(machine().system().name, "vonj" ) == 0) || |
| 754 | | (strcmp(machine().system().name, "rchase2" ) == 0)) |
| 759 | (strcmp(machine().system().name, "rchase2" ) == 0) || |
| 760 | (strcmp(machine().system().name, "lastbrnx" ) == 0) || |
| 761 | (strcmp(machine().system().name, "lastbrnxu" ) == 0) || |
| 762 | (strcmp(machine().system().name, "lastbrnxj" ) == 0)) |
| 755 | 763 | { |
| 756 | 764 | machine().device<adsp21062_device>("dsp")->external_iop_write(offset, data); |
| 757 | 765 | } |
| r29649 | r29650 | |
| 1448 | 1456 | |
| 1449 | 1457 | AM_RANGE(0x00900000, 0x0097ffff) AM_RAM AM_SHARE("bufferram") |
| 1450 | 1458 | |
| 1451 | | |
| 1452 | 1459 | AM_RANGE(0x00980004, 0x00980007) AM_READ(fifoctl_r) |
| 1453 | 1460 | AM_RANGE(0x0098000c, 0x0098000f) AM_READWRITE(videoctl_r,videoctl_w) |
| 1454 | 1461 | AM_RANGE(0x00980030, 0x0098003f) AM_READ8(tgpid_r,0xffffffff) |
| r29649 | r29650 | |
| 1542 | 1549 | AM_IMPORT_FROM(model2_base_mem) |
| 1543 | 1550 | ADDRESS_MAP_END |
| 1544 | 1551 | |
| 1552 | /* TODO: read by Sonic the Fighters (bit 1), unknown purpose */ |
| 1553 | READ32_MEMBER(model2_state::copro_status_r) |
| 1554 | { |
| 1555 | if(m_coprocnt == 0) |
| 1556 | return -1; |
| 1557 | |
| 1558 | return 0; |
| 1559 | } |
| 1560 | |
| 1545 | 1561 | /* 2A-CRX overrides */ |
| 1546 | 1562 | static ADDRESS_MAP_START( model2a_crx_mem, AS_PROGRAM, 32, model2_state ) |
| 1547 | 1563 | AM_RANGE(0x00200000, 0x0023ffff) AM_RAM |
| r29649 | r29650 | |
| 1552 | 1568 | |
| 1553 | 1569 | AM_RANGE(0x00980000, 0x00980003) AM_READWRITE(copro_ctl1_r,copro_ctl1_w) |
| 1554 | 1570 | AM_RANGE(0x00980008, 0x0098000b) AM_WRITE(geo_ctl1_w) |
| 1571 | AM_RANGE(0x00980014, 0x00980017) AM_READ(copro_status_r) |
| 1555 | 1572 | AM_RANGE(0x009c0000, 0x009cffff) AM_READWRITE(model2_serial_r, model2_serial_w ) |
| 1556 | 1573 | |
| 1557 | 1574 | AM_RANGE(0x12000000, 0x121fffff) AM_RAM_WRITE(model2o_tex_w0) AM_MIRROR(0x200000) AM_SHARE("textureram0") // texture RAM 0 |
| r29649 | r29650 | |
| 1583 | 1600 | AM_RANGE(0x008c0000, 0x008c0fff) AM_WRITE(copro_sharc_iop_w) |
| 1584 | 1601 | |
| 1585 | 1602 | AM_RANGE(0x00980000, 0x00980003) AM_READWRITE(copro_ctl1_r,copro_ctl1_w) |
| 1586 | | |
| 1587 | 1603 | AM_RANGE(0x00980008, 0x0098000b) AM_WRITE(geo_ctl1_w) |
| 1604 | AM_RANGE(0x00980014, 0x00980017) AM_READ(copro_status_r) |
| 1588 | 1605 | //AM_RANGE(0x00980008, 0x0098000b) AM_WRITE(geo_sharc_ctl1_w ) |
| 1589 | 1606 | |
| 1590 | 1607 | AM_RANGE(0x009c0000, 0x009cffff) AM_READWRITE(model2_serial_r, model2_serial_w ) |
| r29649 | r29650 | |
| 1616 | 1633 | |
| 1617 | 1634 | AM_RANGE(0x00980000, 0x00980003) AM_READWRITE(copro_ctl1_r,copro_ctl1_w) |
| 1618 | 1635 | AM_RANGE(0x00980008, 0x0098000b) AM_WRITE(geo_ctl1_w ) |
| 1636 | AM_RANGE(0x00980014, 0x00980017) AM_READ(copro_status_r) |
| 1619 | 1637 | AM_RANGE(0x009c0000, 0x009cffff) AM_READWRITE(model2_serial_r, model2_serial_w ) |
| 1620 | 1638 | |
| 1621 | 1639 | AM_RANGE(0x11000000, 0x111fffff) AM_RAM AM_SHARE("textureram0") // texture RAM 0 (2b/2c) |
trunk/src/emu/cpu/sharc/compute.inc
| r29649 | r29650 | |
| 1236 | 1236 | /* TODO: AV flag */ |
| 1237 | 1237 | |
| 1238 | 1238 | FREG(fm) = r_mul.f; |
| 1239 | REG(fa) = alu_i; // TODO: check this, should be RA? |
| 1240 | m_astat |= AF; |
| 1241 | } |
| 1242 | |
| 1243 | void adsp21062_device::compute_fmul_avg(int fm, int fxm, int fym, int fa, int fxa, int fya) |
| 1244 | { |
| 1245 | INT32 alu_i; |
| 1246 | SHARC_REG r_mul, r_alu; |
| 1247 | r_mul.f = FREG(fxm) * FREG(fym); |
| 1248 | r_alu.f = (FREG(fxa) * FREG(fya))/((float) 2.0); |
| 1249 | |
| 1250 | /* TODO: are flags right for this? */ |
| 1251 | if (m_mode1 & MODE1_TRUNCATE) |
| 1252 | { |
| 1253 | alu_i = (INT32)(r_alu.f); |
| 1254 | } |
| 1255 | else |
| 1256 | { |
| 1257 | alu_i = (INT32)(r_alu.f < 0 ? (r_alu.f - 0.5f) : (r_alu.f + 0.5f)); |
| 1258 | } |
| 1259 | |
| 1260 | CLEAR_MULTIPLIER_FLAGS(); |
| 1261 | SET_FLAG_MN(r_mul.r); |
| 1262 | /* TODO: MV flag */ |
| 1263 | /* TODO: MU flag */ |
| 1264 | /* TODO: MI flag */ |
| 1265 | |
| 1266 | CLEAR_ALU_FLAGS(); |
| 1267 | SET_FLAG_AN(alu_i); |
| 1268 | // AZ |
| 1269 | SET_FLAG_AZ(alu_i); |
| 1270 | // AU |
| 1271 | m_stky |= (IS_FLOAT_DENORMAL(r_alu.r)) ? AUS : 0; |
| 1272 | // AI |
| 1273 | m_astat |= (IS_FLOAT_NAN(REG(fxa))) ? AI : 0; |
| 1274 | /* TODO: AV flag */ |
| 1275 | |
| 1276 | FREG(fm) = r_mul.f; |
| 1239 | 1277 | REG(fa) = alu_i; |
| 1240 | 1278 | m_astat |= AF; |
| 1241 | 1279 | } |
| 1242 | 1280 | |
| 1243 | | |
| 1244 | 1281 | /* Fm = Fxm * Fym, Fa = MAX(Fxa, Fya) */ |
| 1245 | 1282 | void adsp21062_device::compute_fmul_fmax(int fm, int fxm, int fym, int fa, int fxa, int fya) |
| 1246 | 1283 | { |
trunk/src/emu/cpu/sharc/sharc.h
| r29649 | r29650 | |
| 142 | 142 | SHARC_LADDR m_laddr; |
| 143 | 143 | UINT32 m_curlcntr; |
| 144 | 144 | UINT32 m_lcntr; |
| 145 | UINT8 m_extdma_shift; |
| 145 | 146 | |
| 146 | 147 | /* Data Address Generator (DAG) */ |
| 147 | 148 | SHARC_DAG m_dag1; // (DM bus) |
| r29649 | r29650 | |
| 339 | 340 | inline void compute_fmul_fsub(int fm, int fxm, int fym, int fa, int fxa, int fya); |
| 340 | 341 | inline void compute_fmul_float_scaled(int fm, int fxm, int fym, int fa, int fxa, int fya); |
| 341 | 342 | inline void compute_fmul_fix_scaled(int fm, int fxm, int fym, int fa, int fxa, int fya); |
| 343 | inline void compute_fmul_avg(int fm, int fxm, int fym, int fa, int fxa, int fya); |
| 342 | 344 | inline void compute_fmul_fmax(int fm, int fxm, int fym, int fa, int fxa, int fya); |
| 343 | 345 | inline void compute_fmul_fmin(int fm, int fxm, int fym, int fa, int fxa, int fya); |
| 344 | 346 | inline void compute_fmul_dual_fadd_fsub(int fm, int fxm, int fym, int fa, int fs, int fxa, int fya); |
trunk/src/emu/cpu/sharc/sharcmem.inc
| r29649 | r29650 | |
| 18 | 18 | (m_internal_ram_block1[addr + 1]); |
| 19 | 19 | } |
| 20 | 20 | else { |
| 21 | | fatalerror("SHARC: PM Bus Read %08X at %08X\n", address, m_pc); |
| 21 | fatalerror("SHARC: PM Bus Read32 %08X at %08X\n", address, m_pc); |
| 22 | 22 | } |
| 23 | 23 | } |
| 24 | 24 | |
| r29649 | r29650 | |
| 42 | 42 | return; |
| 43 | 43 | } |
| 44 | 44 | else { |
| 45 | | fatalerror("SHARC: PM Bus Write %08X, %08X at %08X\n", address, data, m_pc); |
| 45 | fatalerror("SHARC: PM Bus Write32 %08X, %08X at %08X\n", address, data, m_pc); |
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | UINT64 adsp21062_device::pm_read48(UINT32 address) |
| 50 | 50 | { |
| 51 | | if (address >= 0x20000 && address < 0x28000) |
| 51 | if ((address >= 0 && address < 0x8000) || (address >= 0x20000 && address < 0x28000)) |
| 52 | 52 | { |
| 53 | 53 | UINT32 addr = (address & 0x7fff) * 3; |
| 54 | 54 | |
| r29649 | r29650 | |
| 66 | 66 | ((UINT64)(m_internal_ram_block1[addr + 2]) << 0); |
| 67 | 67 | } |
| 68 | 68 | else { |
| 69 | | fatalerror("SHARC: PM Bus Read %08X at %08X\n", address, m_pc); |
| 69 | //fatalerror("SHARC: PM Bus Read48 %08X at %08X\n", address, m_pc); |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | 72 | return 0; |
| r29649 | r29650 | |
| 74 | 74 | |
| 75 | 75 | void adsp21062_device::pm_write48(UINT32 address, UINT64 data) |
| 76 | 76 | { |
| 77 | | if (address >= 0x20000 && address < 0x28000) |
| 77 | if ((address >= 0 && address < 0x8000) || (address >= 0x20000 && address < 0x28000)) |
| 78 | 78 | { |
| 79 | 79 | UINT32 addr = (address & 0x7fff) * 3; |
| 80 | 80 | |
| r29649 | r29650 | |
| 94 | 94 | return; |
| 95 | 95 | } |
| 96 | 96 | else { |
| 97 | | fatalerror("SHARC: PM Bus Write %08X, %04X%08X at %08X\n", address, (UINT16)(data >> 32),(UINT32)data, m_pc); |
| 97 | //fatalerror("SHARC: PM Bus Write48 %08X, %04X%08X at %08X\n", address, (UINT16)(data >> 32),(UINT32)data, m_pc); |
| 98 | 98 | } |
| 99 | 99 | } |
| 100 | 100 | |