trunk/src/emu/cpu/tms0980/tms0980.c
| r242974 | r242975 | |
| 429 | 429 | m_sr = 0; |
| 430 | 430 | m_pa = 0; |
| 431 | 431 | m_pb = 0; |
| 432 | | m_ps = 0; |
| 433 | 432 | m_a = 0; |
| 434 | 433 | m_x = 0; |
| 435 | 434 | m_y = 0; |
| r242974 | r242975 | |
| 467 | 466 | save_item(NAME(m_sr)); |
| 468 | 467 | save_item(NAME(m_pa)); |
| 469 | 468 | save_item(NAME(m_pb)); |
| 470 | | save_item(NAME(m_ps)); |
| 471 | 469 | save_item(NAME(m_a)); |
| 472 | 470 | save_item(NAME(m_x)); |
| 473 | 471 | save_item(NAME(m_y)); |
| r242974 | r242975 | |
| 638 | 636 | tms1100_cpu_device::device_reset(); |
| 639 | 637 | |
| 640 | 638 | // small differences in 00-3f area |
| 641 | | m_fixed_decode[0x09] = F_COMX; |
| 639 | m_fixed_decode[0x09] = F_COMX; // ! |
| 642 | 640 | m_fixed_decode[0x0b] = F_TPC; |
| 643 | 641 | } |
| 644 | 642 | |
| r242974 | r242975 | |
| 960 | 958 | //------------------------------------------------- |
| 961 | 959 | |
| 962 | 960 | // handle branches: |
| 963 | | |
| 964 | | // TMS1000/common |
| 965 | 961 | // note: add(latch) and bl(branch latch) are specific to 0980 series, |
| 966 | 962 | // c(chapter) bits are specific to 1100(and 1400) series |
| 967 | 963 | |
| 964 | // TMS1000/common: |
| 965 | |
| 968 | 966 | void tms1xxx_cpu_device::op_br() |
| 969 | 967 | { |
| 970 | 968 | // BR/BL: conditional branch |
| 971 | | if (m_status) |
| 972 | | { |
| 973 | | if (m_clatch == 0) |
| 974 | | m_pa = m_pb; |
| 975 | | m_ca = m_cb; |
| 976 | | m_pc = m_opcode & m_pc_mask; |
| 977 | | } |
| 969 | if (!m_status) |
| 970 | return; |
| 971 | |
| 972 | if (!m_clatch) |
| 973 | m_pa = m_pb; |
| 974 | m_ca = m_cb; |
| 975 | m_pc = m_opcode & m_pc_mask; |
| 978 | 976 | } |
| 979 | 977 | |
| 980 | 978 | void tms1xxx_cpu_device::op_call() |
| 981 | 979 | { |
| 982 | 980 | // CALL/CALLL: conditional call |
| 983 | | if (m_status) |
| 984 | | { |
| 985 | | UINT8 prev_pa = m_pa; |
| 981 | if (!m_status) |
| 982 | return; |
| 986 | 983 | |
| 987 | | if (m_clatch == 0) |
| 988 | | { |
| 989 | | m_clatch = 1; |
| 990 | | m_sr = m_pc; |
| 991 | | m_pa = m_pb; |
| 992 | | m_cs = m_ca; |
| 993 | | } |
| 994 | | m_ca = m_cb; |
| 995 | | m_pb = prev_pa; |
| 996 | | m_pc = m_opcode & m_pc_mask; |
| 984 | UINT8 prev_pa = m_pa; |
| 985 | if (!m_clatch) |
| 986 | { |
| 987 | m_sr = m_pc; |
| 988 | m_clatch = 1; |
| 989 | m_pa = m_pb; |
| 990 | m_cs = m_ca; |
| 997 | 991 | } |
| 992 | m_ca = m_cb; |
| 993 | m_pb = prev_pa; |
| 994 | m_pc = m_opcode & m_pc_mask; |
| 998 | 995 | } |
| 999 | 996 | |
| 1000 | 997 | void tms1xxx_cpu_device::op_retn() |
| 1001 | 998 | { |
| 1002 | 999 | // RETN: return from subroutine |
| 1003 | | if (m_clatch == 1) |
| 1000 | if (m_clatch) |
| 1004 | 1001 | { |
| 1005 | | m_clatch = 0; |
| 1006 | 1002 | m_pc = m_sr; |
| 1003 | m_clatch = 0; |
| 1007 | 1004 | m_ca = m_cs; |
| 1008 | 1005 | } |
| 1009 | 1006 | m_add = 0; |
| r242974 | r242975 | |
| 1017 | 1014 | void tms1400_cpu_device::op_br() |
| 1018 | 1015 | { |
| 1019 | 1016 | // BR/BL: conditional branch |
| 1020 | | if (m_status) |
| 1021 | | { |
| 1022 | | m_pa = m_pb; // don't care about clatch |
| 1023 | | m_ca = m_cb; |
| 1024 | | m_pc = m_opcode & m_pc_mask; |
| 1025 | | } |
| 1017 | if (!m_status) |
| 1018 | return; |
| 1019 | |
| 1020 | //.. |
| 1026 | 1021 | } |
| 1027 | 1022 | |
| 1028 | 1023 | void tms1400_cpu_device::op_call() |
| 1029 | 1024 | { |
| 1030 | 1025 | // CALL/CALLL: conditional call |
| 1031 | | if (m_status) |
| 1032 | | { |
| 1033 | | // 3-level stack, mask clatch 3 bits (no need to mask others) |
| 1034 | | m_clatch = (m_clatch << 1 | 1) & 7; |
| 1026 | if (!m_status) |
| 1027 | return; |
| 1035 | 1028 | |
| 1036 | | m_sr = m_sr << m_pc_bits | m_pc; |
| 1037 | | m_pc = m_opcode & m_pc_mask; |
| 1038 | | |
| 1039 | | m_ps = m_ps << 4 | m_pa; |
| 1040 | | m_pa = m_pb; |
| 1041 | | |
| 1042 | | m_cs = m_cs << 2 | m_ca; |
| 1043 | | m_ca = m_cb; |
| 1044 | | } |
| 1045 | | else |
| 1046 | | { |
| 1047 | | m_pb = m_pa; |
| 1048 | | m_cb = m_ca; |
| 1049 | | } |
| 1029 | //.. |
| 1050 | 1030 | } |
| 1051 | 1031 | |
| 1052 | 1032 | void tms1400_cpu_device::op_retn() |
| 1053 | 1033 | { |
| 1054 | 1034 | // RETN: return from subroutine |
| 1055 | | if (m_clatch & 1) |
| 1056 | | { |
| 1057 | | m_clatch >>= 1; |
| 1058 | | |
| 1059 | | m_pc = m_sr & m_pc_mask; |
| 1060 | | m_sr >>= m_pc_bits; |
| 1061 | | |
| 1062 | | m_pa = m_pb = m_ps & 0xf; |
| 1063 | | m_ps >>= 4; |
| 1064 | | |
| 1065 | | m_ca = m_cb = m_cs & 3; |
| 1066 | | m_cs >>= 2; |
| 1067 | | } |
| 1035 | //.. |
| 1068 | 1036 | } |
| 1069 | 1037 | |
| 1070 | 1038 | |
| 1071 | 1039 | // handle other: |
| 1072 | 1040 | |
| 1073 | | // TMS1000/common |
| 1041 | // TMS1000/common: |
| 1074 | 1042 | |
| 1075 | 1043 | void tms1xxx_cpu_device::op_sbit() |
| 1076 | 1044 | { |
| r242974 | r242975 | |
| 1190 | 1158 | |
| 1191 | 1159 | |
| 1192 | 1160 | // TMS0980-specific (and possibly child classes) |
| 1193 | | |
| 1194 | 1161 | void tms0980_cpu_device::op_comx() |
| 1195 | 1162 | { |
| 1196 | 1163 | // COMX: complement X register, but not the MSB |
| r242974 | r242975 | |
| 1236 | 1203 | |
| 1237 | 1204 | |
| 1238 | 1205 | // TMS0270-specific |
| 1239 | | |
| 1240 | 1206 | void tms0270_cpu_device::op_setr() |
| 1241 | 1207 | { |
| 1242 | 1208 | // same as default, but handle write to output in dynamic_output |
trunk/src/emu/netlist/analog/nld_bjt.c
| r242974 | r242975 | |
| 11 | 11 | { |
| 12 | 12 | public: |
| 13 | 13 | diode() : m_Is(1e-15), m_VT(0.0258), m_VT_inv(1.0 / m_VT) {} |
| 14 | | diode(const double Is, const double n) |
| 14 | diode(const nl_double Is, const nl_double n) |
| 15 | 15 | { |
| 16 | 16 | m_Is = Is; |
| 17 | 17 | m_VT = 0.0258 * n; |
| 18 | 18 | m_VT_inv = 1.0 / m_VT; |
| 19 | 19 | } |
| 20 | | void set(const double Is, const double n) |
| 20 | void set(const nl_double Is, const nl_double n) |
| 21 | 21 | { |
| 22 | 22 | m_Is = Is; |
| 23 | 23 | m_VT = 0.0258 * n; |
| 24 | 24 | m_VT_inv = 1.0 / m_VT; |
| 25 | 25 | } |
| 26 | | double I(const double V) const { return m_Is * exp(V * m_VT_inv) - m_Is; } |
| 27 | | double g(const double V) const { return m_Is * m_VT_inv * exp(V * m_VT_inv); } |
| 28 | | double V(const double I) const { return log(1.0 + I / m_Is) * m_VT; } |
| 29 | | double gI(const double I) const { return m_VT_inv * (I + m_Is); } |
| 26 | nl_double I(const nl_double V) const { return m_Is * exp(V * m_VT_inv) - m_Is; } |
| 27 | nl_double g(const nl_double V) const { return m_Is * m_VT_inv * exp(V * m_VT_inv); } |
| 28 | nl_double V(const nl_double I) const { return log(1.0 + I / m_Is) * m_VT; } |
| 29 | nl_double gI(const nl_double I) const { return m_VT_inv * (I + m_Is); } |
| 30 | 30 | |
| 31 | 31 | private: |
| 32 | | double m_Is; |
| 33 | | double m_VT; |
| 34 | | double m_VT_inv; |
| 32 | nl_double m_Is; |
| 33 | nl_double m_VT; |
| 34 | nl_double m_VT_inv; |
| 35 | 35 | }; |
| 36 | 36 | |
| 37 | 37 | |
| r242974 | r242975 | |
| 85 | 85 | m_state_on = 0; |
| 86 | 86 | |
| 87 | 87 | { |
| 88 | | double IS = m_model.model_value("IS", 1e-15); |
| 89 | | double BF = m_model.model_value("BF", 100); |
| 90 | | double NF = m_model.model_value("NF", 1); |
| 91 | | //double VJE = m_model.dValue("VJE", 0.75); |
| 88 | nl_double IS = m_model.model_value("IS", 1e-15); |
| 89 | nl_double BF = m_model.model_value("BF", 100); |
| 90 | nl_double NF = m_model.model_value("NF", 1); |
| 91 | //nl_double VJE = m_model.dValue("VJE", 0.75); |
| 92 | 92 | |
| 93 | 93 | set_qtype((m_model.model_type() == "NPN") ? BJT_NPN : BJT_PNP); |
| 94 | 94 | |
| 95 | | double alpha = BF / (1.0 + BF); |
| 95 | nl_double alpha = BF / (1.0 + BF); |
| 96 | 96 | |
| 97 | 97 | diode d(IS, NF); |
| 98 | 98 | |
| r242974 | r242975 | |
| 155 | 155 | m_gD_BC.save("m_D_BC", *this); |
| 156 | 156 | |
| 157 | 157 | { |
| 158 | | double IS = m_model.model_value("IS", 1e-15); |
| 159 | | double BF = m_model.model_value("BF", 100); |
| 160 | | double NF = m_model.model_value("NF", 1); |
| 161 | | double BR = m_model.model_value("BR", 1); |
| 162 | | double NR = m_model.model_value("NR", 1); |
| 163 | | //double VJE = m_model.dValue("VJE", 0.75); |
| 158 | nl_double IS = m_model.model_value("IS", 1e-15); |
| 159 | nl_double BF = m_model.model_value("BF", 100); |
| 160 | nl_double NF = m_model.model_value("NF", 1); |
| 161 | nl_double BR = m_model.model_value("BR", 1); |
| 162 | nl_double NR = m_model.model_value("NR", 1); |
| 163 | //nl_double VJE = m_model.dValue("VJE", 0.75); |
| 164 | 164 | |
| 165 | 165 | set_qtype((m_model.model_type() == "NPN") ? BJT_NPN : BJT_PNP); |
| 166 | 166 | //printf("type %s\n", m_model.model_type().cstr()); |
trunk/src/emu/netlist/analog/nld_bjt.h
| r242974 | r242975 | |
| 98 | 98 | |
| 99 | 99 | NETLIB_UPDATE_TERMINALS() |
| 100 | 100 | { |
| 101 | | const double m = (is_qtype( BJT_NPN) ? 1 : -1); |
| 101 | const nl_double m = (is_qtype( BJT_NPN) ? 1 : -1); |
| 102 | 102 | |
| 103 | 103 | const int new_state = (m_RB.deltaV() * m > m_V ) ? 1 : 0; |
| 104 | 104 | if (m_state_on ^ new_state) |
| 105 | 105 | { |
| 106 | 106 | #if 0 |
| 107 | | double gb = m_gB; |
| 108 | | double gc = m_gC; |
| 109 | | double v = m_V * m; |
| 107 | nl_double gb = m_gB; |
| 108 | nl_double gc = m_gC; |
| 109 | nl_double v = m_V * m; |
| 110 | 110 | if (!new_state ) |
| 111 | 111 | { |
| 112 | 112 | // not conducting |
| r242974 | r242975 | |
| 115 | 115 | gc = netlist().gmin(); |
| 116 | 116 | } |
| 117 | 117 | #else |
| 118 | | const double gb = new_state ? m_gB : netlist().gmin(); |
| 119 | | const double gc = new_state ? m_gC : netlist().gmin(); |
| 120 | | const double v = new_state ? m_V * m : 0; |
| 118 | const nl_double gb = new_state ? m_gB : netlist().gmin(); |
| 119 | const nl_double gc = new_state ? m_gC : netlist().gmin(); |
| 120 | const nl_double v = new_state ? m_V * m : 0; |
| 121 | 121 | #endif |
| 122 | 122 | m_RB.set(gb, v, 0.0); |
| 123 | 123 | m_RC.set(gc, 0.0, 0.0); |
| r242974 | r242975 | |
| 142 | 142 | ATTR_COLD virtual void start(); |
| 143 | 143 | ATTR_HOT void update_param(); |
| 144 | 144 | |
| 145 | | double m_gB; // base conductance / switch on |
| 146 | | double m_gC; // collector conductance / switch on |
| 147 | | double m_V; // internal voltage source |
| 145 | nl_double m_gB; // base conductance / switch on |
| 146 | nl_double m_gC; // collector conductance / switch on |
| 147 | nl_double m_V; // internal voltage source |
| 148 | 148 | UINT8 m_state_on; |
| 149 | 149 | |
| 150 | 150 | private: |
| r242974 | r242975 | |
| 169 | 169 | |
| 170 | 170 | NETLIB_UPDATE_TERMINALS() |
| 171 | 171 | { |
| 172 | | const double polarity = (qtype() == BJT_NPN ? 1.0 : -1.0); |
| 172 | const nl_double polarity = (qtype() == BJT_NPN ? 1.0 : -1.0); |
| 173 | 173 | |
| 174 | 174 | m_gD_BE.update_diode(-m_D_EB.deltaV() * polarity); |
| 175 | 175 | m_gD_BC.update_diode(-m_D_CB.deltaV() * polarity); |
| 176 | 176 | |
| 177 | | const double gee = m_gD_BE.G(); |
| 178 | | const double gcc = m_gD_BC.G(); |
| 179 | | const double gec = m_alpha_r * gcc; |
| 180 | | const double gce = m_alpha_f * gee; |
| 181 | | const double sIe = -m_gD_BE.I() + m_alpha_r * m_gD_BC.I(); |
| 182 | | const double sIc = m_alpha_f * m_gD_BE.I() - m_gD_BC.I(); |
| 183 | | const double Ie = (sIe + gee * m_gD_BE.Vd() - gec * m_gD_BC.Vd()) * polarity; |
| 184 | | const double Ic = (sIc - gce * m_gD_BE.Vd() + gcc * m_gD_BC.Vd()) * polarity; |
| 177 | const nl_double gee = m_gD_BE.G(); |
| 178 | const nl_double gcc = m_gD_BC.G(); |
| 179 | const nl_double gec = m_alpha_r * gcc; |
| 180 | const nl_double gce = m_alpha_f * gee; |
| 181 | const nl_double sIe = -m_gD_BE.I() + m_alpha_r * m_gD_BC.I(); |
| 182 | const nl_double sIc = m_alpha_f * m_gD_BE.I() - m_gD_BC.I(); |
| 183 | const nl_double Ie = (sIe + gee * m_gD_BE.Vd() - gec * m_gD_BC.Vd()) * polarity; |
| 184 | const nl_double Ic = (sIc - gce * m_gD_BE.Vd() + gcc * m_gD_BC.Vd()) * polarity; |
| 185 | 185 | |
| 186 | 186 | m_D_EB.set_mat(gee, gec - gee, gce - gee, gee - gec, Ie, -Ie); |
| 187 | 187 | m_D_CB.set_mat(gcc, gce - gcc, gec - gcc, gcc - gce, Ic, -Ic); |
| r242974 | r242975 | |
| 202 | 202 | nld_twoterm m_D_EB; // gee, gec - gee, gce - gee, gee - gec | Ie |
| 203 | 203 | nld_twoterm m_D_EC; // 0, -gec, -gcc, 0 | 0 |
| 204 | 204 | |
| 205 | | double m_alpha_f; |
| 206 | | double m_alpha_r; |
| 205 | nl_double m_alpha_f; |
| 206 | nl_double m_alpha_r; |
| 207 | 207 | |
| 208 | 208 | private: |
| 209 | 209 | }; |
trunk/src/emu/netlist/analog/nld_ms_direct.h
| r242974 | r242975 | |
| 28 | 28 | protected: |
| 29 | 29 | ATTR_COLD virtual void add_term(int net_idx, netlist_terminal_t *term); |
| 30 | 30 | |
| 31 | | ATTR_HOT virtual double vsolve(); |
| 31 | ATTR_HOT virtual nl_double vsolve(); |
| 32 | 32 | |
| 33 | 33 | ATTR_HOT int solve_non_dynamic(); |
| 34 | 34 | ATTR_HOT void build_LE(); |
| 35 | | ATTR_HOT void gauss_LE(double (* RESTRICT x)); |
| 36 | | ATTR_HOT double delta(const double (* RESTRICT V)); |
| 37 | | ATTR_HOT void store(const double (* RESTRICT V), const bool store_RHS); |
| 35 | ATTR_HOT void gauss_LE(nl_double (* RESTRICT x)); |
| 36 | ATTR_HOT nl_double delta(const nl_double (* RESTRICT V)); |
| 37 | ATTR_HOT void store(const nl_double (* RESTRICT V), const bool store_RHS); |
| 38 | 38 | |
| 39 | 39 | /* bring the whole system to the current time |
| 40 | 40 | * Don't schedule a new calculation time. The recalculation has to be |
| 41 | 41 | * triggered by the caller after the netlist element was changed. |
| 42 | 42 | */ |
| 43 | | ATTR_HOT double compute_next_timestep(); |
| 43 | ATTR_HOT nl_double compute_next_timestep(); |
| 44 | 44 | |
| 45 | | double m_A[_storage_N][((_storage_N + 7) / 8) * 8]; |
| 46 | | double m_RHS[_storage_N]; |
| 47 | | double m_last_RHS[_storage_N]; // right hand side - contains currents |
| 48 | | double m_Vdelta[_storage_N]; |
| 49 | | double m_last_V[_storage_N]; |
| 45 | nl_double m_A[_storage_N][((_storage_N + 7) / 8) * 8]; |
| 46 | nl_double m_RHS[_storage_N]; |
| 47 | nl_double m_last_RHS[_storage_N]; // right hand side - contains currents |
| 48 | nl_double m_Vdelta[_storage_N]; |
| 49 | nl_double m_last_V[_storage_N]; |
| 50 | 50 | |
| 51 | 51 | terms_t **m_terms; |
| 52 | 52 | terms_t *m_rails_temp; |
| r242974 | r242975 | |
| 55 | 55 | vector_ops_t *m_row_ops[_storage_N + 1]; |
| 56 | 56 | |
| 57 | 57 | int m_dim; |
| 58 | | double m_lp_fact; |
| 58 | nl_double m_lp_fact; |
| 59 | 59 | }; |
| 60 | 60 | |
| 61 | 61 | // ---------------------------------------------------------------------------------------- |
| r242974 | r242975 | |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | template <int m_N, int _storage_N> |
| 87 | | ATTR_HOT double netlist_matrix_solver_direct_t<m_N, _storage_N>::compute_next_timestep() |
| 87 | ATTR_HOT nl_double netlist_matrix_solver_direct_t<m_N, _storage_N>::compute_next_timestep() |
| 88 | 88 | { |
| 89 | | double new_solver_timestep = m_params.m_max_timestep; |
| 89 | nl_double new_solver_timestep = m_params.m_max_timestep; |
| 90 | 90 | |
| 91 | 91 | if (m_params.m_dynamic) |
| 92 | 92 | { |
| r242974 | r242975 | |
| 103 | 103 | { |
| 104 | 104 | netlist_analog_net_t *n = m_nets[k]; |
| 105 | 105 | #endif |
| 106 | | const double DD_n = (n->m_cur_Analog - m_last_V[k]); |
| 107 | | const double hn = current_timestep(); |
| 106 | const nl_double DD_n = (n->m_cur_Analog - m_last_V[k]); |
| 107 | const nl_double hn = current_timestep(); |
| 108 | 108 | |
| 109 | | double DD2 = (DD_n / hn - n->m_DD_n_m_1 / n->m_h_n_m_1) / (hn + n->m_h_n_m_1); |
| 110 | | double new_net_timestep; |
| 109 | nl_double DD2 = (DD_n / hn - n->m_DD_n_m_1 / n->m_h_n_m_1) / (hn + n->m_h_n_m_1); |
| 110 | nl_double new_net_timestep; |
| 111 | 111 | |
| 112 | 112 | n->m_h_n_m_1 = hn; |
| 113 | 113 | n->m_DD_n_m_1 = DD_n; |
| r242974 | r242975 | |
| 236 | 236 | for (int i=0; i < N(); i++) |
| 237 | 237 | m_A[k][i] = 0.0; |
| 238 | 238 | |
| 239 | | double rhsk = 0.0; |
| 240 | | double akk = 0.0; |
| 239 | nl_double rhsk = 0.0; |
| 240 | nl_double akk = 0.0; |
| 241 | 241 | { |
| 242 | 242 | const int terms_count = m_terms[k]->count(); |
| 243 | | const double * RESTRICT gt = m_terms[k]->gt(); |
| 244 | | const double * RESTRICT go = m_terms[k]->go(); |
| 245 | | const double * RESTRICT Idr = m_terms[k]->Idr(); |
| 243 | const nl_double * RESTRICT gt = m_terms[k]->gt(); |
| 244 | const nl_double * RESTRICT go = m_terms[k]->go(); |
| 245 | const nl_double * RESTRICT Idr = m_terms[k]->Idr(); |
| 246 | 246 | #if VECTALT |
| 247 | 247 | |
| 248 | 248 | for (int i = 0; i < terms_count; i++) |
| r242974 | r242975 | |
| 253 | 253 | #else |
| 254 | 254 | m_terms[k]->ops()->sum2(Idr, gt, rhsk, akk); |
| 255 | 255 | #endif |
| 256 | | double * const * RESTRICT other_cur_analog = m_terms[k]->other_curanalog(); |
| 256 | nl_double * const * RESTRICT other_cur_analog = m_terms[k]->other_curanalog(); |
| 257 | 257 | for (int i = m_terms[k]->m_railstart; i < terms_count; i++) |
| 258 | 258 | { |
| 259 | 259 | //rhsk = rhsk + go[i] * terms[i]->m_otherterm->net().as_analog().Q_Analog(); |
| r242974 | r242975 | |
| 272 | 272 | m_A[k][k] += 1.0; |
| 273 | 273 | { |
| 274 | 274 | const int *net_other = m_terms[k]->net_other(); |
| 275 | | const double *go = m_terms[k]->go(); |
| 275 | const nl_double *go = m_terms[k]->go(); |
| 276 | 276 | const int railstart = m_terms[k]->m_railstart; |
| 277 | 277 | |
| 278 | 278 | for (int i = 0; i < railstart; i++) |
| r242974 | r242975 | |
| 285 | 285 | m_A[k][k] += akk; |
| 286 | 286 | { |
| 287 | 287 | const int * RESTRICT net_other = m_terms[k]->net_other(); |
| 288 | | const double * RESTRICT go = m_terms[k]->go(); |
| 288 | const nl_double * RESTRICT go = m_terms[k]->go(); |
| 289 | 289 | const int railstart = m_terms[k]->m_railstart; |
| 290 | 290 | |
| 291 | 291 | for (int i = 0; i < railstart; i++) |
| r242974 | r242975 | |
| 299 | 299 | |
| 300 | 300 | template <int m_N, int _storage_N> |
| 301 | 301 | ATTR_HOT void netlist_matrix_solver_direct_t<m_N, _storage_N>::gauss_LE( |
| 302 | | double (* RESTRICT x)) |
| 302 | nl_double (* RESTRICT x)) |
| 303 | 303 | { |
| 304 | 304 | #if 0 |
| 305 | 305 | for (int i = 0; i < N(); i++) |
| r242974 | r242975 | |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | 338 | /* FIXME: Singular matrix? */ |
| 339 | | const double f = 1.0 / m_A[i][i]; |
| 339 | const nl_double f = 1.0 / m_A[i][i]; |
| 340 | 340 | |
| 341 | 341 | /* Eliminate column i from row j */ |
| 342 | 342 | |
| 343 | 343 | for (int j = i + 1; j < kN; j++) |
| 344 | 344 | { |
| 345 | | const double f1 = - m_A[j][i] * f; |
| 345 | const nl_double f1 = - m_A[j][i] * f; |
| 346 | 346 | if (f1 != 0.0) |
| 347 | 347 | { |
| 348 | 348 | #if 0 && VECTALT |
| r242974 | r242975 | |
| 359 | 359 | /* back substitution */ |
| 360 | 360 | for (int j = kN - 1; j >= 0; j--) |
| 361 | 361 | { |
| 362 | | double tmp = 0; |
| 362 | nl_double tmp = 0; |
| 363 | 363 | |
| 364 | 364 | for (int k = j + 1; k < kN; k++) |
| 365 | 365 | tmp += m_A[j][k] * x[k]; |
| r242974 | r242975 | |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | template <int m_N, int _storage_N> |
| 383 | | ATTR_HOT double netlist_matrix_solver_direct_t<m_N, _storage_N>::delta( |
| 384 | | const double (* RESTRICT V)) |
| 383 | ATTR_HOT nl_double netlist_matrix_solver_direct_t<m_N, _storage_N>::delta( |
| 384 | const nl_double (* RESTRICT V)) |
| 385 | 385 | { |
| 386 | | double cerr = 0; |
| 387 | | double cerr2 = 0; |
| 386 | nl_double cerr = 0; |
| 387 | nl_double cerr2 = 0; |
| 388 | 388 | for (int i = 0; i < this->N(); i++) |
| 389 | 389 | { |
| 390 | | const double e = (V[i] - this->m_nets[i]->m_cur_Analog); |
| 391 | | const double e2 = (m_RHS[i] - this->m_last_RHS[i]); |
| 390 | const nl_double e = (V[i] - this->m_nets[i]->m_cur_Analog); |
| 391 | const nl_double e2 = (m_RHS[i] - this->m_last_RHS[i]); |
| 392 | 392 | cerr = (fabs(e) > cerr ? fabs(e) : cerr); |
| 393 | 393 | cerr2 = (fabs(e2) > cerr2 ? fabs(e2) : cerr2); |
| 394 | 394 | } |
| r242974 | r242975 | |
| 398 | 398 | |
| 399 | 399 | template <int m_N, int _storage_N> |
| 400 | 400 | ATTR_HOT void netlist_matrix_solver_direct_t<m_N, _storage_N>::store( |
| 401 | | const double (* RESTRICT V), const bool store_RHS) |
| 401 | const nl_double (* RESTRICT V), const bool store_RHS) |
| 402 | 402 | { |
| 403 | 403 | for (int i = 0; i < this->N(); i++) |
| 404 | 404 | { |
| r242974 | r242975 | |
| 414 | 414 | } |
| 415 | 415 | |
| 416 | 416 | template <int m_N, int _storage_N> |
| 417 | | ATTR_HOT double netlist_matrix_solver_direct_t<m_N, _storage_N>::vsolve() |
| 417 | ATTR_HOT nl_double netlist_matrix_solver_direct_t<m_N, _storage_N>::vsolve() |
| 418 | 418 | { |
| 419 | 419 | solve_base<netlist_matrix_solver_direct_t>(this); |
| 420 | 420 | return this->compute_next_timestep(); |
| r242974 | r242975 | |
| 424 | 424 | template <int m_N, int _storage_N> |
| 425 | 425 | ATTR_HOT int netlist_matrix_solver_direct_t<m_N, _storage_N>::solve_non_dynamic() |
| 426 | 426 | { |
| 427 | | double new_v[_storage_N] = { 0.0 }; |
| 427 | nl_double new_v[_storage_N] = { 0.0 }; |
| 428 | 428 | |
| 429 | 429 | this->gauss_LE(new_v); |
| 430 | 430 | |
| 431 | 431 | if (this->is_dynamic()) |
| 432 | 432 | { |
| 433 | | double err = delta(new_v); |
| 433 | nl_double err = delta(new_v); |
| 434 | 434 | |
| 435 | 435 | store(new_v, true); |
| 436 | 436 | |
trunk/src/emu/netlist/analog/nld_ms_gauss_seidel.h
| r242974 | r242975 | |
| 29 | 29 | |
| 30 | 30 | ATTR_HOT inline int vsolve_non_dynamic(); |
| 31 | 31 | protected: |
| 32 | | ATTR_HOT virtual double vsolve(); |
| 32 | ATTR_HOT virtual nl_double vsolve(); |
| 33 | 33 | |
| 34 | 34 | private: |
| 35 | | double m_lp_fact; |
| 35 | nl_double m_lp_fact; |
| 36 | 36 | int m_gs_fail; |
| 37 | 37 | int m_gs_total; |
| 38 | 38 | |
| r242974 | r242975 | |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | template <int m_N, int _storage_N> |
| 67 | | ATTR_HOT double netlist_matrix_solver_gauss_seidel_t<m_N, _storage_N>::vsolve() |
| 67 | ATTR_HOT nl_double netlist_matrix_solver_gauss_seidel_t<m_N, _storage_N>::vsolve() |
| 68 | 68 | { |
| 69 | 69 | /* |
| 70 | 70 | * enable linear prediction on first newton pass |
| r242974 | r242975 | |
| 86 | 86 | |
| 87 | 87 | if (USE_LINEAR_PREDICTION) |
| 88 | 88 | { |
| 89 | | double sq = 0; |
| 90 | | double sqo = 0; |
| 91 | | const double rez_cts = 1.0 / this->current_timestep(); |
| 89 | nl_double sq = 0; |
| 90 | nl_double sqo = 0; |
| 91 | const nl_double rez_cts = 1.0 / this->current_timestep(); |
| 92 | 92 | for (int k = 0; k < this->N(); k++) |
| 93 | 93 | { |
| 94 | 94 | const netlist_analog_net_t *n = this->m_nets[k]; |
| 95 | | const double nv = (n->m_cur_Analog - this->m_last_V[k]) * rez_cts ; |
| 95 | const nl_double nv = (n->m_cur_Analog - this->m_last_V[k]) * rez_cts ; |
| 96 | 96 | sq += nv * nv; |
| 97 | 97 | sqo += this->m_Vdelta[k] * this->m_Vdelta[k]; |
| 98 | 98 | this->m_Vdelta[k] = nv; |
| r242974 | r242975 | |
| 116 | 116 | */ |
| 117 | 117 | |
| 118 | 118 | #if 0 || USE_MATRIX_GS |
| 119 | | static double ws = 1.0; |
| 120 | | ATTR_ALIGN double new_v[_storage_N] = { 0.0 }; |
| 119 | static nl_double ws = 1.0; |
| 120 | ATTR_ALIGN nl_double new_v[_storage_N] = { 0.0 }; |
| 121 | 121 | const int iN = this->N(); |
| 122 | 122 | |
| 123 | 123 | bool resched = false; |
| r242974 | r242975 | |
| 127 | 127 | this->build_LE(); |
| 128 | 128 | |
| 129 | 129 | { |
| 130 | | double frob; |
| 130 | nl_double frob; |
| 131 | 131 | frob = 0; |
| 132 | | double rmin = 1e99, rmax = -1e99; |
| 132 | nl_double rmin = 1e99, rmax = -1e99; |
| 133 | 133 | for (int k = 0; k < iN; k++) |
| 134 | 134 | { |
| 135 | 135 | new_v[k] = this->m_nets[k]->m_cur_Analog; |
| 136 | | double s=0.0; |
| 136 | nl_double s=0.0; |
| 137 | 137 | for (int i = 0; i < iN; i++) |
| 138 | 138 | { |
| 139 | 139 | frob += this->m_A[k][i] * this->m_A[k][i]; |
| r242974 | r242975 | |
| 146 | 146 | rmax = s; |
| 147 | 147 | } |
| 148 | 148 | #if 0 |
| 149 | | double frobA = sqrt(frob /(iN)); |
| 149 | nl_double frobA = sqrt(frob /(iN)); |
| 150 | 150 | if (1 &&frobA < 1.0) |
| 151 | 151 | //ws = 2.0 / (1.0 + sqrt(1.0-frobA)); |
| 152 | 152 | ws = 2.0 / (2.0 - frobA); |
| r242974 | r242975 | |
| 161 | 161 | // overhead is bigger than the gain. Consequently the fast GS below |
| 162 | 162 | // uses a fixed GS. One can however use this here to determine a |
| 163 | 163 | // suitable parameter. |
| 164 | | double rm = (rmax + rmin) * 0.5; |
| 164 | nl_double rm = (rmax + rmin) * 0.5; |
| 165 | 165 | if (rm < 1.0) |
| 166 | 166 | ws = 2.0 / (1.0 + sqrt(1.0-rm)); |
| 167 | 167 | else |
| r242974 | r242975 | |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | // Frobenius norm for (D-L)^(-1)U |
| 175 | | //double frobU; |
| 176 | | //double frobL; |
| 177 | | //double norm; |
| 175 | //nl_double frobU; |
| 176 | //nl_double frobL; |
| 177 | //nl_double norm; |
| 178 | 178 | do { |
| 179 | 179 | resched = false; |
| 180 | | double cerr = 0.0; |
| 180 | nl_double cerr = 0.0; |
| 181 | 181 | //frobU = 0; |
| 182 | 182 | //frobL = 0; |
| 183 | 183 | //norm = 0; |
| 184 | 184 | |
| 185 | 185 | for (int k = 0; k < iN; k++) |
| 186 | 186 | { |
| 187 | | double Idrive = 0; |
| 188 | | //double norm_t = 0; |
| 187 | nl_double Idrive = 0; |
| 188 | //nl_double norm_t = 0; |
| 189 | 189 | // Reduction loops need -ffast-math |
| 190 | 190 | for (int i = 0; i < iN; i++) |
| 191 | 191 | Idrive += this->m_A[k][i] * new_v[i]; |
| r242974 | r242975 | |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | //if (norm_t > norm) norm = norm_t; |
| 201 | | const double new_val = (1.0-ws) * new_v[k] + ws * (this->m_RHS[k] - Idrive + this->m_A[k][k] * new_v[k]) / this->m_A[k][k]; |
| 201 | const nl_double new_val = (1.0-ws) * new_v[k] + ws * (this->m_RHS[k] - Idrive + this->m_A[k][k] * new_v[k]) / this->m_A[k][k]; |
| 202 | 202 | |
| 203 | | const double e = fabs(new_val - new_v[k]); |
| 203 | const nl_double e = fabs(new_val - new_v[k]); |
| 204 | 204 | cerr = (e > cerr ? e : cerr); |
| 205 | 205 | new_v[k] = new_val; |
| 206 | 206 | } |
| r242974 | r242975 | |
| 210 | 210 | resched = true; |
| 211 | 211 | } |
| 212 | 212 | resched_cnt++; |
| 213 | | //ATTR_UNUSED double frobUL = sqrt((frobU + frobL) / (double) (iN) / (double) (iN)); |
| 213 | //ATTR_UNUSED nl_double frobUL = sqrt((frobU + frobL) / (double) (iN) / (double) (iN)); |
| 214 | 214 | } while (resched && (resched_cnt < this->m_params.m_gs_loops)); |
| 215 | 215 | //printf("Frobenius %f %f %f %f %f\n", sqrt(frobU), sqrt(frobL), frobUL, frobA, norm); |
| 216 | 216 | //printf("Omega Estimate1 %f %f\n", 2.0 / (1.0 + sqrt(1-frobUL)), 2.0 / (1.0 + sqrt(1-frobA)) ); // printf("Frobenius %f\n", sqrt(frob / (double) (iN * iN) )); |
| r242974 | r242975 | |
| 247 | 247 | * omega = 2.0 / (1.0 + sqrt(1-rho)) |
| 248 | 248 | */ |
| 249 | 249 | |
| 250 | | const double ws = this->m_params.m_sor; //1.045; //2.0 / (1.0 + /*sin*/(3.14159 * 5.5 / (double) (m_nets.count()+1))); |
| 251 | | //const double ws = 2.0 / (1.0 + sin(3.14159 * 4 / (double) (this->N()))); |
| 250 | const nl_double ws = this->m_params.m_sor; //1.045; //2.0 / (1.0 + /*sin*/(3.14159 * 5.5 / (double) (m_nets.count()+1))); |
| 251 | //const nl_double ws = 2.0 / (1.0 + sin(3.14159 * 4 / (double) (this->N()))); |
| 252 | 252 | |
| 253 | | ATTR_ALIGN double w[_storage_N]; |
| 254 | | ATTR_ALIGN double one_m_w[_storage_N]; |
| 255 | | ATTR_ALIGN double RHS[_storage_N]; |
| 256 | | ATTR_ALIGN double new_V[_storage_N]; |
| 253 | ATTR_ALIGN nl_double w[_storage_N]; |
| 254 | ATTR_ALIGN nl_double one_m_w[_storage_N]; |
| 255 | ATTR_ALIGN nl_double RHS[_storage_N]; |
| 256 | ATTR_ALIGN nl_double new_V[_storage_N]; |
| 257 | 257 | |
| 258 | 258 | for (int k = 0; k < iN; k++) |
| 259 | 259 | { |
| 260 | | double gtot_t = 0.0; |
| 261 | | double gabs_t = 0.0; |
| 262 | | double RHS_t = 0.0; |
| 260 | nl_double gtot_t = 0.0; |
| 261 | nl_double gabs_t = 0.0; |
| 262 | nl_double RHS_t = 0.0; |
| 263 | 263 | |
| 264 | 264 | new_V[k] = this->m_nets[k]->m_cur_Analog; |
| 265 | 265 | |
| 266 | 266 | { |
| 267 | 267 | const int term_count = this->m_terms[k]->count(); |
| 268 | | const double * const RESTRICT gt = this->m_terms[k]->gt(); |
| 269 | | const double * const RESTRICT go = this->m_terms[k]->go(); |
| 270 | | const double * const RESTRICT Idr = this->m_terms[k]->Idr(); |
| 271 | | const double * const *other_cur_analog = this->m_terms[k]->other_curanalog(); |
| 268 | const nl_double * const RESTRICT gt = this->m_terms[k]->gt(); |
| 269 | const nl_double * const RESTRICT go = this->m_terms[k]->go(); |
| 270 | const nl_double * const RESTRICT Idr = this->m_terms[k]->Idr(); |
| 271 | const nl_double * const *other_cur_analog = this->m_terms[k]->other_curanalog(); |
| 272 | 272 | #if VECTALT |
| 273 | 273 | for (int i = 0; i < term_count; i++) |
| 274 | 274 | { |
| r242974 | r242975 | |
| 308 | 308 | |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | | const double accuracy = this->m_params.m_accuracy; |
| 311 | const nl_double accuracy = this->m_params.m_accuracy; |
| 312 | 312 | |
| 313 | 313 | do { |
| 314 | 314 | resched = false; |
| r242974 | r242975 | |
| 317 | 317 | { |
| 318 | 318 | const int * RESTRICT net_other = this->m_terms[k]->net_other(); |
| 319 | 319 | const int railstart = this->m_terms[k]->m_railstart; |
| 320 | | const double * RESTRICT go = this->m_terms[k]->go(); |
| 320 | const nl_double * RESTRICT go = this->m_terms[k]->go(); |
| 321 | 321 | |
| 322 | | double Idrive = 0.0; |
| 322 | nl_double Idrive = 0.0; |
| 323 | 323 | for (int i = 0; i < railstart; i++) |
| 324 | 324 | Idrive = Idrive + go[i] * new_V[net_other[i]]; |
| 325 | 325 | |
| 326 | | //double new_val = (net->m_cur_Analog * gabs[k] + iIdr) / (gtot[k]); |
| 327 | | const double new_val = new_V[k] * one_m_w[k] + (Idrive + RHS[k]) * w[k]; |
| 326 | //nl_double new_val = (net->m_cur_Analog * gabs[k] + iIdr) / (gtot[k]); |
| 327 | const nl_double new_val = new_V[k] * one_m_w[k] + (Idrive + RHS[k]) * w[k]; |
| 328 | 328 | |
| 329 | 329 | resched = resched || (std::abs(new_val - new_V[k]) > accuracy); |
| 330 | 330 | new_V[k] = new_val; |
trunk/src/emu/netlist/analog/nld_solver.h
| r242974 | r242975 | |
| 37 | 37 | |
| 38 | 38 | struct netlist_solver_parameters_t |
| 39 | 39 | { |
| 40 | | double m_accuracy; |
| 41 | | double m_lte; |
| 42 | | double m_min_timestep; |
| 43 | | double m_max_timestep; |
| 44 | | double m_sor; |
| 40 | nl_double m_accuracy; |
| 41 | nl_double m_lte; |
| 42 | nl_double m_min_timestep; |
| 43 | nl_double m_max_timestep; |
| 44 | nl_double m_sor; |
| 45 | 45 | bool m_dynamic; |
| 46 | 46 | int m_gs_loops; |
| 47 | 47 | int m_nr_loops; |
| r242974 | r242975 | |
| 59 | 59 | |
| 60 | 60 | virtual ~vector_ops_t() {} |
| 61 | 61 | |
| 62 | | virtual const double sum(const double * v) = 0; |
| 63 | | virtual void sum2(const double * RESTRICT v1, const double * RESTRICT v2, double & RESTRICT s1, double & RESTRICT s2) = 0; |
| 64 | | virtual void addmult(double * RESTRICT v1, const double * RESTRICT v2, const double &mult) = 0; |
| 65 | | virtual void sum2a(const double * RESTRICT v1, const double * RESTRICT v2, const double * RESTRICT v3abs, double & RESTRICT s1, double & RESTRICT s2, double & RESTRICT s3abs) = 0; |
| 62 | virtual const nl_double sum(const nl_double * v) = 0; |
| 63 | virtual void sum2(const nl_double * RESTRICT v1, const nl_double * RESTRICT v2, nl_double & RESTRICT s1, nl_double & RESTRICT s2) = 0; |
| 64 | virtual void addmult(nl_double * RESTRICT v1, const nl_double * RESTRICT v2, const nl_double &mult) = 0; |
| 65 | virtual void sum2a(const nl_double * RESTRICT v1, const nl_double * RESTRICT v2, const nl_double * RESTRICT v3abs, nl_double & RESTRICT s1, nl_double & RESTRICT s2, nl_double & RESTRICT s3abs) = 0; |
| 66 | 66 | |
| 67 | | virtual const double sumabs(const double * v) = 0; |
| 67 | virtual const nl_double sumabs(const nl_double * v) = 0; |
| 68 | 68 | |
| 69 | 69 | static vector_ops_t *create_ops(const int size); |
| 70 | 70 | |
| r242974 | r242975 | |
| 95 | 95 | |
| 96 | 96 | ATTR_HOT inline const int N() const { if (m_N == 0) return m_dim; else return m_N; } |
| 97 | 97 | |
| 98 | | const double sum(const double * v) |
| 98 | const nl_double sum(const nl_double * v) |
| 99 | 99 | { |
| 100 | | const double * RESTRICT vl = v; |
| 101 | | double tmp = 0.0; |
| 100 | const nl_double * RESTRICT vl = v; |
| 101 | nl_double tmp = 0.0; |
| 102 | 102 | for (int i=0; i < N(); i++) |
| 103 | 103 | tmp += vl[i]; |
| 104 | 104 | return tmp; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | | void sum2(const double * RESTRICT v1, const double * RESTRICT v2, double & RESTRICT s1, double & RESTRICT s2) |
| 107 | void sum2(const nl_double * RESTRICT v1, const nl_double * RESTRICT v2, nl_double & RESTRICT s1, nl_double & RESTRICT s2) |
| 108 | 108 | { |
| 109 | | const double * RESTRICT v1l = v1; |
| 110 | | const double * RESTRICT v2l = v2; |
| 109 | const nl_double * RESTRICT v1l = v1; |
| 110 | const nl_double * RESTRICT v2l = v2; |
| 111 | 111 | for (int i=0; i < N(); i++) |
| 112 | 112 | { |
| 113 | 113 | s1 += v1l[i]; |
| r242974 | r242975 | |
| 115 | 115 | } |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | | void addmult(double * RESTRICT v1, const double * RESTRICT v2, const double &mult) |
| 118 | void addmult(nl_double * RESTRICT v1, const nl_double * RESTRICT v2, const nl_double &mult) |
| 119 | 119 | { |
| 120 | | double * RESTRICT v1l = v1; |
| 121 | | const double * RESTRICT v2l = v2; |
| 120 | nl_double * RESTRICT v1l = v1; |
| 121 | const nl_double * RESTRICT v2l = v2; |
| 122 | 122 | for (int i=0; i < N(); i++) |
| 123 | 123 | { |
| 124 | 124 | v1l[i] += v2l[i] * mult; |
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | | void sum2a(const double * RESTRICT v1, const double * RESTRICT v2, const double * RESTRICT v3abs, double & RESTRICT s1, double & RESTRICT s2, double & RESTRICT s3abs) |
| 128 | void sum2a(const nl_double * RESTRICT v1, const nl_double * RESTRICT v2, const nl_double * RESTRICT v3abs, nl_double & RESTRICT s1, nl_double & RESTRICT s2, nl_double & RESTRICT s3abs) |
| 129 | 129 | { |
| 130 | | const double * RESTRICT v1l = v1; |
| 131 | | const double * RESTRICT v2l = v2; |
| 132 | | const double * RESTRICT v3l = v3abs; |
| 130 | const nl_double * RESTRICT v1l = v1; |
| 131 | const nl_double * RESTRICT v2l = v2; |
| 132 | const nl_double * RESTRICT v3l = v3abs; |
| 133 | 133 | for (int i=0; i < N(); i++) |
| 134 | 134 | { |
| 135 | 135 | s1 += v1l[i]; |
| r242974 | r242975 | |
| 138 | 138 | } |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | | const double sumabs(const double * v) |
| 141 | const nl_double sumabs(const nl_double * v) |
| 142 | 142 | { |
| 143 | | const double * RESTRICT vl = v; |
| 144 | | double tmp = 0.0; |
| 143 | const nl_double * RESTRICT vl = v; |
| 144 | nl_double tmp = 0.0; |
| 145 | 145 | for (int i=0; i < N(); i++) |
| 146 | 146 | tmp += fabs(vl[i]); |
| 147 | 147 | return tmp; |
| r242974 | r242975 | |
| 171 | 171 | |
| 172 | 172 | ATTR_HOT inline netlist_terminal_t **terms() { return m_term; } |
| 173 | 173 | ATTR_HOT inline int *net_other() { return m_net_other; } |
| 174 | | ATTR_HOT inline double *gt() { return m_gt; } |
| 175 | | ATTR_HOT inline double *go() { return m_go; } |
| 176 | | ATTR_HOT inline double *Idr() { return m_Idr; } |
| 177 | | ATTR_HOT inline double **other_curanalog() { return m_other_curanalog; } |
| 174 | ATTR_HOT inline nl_double *gt() { return m_gt; } |
| 175 | ATTR_HOT inline nl_double *go() { return m_go; } |
| 176 | ATTR_HOT inline nl_double *Idr() { return m_Idr; } |
| 177 | ATTR_HOT inline nl_double **other_curanalog() { return m_other_curanalog; } |
| 178 | 178 | |
| 179 | 179 | ATTR_COLD void set_pointers(); |
| 180 | 180 | |
| r242974 | r242975 | |
| 183 | 183 | private: |
| 184 | 184 | plinearlist_t<netlist_terminal_t *> m_term; |
| 185 | 185 | plinearlist_t<int> m_net_other; |
| 186 | | plinearlist_t<double> m_go; |
| 187 | | plinearlist_t<double> m_gt; |
| 188 | | plinearlist_t<double> m_Idr; |
| 189 | | plinearlist_t<double *> m_other_curanalog; |
| 186 | plinearlist_t<nl_double> m_go; |
| 187 | plinearlist_t<nl_double> m_gt; |
| 188 | plinearlist_t<nl_double> m_Idr; |
| 189 | plinearlist_t<nl_double *> m_other_curanalog; |
| 190 | 190 | }; |
| 191 | 191 | |
| 192 | 192 | class netlist_matrix_solver_t : public netlist_device_t |
| r242974 | r242975 | |
| 209 | 209 | template<class C> |
| 210 | 210 | void solve_base(C *p); |
| 211 | 211 | |
| 212 | | ATTR_HOT double solve(); |
| 212 | ATTR_HOT nl_double solve(); |
| 213 | 213 | |
| 214 | 214 | ATTR_HOT inline bool is_dynamic() { return m_dynamic_devices.count() > 0; } |
| 215 | 215 | ATTR_HOT inline bool is_timestep() { return m_step_devices.count() > 0; } |
| r242974 | r242975 | |
| 236 | 236 | ATTR_HOT void update_dynamic(); |
| 237 | 237 | |
| 238 | 238 | // should return next time step |
| 239 | | ATTR_HOT virtual double vsolve() = 0; |
| 239 | ATTR_HOT virtual nl_double vsolve() = 0; |
| 240 | 240 | |
| 241 | 241 | ATTR_COLD virtual void add_term(int net_idx, netlist_terminal_t *term) = 0; |
| 242 | 242 | |
| r242974 | r242975 | |
| 249 | 249 | |
| 250 | 250 | const netlist_solver_parameters_t &m_params; |
| 251 | 251 | |
| 252 | | ATTR_HOT inline const double current_timestep() { return m_cur_ts; } |
| 252 | ATTR_HOT inline const nl_double current_timestep() { return m_cur_ts; } |
| 253 | 253 | private: |
| 254 | 254 | |
| 255 | 255 | netlist_time m_last_step; |
| 256 | | double m_cur_ts; |
| 256 | nl_double m_cur_ts; |
| 257 | 257 | dev_list_t m_step_devices; |
| 258 | 258 | dev_list_t m_dynamic_devices; |
| 259 | 259 | |
| r242974 | r242975 | |
| 279 | 279 | |
| 280 | 280 | ATTR_COLD void post_start(); |
| 281 | 281 | |
| 282 | | ATTR_HOT inline double gmin() { return m_gmin.Value(); } |
| 282 | ATTR_HOT inline nl_double gmin() { return m_gmin.Value(); } |
| 283 | 283 | |
| 284 | 284 | protected: |
| 285 | 285 | ATTR_HOT void update(); |
trunk/src/emu/netlist/analog/nld_twoterm.h
| r242974 | r242975 | |
| 97 | 97 | { |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | | ATTR_HOT inline void set(const double G, const double V, const double I) |
| 100 | ATTR_HOT inline void set(const nl_double G, const nl_double V, const nl_double I) |
| 101 | 101 | { |
| 102 | 102 | /* GO, GT, I */ |
| 103 | 103 | m_P.set( G, G, ( V) * G - I); |
| 104 | 104 | m_N.set( G, G, ( -V) * G + I); |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | | ATTR_HOT inline double deltaV() const |
| 107 | ATTR_HOT inline nl_double deltaV() const |
| 108 | 108 | { |
| 109 | 109 | return m_P.net().as_analog().Q_Analog() - m_N.net().as_analog().Q_Analog(); |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | | ATTR_HOT void set_mat(double a11, double a12, double a21, double a22, double r1, double r2) |
| 112 | ATTR_HOT void set_mat(nl_double a11, nl_double a12, nl_double a21, nl_double a22, nl_double r1, nl_double r2) |
| 113 | 113 | { |
| 114 | 114 | /* GO, GT, I */ |
| 115 | 115 | m_P.set(-a12, a11, -r1); |
| r242974 | r242975 | |
| 133 | 133 | public: |
| 134 | 134 | ATTR_COLD NETLIB_NAME(R_base)() : NETLIB_NAME(twoterm)(RESISTOR) { } |
| 135 | 135 | |
| 136 | | inline void set_R(const double R) |
| 136 | inline void set_R(const nl_double R) |
| 137 | 137 | { |
| 138 | 138 | set(1.0 / R, 0.0, 0.0); |
| 139 | 139 | } |
| r242974 | r242975 | |
| 171 | 171 | public: |
| 172 | 172 | ATTR_COLD NETLIB_NAME(C)() : NETLIB_NAME(twoterm)(CAPACITOR) { } |
| 173 | 173 | |
| 174 | | ATTR_HOT void step_time(const double st) |
| 174 | ATTR_HOT void step_time(const nl_double st) |
| 175 | 175 | { |
| 176 | | const double G = m_C.Value() / st; |
| 177 | | const double I = -G * deltaV(); |
| 176 | const nl_double G = m_C.Value() / st; |
| 177 | const nl_double I = -G * deltaV(); |
| 178 | 178 | set(G, 0.0, I); |
| 179 | 179 | } |
| 180 | 180 | |
| r242974 | r242975 | |
| 198 | 198 | public: |
| 199 | 199 | ATTR_COLD netlist_generic_diode(); |
| 200 | 200 | |
| 201 | | ATTR_HOT inline void update_diode(const double nVd) |
| 201 | ATTR_HOT inline void update_diode(const nl_double nVd) |
| 202 | 202 | { |
| 203 | 203 | //FIXME: Optimize cutoff case |
| 204 | 204 | |
| r242974 | r242975 | |
| 212 | 212 | { |
| 213 | 213 | m_Vd = nVd; |
| 214 | 214 | |
| 215 | | const double eVDVt = exp(m_Vd * m_VtInv); |
| 215 | const nl_double eVDVt = exp(m_Vd * m_VtInv); |
| 216 | 216 | m_Id = m_Is * (eVDVt - 1.0); |
| 217 | 217 | m_G = m_Is * m_VtInv * eVDVt + m_gmin; |
| 218 | 218 | } |
| r242974 | r242975 | |
| 221 | 221 | #if defined(_MSC_VER) && _MSC_VER < 1800 |
| 222 | 222 | m_Vd = m_Vd + log((nVd - m_Vd) * m_VtInv + 1.0) * m_Vt; |
| 223 | 223 | #else |
| 224 | | double a = (nVd - m_Vd) * m_VtInv; |
| 224 | nl_double a = (nVd - m_Vd) * m_VtInv; |
| 225 | 225 | if (a<1e-12 - 1.0) a = 1e-12 - 1.0; |
| 226 | 226 | m_Vd = m_Vd + log1p(a) * m_Vt; |
| 227 | 227 | #endif |
| 228 | | const double eVDVt = exp(m_Vd * m_VtInv); |
| 228 | const nl_double eVDVt = exp(m_Vd * m_VtInv); |
| 229 | 229 | m_Id = m_Is * (eVDVt - 1.0); |
| 230 | 230 | |
| 231 | 231 | m_G = m_Is * m_VtInv * eVDVt + m_gmin; |
| r242974 | r242975 | |
| 234 | 234 | //printf("nVd %f m_Vd %f Vcrit %f\n", nVd, m_Vd, m_Vcrit); |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | | ATTR_COLD void set_param(const double Is, const double n, double gmin); |
| 237 | ATTR_COLD void set_param(const nl_double Is, const nl_double n, nl_double gmin); |
| 238 | 238 | |
| 239 | | ATTR_HOT inline double I() const { return m_Id; } |
| 240 | | ATTR_HOT inline double G() const { return m_G; } |
| 241 | | ATTR_HOT inline double Ieq() const { return (m_Id - m_Vd * m_G); } |
| 242 | | ATTR_HOT inline double Vd() const { return m_Vd; } |
| 239 | ATTR_HOT inline nl_double I() const { return m_Id; } |
| 240 | ATTR_HOT inline nl_double G() const { return m_G; } |
| 241 | ATTR_HOT inline nl_double Ieq() const { return (m_Id - m_Vd * m_G); } |
| 242 | ATTR_HOT inline nl_double Vd() const { return m_Vd; } |
| 243 | 243 | |
| 244 | 244 | /* owning object must save those ... */ |
| 245 | 245 | |
| 246 | 246 | ATTR_COLD void save(pstring name, netlist_object_t &parent); |
| 247 | 247 | |
| 248 | 248 | private: |
| 249 | | double m_Vd; |
| 250 | | double m_Id; |
| 251 | | double m_G; |
| 249 | nl_double m_Vd; |
| 250 | nl_double m_Id; |
| 251 | nl_double m_G; |
| 252 | 252 | |
| 253 | | double m_Vt; |
| 254 | | double m_Is; |
| 255 | | double m_n; |
| 256 | | double m_gmin; |
| 253 | nl_double m_Vt; |
| 254 | nl_double m_Is; |
| 255 | nl_double m_n; |
| 256 | nl_double m_gmin; |
| 257 | 257 | |
| 258 | | double m_VtInv; |
| 259 | | double m_Vcrit; |
| 258 | nl_double m_VtInv; |
| 259 | nl_double m_Vcrit; |
| 260 | 260 | }; |
| 261 | 261 | |
| 262 | 262 | // ---------------------------------------------------------------------------------------- |
| r242974 | r242975 | |
| 268 | 268 | // add c3 and it'll be better than 1% |
| 269 | 269 | |
| 270 | 270 | #if 0 |
| 271 | | inline double fastexp_h(const double x) |
| 271 | inline nl_double fastexp_h(const nl_double x) |
| 272 | 272 | { |
| 273 | | static const double ln2r = 1.442695040888963387; |
| 274 | | static const double ln2 = 0.693147180559945286; |
| 275 | | //static const double c3 = 0.166666666666666667; |
| 273 | static const nl_double ln2r = 1.442695040888963387; |
| 274 | static const nl_double ln2 = 0.693147180559945286; |
| 275 | //static const nl_double c3 = 0.166666666666666667; |
| 276 | 276 | |
| 277 | | const double y = x * ln2r; |
| 277 | const nl_double y = x * ln2r; |
| 278 | 278 | const unsigned int t = y; |
| 279 | | const double z = (x - ln2 * (double) t); |
| 280 | | const double zz = z * z; |
| 281 | | //const double zzz = zz * z; |
| 279 | const nl_double z = (x - ln2 * (double) t); |
| 280 | const nl_double zz = z * z; |
| 281 | //const nl_double zzz = zz * z; |
| 282 | 282 | |
| 283 | 283 | return (double)(1 << t)*(1.0 + z + 0.5 * zz); // + c3*zzz; |
| 284 | 284 | } |
| 285 | 285 | |
| 286 | | inline double fastexp(const double x) |
| 286 | inline nl_double fastexp(const nl_double x) |
| 287 | 287 | { |
| 288 | 288 | if (x<0) |
| 289 | 289 | return 1.0 / fastexp_h(-x); |
trunk/src/emu/netlist/nl_base.h
| r242974 | r242975 | |
| 272 | 272 | |
| 273 | 273 | struct netlist_logic_family_desc_t |
| 274 | 274 | { |
| 275 | | double m_low_thresh_V; |
| 276 | | double m_high_thresh_V; |
| 277 | | double m_low_V; |
| 278 | | double m_high_V; |
| 279 | | double m_R_low; |
| 280 | | double m_R_high; |
| 275 | nl_double m_low_thresh_V; |
| 276 | nl_double m_high_thresh_V; |
| 277 | nl_double m_low_V; |
| 278 | nl_double m_high_V; |
| 279 | nl_double m_R_low; |
| 280 | nl_double m_R_high; |
| 281 | 281 | }; |
| 282 | 282 | |
| 283 | 283 | /* Terminals inherit the family description from the netlist_device |
| r242974 | r242975 | |
| 474 | 474 | |
| 475 | 475 | ATTR_COLD netlist_terminal_t(); |
| 476 | 476 | |
| 477 | | double *m_Idr1; // drive current |
| 478 | | double *m_go1; // conductance for Voltage from other term |
| 479 | | double *m_gt1; // conductance for total conductance |
| 477 | nl_double *m_Idr1; // drive current |
| 478 | nl_double *m_go1; // conductance for Voltage from other term |
| 479 | nl_double *m_gt1; // conductance for total conductance |
| 480 | 480 | |
| 481 | | ATTR_HOT inline void set(const double G) |
| 481 | ATTR_HOT inline void set(const nl_double G) |
| 482 | 482 | { |
| 483 | 483 | set_ptr(m_Idr1, 0); |
| 484 | 484 | set_ptr(m_go1, G); |
| 485 | 485 | set_ptr(m_gt1, G); |
| 486 | 486 | } |
| 487 | 487 | |
| 488 | | ATTR_HOT inline void set(const double GO, const double GT) |
| 488 | ATTR_HOT inline void set(const nl_double GO, const nl_double GT) |
| 489 | 489 | { |
| 490 | 490 | set_ptr(m_Idr1, 0); |
| 491 | 491 | set_ptr(m_go1, GO); |
| 492 | 492 | set_ptr(m_gt1, GT); |
| 493 | 493 | } |
| 494 | 494 | |
| 495 | | ATTR_HOT inline void set(const double GO, const double GT, const double I) |
| 495 | ATTR_HOT inline void set(const nl_double GO, const nl_double GT, const nl_double I) |
| 496 | 496 | { |
| 497 | 497 | set_ptr(m_Idr1, I); |
| 498 | 498 | set_ptr(m_go1, GO); |
| r242974 | r242975 | |
| 509 | 509 | |
| 510 | 510 | ATTR_COLD virtual void reset(); |
| 511 | 511 | private: |
| 512 | | inline void set_ptr(double *ptr, const double val) |
| 512 | inline void set_ptr(nl_double *ptr, const nl_double val) |
| 513 | 513 | { |
| 514 | 514 | if (ptr != NULL) |
| 515 | 515 | *ptr = val; |
| r242974 | r242975 | |
| 586 | 586 | ATTR_COLD netlist_analog_input_t() |
| 587 | 587 | : netlist_input_t(INPUT, ANALOG) { } |
| 588 | 588 | |
| 589 | | ATTR_HOT inline const double Q_Analog() const; |
| 589 | ATTR_HOT inline const nl_double Q_Analog() const; |
| 590 | 590 | }; |
| 591 | 591 | |
| 592 | 592 | //#define INPVAL(_x) (_x).Q() |
| r242974 | r242975 | |
| 661 | 661 | // We have to have those on one object. Dividing those does lead |
| 662 | 662 | // to a significant performance hit |
| 663 | 663 | // FIXME: Have to fix the public at some time |
| 664 | | double m_cur_Analog; |
| 664 | nl_double m_cur_Analog; |
| 665 | 665 | |
| 666 | 666 | }; |
| 667 | 667 | |
| r242974 | r242975 | |
| 736 | 736 | ATTR_COLD netlist_analog_net_t(); |
| 737 | 737 | ATTR_COLD virtual ~netlist_analog_net_t() { }; |
| 738 | 738 | |
| 739 | | ATTR_HOT inline const double Q_Analog() const |
| 739 | ATTR_HOT inline const nl_double Q_Analog() const |
| 740 | 740 | { |
| 741 | 741 | //nl_assert(object_type(SIGNAL_MASK) == SIGNAL_ANALOG); |
| 742 | 742 | nl_assert(family() == ANALOG); |
| 743 | 743 | return m_cur_Analog; |
| 744 | 744 | } |
| 745 | 745 | |
| 746 | | ATTR_COLD inline double &Q_Analog_state_ptr() |
| 746 | ATTR_COLD inline nl_double &Q_Analog_state_ptr() |
| 747 | 747 | { |
| 748 | 748 | //nl_assert(object_type(SIGNAL_MASK) == SIGNAL_ANALOG); |
| 749 | 749 | nl_assert(family() == ANALOG); |
| r242974 | r242975 | |
| 764 | 764 | private: |
| 765 | 765 | |
| 766 | 766 | public: |
| 767 | | double m_DD_n_m_1; |
| 768 | | double m_h_n_m_1; |
| 767 | nl_double m_DD_n_m_1; |
| 768 | nl_double m_h_n_m_1; |
| 769 | 769 | |
| 770 | 770 | //FIXME: needed by current solver code |
| 771 | 771 | netlist_matrix_solver_t *m_solver; |
| r242974 | r242975 | |
| 831 | 831 | |
| 832 | 832 | ATTR_COLD netlist_analog_output_t(); |
| 833 | 833 | |
| 834 | | ATTR_COLD void initial(const double val); |
| 834 | ATTR_COLD void initial(const nl_double val); |
| 835 | 835 | |
| 836 | | ATTR_HOT inline void set_Q(const double newQ); |
| 836 | ATTR_HOT inline void set_Q(const nl_double newQ); |
| 837 | 837 | |
| 838 | 838 | netlist_analog_net_t *m_proxied_net; // only for proxy nets in analog input logic |
| 839 | 839 | |
| r242974 | r242975 | |
| 876 | 876 | public: |
| 877 | 877 | ATTR_COLD netlist_param_double_t(); |
| 878 | 878 | |
| 879 | | ATTR_HOT inline void setTo(const double param); |
| 880 | | ATTR_COLD inline void initial(const double val) { m_param = val; } |
| 881 | | ATTR_HOT inline const double Value() const { return m_param; } |
| 879 | ATTR_HOT inline void setTo(const nl_double param); |
| 880 | ATTR_COLD inline void initial(const nl_double val) { m_param = val; } |
| 881 | ATTR_HOT inline const nl_double Value() const { return m_param; } |
| 882 | 882 | |
| 883 | 883 | protected: |
| 884 | 884 | ATTR_COLD virtual void save_register() |
| r242974 | r242975 | |
| 888 | 888 | } |
| 889 | 889 | |
| 890 | 890 | private: |
| 891 | | double m_param; |
| 891 | nl_double m_param; |
| 892 | 892 | }; |
| 893 | 893 | |
| 894 | 894 | class netlist_param_int_t : public netlist_param_t |
| r242974 | r242975 | |
| 946 | 946 | ATTR_HOT inline const pstring &Value() const { return m_param; } |
| 947 | 947 | |
| 948 | 948 | /* these should be cached! */ |
| 949 | | ATTR_COLD double model_value(const pstring &entity, const double defval = 0.0) const; |
| 949 | ATTR_COLD nl_double model_value(const pstring &entity, const nl_double defval = 0.0) const; |
| 950 | 950 | ATTR_COLD const pstring model_type() const; |
| 951 | 951 | |
| 952 | 952 | private: |
| r242974 | r242975 | |
| 997 | 997 | out.set_Q(val, delay); |
| 998 | 998 | } |
| 999 | 999 | |
| 1000 | | ATTR_HOT inline const double INPANALOG(const netlist_analog_input_t &inp) const { return inp.Q_Analog(); } |
| 1000 | ATTR_HOT inline const nl_double INPANALOG(const netlist_analog_input_t &inp) const { return inp.Q_Analog(); } |
| 1001 | 1001 | |
| 1002 | | ATTR_HOT inline const double TERMANALOG(const netlist_terminal_t &term) const { return term.net().as_analog().Q_Analog(); } |
| 1002 | ATTR_HOT inline const nl_double TERMANALOG(const netlist_terminal_t &term) const { return term.net().as_analog().Q_Analog(); } |
| 1003 | 1003 | |
| 1004 | | ATTR_HOT inline void OUTANALOG(netlist_analog_output_t &out, const double val) |
| 1004 | ATTR_HOT inline void OUTANALOG(netlist_analog_output_t &out, const nl_double val) |
| 1005 | 1005 | { |
| 1006 | 1006 | out.set_Q(val); |
| 1007 | 1007 | } |
| r242974 | r242975 | |
| 1010 | 1010 | |
| 1011 | 1011 | ATTR_HOT virtual void dec_active() { } |
| 1012 | 1012 | |
| 1013 | | ATTR_HOT virtual void step_time(const double st) { } |
| 1013 | ATTR_HOT virtual void step_time(const nl_double st) { } |
| 1014 | 1014 | ATTR_HOT virtual void update_terminals() { } |
| 1015 | 1015 | |
| 1016 | 1016 | |
| r242974 | r242975 | |
| 1120 | 1120 | ATTR_HOT inline const netlist_time time() const { return m_time; } |
| 1121 | 1121 | ATTR_HOT inline NETLIB_NAME(solver) *solver() const { return m_solver; } |
| 1122 | 1122 | ATTR_HOT inline NETLIB_NAME(gnd) *gnd() const { return m_gnd; } |
| 1123 | | ATTR_HOT const double gmin() const; |
| 1123 | ATTR_HOT const nl_double gmin() const; |
| 1124 | 1124 | |
| 1125 | 1125 | ATTR_HOT inline void push_to_queue(netlist_net_t *out, const netlist_time attime) |
| 1126 | 1126 | { |
| r242974 | r242975 | |
| 1251 | 1251 | } |
| 1252 | 1252 | } |
| 1253 | 1253 | |
| 1254 | | ATTR_HOT inline void netlist_param_double_t::setTo(const double param) |
| 1254 | ATTR_HOT inline void netlist_param_double_t::setTo(const nl_double param) |
| 1255 | 1255 | { |
| 1256 | 1256 | if (m_param != param) |
| 1257 | 1257 | { |
| r242974 | r242975 | |
| 1356 | 1356 | return net().as_logic().Q(); |
| 1357 | 1357 | } |
| 1358 | 1358 | |
| 1359 | | ATTR_HOT inline const double netlist_analog_input_t::Q_Analog() const |
| 1359 | ATTR_HOT inline const nl_double netlist_analog_input_t::Q_Analog() const |
| 1360 | 1360 | { |
| 1361 | 1361 | return net().as_analog().Q_Analog(); |
| 1362 | 1362 | } |
| 1363 | 1363 | |
| 1364 | | ATTR_HOT inline void netlist_analog_output_t::set_Q(const double newQ) |
| 1364 | ATTR_HOT inline void netlist_analog_output_t::set_Q(const nl_double newQ) |
| 1365 | 1365 | { |
| 1366 | 1366 | if (newQ != net().as_analog().m_cur_Analog) |
| 1367 | 1367 | { |
trunk/src/emu/ui/imginfo.c
| r0 | r242975 | |
| 1 | /*************************************************************************** |
| 2 | |
| 3 | ui/imginfo.c |
| 4 | |
| 5 | Image info screen |
| 6 | |
| 7 | Copyright Nicola Salmoria and the MAME Team. |
| 8 | Visit http://mamedev.org for licensing and usage restrictions. |
| 9 | |
| 10 | ***************************************************************************/ |
| 11 | |
| 12 | #include "emu.h" |
| 13 | #include "ui/menu.h" |
| 14 | #include "ui/imginfo.h" |
| 15 | |
| 16 | |
| 17 | /*************************************************************************** |
| 18 | IMPLEMENTATION |
| 19 | ***************************************************************************/ |
| 20 | |
| 21 | //------------------------------------------------- |
| 22 | // ctor |
| 23 | //------------------------------------------------- |
| 24 | |
| 25 | ui_menu_image_info::ui_menu_image_info(running_machine &machine, render_container *container) : ui_menu(machine, container) |
| 26 | { |
| 27 | } |
| 28 | |
| 29 | |
| 30 | //------------------------------------------------- |
| 31 | // dtor |
| 32 | //------------------------------------------------- |
| 33 | |
| 34 | ui_menu_image_info::~ui_menu_image_info() |
| 35 | { |
| 36 | } |
| 37 | |
| 38 | |
| 39 | //------------------------------------------------- |
| 40 | // populate |
| 41 | //------------------------------------------------- |
| 42 | |
| 43 | void ui_menu_image_info::populate() |
| 44 | { |
| 45 | item_append(machine().system().description, NULL, MENU_FLAG_DISABLE, NULL); |
| 46 | item_append("", NULL, MENU_FLAG_DISABLE, NULL); |
| 47 | |
| 48 | image_interface_iterator iter(machine().root_device()); |
| 49 | for (device_image_interface *image = iter.first(); image != NULL; image = iter.next()) |
| 50 | image_info(image); |
| 51 | } |
| 52 | |
| 53 | |
| 54 | //------------------------------------------------- |
| 55 | // handle |
| 56 | //------------------------------------------------- |
| 57 | |
| 58 | void ui_menu_image_info::handle() |
| 59 | { |
| 60 | // process the menu |
| 61 | process(0); |
| 62 | } |
| 63 | |
| 64 | |
| 65 | //------------------------------------------------- |
| 66 | // image_info - display image info for a specific |
| 67 | // image interface device |
| 68 | //------------------------------------------------- |
| 69 | |
| 70 | void ui_menu_image_info::image_info(device_image_interface *image) |
| 71 | { |
| 72 | if (image->exists()) |
| 73 | { |
| 74 | // display device type and filename |
| 75 | item_append(image->brief_instance_name(), image->basename(), 0, NULL); |
| 76 | |
| 77 | // if image has been loaded through softlist, let's add some more info |
| 78 | if (image->software_entry()) |
| 79 | { |
| 80 | astring string; |
| 81 | |
| 82 | // display long filename |
| 83 | item_append(image->longname(), "", MENU_FLAG_DISABLE, NULL); |
| 84 | |
| 85 | // display manufacturer and year |
| 86 | string.catprintf("%s, %s", image->manufacturer(), image->year()); |
| 87 | item_append(string, "", MENU_FLAG_DISABLE, NULL); |
| 88 | |
| 89 | // display supported information, if available |
| 90 | switch (image->supported()) |
| 91 | { |
| 92 | case SOFTWARE_SUPPORTED_NO: |
| 93 | item_append("Not supported", "", MENU_FLAG_DISABLE, NULL); |
| 94 | break; |
| 95 | case SOFTWARE_SUPPORTED_PARTIAL: |
| 96 | item_append("Partially supported", "", MENU_FLAG_DISABLE, NULL); |
| 97 | break; |
| 98 | default: |
| 99 | break; |
| 100 | } |
| 101 | } |
| 102 | } |
| 103 | else |
| 104 | item_append(image->brief_instance_name(), "[empty]", 0, NULL); |
| 105 | item_append("", NULL, MENU_FLAG_DISABLE, NULL); |
| 106 | } |
trunk/src/emu/ui/info.c
| r242974 | r242975 | |
| 1 | | /*************************************************************************** |
| 2 | | |
| 3 | | ui/info.c |
| 4 | | |
| 5 | | System and image info screens |
| 6 | | |
| 7 | | Copyright Nicola Salmoria and the MAME Team. |
| 8 | | Visit http://mamedev.org for licensing and usage restrictions. |
| 9 | | |
| 10 | | ***************************************************************************/ |
| 11 | | |
| 12 | | #include "emu.h" |
| 13 | | #include "ui/menu.h" |
| 14 | | #include "ui/info.h" |
| 15 | | #include "ui/ui.h" |
| 16 | | |
| 17 | | /*------------------------------------------------- |
| 18 | | menu_game_info - handle the game information |
| 19 | | menu |
| 20 | | -------------------------------------------------*/ |
| 21 | | |
| 22 | | ui_menu_game_info::ui_menu_game_info(running_machine &machine, render_container *container) : ui_menu(machine, container) |
| 23 | | { |
| 24 | | } |
| 25 | | |
| 26 | | ui_menu_game_info::~ui_menu_game_info() |
| 27 | | { |
| 28 | | } |
| 29 | | |
| 30 | | void ui_menu_game_info::populate() |
| 31 | | { |
| 32 | | astring tempstring; |
| 33 | | item_append(machine().ui().game_info_astring(tempstring), NULL, MENU_FLAG_MULTILINE, NULL); |
| 34 | | } |
| 35 | | |
| 36 | | void ui_menu_game_info::handle() |
| 37 | | { |
| 38 | | // process the menu |
| 39 | | process(0); |
| 40 | | } |
| 41 | | |
| 42 | | |
| 43 | | /*------------------------------------------------- |
| 44 | | ui_menu_image_info - handle the image information |
| 45 | | menu |
| 46 | | -------------------------------------------------*/ |
| 47 | | |
| 48 | | ui_menu_image_info::ui_menu_image_info(running_machine &machine, render_container *container) : ui_menu(machine, container) |
| 49 | | { |
| 50 | | } |
| 51 | | |
| 52 | | ui_menu_image_info::~ui_menu_image_info() |
| 53 | | { |
| 54 | | } |
| 55 | | |
| 56 | | void ui_menu_image_info::populate() |
| 57 | | { |
| 58 | | item_append(machine().system().description, NULL, MENU_FLAG_DISABLE, NULL); |
| 59 | | item_append("", NULL, MENU_FLAG_DISABLE, NULL); |
| 60 | | |
| 61 | | image_interface_iterator iter(machine().root_device()); |
| 62 | | for (device_image_interface *image = iter.first(); image != NULL; image = iter.next()) |
| 63 | | image_info(image); |
| 64 | | } |
| 65 | | |
| 66 | | void ui_menu_image_info::handle() |
| 67 | | { |
| 68 | | // process the menu |
| 69 | | process(0); |
| 70 | | } |
| 71 | | |
| 72 | | |
| 73 | | /*------------------------------------------------- |
| 74 | | image_info - display image info for a specific |
| 75 | | image interface device |
| 76 | | -------------------------------------------------*/ |
| 77 | | |
| 78 | | void ui_menu_image_info::image_info(device_image_interface *image) |
| 79 | | { |
| 80 | | if (image->exists()) |
| 81 | | { |
| 82 | | // display device type and filename |
| 83 | | item_append(image->brief_instance_name(), image->basename(), 0, NULL); |
| 84 | | |
| 85 | | // if image has been loaded through softlist, let's add some more info |
| 86 | | if (image->software_entry()) |
| 87 | | { |
| 88 | | astring string; |
| 89 | | |
| 90 | | // display long filename |
| 91 | | item_append(image->longname(), "", MENU_FLAG_DISABLE, NULL); |
| 92 | | |
| 93 | | // display manufacturer and year |
| 94 | | string.catprintf("%s, %s", image->manufacturer(), image->year()); |
| 95 | | item_append(string, "", MENU_FLAG_DISABLE, NULL); |
| 96 | | |
| 97 | | // display supported information, if available |
| 98 | | switch (image->supported()) |
| 99 | | { |
| 100 | | case SOFTWARE_SUPPORTED_NO: |
| 101 | | item_append("Not supported", "", MENU_FLAG_DISABLE, NULL); |
| 102 | | break; |
| 103 | | case SOFTWARE_SUPPORTED_PARTIAL: |
| 104 | | item_append("Partially supported", "", MENU_FLAG_DISABLE, NULL); |
| 105 | | break; |
| 106 | | default: |
| 107 | | break; |
| 108 | | } |
| 109 | | } |
| 110 | | } |
| 111 | | else |
| 112 | | item_append(image->brief_instance_name(), "[empty]", 0, NULL); |
| 113 | | item_append("", NULL, MENU_FLAG_DISABLE, NULL); |
| 114 | | } |
trunk/src/mame/drivers/20pacgal.c
| r242974 | r242975 | |
| 341 | 341 | PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 342 | 342 | INPUT_PORTS_END |
| 343 | 343 | |
| 344 | | static INPUT_PORTS_START( 25pacmano ) |
| 345 | | PORT_INCLUDE(20pacgal) |
| 346 | 344 | |
| 347 | | PORT_MODIFY("SERVICE") |
| 348 | | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNKNOWN ) |
| 349 | | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_UNKNOWN ) |
| 350 | | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN ) |
| 351 | | PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN ) |
| 352 | | PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN ) |
| 353 | | PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN ) |
| 354 | | INPUT_PORTS_END |
| 355 | 345 | |
| 356 | 346 | /************************************* |
| 357 | 347 | * |
| r242974 | r242975 | |
| 534 | 524 | *************************************/ |
| 535 | 525 | |
| 536 | 526 | GAME( 2006, 25pacman, 0, 25pacman, 25pacman, _20pacgal_state, 25pacman, ROT90, "Namco / Cosmodog", "Pac-Man - 25th Anniversary Edition (Rev 3.00)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE | GAME_NOT_WORKING ) |
| 537 | | GAME( 2005, 25pacmano, 25pacman, 20pacgal, 25pacmano,_20pacgal_state, 25pacman, ROT90, "Namco / Cosmodog", "Pac-Man - 25th Anniversary Edition (Rev 2.00)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE) |
| 527 | GAME( 2005, 25pacmano, 25pacman, 20pacgal, 25pacman, _20pacgal_state, 25pacman, ROT90, "Namco / Cosmodog", "Pac-Man - 25th Anniversary Edition (Rev 2.00)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE) |
| 538 | 528 | |
| 539 | 529 | GAME( 2000, 20pacgal, 0, 20pacgal, 20pacgal, _20pacgal_state, 20pacgal, ROT90, "Namco / Cosmodog", "Ms. Pac-Man/Galaga - 20th Anniversary Class of 1981 Reunion (V1.08)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE) |
| 540 | 530 | GAME( 2000, 20pacgalr4, 20pacgal, 20pacgal, 20pacgal, _20pacgal_state, 20pacgal, ROT90, "Namco / Cosmodog", "Ms. Pac-Man/Galaga - 20th Anniversary Class of 1981 Reunion (V1.04)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE) |
trunk/src/mame/drivers/itech32.c
| r242974 | r242975 | |
| 76 | 76 | Starting with GT Fore!, I.T. moved to a redesigned hardware platform known as the Eagle platform. |
| 77 | 77 | It has a main board with a 3Dfx video card and is hard drive based. This series started with |
| 78 | 78 | GT Fore! in 2000 and continued through 2006 ending with Golden Tee Complete. This final |
| 79 | | version included all the courses from all the previous years in the Fore! series. |
| 79 | version incuded all the courses from all the previous years in the Fore! series. |
| 80 | 80 | The Eagle platform also supports I.T.'s hunting series "Big Buck Hunter", the light game gun |
| 81 | 81 | called Carnival King as well as the limited release game Virtual Pool. |
| 82 | 82 | |
| r242974 | r242975 | |
| 1615 | 1615 | |
| 1616 | 1616 | PORT_MODIFY("DIPS") |
| 1617 | 1617 | PORT_DIPNAME( 0x00100000, 0x00000000, "Trackball Orientation" ) PORT_DIPLOCATION("SW1:4") /* Determined by actual use / trial & error */ |
| 1618 | | PORT_DIPSETTING( 0x00000000, "Normal Mount" ) /* The manual says "Always on (default)" and "Off -- UNUSED --" */ |
| 1618 | PORT_DIPSETTING( 0x00000000, "Normal Mount" ) /* The manual says "Always on (defualt)" and "Off -- UNUSED --" */ |
| 1619 | 1619 | PORT_DIPSETTING( 0x00100000, "45 Degree Angle" ) |
| 1620 | 1620 | PORT_DIPNAME( 0x00200000, 0x00000000, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:3") /* Single controller version - has no effect */ |
| 1621 | 1621 | PORT_DIPSETTING( 0x00000000, DEF_STR( Off ) ) |
| r242974 | r242975 | |
| 1631 | 1631 | |
| 1632 | 1632 | PORT_MODIFY("DIPS") |
| 1633 | 1633 | PORT_DIPNAME( 0x00100000, 0x00000000, "Trackball Orientation" ) PORT_DIPLOCATION("SW1:4") /* Determined by actual use / trial & error */ |
| 1634 | | PORT_DIPSETTING( 0x00000000, "Normal Mount" ) /* The manual says "Always on (default)" and "Off -- UNUSED --" */ |
| 1634 | PORT_DIPSETTING( 0x00000000, "Normal Mount" ) /* The manual says "Always on (defualt)" and "Off -- UNUSED --" */ |
| 1635 | 1635 | PORT_DIPSETTING( 0x00100000, "45 Degree Angle" ) |
| 1636 | 1636 | PORT_DIPNAME( 0x00200000, 0x00000000, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW1:3") |
| 1637 | 1637 | PORT_DIPSETTING( 0x00000000, DEF_STR( Upright ) ) |
| r242974 | r242975 | |
| 2450 | 2450 | ROM_CONTINUE( 0x08000, 0x08000 ) |
| 2451 | 2451 | |
| 2452 | 2452 | ROM_REGION( 0x880000, "gfx1", 0 ) |
| 2453 | | /* No known set specifically checks for this, however the GROM data may be in the form of four 8 Meg roms: |
| 2453 | /* No known set specificly checks for this, however the GROM data may be in the form of four 8 Meg roms: |
| 2454 | 2454 | ROM_LOAD32_BYTE( "wcb_grom0_0_+.grm0_0", 0x000000, 0x100000, CRC(40837737) SHA1(f073943ec6f84285a8559553fb292ec1f8a629d0) ) Labeled as "WCB GROM0_0 *" ect |
| 2455 | 2455 | ROM_LOAD32_BYTE( "wcb_grom0_1_+.grm0_1", 0x000001, 0x100000, CRC(1615aee8) SHA1(6184919371a894b1d6f2e06a2b328cb55abed4a9) ) |
| 2456 | 2456 | ROM_LOAD32_BYTE( "wcb_grom0_2_+.grm0_2", 0x000002, 0x100000, CRC(d8e0b06e) SHA1(4981c0cf16df68a1b4da7ebf65ca587c21292478) ) |
| r242974 | r242975 | |
| 2485 | 2485 | ROM_CONTINUE( 0x08000, 0x08000 ) |
| 2486 | 2486 | |
| 2487 | 2487 | ROM_REGION( 0x880000, "gfx1", 0 ) |
| 2488 | | /* No known set specifically checks for this, however the GROM data may be in the form of four 8 Meg roms: |
| 2488 | /* No known set specificly checks for this, however the GROM data may be in the form of four 8 Meg roms: |
| 2489 | 2489 | ROM_LOAD32_BYTE( "wcb_grom0_0_+.grm0_0", 0x000000, 0x100000, CRC(40837737) SHA1(f073943ec6f84285a8559553fb292ec1f8a629d0) ) Labeled as "WCB GROM0_0 *" ect |
| 2490 | 2490 | ROM_LOAD32_BYTE( "wcb_grom0_1_+.grm0_1", 0x000001, 0x100000, CRC(1615aee8) SHA1(6184919371a894b1d6f2e06a2b328cb55abed4a9) ) |
| 2491 | 2491 | ROM_LOAD32_BYTE( "wcb_grom0_2_+.grm0_2", 0x000002, 0x100000, CRC(d8e0b06e) SHA1(4981c0cf16df68a1b4da7ebf65ca587c21292478) ) |
| r242974 | r242975 | |
| 2520 | 2520 | ROM_CONTINUE( 0x08000, 0x08000 ) |
| 2521 | 2521 | |
| 2522 | 2522 | ROM_REGION( 0x880000, "gfx1", 0 ) |
| 2523 | | /* No known set specifically checks for this, however the GROM data may be in the form of four 8 Meg roms: |
| 2523 | /* No known set specificly checks for this, however the GROM data may be in the form of four 8 Meg roms: |
| 2524 | 2524 | ROM_LOAD32_BYTE( "wcb_grom0_0_+.grm0_0", 0x000000, 0x100000, CRC(40837737) SHA1(f073943ec6f84285a8559553fb292ec1f8a629d0) ) Labeled as "WCB GROM0_0 *" ect |
| 2525 | 2525 | ROM_LOAD32_BYTE( "wcb_grom0_1_+.grm0_1", 0x000001, 0x100000, CRC(1615aee8) SHA1(6184919371a894b1d6f2e06a2b328cb55abed4a9) ) |
| 2526 | 2526 | ROM_LOAD32_BYTE( "wcb_grom0_2_+.grm0_2", 0x000002, 0x100000, CRC(d8e0b06e) SHA1(4981c0cf16df68a1b4da7ebf65ca587c21292478) ) |
| r242974 | r242975 | |
| 2555 | 2555 | ROM_CONTINUE( 0x08000, 0x08000 ) |
| 2556 | 2556 | |
| 2557 | 2557 | ROM_REGION( 0x880000, "gfx1", 0 ) |
| 2558 | | /* No known set specifically checks for this, however the GROM data may be in the form of four 8 Meg roms: |
| 2558 | /* No known set specificly checks for this, however the GROM data may be in the form of four 8 Meg roms: |
| 2559 | 2559 | ROM_LOAD32_BYTE( "wcb_grom0_0_+.grm0_0", 0x000000, 0x100000, CRC(40837737) SHA1(f073943ec6f84285a8559553fb292ec1f8a629d0) ) Labeled as "WCB GROM0_0 *" ect |
| 2560 | 2560 | ROM_LOAD32_BYTE( "wcb_grom0_1_+.grm0_1", 0x000001, 0x100000, CRC(1615aee8) SHA1(6184919371a894b1d6f2e06a2b328cb55abed4a9) ) |
| 2561 | 2561 | ROM_LOAD32_BYTE( "wcb_grom0_2_+.grm0_2", 0x000002, 0x100000, CRC(d8e0b06e) SHA1(4981c0cf16df68a1b4da7ebf65ca587c21292478) ) |
| r242974 | r242975 | |
| 2590 | 2590 | ROM_CONTINUE( 0x08000, 0x08000 ) |
| 2591 | 2591 | |
| 2592 | 2592 | ROM_REGION( 0x880000, "gfx1", 0 ) |
| 2593 | | /* No known set specifically checks for this, however the GROM data may be in the form of four 8 Meg roms: |
| 2593 | /* No known set specificly checks for this, however the GROM data may be in the form of four 8 Meg roms: |
| 2594 | 2594 | ROM_LOAD32_BYTE( "wcb_grom0_0_+.grm0_0", 0x000000, 0x100000, CRC(40837737) SHA1(f073943ec6f84285a8559553fb292ec1f8a629d0) ) Labeled as "WCB GROM0_0 *" ect |
| 2595 | 2595 | ROM_LOAD32_BYTE( "wcb_grom0_1_+.grm0_1", 0x000001, 0x100000, CRC(1615aee8) SHA1(6184919371a894b1d6f2e06a2b328cb55abed4a9) ) |
| 2596 | 2596 | ROM_LOAD32_BYTE( "wcb_grom0_2_+.grm0_2", 0x000002, 0x100000, CRC(d8e0b06e) SHA1(4981c0cf16df68a1b4da7ebf65ca587c21292478) ) |
| r242974 | r242975 | |
| 2625 | 2625 | ROM_CONTINUE( 0x08000, 0x08000 ) |
| 2626 | 2626 | |
| 2627 | 2627 | ROM_REGION( 0x880000, "gfx1", 0 ) |
| 2628 | | /* No known set specifically checks for this, however the GROM data may be in the form of four 8 Meg roms: |
| 2628 | /* No known set specificly checks for this, however the GROM data may be in the form of four 8 Meg roms: |
| 2629 | 2629 | ROM_LOAD32_BYTE( "wcb_grom0_0_+.grm0_0", 0x000000, 0x100000, CRC(40837737) SHA1(f073943ec6f84285a8559553fb292ec1f8a629d0) ) Labeled as "WCB GROM0_0 *" ect |
| 2630 | 2630 | ROM_LOAD32_BYTE( "wcb_grom0_1_+.grm0_1", 0x000001, 0x100000, CRC(1615aee8) SHA1(6184919371a894b1d6f2e06a2b328cb55abed4a9) ) |
| 2631 | 2631 | ROM_LOAD32_BYTE( "wcb_grom0_2_+.grm0_2", 0x000002, 0x100000, CRC(d8e0b06e) SHA1(4981c0cf16df68a1b4da7ebf65ca587c21292478) ) |
| r242974 | r242975 | |
| 3354 | 3354 | ROM_LOAD32_BYTE( "gtg3_grom0_3++.grm0_3", 0x000003, 0x100000, CRC(1173a710) SHA1(1f612c1efbf38796707f5b5fecf9d4044691f031) ) |
| 3355 | 3355 | /* |
| 3356 | 3356 | The above 4 roms have the same exact data as the other sets, but in 8 meg roms instead of 4 meg roms. |
| 3357 | | This is the only set that specifically checks for these roms in this format |
| 3357 | This is the only set that specificaly checks for these roms in this format |
| 3358 | 3358 | */ |
| 3359 | 3359 | ROM_LOAD32_BYTE( "gtg3_grom1_0+.grm1_0", 0x400000, 0x080000, CRC(80ae7148) SHA1(e19d3390a2a0dad260d770fdbbb64d1f8e43d53f) ) /* actually labeled "GTG3 GROM1_0*" ect */ |
| 3360 | 3360 | ROM_LOAD32_BYTE( "gtg3_grom1_1+.grm1_1", 0x400001, 0x080000, CRC(0f85a618) SHA1(d9ced21c20f9ed6b7f19e7645d75b239ea709b79) ) |
| r242974 | r242975 | |
| 4036 | 4036 | ROM_LOAD32_BYTE( "gt2k_grom1_3.grm1_3", 0x200003, 0x80000, CRC(59f48688) SHA1(37b2c84e487f4f3a9145bef34c573a3716b4a6a7) ) |
| 4037 | 4037 | |
| 4038 | 4038 | /* GT99, GT2K & GT Classic all share the above listed 8 graphics roms and may be labeled GT99, GT2K or GTClassic */ |
| 4039 | | /* The Euro version has different GROM2_x compared to the standard US versions. GT Supreme PCBs have been seen */ |
| 4039 | /* The Euro version has different GROM2_x compared to the standard US versions. GT Superme PCBs have been seen */ |
| 4040 | 4040 | /* with GT 2K mask roms as well as all GROMs labeled "GT SUPREME" */ |
| 4041 | 4041 | |
| 4042 | 4042 | ROM_LOAD32_BYTE( "gt_supreme_grom2_0.grm2_0", 0x400000, 0x80000, CRC(33998a3e) SHA1(53832e37c42155eb9c774eb33b8b36fe387fa162) ) |
| r242974 | r242975 | |
| 4505 | 4505 | NOTE: Due to various different upgrade packages from IT, the 3 tier boards can end up with any combination |
| 4506 | 4506 | of rom boards and sound boards. For historical reasons, GTG3 3 tier S versions will use the oldest |
| 4507 | 4507 | sound file set up. Version L will use the newer Ensoniq sample rom and v2.X sound code, while gt97 |
| 4508 | | through gtclassic will use the latest "NR" versions. |
| 4508 | through gtclassic will use the lastest "NR" versions. |
| 4509 | 4509 | |
| 4510 | 4510 | GT Diamond Edition Tournament is a Euro GT98 with different GROM2_0 through GROM2_3 |
| 4511 | 4511 | GT Royal Edition Tournament is a Euro GT99 |
| 4512 | 4512 | GT Supreme Edition Tournament is a Euro GT2K with different GROM2_0 through GROM2_3 |
| 4513 | 4513 | GT Supreme (on a real PCB with actual tournament data) comes up with a different title screen and is (c) 2002 |
| 4514 | | showing the title as GT Supreme Plus! and the Hole-In-One board shows an additional course, Coconut Cove from GT99 |
| 4514 | showing the title as GT Supreme Plus! and the Hole-In-One board shows an aditional course, Coconut Cove from GT99 |
| 4515 | 4515 | Current emulation does not reproduce this extra title screen due to missing tournament data. |
| 4516 | 4516 | There doesn't seem to be a Euro version of GT Classic (at least none have been found). |
| 4517 | 4517 | |
| 4518 | 4518 | NOTE: There is an "8 Meg board" version of the P/N 1083 Rev 2 PCB, so GROM0_0 through GROM0_3 are 8 meg roms and labeled "GTxx GROM0_0 **" ect |
| 4519 | 4519 | while GROM1_0 through GROM1_3 are 4 meg roms matching "4 Meg board" GROM2_0 through GROM2_3 and are labeled "GTxx GROM1_0 *" ect |
| 4520 | | It is possible to find these rom combinations on any given GT board set. There is only 1 known GT set which specifically checks for 8 meg |
| 4520 | It is possible to find these rom combinations on any given GT board set. There is only 1 known GT set which specificly checks for 8 meg |
| 4521 | 4521 | roms under the GROM Checksum test. |
| 4522 | 4522 | |
| 4523 | 4523 | Parent set will always be gt(year) with the most recent version. IE: gt97 is Golden Tee '97 v1.30 |
trunk/src/mame/drivers/naomi.c
| r242974 | r242975 | |
| 521 | 521 | Star Horse (satellite) 840-0056C 23627 6 (128Mb)* 315-6319 315-6213 not present * +1 (64Mb), requires 837-13785 ARCNET&IO BD |
| 522 | 522 | Star Horse Progress (satellite) (Rev A) 840-0123C 24122A 7 (128Mb) 315-6319A 315-6213 not present requires 837-13785 ARCNET&IO BD |
| 523 | 523 | The King of Route 66 (Rev A) 840-0087C 23819A 10 (128Mb) 315-6319A 315-6213 not present |
| 524 | | Virtua Striker 3 840-0061C 23663 11 (128Mb) 315-6319A 315-6213 317-0310-COM |
| 525 | 524 | Virtua Striker 3 (Rev B) 840-0061C 23663B 11 (128Mb) 315-6319A 315-6213 317-0310-COM |
| 525 | Virtua Striker 3 (Rev C) 840-0061C 23663C 11 (128Mb) 315-6319A 315-6213 317-0310-COM |
| 526 | 526 | Wave Runner GP 840-0064C 24059 6 (128Mb) 315-6319A 315-6213 not present |
| 527 | 527 | Wild Riders 840-0046C 23622 10 (128Mb) 315-6319A 315-6213 317-0301-COM |
| 528 | 528 | WWF Royal Rumble 840-0040C 22261 8 (128Mb) 315-6319 315-6213 317-0285-COM |
| r242974 | r242975 | |
| 6014 | 6014 | ROM_LOAD( "wk1ma10.4c", 0xa000000, 0x1000000, CRC(e96f312c) SHA1(0a92640277111aef5c6e9dab4218a8ae2196ce61) ) |
| 6015 | 6015 | |
| 6016 | 6016 | ROM_REGION( 4, "rom_key", 0 ) |
| 6017 | | ROM_LOAD( "wldkicks-key.bin", 0, 4, CRC(1708ebb9) SHA1(c1115e4dd675f10d5fb41f57c1eea8e6a4f09fed) ) |
| 6017 | ROM_LOAD( "wldkicks-key.bin", 0, 4, CRC(c1e3000b) SHA1(36c2546833effe9452e2b3f7d31335fc5e349f49) ) |
| 6018 | 6018 | ROM_END |
| 6019 | 6019 | |
| 6020 | 6020 | ROM_START( wldkicksa ) |
| r242974 | r242975 | |
| 6036 | 6036 | ROM_LOAD( "wk1ma10.4c", 0xa000000, 0x1000000, CRC(e96f312c) SHA1(0a92640277111aef5c6e9dab4218a8ae2196ce61) ) |
| 6037 | 6037 | |
| 6038 | 6038 | ROM_REGION( 4, "rom_key", 0 ) |
| 6039 | | ROM_LOAD( "wldkicks-key.bin", 0, 4, CRC(1708ebb9) SHA1(c1115e4dd675f10d5fb41f57c1eea8e6a4f09fed) ) |
| 6039 | ROM_LOAD( "wldkicks-key.bin", 0, 4, CRC(c1e3000b) SHA1(36c2546833effe9452e2b3f7d31335fc5e349f49) ) |
| 6040 | 6040 | ROM_END |
| 6041 | 6041 | |
| 6042 | 6042 | ROM_START( wldkicksb ) |
| r242974 | r242975 | |
| 6058 | 6058 | ROM_LOAD( "wk1ma10.4c", 0xa000000, 0x1000000, CRC(e96f312c) SHA1(0a92640277111aef5c6e9dab4218a8ae2196ce61) ) |
| 6059 | 6059 | |
| 6060 | 6060 | ROM_REGION( 4, "rom_key", 0 ) |
| 6061 | | ROM_LOAD( "wldkicks-key.bin", 0, 4, CRC(1708ebb9) SHA1(c1115e4dd675f10d5fb41f57c1eea8e6a4f09fed) ) |
| 6061 | ROM_LOAD( "wldkicks-key.bin", 0, 4, CRC(c1e3000b) SHA1(36c2546833effe9452e2b3f7d31335fc5e349f49) ) |
| 6062 | 6062 | ROM_END |
| 6063 | 6063 | |
| 6064 | 6064 | ROM_START( toukon4 ) |
| r242974 | r242975 | |
| 6085 | 6085 | ROM_LOAD( "trf1ma15.6l", 0xf000000, 0x1000000, CRC(42d318c5) SHA1(f9fe82ffbfc51fcb52333f94c55a7092e7124fb4) ) |
| 6086 | 6086 | |
| 6087 | 6087 | ROM_REGION( 4, "rom_key", 0 ) |
| 6088 | | ROM_LOAD( "tr4ae-key.bin", 0x000000, 0x000004, CRC(1708ebb9) SHA1(c1115e4dd675f10d5fb41f57c1eea8e6a4f09fed) ) |
| 6088 | ROM_LOAD( "tr4ae-key.bin", 0x000000, 0x000004, CRC(986a7cee) SHA1(70c3ff80f86de6a0655251658c66a156fb644995) ) |
| 6089 | 6089 | ROM_END |
| 6090 | 6090 | |
| 6091 | 6091 | ROM_START( ninjaslt ) |
| r242974 | r242975 | |
| 7790 | 7790 | NAOMI_DEFAULT_EEPROM |
| 7791 | 7791 | |
| 7792 | 7792 | ROM_REGION( 0xb000000, "rom_board", ROMREGION_ERASEFF) |
| 7793 | | // rom was handmade from 2 damaged dumps, needs to be verified |
| 7794 | | ROM_LOAD( "epr-23663.ic22", 0x0000000, 0x0400000, BAD_DUMP CRC(6910a008) SHA1(865affff1cf31321725ef727a17be384555e3aae) ) |
| 7793 | ROM_LOAD( "epr-23663c.ic22",0x0000000, 0x0400000, CRC(7007fec7) SHA1(523168f0b218d0bd5c815d65bf0caba2c8468c9d) ) |
| 7795 | 7794 | ROM_LOAD( "mpr-23652.ic1", 0x0800000, 0x1000000, CRC(992758a2) SHA1(5e2a25c520c1795128e5026fc00d355c24852ded) ) |
| 7796 | 7795 | ROM_LOAD( "mpr-23653.ic2", 0x1800000, 0x1000000, CRC(e210e932) SHA1(2f6f0a31c3e98b21f1ff3af1680e50b3535b130f) ) |
| 7797 | 7796 | ROM_LOAD( "mpr-23654.ic3", 0x2800000, 0x1000000, CRC(91335971) SHA1(fc7599b836fb7995dd7da940e64b08b3c09cb180) ) |
| r242974 | r242975 | |
| 7805 | 7804 | ROM_LOAD( "mpr-23662.ic11", 0xa800000, 0x0800000, CRC(d6ef7d68) SHA1(4ee396af6c5caf4c5af6e9ad0e03a7ac2c5039f4) ) |
| 7806 | 7805 | |
| 7807 | 7806 | ROM_REGION( 4, "rom_key", 0 ) |
| 7808 | | ROM_LOAD( "vstrik3c-key.bin", 0, 4, CRC(8c9012fe) SHA1(d81e00d6377a3f0eeed01dc523707e36ca1b434d) ) |
| 7807 | ROM_LOAD( "vstrik3c-key.bin", 0, 4, CRC(049f41b0) SHA1(4ea444878c8e9288ec95b1763d48bc92c634acdd) ) |
| 7809 | 7808 | ROM_END |
| 7810 | 7809 | |
| 7811 | 7810 | ROM_START( vstrik3cb ) |
| r242974 | r242975 | |
| 7827 | 7826 | ROM_LOAD( "mpr-23662.ic11", 0xa800000, 0x0800000, CRC(d6ef7d68) SHA1(4ee396af6c5caf4c5af6e9ad0e03a7ac2c5039f4) ) |
| 7828 | 7827 | |
| 7829 | 7828 | ROM_REGION( 4, "rom_key", 0 ) |
| 7830 | | ROM_LOAD( "vstrik3c-key.bin", 0, 4, CRC(8c9012fe) SHA1(d81e00d6377a3f0eeed01dc523707e36ca1b434d) ) |
| 7829 | ROM_LOAD( "vstrik3c-key.bin", 0, 4, CRC(049f41b0) SHA1(4ea444878c8e9288ec95b1763d48bc92c634acdd) ) |
| 7831 | 7830 | ROM_END |
| 7832 | 7831 | |
| 7833 | 7832 | ROM_START( wldrider ) |
| r242974 | r242975 | |
| 7848 | 7847 | ROM_LOAD( "mpr-23620.ic10", 0x9800000, 0x1000000, CRC(67aa15a9) SHA1(42c24cbf7069c27430a71509a872cd1c4224aaeb) ) |
| 7849 | 7848 | |
| 7850 | 7849 | ROM_REGION( 4, "rom_key", 0 ) |
| 7851 | | ROM_LOAD( "wldrider-key.bin", 0, 4, CRC(7ac4f5fa) SHA1(5d08ecfbdc5f4bf26a9ea521a647c93141e7f635) ) |
| 7850 | ROM_LOAD( "wldrider-key.bin", 0, 4, CRC(f5a662ad) SHA1(a75b1e490d1f7d57cd8976115572266d1ca05202) ) |
| 7852 | 7851 | ROM_END |
| 7853 | 7852 | |
| 7854 | 7853 | ROM_START( vf4cart ) |
| r242974 | r242975 | |
| 7870 | 7869 | ROM_LOAD( "mpr-23784.ic11", 0xa800000, 0x1000000, CRC(f74f2fee) SHA1(84b07baa6d116727e66ef27e24ba6484c3393891) ) |
| 7871 | 7870 | |
| 7872 | 7871 | ROM_REGION( 4, "rom_key", 0 ) |
| 7873 | | ROM_LOAD( "vf4cart-key.bin", 0, 4, CRC(aa8cdd58) SHA1(e282b7d215044a005b50c8553b8056f3d599135c) ) |
| 7872 | ROM_LOAD( "vf4cart-key.bin", 0, 4, CRC(22838e16) SHA1(afee674dce3cfdd20360c30da2da5ba69f8d4682) ) |
| 7874 | 7873 | ROM_END |
| 7875 | 7874 | |
| 7876 | 7875 | // There is also a development cart (171-7885A) with 20x 64Mb FlashROMs instead of 10x 128Mb MaskROMs. Content is the same. |
| r242974 | r242975 | |
| 7993 | 7992 | ROM_LOAD( "mpr-23703.ic11", 0xa800000, 0x1000000, CRC(702b8b4a) SHA1(3a8dfde458f341e7db20664382b9fce2b6e5d462) ) |
| 7994 | 7993 | |
| 7995 | 7994 | ROM_REGION( 4, "rom_key", 0 ) |
| 7996 | | ROM_LOAD( "clubkrte-key.bin", 0, 4, CRC(5420fd0a) SHA1(06cb480c12f0ddc10e7601d34c5f42dda6ac6145) ) |
| 7995 | ROM_LOAD( "clubkrte-key.bin", 0, 4, CRC(db426a5d) SHA1(6a6a0b80ec0416605541159efea379dc19fe796d) ) |
| 7997 | 7996 | ROM_END |
| 7998 | 7997 | |
| 7999 | 7998 | ROM_START( clubkrtd ) |
| r242974 | r242975 | |
| 9035 | 9034 | |
| 9036 | 9035 | /* 840-xxxxx (Sega Naomi 2 cart games) */ |
| 9037 | 9036 | /* 0046 */ GAME( 2001, wldrider, naomi2, naomi2m2, naomi, naomi_state, naomi2, ROT0, "Sega", "Wild Riders (JPN, USA, EXP, KOR, AUS)", GAME_FLAGS ) |
| 9038 | | /* 0061 */ GAME( 2001, vstrik3c, naomi2, naomi2m2, naomi, naomi_state, naomi2, ROT0, "Sega", "Virtua Striker 3 (USA, EXP, KOR, AUS) (Cart)", GAME_FLAGS ) |
| 9037 | /* 0061 */ GAME( 2001, vstrik3c, naomi2, naomi2m2, naomi, naomi_state, naomi2, ROT0, "Sega", "Virtua Striker 3 (USA, EXP, KOR, AUS) (Cart, Rev C)", GAME_FLAGS ) |
| 9039 | 9038 | /* 0061 */ GAME( 2001, vstrik3cb,vstrik3c,naomi2m2, naomi, naomi_state, naomi2, ROT0, "Sega", "Virtua Striker 3 (USA, EXP, KOR, AUS) (Cart, Rev B)", GAME_FLAGS ) |
| 9040 | 9039 | /* 0062 */ GAME( 2001, clubkrte, naomi2, naomi2m2, naomi, naomi_state, naomi2, ROT0, "Sega", "Club Kart: European Session", GAME_FLAGS ) |
| 9041 | 9040 | /* 0062 */ GAME( 2001, clubkrtd, clubkrte,naomi2m2, naomi, naomi_state, naomi2, ROT0, "Sega", "Club Kart: European Session (Rev D)", GAME_FLAGS ) |
trunk/src/mame/drivers/snowbros.c
| r242974 | r242975 | |
| 185 | 185 | if (ACCESSING_BITS_0_7) soundlatch_byte_w(space,0,data & 0xff); |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | | READ16_MEMBER(snowbros_state::toto_read) |
| 189 | | { |
| 190 | | int pc = space.device().safe_pc(); |
| 191 | | if ((pc!= 0x3f010) && (pc!= 0x38008)) printf("toto prot %08x %04x\n", pc, mem_mask); |
| 192 | | return 0x0700; |
| 193 | | } |
| 194 | | |
| 195 | 188 | /* Snow Bros Memory Map */ |
| 196 | 189 | |
| 197 | 190 | static ADDRESS_MAP_START( snowbros_map, AS_PROGRAM, 16, snowbros_state ) |
| r242974 | r242975 | |
| 1962 | 1955 | ROM_LOAD16_BYTE( "wb09.bin", 0x60001, 0x10000, CRC(9be718ca) SHA1(5c195e4f13efbdb229201d2408d018861bf389cc) ) |
| 1963 | 1956 | ROM_END |
| 1964 | 1957 | |
| 1965 | | ROM_START( toto ) |
| 1966 | | ROM_REGION( 0x40000, "maincpu", 0 ) |
| 1967 | | ROM_LOAD16_BYTE( "u60.5j", 0x00000, 0x20000, CRC(39203792) SHA1(4c8d560be02a514cbf91774c7a0b4a95cf573356) ) |
| 1968 | | ROM_LOAD16_BYTE( "u51.4j", 0x00001, 0x20000, CRC(7b846cd4) SHA1(04aa0bbaab4303fb08dff52d5515f7e764f1be6d)) |
| 1969 | | |
| 1970 | | ROM_REGION( 0x10000, "soundcpu", 0 ) /* 64k for z80 sound code */ |
| 1971 | | ROM_LOAD( "u46.4c", 0x0000, 0x8000, CRC(77b1ef42) SHA1(75e3c8c2b687669cc56f972dd7375dab5185859c) ) |
| 1972 | | |
| 1973 | | ROM_REGION( 0x80000, "gfx1", 0 ) |
| 1974 | | ROM_LOAD( "u107.8k", 0x00000, 0x20000, CRC(4486153b) SHA1(a6dc0c17bf2328ab725bce4aaa0a413a42129fb0) ) |
| 1975 | | ROM_LOAD( "u108.8l", 0x20000, 0x20000, CRC(3286cf5f) SHA1(133366b0e10ab86111247cbedf329e8e3a7f2148) ) |
| 1976 | | ROM_LOAD( "u109.8m", 0x40000, 0x20000, CRC(464d7251) SHA1(f03ee54e9301ea87de4171cecdbad4a5e17929c4) ) |
| 1977 | | ROM_LOAD( "u110.8n", 0x60000, 0x20000, CRC(7dea56df) SHA1(7e7b9238837c6f4221cff416a2de21723d2c9272) ) |
| 1978 | | ROM_END |
| 1979 | | |
| 1980 | 1958 | /* Barko */ |
| 1981 | 1959 | |
| 1982 | 1960 | ROM_START( honeydol ) |
| r242974 | r242975 | |
| 2888 | 2866 | |
| 2889 | 2867 | |
| 2890 | 2868 | |
| 2891 | | DRIVER_INIT_MEMBER(snowbros_state,toto) |
| 2892 | | { |
| 2893 | | // every single rom has bits 0x10 and 0x08 swapped |
| 2894 | | UINT8 *src = memregion("maincpu")->base(); |
| 2895 | | int len = memregion("maincpu")->bytes(); |
| 2896 | | |
| 2897 | | for (int i = 0; i < len; i++) |
| 2898 | | { |
| 2899 | | src[i] = BITSWAP8(src[i], 7, 6, 5, 3, 4, 2, 1, 0); |
| 2900 | | } |
| 2901 | | |
| 2902 | | src = memregion("gfx1")->base(); |
| 2903 | | len = memregion("gfx1")->bytes(); |
| 2904 | | |
| 2905 | | for (int i = 0; i < len; i++) |
| 2906 | | { |
| 2907 | | src[i] = BITSWAP8(src[i], 7, 6, 5, 3, 4, 2, 1, 0); |
| 2908 | | } |
| 2909 | | |
| 2910 | | src = memregion("soundcpu")->base(); |
| 2911 | | len = memregion("soundcpu")->bytes(); |
| 2912 | | |
| 2913 | | for (int i = 0; i < len; i++) |
| 2914 | | { |
| 2915 | | src[i] = BITSWAP8(src[i], 7, 6, 5, 3, 4, 2, 1, 0); |
| 2916 | | } |
| 2917 | | |
| 2918 | | // protection? (just return 0x07) |
| 2919 | | m_maincpu->space(AS_PROGRAM).install_read_handler(0x500006, 0x500007, read16_delegate(FUNC(snowbros_state::toto_read),this)); |
| 2920 | | } |
| 2921 | | |
| 2922 | | |
| 2923 | | |
| 2924 | 2869 | GAME( 1990, snowbros, 0, snowbros, snowbros, driver_device, 0, ROT0, "Toaplan", "Snow Bros. - Nick & Tom (set 1)", 0 ) |
| 2925 | 2870 | GAME( 1990, snowbrosa, snowbros, snowbros, snowbros, driver_device, 0, ROT0, "Toaplan", "Snow Bros. - Nick & Tom (set 2)", 0 ) |
| 2926 | 2871 | GAME( 1990, snowbrosb, snowbros, snowbros, snowbros, driver_device, 0, ROT0, "Toaplan", "Snow Bros. - Nick & Tom (set 3)", 0 ) |
| r242974 | r242975 | |
| 2930 | 2875 | GAME( 1990, wintbob, snowbros, wintbob, snowbros, driver_device, 0, ROT0, "bootleg (Sakowa Project Korea)", "The Winter Bobble (bootleg of Snow Bros.)", 0 ) |
| 2931 | 2876 | GAME( 1990, snowbroswb,snowbros, wintbob, snowbros, driver_device, 0, ROT0, "bootleg", "Snow Bros. - Nick & Tom (The Winter Bobble hardware bootleg)", 0 ) // this was probably unhacked back from the more common Winter Bobble to make it look more original |
| 2932 | 2877 | |
| 2933 | | GAME( 1996, toto, 0, snowbros, snowbros, snowbros_state, toto, ROT0, "SoftClub", "Come Back Toto", 0 ) // modified from 'snowbros' code |
| 2934 | | |
| 2935 | 2878 | // none of the games below are on genuine SnowBros hardware, but they clone the functionality of it. |
| 2936 | 2879 | |
| 2937 | 2880 | // SemiCom / Jeil titles are protected, a dumb MCU copies code into RAM at startup, some also check for a specific return value from an address on startup. |
trunk/src/mame/drivers/twinkle.c
| r242974 | r242975 | |
| 254 | 254 | m_maincpu(*this, "maincpu"), |
| 255 | 255 | m_audiocpu(*this, "audiocpu") |
| 256 | 256 | { |
| 257 | m_spu_hle[0x200] = 0; |
| 258 | m_spu_hle[0x202] = 0; |
| 257 | 259 | } |
| 258 | 260 | |
| 259 | 261 | required_device<am53cf96_device> m_am53cf96; |
| r242974 | r242975 | |
| 262 | 264 | |
| 263 | 265 | UINT16 m_spu_ctrl; // SPU board control register |
| 264 | 266 | UINT8 m_spu_shared[0x400]; // SPU/PSX shared dual-ported RAM |
| 267 | UINT8 m_spu_hle[0x400]; |
| 265 | 268 | UINT32 m_spu_ata_dma; |
| 266 | 269 | int m_spu_ata_dmarq; |
| 267 | 270 | |
| r242974 | r242975 | |
| 282 | 285 | DECLARE_WRITE16_MEMBER(twinkle_waveram_w); |
| 283 | 286 | DECLARE_READ16_MEMBER(shared_68k_r); |
| 284 | 287 | DECLARE_WRITE16_MEMBER(shared_68k_w); |
| 285 | | DECLARE_READ16_MEMBER(unk_68k_r); |
| 286 | 288 | DECLARE_WRITE_LINE_MEMBER(spu_ata_irq); |
| 287 | 289 | DECLARE_WRITE_LINE_MEMBER(spu_ata_dmarq); |
| 288 | 290 | required_device<cpu_device> m_maincpu; |
| r242974 | r242975 | |
| 669 | 671 | |
| 670 | 672 | WRITE8_MEMBER(twinkle_state::shared_psx_w) |
| 671 | 673 | { |
| 672 | | // printf("shared_psx_w: %04x, %04x, %04x\n", offset, data, mem_mask); |
| 674 | //printf("shared_psx_w: %04x, %04x, %04x\n", offset, data, mem_mask); |
| 673 | 675 | |
| 674 | 676 | m_spu_shared[offset] = data; |
| 675 | 677 | |
| 678 | // HLE sound board |
| 679 | m_spu_hle[offset] = data; |
| 680 | |
| 676 | 681 | if (offset == 0x03fe && data == 0xff) |
| 677 | 682 | { |
| 678 | | // printf("spu command %02x %02x\n", m_spu_shared[1], m_spu_shared[3]); |
| 683 | //printf("spu command %02x %02x\n", m_spu_hle[1], m_spu_hle[3]); |
| 679 | 684 | |
| 680 | | m_audiocpu->set_input_line(M68K_IRQ_4, HOLD_LINE); |
| 685 | for (int i = 0x200; i < 0x300; i++) m_spu_hle[i] = 0xea; |
| 686 | |
| 687 | switch (m_spu_hle[1]) |
| 688 | { |
| 689 | case 0x91: // hdd sum 1 |
| 690 | m_spu_hle[0x200] = 0; // ? |
| 691 | m_spu_hle[0x202] = 0; // ? |
| 692 | break; |
| 693 | |
| 694 | case 0x9a: // hdd sum 2 |
| 695 | m_spu_hle[0x200] = 0; // ? |
| 696 | m_spu_hle[0x202] = 0; // ? |
| 697 | m_spu_hle[0x203] = 1; // Must be 1 to pass test |
| 698 | break; |
| 699 | |
| 700 | case 0xa1: // version |
| 701 | m_spu_hle[0x200] = 0; // ? |
| 702 | m_spu_hle[0x202] = 0; // ? |
| 703 | |
| 704 | if (strcmp(machine().system().name, "bmiidx") == 0 || |
| 705 | strcmp(machine().system().name, "bmiidxa") == 0 || |
| 706 | strcmp(machine().system().name, "bmiidxc") == 0 || |
| 707 | strcmp(machine().system().name, "bmiidxca") == 0) |
| 708 | { |
| 709 | strcpy((char *)&m_spu_hle[0x204], "GQ863JA_A"); |
| 710 | } |
| 711 | else if (strcmp(machine().system().name, "bmiidxs") == 0 || |
| 712 | strcmp(machine().system().name, "bmiidxc2") == 0) |
| 713 | { |
| 714 | strcpy((char *)&m_spu_hle[0x204], "GC983JA_R"); |
| 715 | } |
| 716 | else if (strcmp(machine().system().name, "bmiidx2") == 0) |
| 717 | { |
| 718 | strcpy((char *)&m_spu_hle[0x204], "GC985JA_A"); |
| 719 | } |
| 720 | else if (strcmp(machine().system().name, "bmiidx3") == 0 || |
| 721 | strcmp(machine().system().name, "bmiidx3a") == 0) |
| 722 | { |
| 723 | strcpy((char *)&m_spu_hle[0x204], "GC992JA_A"); |
| 724 | } |
| 725 | else if (strcmp(machine().system().name, "bmiidx4") == 0) |
| 726 | { |
| 727 | strcpy((char *)&m_spu_hle[0x204], "GCA03JA_A"); |
| 728 | } |
| 729 | else if (strcmp(machine().system().name, "bmiidx5") == 0) |
| 730 | { |
| 731 | strcpy((char *)&m_spu_hle[0x204], "GCA17JA_A"); |
| 732 | } |
| 733 | else if (strcmp(machine().system().name, "bmiidx6") == 0 || |
| 734 | strcmp(machine().system().name, "bmiidx6a") == 0) |
| 735 | { |
| 736 | strcpy((char *)&m_spu_hle[0x204], "GCB4UJA_A"); |
| 737 | } |
| 738 | else if (strcmp(machine().system().name, "bmiidx7") == 0) |
| 739 | { |
| 740 | strcpy((char *)&m_spu_hle[0x204], "GCB44JA_A"); |
| 741 | } |
| 742 | else if (strcmp(machine().system().name, "bmiidx8") == 0) |
| 743 | { |
| 744 | strcpy((char *)&m_spu_hle[0x204], "GCC44JA_A"); |
| 745 | } |
| 746 | break; |
| 747 | |
| 748 | case 0x30: // play sound [3]=sound code |
| 749 | case 0x51: // sound off |
| 750 | case 0x25: // spu rom error ([3]==0x0f) |
| 751 | case 0x26: // spu rom error ([3]==0x0f) |
| 752 | case 0x08: // spu rom error |
| 753 | case 0x40: // spu rom error ([3]==0x01 coin sound?) |
| 754 | case 0x2f: // spu rom error |
| 755 | case 0x52: // spu rom error |
| 756 | case 0x04: // spu rom error ([3]==?) |
| 757 | m_spu_hle[0x200] = 0; |
| 758 | m_spu_hle[0x202] = 0; |
| 759 | break; |
| 760 | } |
| 681 | 761 | } |
| 682 | 762 | } |
| 683 | 763 | |
| 684 | 764 | READ8_MEMBER(twinkle_state::shared_psx_r) |
| 685 | 765 | { |
| 686 | | UINT32 result = m_spu_shared[offset]; |
| 766 | //UINT32 result = m_spu_shared[offset]; |
| 767 | UINT32 result = m_spu_hle[offset]; |
| 687 | 768 | |
| 688 | 769 | //printf("shared_psx_r: %04x, %04x, %04x\n", offset, result, mem_mask); |
| 689 | 770 | |
| r242974 | r242975 | |
| 722 | 803 | /* |
| 723 | 804 | System control register (Konami always has one) |
| 724 | 805 | |
| 725 | | bit 7 = write 0 to ack IRQ 1, write 1 to enable (IRQ 1 appears to be an RF5C400-related timer, or some free-running timing source) |
| 806 | bit 7 = write 0 to ack IRQ 1, write 1 to enable (IRQ 1 appears to be vblank) |
| 726 | 807 | bit 8 = write 0 to ack IRQ 2, write 1 to enable (IRQ 2 appears to be DMA completion) |
| 727 | | bit 9 = write 0 to ack IRQ 4, write 1 to enable (IRQ 4 is "command available") |
| 728 | | bit 10 = write 0 to ack IRQ 6, write 1 to enable (IRQ 6 is the ATA IRQ) |
| 729 | | bit 11 = watchdog toggle |
| 808 | bit 9 = write 0 to ack IRQ 4, write 1 to enable (IRQ 4 appears to be "command sent", unsure how the MIPS causes it yet however) |
| 809 | bit 10 = write 0 to ack IRQ 6, write 1 to enable (IRQ 6 is IDE) |
| 810 | bit 11 = watchdog toggle? |
| 730 | 811 | |
| 731 | 812 | Other bits unknown. |
| 732 | 813 | */ |
| r242974 | r242975 | |
| 755 | 836 | WRITE16_MEMBER(twinkle_state::spu_ata_dma_low_w) |
| 756 | 837 | { |
| 757 | 838 | m_spu_ata_dma = (m_spu_ata_dma & ~0xffff) | data; |
| 839 | |
| 840 | //printf("dma_low %08x\n", m_spu_ata_dma * 2); |
| 758 | 841 | } |
| 759 | 842 | |
| 760 | 843 | WRITE16_MEMBER(twinkle_state::spu_ata_dma_high_w) |
| 761 | 844 | { |
| 762 | 845 | m_spu_ata_dma = (m_spu_ata_dma & 0xffff) | (data << 16); |
| 846 | |
| 847 | //printf("dma_high %08x\n", m_spu_ata_dma * 2); |
| 763 | 848 | } |
| 764 | 849 | |
| 765 | 850 | WRITE_LINE_MEMBER(twinkle_state::spu_ata_dmarq) |
| r242974 | r242975 | |
| 779 | 864 | //waveram[m_spu_ata_dma++] = (data >> 8) | (data << 8); |
| 780 | 865 | // bp 4a0e ;bmiidx4 checksum |
| 781 | 866 | // bp 4d62 ;bmiidx4 dma |
| 782 | | |
| 783 | | // $$$HACK - game DMAs nothing useful to 0x400000 but all sound plays are 0x400000 or above |
| 784 | | // so limit sound RAM to 4MB (there's 6 MB on the board) and let the 5c400's address masking |
| 785 | | // work for us until we figure out what's actually going on. |
| 786 | | if (m_spu_ata_dma < 0x200000) |
| 787 | | { |
| 788 | | m_waveram[m_spu_ata_dma++] = data; |
| 789 | | } |
| 867 | m_waveram[m_spu_ata_dma++] = data; |
| 790 | 868 | } |
| 791 | 869 | |
| 792 | 870 | m_ata->write_dmack(CLEAR_LINE); |
| r242974 | r242975 | |
| 808 | 886 | { |
| 809 | 887 | UINT16 result = m_spu_shared[offset]; |
| 810 | 888 | |
| 811 | | // printf("shared_68k_r: %04x, %04x, %04x\n", offset, result, mem_mask); |
| 889 | //printf("shared_68k_r: %04x, %04x, %04x\n", offset, result, mem_mask); |
| 812 | 890 | |
| 813 | 891 | return result; |
| 814 | 892 | } |
| 815 | 893 | |
| 816 | 894 | WRITE16_MEMBER(twinkle_state::shared_68k_w) |
| 817 | 895 | { |
| 818 | | // printf("shared_68k_w: %04x, %04x, %04x\n", offset, data, mem_mask); |
| 896 | //printf("shared_68k_w: %04x, %04x, %04x\n", offset, data, mem_mask); |
| 819 | 897 | |
| 820 | 898 | m_spu_shared[offset] = data & 0xff; |
| 821 | 899 | } |
| 822 | 900 | |
| 823 | | READ16_MEMBER(twinkle_state::unk_68k_r) |
| 824 | | { |
| 825 | | return 0xffff; // must return 0xff for 68000 POST to complete properly |
| 826 | | } |
| 827 | | |
| 828 | 901 | static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 16, twinkle_state ) |
| 829 | 902 | AM_RANGE(0x000000, 0x07ffff) AM_ROM |
| 830 | 903 | AM_RANGE(0x100000, 0x13ffff) AM_RAM |
| 831 | | AM_RANGE(0x200000, 0x200001) AM_READ(unk_68k_r) |
| 832 | 904 | // 220000 = LEDs? |
| 833 | 905 | AM_RANGE(0x230000, 0x230003) AM_WRITE(twinkle_spu_ctrl_w) |
| 834 | 906 | AM_RANGE(0x240000, 0x240003) AM_WRITE(spu_ata_dma_low_w) |
| r242974 | r242975 | |
| 837 | 909 | AM_RANGE(0x280000, 0x280fff) AM_READWRITE(shared_68k_r, shared_68k_w) |
| 838 | 910 | AM_RANGE(0x300000, 0x30000f) AM_DEVREADWRITE("ata", ata_interface_device, read_cs0, write_cs0) |
| 839 | 911 | // 34000E = ??? |
| 840 | | AM_RANGE(0x34000e, 0x34000f) AM_WRITENOP |
| 841 | 912 | AM_RANGE(0x400000, 0x400fff) AM_DEVREADWRITE("rfsnd", rf5c400_device, rf5c400_r, rf5c400_w) |
| 842 | | AM_RANGE(0x800000, 0xbfffff) AM_READWRITE(twinkle_waveram_r, twinkle_waveram_w ) |
| 843 | | AM_RANGE(0xfe0000, 0xffffff) AM_RAM // ...and the RAM test checks this last 128k (mirror of the work RAM at 0x100000?) |
| 913 | AM_RANGE(0x800000, 0xffffff) AM_READWRITE(twinkle_waveram_r, twinkle_waveram_w ) // 8 MB window wave RAM |
| 844 | 914 | ADDRESS_MAP_END |
| 845 | 915 | |
| 846 | 916 | /* SCSI */ |
| r242974 | r242975 | |
| 941 | 1011 | |
| 942 | 1012 | MCFG_CPU_ADD("audiocpu", M68000, 32000000/2) /* 16.000 MHz */ |
| 943 | 1013 | MCFG_CPU_PROGRAM_MAP( sound_map ) |
| 944 | | MCFG_CPU_PERIODIC_INT_DRIVER(twinkle_state, irq1_line_assert, 60) |
| 945 | | MCFG_CPU_PERIODIC_INT_DRIVER(twinkle_state, irq2_line_assert, 60) |
| 946 | 1014 | |
| 947 | 1015 | MCFG_WATCHDOG_TIME_INIT(attotime::from_msec(1200)) /* check TD pin on LTC1232 */ |
| 948 | 1016 | |
| r242974 | r242975 | |
| 1081 | 1149 | ROM_REGION32_LE( 0x080000, "audiocpu", 0 )\ |
| 1082 | 1150 | ROM_LOAD16_WORD_SWAP( "863a05.2x", 0x000000, 0x080000, CRC(6f42a09e) SHA1(cab5209f90f47b9ee6e721479913ad74e3ba84b1) )\ |
| 1083 | 1151 | \ |
| 1084 | | ROM_REGION16_LE(0x400000, "rfsnd", ROMREGION_ERASE00) |
| 1152 | ROM_REGION16_LE(0x1800000, "rfsnd", ROMREGION_ERASE00) |
| 1085 | 1153 | |
| 1086 | 1154 | ROM_START( gq863 ) |
| 1087 | 1155 | TWINKLE_BIOS |
trunk/src/mame/machine/315-5881_crypt.c
| r242974 | r242975 | |
| 121 | 121 | The encryption is done by a stream cipher operating in counter mode, which use a 16-bits internal block cipher. |
| 122 | 122 | |
| 123 | 123 | There are 2 "control bits" at the start of the decrypted stream which control the mode of operation: bit #1 set to 1 means |
| 124 | | that the stream needs to be decompressed after being decrypted. More on this later. |
| 124 | that the decrypted stream needs to be decompressed after being decrypted. More on this later. |
| 125 | 125 | |
| 126 | 126 | The next 16-bits are part of the header (they don't belong to the plaintext), but his meaning is unclear. It has been |
| 127 | 127 | conjectured that it could stablish when to "reset" the process and start processing a new stream (based on some tests |
| r242974 | r242975 | |
| 134 | 134 | given plaintext word, and the remaining 2 to the next plaintext word. |
| 135 | 135 | |
| 136 | 136 | The underlying block cipher consists of two 4-round Feistel Networks (FN): the first one takes the counter (16 bits), |
| 137 | | the game-key (>=27 bits) and the sequence-key (16 bits) and output a middle result (16 bits) which will act as another key |
| 137 | the game-key (>=26 bits) and the sequence-key (16 bits) and output a middle result (16 bits) which will act as another key |
| 138 | 138 | for the second one. The second FN will take the encrypted word (16 bits), the game-key, the sequence-key and the result |
| 139 | 139 | from the first FN and will output the decrypted word (16 bits). |
| 140 | 140 | |
| 141 | | Each round of the Feistel Networks use four substitution sboxes, each having 6 inputs and 2 outputs. The input is the |
| 142 | | XOR of at most one bit from the previous round and at most one bit from the different keys. |
| 141 | Each round of the Feistel Networks use four substitution sboxes, each having 6 inputs and 2 outputs. The input can be the |
| 142 | XOR of at most two "sources bits", being source bits the bits from the previous round and the bits from the different keys. |
| 143 | 143 | |
| 144 | 144 | The underlying block cipher has the same structure than the one used by the CPS-2 (Capcom Play System 2) and, |
| 145 | 145 | indeed, some of the used sboxes are exactly the same and appear in the same FN/round in both systems (this is not evident, |
| r242974 | r242975 | |
| 151 | 151 | some (encrypted word-decrypted word) pairs suffice. However, due to the weak key scheduling, it should be noted that some |
| 152 | 152 | related keys can produce the same output bytes for some (short) input sequences. |
| 153 | 153 | |
| 154 | The only difference in the decryption process between M2 and M3 is the initialization of the counter. In M3, the counter is |
| 155 | always set to 0 at the beginning of the decryption while, in M2, the bits #1-#16 of the ciphertext's address are used |
| 156 | to initialize the counter. |
| 157 | |
| 154 | 158 | Note that this implementation considers that the counter initialization for ram decryption is 0 simply because the ram is |
| 155 | 159 | mapped to multiples of 128K. |
| 156 | 160 | |
| r242974 | r242975 | |
| 160 | 164 | chosen so as to make the key for CAPSNK equal to 0. |
| 161 | 165 | |
| 162 | 166 | It can be observed that a couple of sboxes have incomplete tables (a 255 value indicate an unknown value). The recovered keys |
| 163 | | as of january/2015 show small randomness and big correlations, making possible that some unseen bits could make the |
| 167 | as of december/2010 show small randomness and big correlations, making possible that some unseen bits could make the |
| 164 | 168 | decryption need those incomplete parts. |
| 165 | 169 | |
| 166 | 170 | ****************************************************************************************/ |
| r242974 | r242975 | |
| 474 | 478 | {1,29}, {1,71}, {2,4}, {2,54}, {3,8}, {4,56}, {4,73}, {5,11}, |
| 475 | 479 | {6,51}, {7,92}, {8,89}, {9,9}, {9,10}, {9,39}, {9,41}, {9,58}, |
| 476 | 480 | {9,59}, {9,86}, {10,90}, {11,6}, {12,64}, {13,49}, {14,44}, {15,40}, |
| 477 | | {16,69}, {17,15}, {18,23}, {18,43}, {19,82}, {20,81}, {21,32}, {22,5}, |
| 478 | | {23,66}, {24,13}, {24,45}, {25,12}, {25,35}, {26,61}, |
| 481 | {16,69}, {17,15}, {18,23}, {18,43}, {19,82}, {20,81}, {21,32}, {21,61}, |
| 482 | {22,5}, {23,66}, {24,13}, {24,45}, {25,12}, {25,35} |
| 479 | 483 | }; |
| 480 | 484 | |
| 481 | 485 | const int sega_315_5881_crypt_device::fn2_game_key_scheduling[34][2] = { |
| 482 | 486 | {0,0}, {1,3}, {2,11}, {3,20}, {4,22}, {5,23}, {6,29}, {7,38}, |
| 483 | 487 | {8,39}, {9,47}, {9,55}, {9,86}, {9,87}, {9,90}, {10,50}, {10,53}, |
| 484 | 488 | {11,57}, {12,59}, {13,61}, {13,64}, {14,63}, {15,67}, {16,72}, {17,83}, |
| 485 | | {18,88}, {19,94}, {20,35}, {21,17}, {22,6}, {22,11}, {23,85}, {24,16}, |
| 486 | | {25,25}, {26,92} |
| 489 | {18,88}, {19,94}, {20,35}, {21,17}, {21,92}, {22,6}, {22,11}, {23,85}, |
| 490 | {24,16}, {25,25} |
| 487 | 491 | }; |
| 488 | 492 | |
| 489 | 493 | const int sega_315_5881_crypt_device::fn1_sequence_key_scheduling[20][2] = { |