trunk/src/emu/cpu/tms0980/tms0980.c
| r242480 | r242481 | |
| 1156 | 1156 | set_cki_bus(); |
| 1157 | 1157 | m_ram_in = m_data->read_byte(m_ram_address) & 0xf; |
| 1158 | 1158 | m_dam_in = m_data->read_byte(m_ram_address | (0x10 << (m_x_bits-1))) & 0xf; |
| 1159 | | m_ram_out = -1; |
| 1160 | | m_status = 1; |
| 1161 | 1159 | m_p = 0; |
| 1162 | 1160 | m_n = 0; |
| 1163 | 1161 | m_carry_in = 0; |
| r242480 | r242481 | |
| 1197 | 1195 | // note: officially, only 1 alu operation is allowed per opcode |
| 1198 | 1196 | m_adder_out = m_p + m_n + m_carry_in; |
| 1199 | 1197 | int carry_out = m_adder_out >> 4 & 1; |
| 1198 | int status = 1; |
| 1199 | m_ram_out = -1; |
| 1200 | 1200 | |
| 1201 | | if (m_micro & M_C8) m_status &= carry_out; |
| 1202 | | if (m_micro & M_NE) m_status &= (m_n != m_p); // COMP |
| 1201 | if (m_micro & M_C8) status &= carry_out; |
| 1202 | if (m_micro & M_NE) status &= (m_n != m_p); // COMP |
| 1203 | if (m_micro & M_CKM) m_ram_out = m_cki_bus; |
| 1203 | 1204 | |
| 1204 | | if (m_micro & M_CKM) m_ram_out = m_cki_bus; |
| 1205 | | |
| 1206 | 1205 | // special status circuit |
| 1207 | 1206 | if (m_micro & M_SSE) |
| 1208 | 1207 | { |
| r242480 | r242481 | |
| 1233 | 1232 | if (m_fixed & F_SAL) op_sal(); |
| 1234 | 1233 | if (m_fixed & F_SBL) op_sbl(); |
| 1235 | 1234 | if (m_fixed & F_XDA) op_xda(); |
| 1236 | | |
| 1237 | | // execute: write ram |
| 1235 | |
| 1236 | // after fixed opcode handling: store status, write ram |
| 1237 | m_status = status; |
| 1238 | 1238 | if (m_ram_out != -1) |
| 1239 | 1239 | m_data->write_byte(m_ram_address, m_ram_out); |
| 1240 | 1240 | |
| r242480 | r242481 | |
| 1248 | 1248 | |
| 1249 | 1249 | case 4: |
| 1250 | 1250 | // execute: register store 2/2 |
| 1251 | | if (m_micro & M_AUTA) m_a = m_adder_out & 0xf; |
| 1252 | | if (m_micro & M_AUTY) m_y = m_adder_out & 0xf; |
| 1253 | | if (m_micro & M_STSL) m_status_latch = m_status; |
| 1251 | if (m_micro & M_AUTA) m_a = m_adder_out & 0xf; |
| 1252 | if (m_micro & M_AUTY) m_y = m_adder_out & 0xf; |
| 1253 | if (m_micro & M_STSL) m_status_latch = m_status; |
| 1254 | 1254 | |
| 1255 | 1255 | // fetch: update pc, ram address 2/2 |
| 1256 | 1256 | read_opcode(); |