src/mess/machine/lynx.c
| r14324 | r14325 | |
| 882 | 882 | Accumulate JKLM |
| 883 | 883 | */ |
| 884 | 884 | state->m_suzy.accumulate_overflow = FALSE; |
| 885 | | |
| 886 | | if (state->m_suzy.signed_math) |
| 887 | | { |
| 888 | | UINT16 factor, temp; |
| 889 | | factor = state->m_suzy.data[MATH_B] | (state->m_suzy.data[MATH_A] << 8); |
| 890 | | if ((factor - 1) & 0x8000) /* here we use -1 to cover the math bugs on the sign of 0 and 0x8000 */ |
| 891 | | { |
| 892 | | temp = (factor ^ 0xffff) + 1; |
| 893 | | state->m_sign_AB = - 1; |
| 894 | | state->m_suzy.data[MATH_B] = temp & 0xff; |
| 895 | | state->m_suzy.data[MATH_A] = temp >> 8; |
| 896 | | } |
| 897 | | else |
| 898 | | state->m_sign_AB = 1; |
| 899 | | |
| 900 | | factor = state->m_suzy.data[MATH_D] | (state->m_suzy.data[MATH_C] << 8); |
| 901 | | if ((factor - 1) & 0x8000) /* here we use -1 to cover the math bugs on the sign of 0 and 0x8000 */ |
| 902 | | { |
| 903 | | temp = (factor ^ 0xffff) + 1; |
| 904 | | state->m_sign_CD = - 1; |
| 905 | | state->m_suzy.data[MATH_D] = temp & 0xff; |
| 906 | | state->m_suzy.data[MATH_C] = temp >> 8; |
| 907 | | } |
| 908 | | else |
| 909 | | state->m_sign_CD = 1; |
| 910 | | } |
| 911 | 885 | |
| 912 | 886 | left = state->m_suzy.data[MATH_B] | (state->m_suzy.data[MATH_A] << 8); |
| 913 | 887 | right = state->m_suzy.data[MATH_D] | (state->m_suzy.data[MATH_C] << 8); |
| r14324 | r14325 | |
| 1229 | 1203 | case MATH_M: |
| 1230 | 1204 | state->m_suzy.accumulate_overflow = FALSE; |
| 1231 | 1205 | break; |
| 1206 | case MATH_C: |
| 1207 | /* If we are going to perform a signed multiplication, we store the sign and convert the number |
| 1208 | to an unsigned one */ |
| 1209 | if (state->m_suzy.signed_math) |
| 1210 | { |
| 1211 | UINT16 factor, temp; |
| 1212 | factor = state->m_suzy.data[MATH_D] | (state->m_suzy.data[MATH_C] << 8); |
| 1213 | if ((factor - 1) & 0x8000) /* here we use -1 to cover the math bugs on the sign of 0 and 0x8000 */ |
| 1214 | { |
| 1215 | temp = (factor ^ 0xffff) + 1; |
| 1216 | state->m_sign_CD = - 1; |
| 1217 | state->m_suzy.data[MATH_D] = temp & 0xff; |
| 1218 | state->m_suzy.data[MATH_C] = temp >> 8; |
| 1219 | } |
| 1220 | else |
| 1221 | state->m_sign_CD = 1; |
| 1222 | } |
| 1223 | break; |
| 1224 | case MATH_D: |
| 1225 | /* Documentation states that writing to the MATH_D will set MATH_C to zero but not update the sign flag. |
| 1226 | Implementing the sign detection as described in the documentation causes Stun Runners to not work. |
| 1227 | Either the sign error in the docs is not as described or writing to the lower byte does update the sign flag. |
| 1228 | Here I assume the sign flag gets updated. */ |
| 1229 | if (data) |
| 1230 | state->m_sign_CD = 1; |
| 1231 | break; |
| 1232 | 1232 | /* Writing to A will start a 16 bit multiply */ |
| 1233 | 1233 | /* If we are going to perform a signed multiplication, we also store the sign and convert the |
| 1234 | 1234 | number to an unsigned one */ |
| 1235 | 1235 | case MATH_A: |
| 1236 | if (state->m_suzy.signed_math) |
| 1237 | { |
| 1238 | UINT16 factor, temp; |
| 1239 | factor = state->m_suzy.data[MATH_B] | (state->m_suzy.data[MATH_A] << 8); |
| 1240 | if ((factor - 1) & 0x8000) /* here we use -1 to cover the math bugs on the sign of 0 and 0x8000 */ |
| 1241 | { |
| 1242 | temp = (factor ^ 0xffff) + 1; |
| 1243 | state->m_sign_AB = - 1; |
| 1244 | state->m_suzy.data[MATH_B] = temp & 0xff; |
| 1245 | state->m_suzy.data[MATH_A] = temp >> 8; |
| 1246 | } |
| 1247 | else |
| 1248 | state->m_sign_AB = 1; |
| 1249 | } |
| 1236 | 1250 | lynx_multiply(state); |
| 1237 | 1251 | break; |
| 1238 | 1252 | /* Writing to E will start a 16 bit divide */ |
| r14324 | r14325 | |
| 1932 | 1946 | state->m_mikey.data[0x90] = 0x00; |
| 1933 | 1947 | state->m_mikey.data[0x92] = 0x00; |
| 1934 | 1948 | |
| 1935 | | /* |
| 1936 | | state->m_suzy.data[MATH_A] = 0xff; |
| 1937 | | state->m_suzy.data[MATH_B] = 0xff; |
| 1938 | | state->m_suzy.data[MATH_C] = 0xff; |
| 1939 | | state->m_suzy.data[MATH_D] = 0xff; |
| 1940 | | |
| 1941 | | state->m_suzy.data[MATH_E] = 0xff; |
| 1942 | | state->m_suzy.data[MATH_F] = 0xff; |
| 1943 | | state->m_suzy.data[MATH_G] = 0xff; |
| 1944 | | state->m_suzy.data[MATH_H] = 0xff; |
| 1945 | | |
| 1946 | | state->m_suzy.data[MATH_J] = 0xff; |
| 1947 | | state->m_suzy.data[MATH_K] = 0xff; |
| 1948 | | state->m_suzy.data[MATH_L] = 0xff; |
| 1949 | | state->m_suzy.data[MATH_M] = 0xff; |
| 1950 | | state->m_suzy.data[MATH_P] = 0xff; |
| 1951 | | */ |
| 1952 | | |
| 1953 | 1949 | lynx_uart_reset(state); |
| 1954 | 1950 | |
| 1955 | 1951 | // hack to allow current object loading to work |
| r14324 | r14325 | |
| 2131 | 2127 | MACHINE_CONFIG_FRAGMENT(lynx_cartslot) |
| 2132 | 2128 | MCFG_CARTSLOT_ADD("cart") |
| 2133 | 2129 | MCFG_CARTSLOT_EXTENSION_LIST("lnx,lyx") |
| 2134 | | MCFG_CARTSLOT_NOT_MANDATORY |
| 2130 | MCFG_CARTSLOT_MANDATORY |
| 2135 | 2131 | MCFG_CARTSLOT_INTERFACE("lynx_cart") |
| 2136 | 2132 | MCFG_CARTSLOT_LOAD(lynx_cart) |
| 2137 | 2133 | MCFG_CARTSLOT_PARTIALHASH(lynx_partialhash) |