trunk/src/mame/machine/seicop.c
r17953 | r17954 | |
1477 | 1477 | 0x1a0 0x00 0x6f |
1478 | 1478 | 0x1c0 0x00 0x71 |
1479 | 1479 | 0x1e0 0x00 0x72 |
| 1480 | |
1480 | 1481 | */ |
1481 | 1482 | |
1482 | 1483 | #include "emu.h" |
r17953 | r17954 | |
2227 | 2228 | |
2228 | 2229 | offs = (offset & 3) * 4; |
2229 | 2230 | |
2230 | | space->write_dword(cop_register[0] + 4 + offs, space->read_dword(cop_register[0] + 4 + offs) + space->read_dword(cop_register[0] + 16 + offs)); |
| 2231 | /* TODO: 0x1c operation? */ |
| 2232 | |
| 2233 | space->write_dword(cop_register[0] + 0x04 + offs, space->read_dword(cop_register[0] + 0x04 + offs) + space->read_dword(cop_register[0] + 0x10 + offs)); |
2231 | 2234 | return; |
2232 | 2235 | } |
2233 | 2236 | |
r17953 | r17954 | |
2238 | 2241 | |
2239 | 2242 | offs = (offset & 3) * 4; |
2240 | 2243 | |
2241 | | //popmessage("%d %d",space->read_dword(cop_register[0] + 0x2c + 0),space->read_dword(cop_register[0] + 0x2c + 4)); |
| 2244 | /* read 0x28 + offs */ |
| 2245 | /* add 0x10 + offs */ |
| 2246 | /* write 0x10 + offs */ |
2242 | 2247 | |
2243 | | space->write_dword(cop_register[0] + 16 + offs, space->read_dword(cop_register[0] + 16 + offs) + space->read_dword(cop_register[0] + 0x28 + offs)); |
| 2248 | space->write_dword(cop_register[0] + 0x10 + offs, space->read_dword(cop_register[0] + 0x10 + offs) + space->read_dword(cop_register[0] + 0x28 + offs)); |
2244 | 2249 | return; |
2245 | 2250 | } |
2246 | 2251 | |
r17953 | r17954 | |
2269 | 2274 | |
2270 | 2275 | res = int(amp*sin(angle)) << cop_scale; |
2271 | 2276 | |
2272 | | space->write_dword(cop_register[0] + 16, res); |
| 2277 | space->write_dword(cop_register[0] + 0x10, res); |
2273 | 2278 | return; |
2274 | 2279 | } |
2275 | 2280 | |
r17953 | r17954 | |
2321 | 2326 | //printf("%d %d %f %04x\n",dx,dy,atan(double(dy)/double(dx)) * 128 / M_PI,cop_angle); |
2322 | 2327 | |
2323 | 2328 | if(cop_mcu_ram[offset] & 0x80) |
2324 | | space->write_byte(cop_register[0]+(0x34^3), cop_angle); |
| 2329 | space->write_word(cop_register[0]+(0x34^2), cop_angle); |
2325 | 2330 | return; |
2326 | 2331 | } |
2327 | 2332 | |
r17953 | r17954 | |
2346 | 2351 | r1 = dx; |
2347 | 2352 | |
2348 | 2353 | if(cop_mcu_ram[offset] & 0x80) |
2349 | | space->write_byte(cop_register[0]+(0x34^3), cop_angle); |
| 2354 | space->write_word(cop_register[0]+(0x34^2), cop_angle); |
2350 | 2355 | return; |
2351 | 2356 | } |
2352 | 2357 | |
r17953 | r17954 | |
2367 | 2372 | dy = dy >> 16; |
2368 | 2373 | cop_dist = sqrt((double)(dx*dx+dy*dy)); |
2369 | 2374 | |
2370 | | /* TODO: bit 7 of macro command says if we have to write on work RAM */ |
2371 | | space->write_word(cop_register[0]+(0x38^2), cop_dist); |
| 2375 | if(cop_mcu_ram[offset] & 0x80) |
| 2376 | space->write_word(cop_register[0]+(0x38^2), cop_dist); |
2372 | 2377 | return; |
2373 | 2378 | } |
2374 | 2379 | |
r17953 | r17954 | |
2503 | 2508 | int div; |
2504 | 2509 | // INT16 offs_val; |
2505 | 2510 | |
| 2511 | /* TODO: [4-7] could be mirrors of [0-3] (this is the only command so far that uses 4-7 actually)*/ |
| 2512 | /* 0 + [4] */ |
| 2513 | /* 4 + [5] */ |
| 2514 | /* 8 + [4] */ |
| 2515 | /* 4 + [6] */ |
| 2516 | |
2506 | 2517 | //printf("%08x %08x %08x %08x %08x %08x %08x\n",cop_register[0],cop_register[1],cop_register[2],cop_register[3],cop_register[4],cop_register[5],cop_register[6]); |
2507 | 2518 | |
2508 | 2519 | offs = (offset & 3) * 4; |
r17953 | r17954 | |
2522 | 2533 | { |
2523 | 2534 | INT8 cur_angle; |
2524 | 2535 | |
| 2536 | /* 0 [1] */ |
| 2537 | /* 0xc [1] */ |
| 2538 | /* 0 [0] */ |
| 2539 | /* 0 [1] */ |
| 2540 | /* 0xc [1] */ |
| 2541 | |
2525 | 2542 | cur_angle = space->read_byte(cop_register[1] + (0xc ^ 3)); |
2526 | 2543 | space->write_byte(cop_register[1] + (0^3),space->read_byte(cop_register[1] + (0^3)) & 0xfb); //correct? |
2527 | 2544 | |