Previous 199869 Revisions Next

r17953 Sunday 16th September, 2012 at 23:21:28 UTC by Angelo Salese
Other small notes, nw
[src/mame/machine]seicop.c

trunk/src/mame/machine/seicop.c
r17952r17953
145714570xc0  0xc0     1    0xffe80000 0x00000000
145814580xc0  0xc0     2    0xffd00000 0x00000000
145914590xc0  0xc0     3    0xffa00000 0x00000000
1460
1461commands 0x130e/0x138e: (dx dy 2 fixed point 0x80)
1462dx     dy      angle
1463---------------------
14640x00   0x00    0x20
14650x20   0x00    0x25 (0x26 in test)
14660x40   0x00    0x2d (0x2b in test)
14670x60   0x00    0x36
14680x80   0x00    0x00 cop status 0x8007
14690xa0   0x00    0x4a
14700xc0   0x00    0x53
14710xe0   0x00    0x5b (0x5a)
14720x100  0x00    0x60
14730x120  0x00    0x65
14740x140  0x00    0x69 (0x68)
14750x160  0x00    0x6b
14760x180  0x00    0x6e (0x6d)
14770x1a0  0x00    0x6f
14780x1c0  0x00    0x71
14790x1e0  0x00    0x72
14601480*/
14611481
14621482#include "emu.h"
r17952r17953
18041824   UINT16 hitbox;
18051825   UINT16 hitbox_x,hitbox_y;
18061826}cop_collision_info[2];
1827static int r0, r1;
18071828
18081829/* RE from Seibu Cup Soccer bootleg */
18091830static const UINT8 fade_table(int v)
r17952r17953
21842205
21852206         //printf("%04x %04x %04x\n",cop_mcu_ram[offset],u1,u2);
21862207
2187         cop_status &= 0x7fff;
2188
21892208         /*
21902209            Macro notes:
21912210            - endianess changes from/to Raiden 2:
r17952r17953
22262245         }
22272246
22282247         /* SINE math - 0x8100 */
2229         /* FIXME: cop scale is unreliable */
22302248         /*
22312249                 00000-0ffff:
22322250                   amp = x/256
r17952r17953
22562274         }
22572275
22582276         /* COSINE math - 0x8900 */
2259         /* FIXME: cop scale is unreliable */
22602277         /*
22612278             10000-1ffff:
22622279               amp = x/256
r17952r17953
22882305         /* 0x130e / 0x138e */
22892306         if(COP_CMD(0x984,0xaa4,0xd82,0xaa2,0x39b,0xb9a,0xb9a,0xa9a,5,0xbf7f))
22902307         {
2291            int dx = space->read_dword(cop_register[1]+4) - space->read_dword(cop_register[0]+4);
2292            int dy = space->read_dword(cop_register[1]+8) - space->read_dword(cop_register[0]+8);
2308            int dy = space->read_dword(cop_register[1]+4) - space->read_dword(cop_register[0]+4);
2309            int dx = space->read_dword(cop_register[1]+8) - space->read_dword(cop_register[0]+8);
22932310
2294            if(!dy) {
2311            cop_status = 7;
2312            if(!dx) {
22952313               cop_status |= 0x8000;
22962314               cop_angle = 0;
22972315            } else {
2298               cop_angle = atan(double(dx)/double(dy)) * 128 / M_PI;
2299               if(dy<0)
2316               cop_angle = atan(double(dy)/double(dx)) * 128.0 / M_PI;
2317               if(dx<0)
23002318                  cop_angle += 0x80;
23012319            }
23022320
2303            space->write_byte(cop_register[0]+(0x34^3), cop_angle);
2321            //printf("%d %d %f %04x\n",dx,dy,atan(double(dy)/double(dx)) * 128 / M_PI,cop_angle);
2322
2323            if(cop_mcu_ram[offset] & 0x80)
2324               space->write_byte(cop_register[0]+(0x34^3), cop_angle);
23042325            return;
23052326         }
23062327
r17952r17953
23082329         //(heatbrl)  | 5 | bf7f | 138e | 984 aa4 d82 aa2 39b b9a b9a b9a
23092330         if(COP_CMD(0x984,0xaa4,0xd82,0xaa2,0x39b,0xb9a,0xb9a,0xb9a,5,0xbf7f))
23102331         {
2311            int dx = space->read_dword(cop_register[1]+4) - space->read_dword(cop_register[0]+4);
2312            int dy = space->read_dword(cop_register[1]+8) - space->read_dword(cop_register[0]+8);
2313            if(!dy) {
2332            int dy = space->read_dword(cop_register[1]+4) - space->read_dword(cop_register[0]+4);
2333            int dx = space->read_dword(cop_register[1]+8) - space->read_dword(cop_register[0]+8);
2334
2335            cop_status = 7;
2336            if(!dx) {
23142337               cop_status |= 0x8000;
23152338               cop_angle = 0;
23162339            } else {
2317               cop_angle = atan(double(dx)/double(dy)) * 128 / M_PI;
2318               if(dy<0)
2340               cop_angle = atan(double(dy)/double(dx)) * 128.0 / M_PI;
2341               if(dx<0)
23192342                  cop_angle += 0x80;
23202343            }
23212344
2322            /* TODO: bit 7 of macro command says if we have to write on work RAM */
2323            //if(0)
2345            r0 = dy;
2346            r1 = dx;
2347
2348            if(cop_mcu_ram[offset] & 0x80)
23242349               space->write_byte(cop_register[0]+(0x34^3), cop_angle);
23252350            return;
23262351         }
23272352
23282353         /* Pythagorean theorem, hypotenuse length - 0x3bb0 */
2329         //07 | 4 | 007f | 3bb0 | f9c b9c b9c b9c b9c b9c b9c 99c
23302354         //(grainbow) | 4 | 007f | 3bb0 | f9c b9c b9c b9c b9c b9c b9c 99c
23312355         /*
23322356             40000-7ffff:
r17952r17953
23362360            */
23372361         if(COP_CMD(0xf9c,0xb9c,0xb9c,0xb9c,0xb9c,0xb9c,0xb9c,0x99c,4,0x007f))
23382362         {
2339            int dx = space->read_dword(cop_register[1]+4) - space->read_dword(cop_register[0]+4);
2340            int dy = space->read_dword(cop_register[1]+8) - space->read_dword(cop_register[0]+8);
2363            int dy = r0;
2364            int dx = r1;
23412365
23422366            dx = dx >> 16;
23432367            dy = dy >> 16;
r17952r17953
23592383               v2 = (x & 1023)*32
23602384               val = !v1 ? 32767 : trunc(v2/v1+0.5)
23612385            */
2386            /* TODO: this is WRONG! */
23622387         if(COP_CMD(0xf9a,0xb9a,0xb9c,0xb9c,0xb9c,0x29c,0x000,0x000,5,0xfcdd))
23632388         {
23642389            int div = space->read_word(cop_register[0]+(0x36^2));
23652390            int res;
23662391
2367            cop_status = 0x8007;
2368
23692392            if(!div)
23702393            {
23712394               printf("divide by zero?\n");

Previous 199869 Revisions Next


© 1997-2024 The MAME Team