trunk/src/mame/machine/raiden2cop.c
| r32363 | r32364 | |
| 178 | 178 | else return space.read_word(address); |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | UINT8 raiden2cop_device::cop_read_byte(address_space &space, int address) |
| 182 | { |
| 183 | if (m_cpu_is_68k) return space.read_byte(address ^ 3); |
| 184 | else return space.read_byte(address); |
| 185 | } |
| 186 | |
| 187 | |
| 181 | 188 | /*** Command Table uploads ***/ |
| 182 | 189 | |
| 183 | 190 | |
| r32363 | r32364 | |
| 783 | 790 | */ |
| 784 | 791 | |
| 785 | 792 | // triggered with 0904 0905 |
| 786 | | /* X Se Dae and Zero Team uses this variant */ |
| 793 | |
| 787 | 794 | void raiden2cop_device::execute_0904(address_space &space, int offset, UINT16 data) |
| 788 | 795 | { |
| 789 | | space.write_dword(cop_regs[0] + 16 + offset * 4, space.read_dword(cop_regs[0] + 16 + offset * 4) - space.read_dword(cop_regs[0] + 0x28 + offset * 4)); |
| 796 | if (data&0x0001) |
| 797 | space.write_dword(cop_regs[0] + 16 + offset * 4, space.read_dword(cop_regs[0] + 16 + offset * 4) + space.read_dword(cop_regs[0] + 0x28 + offset * 4)); |
| 798 | else /* X Se Dae and Zero Team uses this variant */ |
| 799 | space.write_dword(cop_regs[0] + 16 + offset * 4, space.read_dword(cop_regs[0] + 16 + offset * 4) - space.read_dword(cop_regs[0] + 0x28 + offset * 4)); |
| 790 | 800 | } |
| 791 | 801 | |
| 792 | | void raiden2cop_device::execute_0905(address_space &space, int offset, UINT16 data) |
| 793 | | { |
| 794 | | space.write_dword(cop_regs[0] + 16 + offset * 4, space.read_dword(cop_regs[0] + 16 + offset * 4) + space.read_dword(cop_regs[0] + 0x28 + offset * 4)); |
| 795 | | } |
| 796 | 802 | |
| 797 | | void raiden2cop_device::LEGACY_execute_0905(address_space &space, int offset, UINT16 data) |
| 798 | | { |
| 799 | | UINT8 offs; |
| 800 | 803 | |
| 801 | | offs = (offset & 3) * 4; |
| 802 | 804 | |
| 803 | | /* read 0x28 + offs */ |
| 804 | | /* add 0x10 + offs */ |
| 805 | | /* write 0x10 + offs */ |
| 806 | | |
| 807 | | space.write_dword(cop_regs[0] + 0x10 + offs, space.read_dword(cop_regs[0] + 0x10 + offs) + space.read_dword(cop_regs[0] + 0x28 + offs)); |
| 808 | | |
| 809 | | } |
| 810 | | |
| 811 | 805 | /* |
| 812 | 806 | 02 - 138e (130e ) : (984, aa4, d82, aa2, 39b, b9a, b9a, b9a) 5 bf7f (heatbrl, legionna) |
| 813 | 807 | 02 - 138e (130e ) : (984, aa4, d82, aa2, 39b, b9a, b9a, a9a) 5 bf7f (cupsoc, godzilla, grainbow, denjinmk) |
| r32363 | r32364 | |
| 1060 | 1054 | */ |
| 1061 | 1055 | void raiden2cop_device::execute_6200(address_space &space, int offset, UINT16 data) |
| 1062 | 1056 | { |
| 1063 | | UINT8 angle = space.read_byte(cop_regs[0] + 0x34); |
| 1064 | | UINT16 flags = space.read_word(cop_regs[0]); |
| 1057 | UINT8 angle = cop_read_byte(space, cop_regs[0] + 0x34); |
| 1058 | UINT16 flags = cop_read_word(space, cop_regs[0]); |
| 1065 | 1059 | cop_angle_target &= 0xff; |
| 1066 | 1060 | cop_angle_step &= 0xff; |
| 1067 | 1061 | flags &= ~0x0004; |
| r32363 | r32364 | |
| 1090 | 1084 | space.write_byte(cop_regs[0] + 0x34, angle); |
| 1091 | 1085 | } |
| 1092 | 1086 | |
| 1093 | | void raiden2cop_device::LEGACY_execute_6200(address_space &space, int offset, UINT16 data) |
| 1087 | |
| 1088 | void raiden2cop_device::LEGACY_execute_6200_grainbow(address_space &space, int offset, UINT16 data) |
| 1094 | 1089 | { |
| 1095 | 1090 | UINT8 cur_angle; |
| 1096 | 1091 | UINT16 flags; |
| 1097 | 1092 | |
| 1098 | | /* 0 [1] */ |
| 1099 | | /* 0xc [1] */ |
| 1100 | | /* 0 [0] */ |
| 1101 | | /* 0 [1] */ |
| 1102 | | /* 0xc [1] */ |
| 1103 | | |
| 1104 | | cur_angle = space.read_byte(cop_regs[1] + (0xc ^ 3)); |
| 1105 | | flags = space.read_word(cop_regs[1]); |
| 1093 | cur_angle = cop_read_byte(space,cop_regs[0] + 0x34); |
| 1094 | flags = cop_read_word(space, cop_regs[0]); |
| 1106 | 1095 | //space.write_byte(cop_regs[1] + (0^3),space.read_byte(cop_regs[1] + (0^3)) & 0xfb); //correct? |
| 1107 | 1096 | |
| 1108 | 1097 | INT8 tempangle_compare = (INT8)cop_angle_target; |
| r32363 | r32364 | |
| 1114 | 1103 | cop_angle_target = tempangle_compare; |
| 1115 | 1104 | cop_angle_step = tempangle_mod_val; |
| 1116 | 1105 | |
| 1106 | |
| 1117 | 1107 | flags &= ~0x0004; |
| 1118 | 1108 | |
| 1119 | 1109 | int delta = cur_angle - tempangle_compare; |
| r32363 | r32364 | |
| 1142 | 1132 | cur_angle -= tempangle_mod_val; |
| 1143 | 1133 | } |
| 1144 | 1134 | |
| 1145 | | space.write_byte(cop_regs[1] + (0 ^ 2), flags); |
| 1146 | | space.write_byte(cop_regs[1] + (0xc ^ 3), cur_angle); |
| 1135 | space.write_byte(cop_regs[0] + (0 ^ 3), flags); // this is a word in the avoce |
| 1136 | space.write_word(cop_regs[0] + (0x34 ^ 3), cur_angle); // why ^3 on a word? should it be a byte, it is in the above |
| 1147 | 1137 | } |
| 1148 | 1138 | |
| 1149 | | void raiden2cop_device::LEGACY_execute_6200_grainbow(address_space &space, int offset, UINT16 data) |
| 1139 | |
| 1140 | void raiden2cop_device::LEGACY_execute_6200(address_space &space, int offset, UINT16 data) // this is for cupsoc, different sequence, works on different registers |
| 1150 | 1141 | { |
| 1151 | 1142 | UINT8 cur_angle; |
| 1152 | 1143 | UINT16 flags; |
| 1153 | 1144 | |
| 1154 | | cur_angle = space.read_byte(cop_regs[0] + (0x34 ^ 3)); |
| 1155 | | flags = space.read_word(cop_regs[0] + (0 ^ 2)); |
| 1145 | /* 0 [1] */ |
| 1146 | /* 0xc [1] */ |
| 1147 | /* 0 [0] */ |
| 1148 | /* 0 [1] */ |
| 1149 | /* 0xc [1] */ |
| 1150 | |
| 1151 | cur_angle = space.read_byte(cop_regs[1] + (0xc ^ 3)); |
| 1152 | flags = space.read_word(cop_regs[1]); |
| 1156 | 1153 | //space.write_byte(cop_regs[1] + (0^3),space.read_byte(cop_regs[1] + (0^3)) & 0xfb); //correct? |
| 1157 | 1154 | |
| 1158 | 1155 | INT8 tempangle_compare = (INT8)cop_angle_target; |
| r32363 | r32364 | |
| 1164 | 1161 | cop_angle_target = tempangle_compare; |
| 1165 | 1162 | cop_angle_step = tempangle_mod_val; |
| 1166 | 1163 | |
| 1167 | | |
| 1168 | 1164 | flags &= ~0x0004; |
| 1169 | 1165 | |
| 1170 | 1166 | int delta = cur_angle - tempangle_compare; |
| r32363 | r32364 | |
| 1193 | 1189 | cur_angle -= tempangle_mod_val; |
| 1194 | 1190 | } |
| 1195 | 1191 | |
| 1196 | | space.write_byte(cop_regs[0] + (0 ^ 3), flags); |
| 1197 | | space.write_word(cop_regs[0] + (0x34 ^ 3), cur_angle); |
| 1192 | space.write_byte(cop_regs[1] + (0 ^ 2), flags); |
| 1193 | space.write_byte(cop_regs[1] + (0xc ^ 3), cur_angle); |
| 1198 | 1194 | } |
| 1199 | 1195 | |
| 1200 | 1196 | /* |
| r32363 | r32364 | |
| 1584 | 1580 | } |
| 1585 | 1581 | |
| 1586 | 1582 | case 0x0904: /* X Se Dae and Zero Team uses this variant */ |
| 1583 | case 0x0905: // 0905 0006 fbfb 0008 - 0194 0288 0088 0000 0000 0000 0000 0000 |
| 1587 | 1584 | execute_0904(space, offset, data); |
| 1588 | 1585 | break; |
| 1589 | | |
| 1590 | | case 0x0905: // 0905 0006 fbfb 0008 - 0194 0288 0088 0000 0000 0000 0000 0000 |
| 1591 | | execute_0905(space, offset, data); |
| 1592 | | break; |
| 1593 | 1586 | |
| 1594 | 1587 | case 0x130e: // 130e 0005 bf7f 0010 - 0984 0aa4 0d82 0aa2 039b 0b9a 0b9a 0a9a |
| 1595 | 1588 | case 0x138e: |
| r32363 | r32364 | |
| 2004 | 1997 | if (check_command_matches(command, 0x194, 0x288, 0x088, 0x000, 0x000, 0x000, 0x000, 0x000, 6, 0xfbfb)) |
| 2005 | 1998 | { |
| 2006 | 1999 | executed = 1; |
| 2007 | | LEGACY_execute_0905(space, offset, data); |
| 2000 | execute_0904(space, offset, data); |
| 2008 | 2001 | return; |
| 2009 | 2002 | } |
| 2010 | 2003 | |
trunk/src/mame/machine/raiden2cop.h
| r32363 | r32364 | |
| 159 | 159 | void execute_3b30(address_space &space, int offset, UINT16 data); |
| 160 | 160 | void execute_130e(address_space &space, int offset, UINT16 data); |
| 161 | 161 | void execute_0904(address_space &space, int offset, UINT16 data); |
| 162 | | void execute_0905(address_space &space, int offset, UINT16 data); |
| 163 | 162 | void execute_2a05(address_space &space, int offset, UINT16 data); |
| 164 | 163 | void execute_7e05(address_space &space, int offset, UINT16 data); |
| 165 | 164 | void execute_5205(address_space &space, int offset, UINT16 data); |
| r32363 | r32364 | |
| 180 | 179 | void LEGACY_execute_b900(address_space &space, int offset, UINT16 data); |
| 181 | 180 | void LEGACY_execute_0205(address_space &space, int offset, UINT16 data); |
| 182 | 181 | void LEGACY_execute_42c2(address_space &space, int offset, UINT16 data); |
| 183 | | void LEGACY_execute_0905(address_space &space, int offset, UINT16 data); |
| 184 | 182 | void LEGACY_execute_e30e(address_space &space, int offset, UINT16 data); |
| 185 | 183 | void LEGACY_execute_6200(address_space &space, int offset, UINT16 data); |
| 186 | 184 | void LEGACY_execute_6200_grainbow(address_space &space, int offset, UINT16 data); |
| r32363 | r32364 | |
| 260 | 258 | int m_cpu_is_68k; |
| 261 | 259 | static void set_cpu_is_68k(device_t &device, int value) { downcast<raiden2cop_device &>(device).m_cpu_is_68k = value; } |
| 262 | 260 | UINT16 cop_read_word(address_space &space, int address); |
| 261 | UINT8 cop_read_byte(address_space &space, int address); |
| 263 | 262 | |
| 264 | 263 | // DEBUG |
| 265 | 264 | void dump_table(); |