src/mess/machine/ti85.c
| r3659 | r3660 | |
| 137 | 137 | |
| 138 | 138 | static void update_ti86_memory (running_machine *machine) |
| 139 | 139 | { |
| 140 | | write8_machine_func wh; |
| 140 | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 141 | write8_space_func wh; |
| 141 | 142 | |
| 142 | 143 | if (ti85_memory_page_0x4000 & 0x40) |
| 143 | 144 | { |
| 144 | | memory_set_bankptr(machine, 2,ti86_ram + 0x004000*(ti85_memory_page_0x4000&0x07)); |
| 145 | | memory_set_bankptr(machine, 6,ti86_ram + 0x004000*(ti85_memory_page_0x4000&0x07)); |
| 145 | memory_set_bankptr(machine, 2, ti86_ram + 0x004000*(ti85_memory_page_0x4000&0x07)); |
| 146 | memory_set_bankptr(machine, 6, ti86_ram + 0x004000*(ti85_memory_page_0x4000&0x07)); |
| 146 | 147 | wh = SMH_BANK6; |
| 147 | 148 | } |
| 148 | 149 | else |
| 149 | 150 | { |
| 150 | | memory_set_bankptr(machine, 2,memory_region(machine, "main") + 0x010000 + 0x004000*(ti85_memory_page_0x4000&0x0f)); |
| 151 | memory_set_bankptr(machine, 2, memory_region(machine, "main") + 0x010000 + 0x004000*(ti85_memory_page_0x4000&0x0f)); |
| 151 | 152 | wh = SMH_UNMAP; |
| 152 | 153 | } |
| 153 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x7fff, 0, 0, wh); |
| 154 | memory_install_write8_handler(space, 0x4000, 0x7fff, 0, 0, wh); |
| 154 | 155 | |
| 155 | 156 | if (ti86_memory_page_0x8000 & 0x40) |
| 156 | 157 | { |
| 157 | | memory_set_bankptr(machine, 3,ti86_ram + 0x004000*(ti86_memory_page_0x8000&0x07)); |
| 158 | | memory_set_bankptr(machine, 7,ti86_ram + 0x004000*(ti86_memory_page_0x8000&0x07)); |
| 158 | memory_set_bankptr(machine, 3, ti86_ram + 0x004000*(ti86_memory_page_0x8000&0x07)); |
| 159 | memory_set_bankptr(machine, 7, ti86_ram + 0x004000*(ti86_memory_page_0x8000&0x07)); |
| 159 | 160 | wh = SMH_BANK7; |
| 160 | 161 | } |
| 161 | 162 | else |
| 162 | 163 | { |
| 163 | | memory_set_bankptr(machine, 3,memory_region(machine, "main") + 0x010000 + 0x004000*(ti86_memory_page_0x8000&0x0f)); |
| 164 | memory_set_bankptr(machine, 3, memory_region(machine, "main") + 0x010000 + 0x004000*(ti86_memory_page_0x8000&0x0f)); |
| 164 | 165 | wh = SMH_UNMAP; |
| 165 | 166 | } |
| 166 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0xbfff, 0, 0, wh); |
| 167 | memory_install_write8_handler(space, 0x8000, 0xbfff, 0, 0, wh); |
| 167 | 168 | } |
| 168 | 169 | |
| 169 | 170 | /*************************************************************************** |
| r3659 | r3660 | |
| 172 | 173 | |
| 173 | 174 | MACHINE_START( ti81 ) |
| 174 | 175 | { |
| 176 | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 175 | 177 | UINT8 *mem = memory_region(machine, "main"); |
| 176 | 178 | |
| 177 | 179 | ti85_timer_interrupt_mask = 0; |
| r3659 | r3660 | |
| 197 | 199 | |
| 198 | 200 | timer_pulse(ATTOTIME_IN_HZ(200), NULL, 0, ti85_timer_callback); |
| 199 | 201 | |
| 200 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x3fff, 0, 0, SMH_UNMAP); |
| 201 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x7fff, 0, 0, SMH_UNMAP); |
| 202 | | memory_set_bankptr(machine, 1,mem + 0x010000); |
| 203 | | memory_set_bankptr(machine, 2,mem + 0x014000); |
| 202 | memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP); |
| 203 | memory_install_write8_handler(space, 0x4000, 0x7fff, 0, 0, SMH_UNMAP); |
| 204 | memory_set_bankptr(machine, 1, mem + 0x010000); |
| 205 | memory_set_bankptr(machine, 2, mem + 0x014000); |
| 204 | 206 | } |
| 205 | 207 | |
| 206 | 208 | MACHINE_START( ti85 ) |
| 207 | 209 | { |
| 210 | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 208 | 211 | UINT8 *mem = memory_region(machine, "main"); |
| 209 | 212 | |
| 210 | 213 | ti85_timer_interrupt_mask = 0; |
| r3659 | r3660 | |
| 229 | 232 | |
| 230 | 233 | timer_pulse(ATTOTIME_IN_HZ(200), NULL, 0, ti85_timer_callback); |
| 231 | 234 | |
| 232 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x3fff, 0, 0, SMH_UNMAP); |
| 233 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x4000, 0x7fff, 0, 0, SMH_UNMAP); |
| 234 | | memory_set_bankptr(machine, 1,mem + 0x010000); |
| 235 | | memory_set_bankptr(machine, 2,mem + 0x014000); |
| 235 | memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP); |
| 236 | memory_install_write8_handler(space, 0x4000, 0x7fff, 0, 0, SMH_UNMAP); |
| 237 | memory_set_bankptr(machine, 1, mem + 0x010000); |
| 238 | memory_set_bankptr(machine, 2, mem + 0x014000); |
| 236 | 239 | |
| 237 | 240 | add_reset_callback(machine, ti85_reset_serial); |
| 238 | 241 | add_exit_callback(machine, ti85_free_serial_data_memory); |
| r3659 | r3660 | |
| 240 | 243 | |
| 241 | 244 | MACHINE_START( ti86 ) |
| 242 | 245 | { |
| 246 | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 243 | 247 | UINT8 *mem = memory_region(machine, "main"); |
| 244 | 248 | |
| 245 | 249 | ti85_timer_interrupt_mask = 0; |
| r3659 | r3660 | |
| 260 | 264 | |
| 261 | 265 | ti86_ram = auto_malloc(128*1024); |
| 262 | 266 | { |
| 263 | | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x3fff, 0, 0, SMH_UNMAP); |
| 267 | memory_install_write8_handler(space, 0x0000, 0x3fff, 0, 0, SMH_UNMAP); |
| 264 | 268 | |
| 265 | | memory_set_bankptr(machine, 1,mem + 0x010000); |
| 266 | | memory_set_bankptr(machine, 2,mem + 0x014000); |
| 269 | memory_set_bankptr(machine, 1, mem + 0x010000); |
| 270 | memory_set_bankptr(machine, 2, mem + 0x014000); |
| 267 | 271 | |
| 268 | 272 | memory_set_bankptr(machine, 4, ti86_ram); |
| 269 | 273 | memory_set_bankptr(machine, 8, ti86_ram); |
| r3659 | r3660 | |
| 287 | 291 | return 0xff; |
| 288 | 292 | } |
| 289 | 293 | |
| 290 | | READ8_HANDLER ( ti85_port_0001_r ) |
| 294 | READ8_HANDLER ( ti85_port_0001_r ) |
| 291 | 295 | { |
| 292 | 296 | int data = 0xff; |
| 293 | 297 | int port; |
| r3659 | r3660 | |
| 297 | 301 | if (ti85_keypad_mask == 0x7f) return data; |
| 298 | 302 | |
| 299 | 303 | for (bit = 0; bit < 7; bit++) |
| 304 | { |
| 300 | 305 | if (~ti85_keypad_mask&(0x01<<bit)) |
| 306 | { |
| 301 | 307 | for (port = 0; port < 8; port++) |
| 302 | | { |
| 303 | | data ^= input_port_read(machine, bitnames[port]) & (0x01<<bit) ? 0x01<<port : 0x00; |
| 304 | | } |
| 308 | { |
| 309 | data ^= input_port_read(space->machine, bitnames[port]) & (0x01<<bit) ? 0x01<<port : 0x00; |
| 310 | } |
| 311 | } |
| 312 | } |
| 305 | 313 | return data; |
| 306 | 314 | } |
| 307 | 315 | |
| r3659 | r3660 | |
| 337 | 345 | return ti85_memory_page_0x4000; |
| 338 | 346 | } |
| 339 | 347 | |
| 340 | | READ8_HANDLER ( ti85_port_0006_r ) |
| 348 | READ8_HANDLER ( ti85_port_0006_r ) |
| 341 | 349 | { |
| 342 | 350 | return ti85_power_mode; |
| 343 | 351 | } |
| 344 | 352 | |
| 345 | | READ8_HANDLER ( ti85_port_0007_r ) |
| 353 | READ8_HANDLER ( ti85_port_0007_r ) |
| 346 | 354 | { |
| 347 | | ti85_update_serial(machine); |
| 348 | | return (ti85_white_out<<3) | |
| 349 | | (ti85_red_out<<2)| |
| 350 | | ((ti85_white_in&(1-ti85_white_out))<<1)| |
| 351 | | (ti85_red_in&(1-ti85_red_out))| |
| 352 | | ti85_PCR; |
| 355 | ti85_update_serial(space->machine); |
| 356 | return (ti85_white_out<<3) |
| 357 | | (ti85_red_out<<2) |
| 358 | | ((ti85_white_in&(1-ti85_white_out))<<1) |
| 359 | | (ti85_red_in&(1-ti85_red_out)) |
| 360 | | ti85_PCR; |
| 353 | 361 | } |
| 354 | 362 | |
| 355 | | READ8_HANDLER ( ti86_port_0005_r ) |
| 363 | READ8_HANDLER ( ti86_port_0005_r ) |
| 356 | 364 | { |
| 357 | 365 | return ti85_memory_page_0x4000; |
| 358 | 366 | } |
| r3659 | r3660 | |
| 401 | 409 | WRITE8_HANDLER ( ti85_port_0005_w ) |
| 402 | 410 | { |
| 403 | 411 | ti85_memory_page_0x4000 = data; |
| 404 | | update_ti85_memory(machine); |
| 412 | update_ti85_memory(space->machine); |
| 405 | 413 | } |
| 406 | 414 | |
| 407 | 415 | WRITE8_HANDLER ( ti85_port_0006_w ) |
| r3659 | r3660 | |
| 414 | 422 | speaker_level_w(0,( (data>>2)|(data>>3) )&0x01 ); |
| 415 | 423 | ti85_red_out=(data>>2)&0x01; |
| 416 | 424 | ti85_white_out=(data>>3)&0x01; |
| 417 | | ti85_update_serial(machine); |
| 425 | ti85_update_serial(space->machine); |
| 418 | 426 | ti85_PCR = data&0xf0; |
| 419 | 427 | } |
| 420 | 428 | |
| 421 | 429 | WRITE8_HANDLER ( ti86_port_0005_w ) |
| 422 | 430 | { |
| 423 | 431 | ti85_memory_page_0x4000 = data&((data&0x40)?0x47:0x4f); |
| 424 | | update_ti86_memory(machine); |
| 432 | update_ti86_memory(space->machine); |
| 425 | 433 | } |
| 426 | 434 | |
| 427 | 435 | WRITE8_HANDLER ( ti86_port_0006_w ) |
| 428 | 436 | { |
| 429 | 437 | ti86_memory_page_0x8000 = data&((data&0x40)?0x47:0x4f); |
| 430 | | update_ti86_memory(machine); |
| 438 | update_ti86_memory(space->machine); |
| 431 | 439 | } |
| 432 | 440 | |
| 433 | 441 | |
| r3659 | r3660 | |
| 540 | 548 | |
| 541 | 549 | cpu_set_reg(machine->cpu[0], Z80_R, (reg[0x44]&0x7f) | (reg[0x48]&0x80)); |
| 542 | 550 | |
| 543 | | activecpu_set_input_line(0, 0); |
| 544 | | activecpu_set_input_line(INPUT_LINE_NMI, 0); |
| 551 | cpu_set_input_line(machine->cpu[0], 0, 0); |
| 552 | cpu_set_input_line(machine->cpu[0], INPUT_LINE_NMI, 0); |
| 545 | 553 | cpu_set_input_line(machine->cpu[0], INPUT_LINE_HALT, 0); |
| 546 | 554 | } |
| 547 | 555 | |
| 548 | 556 | static void ti85_setup_snapshot (running_machine *machine, UINT8 * data) |
| 549 | 557 | { |
| 558 | const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); |
| 550 | 559 | int i; |
| 551 | 560 | unsigned char lo,hi; |
| 552 | 561 | unsigned char * hdw = data + 0x8000 + 0x94; |
src/mess/machine/compis.c
| r3659 | r3660 | |
| 192 | 192 | #ifdef UNUSED_FUNCTION |
| 193 | 193 | void compis_irq_set(UINT8 irq) |
| 194 | 194 | { |
| 195 | | cpunum_set_input_line_vector(0, 0, irq); |
| 196 | | cpunum_set_input_line(machine, 0, 0, HOLD_LINE); |
| 195 | cpu_set_input_line_vector(machine->cpu[0], 0, irq); |
| 196 | cpu_set_input_line(machine->cpu[0], 0, HOLD_LINE); |
| 197 | 197 | } |
| 198 | 198 | #endif |
| 199 | 199 | |
| r3659 | r3660 | |
| 584 | 584 | logerror("(%f) **** Acknowledged interrupt vector %02X\n", attotime_to_double(timer_get_time()), i186.intr.poll_status & 0x1f); |
| 585 | 585 | |
| 586 | 586 | /* clear the interrupt */ |
| 587 | | activecpu_set_input_line(0, CLEAR_LINE); |
| 587 | cpu_set_input_line(machine->cpu[0], 0, CLEAR_LINE); |
| 588 | 588 | i186.intr.pending = 0; |
| 589 | 589 | |
| 590 | 590 | /* clear the request and set the in-service bit */ |
| r3659 | r3660 | |
| 719 | 719 | case 0x0d: i186.intr.in_service &= ~0x20; break; |
| 720 | 720 | case 0x0e: i186.intr.in_service &= ~0x40; break; |
| 721 | 721 | case 0x0f: i186.intr.in_service &= ~0x80; break; |
| 722 | | default: logerror("%05X:ERROR - 80186 EOI with unknown vector %02X\n", activecpu_get_pc(), data & 0x1f); |
| 722 | default: logerror("%05X:ERROR - 80186 EOI with unknown vector %02X\n", cpu_get_pc(space->cpu), data & 0x1f); |
| 723 | 723 | } |
| 724 | 724 | if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for vector %02X\n", attotime_to_double(timer_get_time()), data & 0x1f); |
| 725 | 725 | } |
| r3659 | r3660 | |
| 890 | 890 | diff = new_control ^ t->control; |
| 891 | 891 | if (diff & 0x001c) |
| 892 | 892 | logerror("%05X:ERROR! -unsupported timer mode %04X\n", |
| 893 | | activecpu_get_pc(), |
| 893 | cpu_get_pc(space->cpu), |
| 894 | 894 | new_control); |
| 895 | 895 | |
| 896 | 896 | /* if we have real changes, update things */ |
| r3659 | r3660 | |
| 992 | 992 | diff = new_control ^ d->control; |
| 993 | 993 | if (diff & 0x6811) |
| 994 | 994 | logerror("%05X:ERROR! - unsupported DMA mode %04X\n", |
| 995 | | activecpu_get_pc(), |
| 995 | cpu_get_pc(space->cpu), |
| 996 | 996 | new_control); |
| 997 | 997 | |
| 998 | 998 | /* if we're going live, set a timer */ |
| r3659 | r3660 | |
| 1049 | 1049 | switch (offset) |
| 1050 | 1050 | { |
| 1051 | 1051 | case 0x11: |
| 1052 | | logerror("%05X:ERROR - read from 80186 EOI\n", activecpu_get_pc()); |
| 1052 | logerror("%05X:ERROR - read from 80186 EOI\n", cpu_get_pc(space->cpu)); |
| 1053 | 1053 | break; |
| 1054 | 1054 | |
| 1055 | 1055 | case 0x12: |
| 1056 | | if (LOG_PORTS) logerror("%05X:read 80186 interrupt poll\n", activecpu_get_pc()); |
| 1056 | if (LOG_PORTS) logerror("%05X:read 80186 interrupt poll\n", cpu_get_pc(space->cpu)); |
| 1057 | 1057 | if (i186.intr.poll_status & 0x8000) |
| 1058 | 1058 | int_callback(machine, 0); |
| 1059 | 1059 | return i186.intr.poll_status; |
| 1060 | 1060 | |
| 1061 | 1061 | case 0x13: |
| 1062 | | if (LOG_PORTS) logerror("%05X:read 80186 interrupt poll status\n", activecpu_get_pc()); |
| 1062 | if (LOG_PORTS) logerror("%05X:read 80186 interrupt poll status\n", cpu_get_pc(space->cpu)); |
| 1063 | 1063 | return i186.intr.poll_status; |
| 1064 | 1064 | |
| 1065 | 1065 | case 0x14: |
| 1066 | | if (LOG_PORTS) logerror("%05X:read 80186 interrupt mask\n", activecpu_get_pc()); |
| 1066 | if (LOG_PORTS) logerror("%05X:read 80186 interrupt mask\n", cpu_get_pc(space->cpu)); |
| 1067 | 1067 | temp = (i186.intr.timer >> 3) & 0x01; |
| 1068 | 1068 | temp |= (i186.intr.dma[0] >> 1) & 0x04; |
| 1069 | 1069 | temp |= (i186.intr.dma[1] >> 0) & 0x08; |
| r3659 | r3660 | |
| 1074 | 1074 | return temp; |
| 1075 | 1075 | |
| 1076 | 1076 | case 0x15: |
| 1077 | | if (LOG_PORTS) logerror("%05X:read 80186 interrupt priority mask\n", activecpu_get_pc()); |
| 1077 | if (LOG_PORTS) logerror("%05X:read 80186 interrupt priority mask\n", cpu_get_pc(space->cpu)); |
| 1078 | 1078 | return i186.intr.priority_mask; |
| 1079 | 1079 | |
| 1080 | 1080 | case 0x16: |
| 1081 | | if (LOG_PORTS) logerror("%05X:read 80186 interrupt in-service\n", activecpu_get_pc()); |
| 1081 | if (LOG_PORTS) logerror("%05X:read 80186 interrupt in-service\n", cpu_get_pc(space->cpu)); |
| 1082 | 1082 | return i186.intr.in_service; |
| 1083 | 1083 | |
| 1084 | 1084 | case 0x17: |
| 1085 | | if (LOG_PORTS) logerror("%05X:read 80186 interrupt request\n", activecpu_get_pc()); |
| 1085 | if (LOG_PORTS) logerror("%05X:read 80186 interrupt request\n", cpu_get_pc(space->cpu)); |
| 1086 | 1086 | temp = i186.intr.request & ~0x0001; |
| 1087 | 1087 | if (i186.intr.status & 0x0007) |
| 1088 | 1088 | temp |= 1; |
| 1089 | 1089 | return temp; |
| 1090 | 1090 | |
| 1091 | 1091 | case 0x18: |
| 1092 | | if (LOG_PORTS) logerror("%05X:read 80186 interrupt status\n", activecpu_get_pc()); |
| 1092 | if (LOG_PORTS) logerror("%05X:read 80186 interrupt status\n", cpu_get_pc(space->cpu)); |
| 1093 | 1093 | return i186.intr.status; |
| 1094 | 1094 | |
| 1095 | 1095 | case 0x19: |
| 1096 | | if (LOG_PORTS) logerror("%05X:read 80186 timer interrupt control\n", activecpu_get_pc()); |
| 1096 | if (LOG_PORTS) logerror("%05X:read 80186 timer interrupt control\n", cpu_get_pc(space->cpu)); |
| 1097 | 1097 | return i186.intr.timer; |
| 1098 | 1098 | |
| 1099 | 1099 | case 0x1a: |
| 1100 | | if (LOG_PORTS) logerror("%05X:read 80186 DMA 0 interrupt control\n", activecpu_get_pc()); |
| 1100 | if (LOG_PORTS) logerror("%05X:read 80186 DMA 0 interrupt control\n", cpu_get_pc(space->cpu)); |
| 1101 | 1101 | return i186.intr.dma[0]; |
| 1102 | 1102 | |
| 1103 | 1103 | case 0x1b: |
| 1104 | | if (LOG_PORTS) logerror("%05X:read 80186 DMA 1 interrupt control\n", activecpu_get_pc()); |
| 1104 | if (LOG_PORTS) logerror("%05X:read 80186 DMA 1 interrupt control\n", cpu_get_pc(space->cpu)); |
| 1105 | 1105 | return i186.intr.dma[1]; |
| 1106 | 1106 | |
| 1107 | 1107 | case 0x1c: |
| 1108 | | if (LOG_PORTS) logerror("%05X:read 80186 INT 0 interrupt control\n", activecpu_get_pc()); |
| 1108 | if (LOG_PORTS) logerror("%05X:read 80186 INT 0 interrupt control\n", cpu_get_pc(space->cpu)); |
| 1109 | 1109 | return i186.intr.ext[0]; |
| 1110 | 1110 | |
| 1111 | 1111 | case 0x1d: |
| 1112 | | if (LOG_PORTS) logerror("%05X:read 80186 INT 1 interrupt control\n", activecpu_get_pc()); |
| 1112 | if (LOG_PORTS) logerror("%05X:read 80186 INT 1 interrupt control\n", cpu_get_pc(space->cpu)); |
| 1113 | 1113 | return i186.intr.ext[1]; |
| 1114 | 1114 | |
| 1115 | 1115 | case 0x1e: |
| 1116 | | if (LOG_PORTS) logerror("%05X:read 80186 INT 2 interrupt control\n", activecpu_get_pc()); |
| 1116 | if (LOG_PORTS) logerror("%05X:read 80186 INT 2 interrupt control\n", cpu_get_pc(space->cpu)); |
| 1117 | 1117 | return i186.intr.ext[2]; |
| 1118 | 1118 | |
| 1119 | 1119 | case 0x1f: |
| 1120 | | if (LOG_PORTS) logerror("%05X:read 80186 INT 3 interrupt control\n", activecpu_get_pc()); |
| 1120 | if (LOG_PORTS) logerror("%05X:read 80186 INT 3 interrupt control\n", cpu_get_pc(space->cpu)); |
| 1121 | 1121 | return i186.intr.ext[3]; |
| 1122 | 1122 | |
| 1123 | 1123 | case 0x28: |
| 1124 | 1124 | case 0x2c: |
| 1125 | 1125 | case 0x30: |
| 1126 | | if (LOG_PORTS) logerror("%05X:read 80186 Timer %d count\n", activecpu_get_pc(), (offset - 0x28) / 4); |
| 1126 | if (LOG_PORTS) logerror("%05X:read 80186 Timer %d count\n", cpu_get_pc(space->cpu), (offset - 0x28) / 4); |
| 1127 | 1127 | which = (offset - 0x28) / 4; |
| 1128 | 1128 | if (!(offset & 1)) |
| 1129 | 1129 | internal_timer_sync(which); |
| r3659 | r3660 | |
| 1132 | 1132 | case 0x29: |
| 1133 | 1133 | case 0x2d: |
| 1134 | 1134 | case 0x31: |
| 1135 | | if (LOG_PORTS) logerror("%05X:read 80186 Timer %d max A\n", activecpu_get_pc(), (offset - 0x29) / 4); |
| 1135 | if (LOG_PORTS) logerror("%05X:read 80186 Timer %d max A\n", cpu_get_pc(space->cpu), (offset - 0x29) / 4); |
| 1136 | 1136 | which = (offset - 0x29) / 4; |
| 1137 | 1137 | return i186.timer[which].maxA; |
| 1138 | 1138 | |
| 1139 | 1139 | case 0x2a: |
| 1140 | 1140 | case 0x2e: |
| 1141 | | logerror("%05X:read 80186 Timer %d max B\n", activecpu_get_pc(), (offset - 0x2a) / 4); |
| 1141 | logerror("%05X:read 80186 Timer %d max B\n", cpu_get_pc(space->cpu), (offset - 0x2a) / 4); |
| 1142 | 1142 | which = (offset - 0x2a) / 4; |
| 1143 | 1143 | return i186.timer[which].maxB; |
| 1144 | 1144 | |
| 1145 | 1145 | case 0x2b: |
| 1146 | 1146 | case 0x2f: |
| 1147 | 1147 | case 0x33: |
| 1148 | | if (LOG_PORTS) logerror("%05X:read 80186 Timer %d control\n", activecpu_get_pc(), (offset - 0x2b) / 4); |
| 1148 | if (LOG_PORTS) logerror("%05X:read 80186 Timer %d control\n", cpu_get_pc(space->cpu), (offset - 0x2b) / 4); |
| 1149 | 1149 | which = (offset - 0x2b) / 4; |
| 1150 | 1150 | return i186.timer[which].control; |
| 1151 | 1151 | |
| 1152 | 1152 | case 0x50: |
| 1153 | | if (LOG_PORTS) logerror("%05X:read 80186 upper chip select\n", activecpu_get_pc()); |
| 1153 | if (LOG_PORTS) logerror("%05X:read 80186 upper chip select\n", cpu_get_pc(space->cpu)); |
| 1154 | 1154 | return i186.mem.upper; |
| 1155 | 1155 | |
| 1156 | 1156 | case 0x51: |
| 1157 | | if (LOG_PORTS) logerror("%05X:read 80186 lower chip select\n", activecpu_get_pc()); |
| 1157 | if (LOG_PORTS) logerror("%05X:read 80186 lower chip select\n", cpu_get_pc(space->cpu)); |
| 1158 | 1158 | return i186.mem.lower; |
| 1159 | 1159 | |
| 1160 | 1160 | case 0x52: |
| 1161 | | if (LOG_PORTS) logerror("%05X:read 80186 peripheral chip select\n", activecpu_get_pc()); |
| 1161 | if (LOG_PORTS) logerror("%05X:read 80186 peripheral chip select\n", cpu_get_pc(space->cpu)); |
| 1162 | 1162 | return i186.mem.peripheral; |
| 1163 | 1163 | |
| 1164 | 1164 | case 0x53: |
| 1165 | | if (LOG_PORTS) logerror("%05X:read 80186 middle chip select\n", activecpu_get_pc()); |
| 1165 | if (LOG_PORTS) logerror("%05X:read 80186 middle chip select\n", cpu_get_pc(space->cpu)); |
| 1166 | 1166 | return i186.mem.middle; |
| 1167 | 1167 | |
| 1168 | 1168 | case 0x54: |
| 1169 | | if (LOG_PORTS) logerror("%05X:read 80186 middle P chip select\n", activecpu_get_pc()); |
| 1169 | if (LOG_PORTS) logerror("%05X:read 80186 middle P chip select\n", cpu_get_pc(space->cpu)); |
| 1170 | 1170 | return i186.mem.middle_size; |
| 1171 | 1171 | |
| 1172 | 1172 | case 0x60: |
| 1173 | 1173 | case 0x68: |
| 1174 | | if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower source address\n", activecpu_get_pc(), (offset - 0x60) / 8); |
| 1174 | if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower source address\n", cpu_get_pc(space->cpu), (offset - 0x60) / 8); |
| 1175 | 1175 | which = (offset - 0x60) / 8; |
| 1176 | 1176 | // stream_update(dma_stream, 0); |
| 1177 | 1177 | return i186.dma[which].source; |
| 1178 | 1178 | |
| 1179 | 1179 | case 0x61: |
| 1180 | 1180 | case 0x69: |
| 1181 | | if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper source address\n", activecpu_get_pc(), (offset - 0x61) / 8); |
| 1181 | if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper source address\n", cpu_get_pc(space->cpu), (offset - 0x61) / 8); |
| 1182 | 1182 | which = (offset - 0x61) / 8; |
| 1183 | 1183 | // stream_update(dma_stream, 0); |
| 1184 | 1184 | return i186.dma[which].source >> 16; |
| 1185 | 1185 | |
| 1186 | 1186 | case 0x62: |
| 1187 | 1187 | case 0x6a: |
| 1188 | | if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower dest address\n", activecpu_get_pc(), (offset - 0x62) / 8); |
| 1188 | if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower dest address\n", cpu_get_pc(space->cpu), (offset - 0x62) / 8); |
| 1189 | 1189 | which = (offset - 0x62) / 8; |
| 1190 | 1190 | // stream_update(dma_stream, 0); |
| 1191 | 1191 | return i186.dma[which].dest; |
| 1192 | 1192 | |
| 1193 | 1193 | case 0x63: |
| 1194 | 1194 | case 0x6b: |
| 1195 | | if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper dest address\n", activecpu_get_pc(), (offset - 0x63) / 8); |
| 1195 | if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper dest address\n", cpu_get_pc(space->cpu), (offset - 0x63) / 8); |
| 1196 | 1196 | which = (offset - 0x63) / 8; |
| 1197 | 1197 | // stream_update(dma_stream, 0); |
| 1198 | 1198 | return i186.dma[which].dest >> 16; |
| 1199 | 1199 | |
| 1200 | 1200 | case 0x64: |
| 1201 | 1201 | case 0x6c: |
| 1202 | | if (LOG_PORTS) logerror("%05X:read 80186 DMA%d transfer count\n", activecpu_get_pc(), (offset - 0x64) / 8); |
| 1202 | if (LOG_PORTS) logerror("%05X:read 80186 DMA%d transfer count\n", cpu_get_pc(space->cpu), (offset - 0x64) / 8); |
| 1203 | 1203 | which = (offset - 0x64) / 8; |
| 1204 | 1204 | // stream_update(dma_stream, 0); |
| 1205 | 1205 | return i186.dma[which].count; |
| 1206 | 1206 | |
| 1207 | 1207 | case 0x65: |
| 1208 | 1208 | case 0x6d: |
| 1209 | | if (LOG_PORTS) logerror("%05X:read 80186 DMA%d control\n", activecpu_get_pc(), (offset - 0x65) / 8); |
| 1209 | if (LOG_PORTS) logerror("%05X:read 80186 DMA%d control\n", cpu_get_pc(space->cpu), (offset - 0x65) / 8); |
| 1210 | 1210 | which = (offset - 0x65) / 8; |
| 1211 | 1211 | // stream_update(dma_stream, 0); |
| 1212 | 1212 | return i186.dma[which].control; |
| 1213 | 1213 | |
| 1214 | 1214 | default: |
| 1215 | | logerror("%05X:read 80186 port %02X\n", activecpu_get_pc(), offset); |
| 1215 | logerror("%05X:read 80186 port %02X\n", cpu_get_pc(space->cpu), offset); |
| 1216 | 1216 | break; |
| 1217 | 1217 | } |
| 1218 | 1218 | return 0x00; |
| r3659 | r3660 | |
| 1231 | 1231 | switch (offset) |
| 1232 | 1232 | { |
| 1233 | 1233 | case 0x11: |
| 1234 | | if (LOG_PORTS) logerror("%05X:80186 EOI = %04X\n", activecpu_get_pc(), data16); |
| 1234 | if (LOG_PORTS) logerror("%05X:80186 EOI = %04X\n", cpu_get_pc(space->cpu), data16); |
| 1235 | 1235 | handle_eoi(0x8000); |
| 1236 | 1236 | update_interrupt_state(machine); |
| 1237 | 1237 | break; |
| 1238 | 1238 | |
| 1239 | 1239 | case 0x12: |
| 1240 | | logerror("%05X:ERROR - write to 80186 interrupt poll = %04X\n", activecpu_get_pc(), data16); |
| 1240 | logerror("%05X:ERROR - write to 80186 interrupt poll = %04X\n", cpu_get_pc(space->cpu), data16); |
| 1241 | 1241 | break; |
| 1242 | 1242 | |
| 1243 | 1243 | case 0x13: |
| 1244 | | logerror("%05X:ERROR - write to 80186 interrupt poll status = %04X\n", activecpu_get_pc(), data16); |
| 1244 | logerror("%05X:ERROR - write to 80186 interrupt poll status = %04X\n", cpu_get_pc(space->cpu), data16); |
| 1245 | 1245 | break; |
| 1246 | 1246 | |
| 1247 | 1247 | case 0x14: |
| 1248 | | if (LOG_PORTS) logerror("%05X:80186 interrupt mask = %04X\n", activecpu_get_pc(), data16); |
| 1248 | if (LOG_PORTS) logerror("%05X:80186 interrupt mask = %04X\n", cpu_get_pc(space->cpu), data16); |
| 1249 | 1249 | i186.intr.timer = (i186.intr.timer & ~0x08) | ((data16 << 3) & 0x08); |
| 1250 | 1250 | i186.intr.dma[0] = (i186.intr.dma[0] & ~0x08) | ((data16 << 1) & 0x08); |
| 1251 | 1251 | i186.intr.dma[1] = (i186.intr.dma[1] & ~0x08) | ((data16 << 0) & 0x08); |
| r3659 | r3660 | |
| 1257 | 1257 | break; |
| 1258 | 1258 | |
| 1259 | 1259 | case 0x15: |
| 1260 | | if (LOG_PORTS) logerror("%05X:80186 interrupt priority mask = %04X\n", activecpu_get_pc(), data16); |
| 1260 | if (LOG_PORTS) logerror("%05X:80186 interrupt priority mask = %04X\n", cpu_get_pc(space->cpu), data16); |
| 1261 | 1261 | i186.intr.priority_mask = data16 & 0x0007; |
| 1262 | 1262 | update_interrupt_state(machine); |
| 1263 | 1263 | break; |
| 1264 | 1264 | |
| 1265 | 1265 | case 0x16: |
| 1266 | | if (LOG_PORTS) logerror("%05X:80186 interrupt in-service = %04X\n", activecpu_get_pc(), data16); |
| 1266 | if (LOG_PORTS) logerror("%05X:80186 interrupt in-service = %04X\n", cpu_get_pc(space->cpu), data16); |
| 1267 | 1267 | i186.intr.in_service = data16 & 0x00ff; |
| 1268 | 1268 | update_interrupt_state(machine); |
| 1269 | 1269 | break; |
| 1270 | 1270 | |
| 1271 | 1271 | case 0x17: |
| 1272 | | if (LOG_PORTS) logerror("%05X:80186 interrupt request = %04X\n", activecpu_get_pc(), data16); |
| 1272 | if (LOG_PORTS) logerror("%05X:80186 interrupt request = %04X\n", cpu_get_pc(space->cpu), data16); |
| 1273 | 1273 | i186.intr.request = (i186.intr.request & ~0x00c0) | (data16 & 0x00c0); |
| 1274 | 1274 | update_interrupt_state(machine); |
| 1275 | 1275 | break; |
| 1276 | 1276 | |
| 1277 | 1277 | case 0x18: |
| 1278 | | if (LOG_PORTS) logerror("%05X:WARNING - wrote to 80186 interrupt status = %04X\n", activecpu_get_pc(), data16); |
| 1278 | if (LOG_PORTS) logerror("%05X:WARNING - wrote to 80186 interrupt status = %04X\n", cpu_get_pc(space->cpu), data16); |
| 1279 | 1279 | i186.intr.status = (i186.intr.status & ~0x8007) | (data16 & 0x8007); |
| 1280 | 1280 | update_interrupt_state(machine); |
| 1281 | 1281 | break; |
| 1282 | 1282 | |
| 1283 | 1283 | case 0x19: |
| 1284 | | if (LOG_PORTS) logerror("%05X:80186 timer interrupt contol = %04X\n", activecpu_get_pc(), data16); |
| 1284 | if (LOG_PORTS) logerror("%05X:80186 timer interrupt contol = %04X\n", cpu_get_pc(space->cpu), data16); |
| 1285 | 1285 | i186.intr.timer = data16 & 0x000f; |
| 1286 | 1286 | break; |
| 1287 | 1287 | |
| 1288 | 1288 | case 0x1a: |
| 1289 | | if (LOG_PORTS) logerror("%05X:80186 DMA 0 interrupt control = %04X\n", activecpu_get_pc(), data16); |
| 1289 | if (LOG_PORTS) logerror("%05X:80186 DMA 0 interrupt control = %04X\n", cpu_get_pc(space->cpu), data16); |
| 1290 | 1290 | i186.intr.dma[0] = data16 & 0x000f; |
| 1291 | 1291 | break; |
| 1292 | 1292 | |
| 1293 | 1293 | case 0x1b: |
| 1294 | | if (LOG_PORTS) logerror("%05X:80186 DMA 1 interrupt control = %04X\n", activecpu_get_pc(), data16); |
| 1294 | if (LOG_PORTS) logerror("%05X:80186 DMA 1 interrupt control = %04X\n", cpu_get_pc(space->cpu), data16); |
| 1295 | 1295 | i186.intr.dma[1] = data16 & 0x000f; |
| 1296 | 1296 | break; |
| 1297 | 1297 | |
| 1298 | 1298 | case 0x1c: |
| 1299 | | if (LOG_PORTS) logerror("%05X:80186 INT 0 interrupt control = %04X\n", activecpu_get_pc(), data16); |
| 1299 | if (LOG_PORTS) logerror("%05X:80186 INT 0 interrupt control = %04X\n", cpu_get_pc(space->cpu), data16); |
| 1300 | 1300 | i186.intr.ext[0] = data16 & 0x007f; |
| 1301 | 1301 | break; |
| 1302 | 1302 | |
| 1303 | 1303 | case 0x1d: |
| 1304 | | if (LOG_PORTS) logerror("%05X:80186 INT 1 interrupt control = %04X\n", activecpu_get_pc(), data16); |
| 1304 | if (LOG_PORTS) logerror("%05X:80186 INT 1 interrupt control = %04X\n", cpu_get_pc(space->cpu), data16); |
| 1305 | 1305 | i186.intr.ext[1] = data16 & 0x007f; |
| 1306 | 1306 | break; |
| 1307 | 1307 | |
| 1308 | 1308 | case 0x1e: |
| 1309 | | if (LOG_PORTS) logerror("%05X:80186 INT 2 interrupt control = %04X\n", activecpu_get_pc(), data16); |
| 1309 | if (LOG_PORTS) logerror("%05X:80186 INT 2 interrupt control = %04X\n", cpu_get_pc(space->cpu), data16); |
| 1310 | 1310 | i186.intr.ext[2] = data16 & 0x001f; |
| 1311 | 1311 | break; |
| 1312 | 1312 | |
| 1313 | 1313 | case 0x1f: |
| 1314 | | if (LOG_PORTS) logerror("%05X:80186 INT 3 interrupt control = %04X\n", activecpu_get_pc(), data16); |
| 1314 | if (LOG_PORTS) logerror("%05X:80186 INT 3 interrupt control = %04X\n", cpu_get_pc(space->cpu), data16); |
| 1315 | 1315 | i186.intr.ext[3] = data16 & 0x001f; |
| 1316 | 1316 | break; |
| 1317 | 1317 | |
| 1318 | 1318 | case 0x28: |
| 1319 | 1319 | case 0x2c: |
| 1320 | 1320 | case 0x30: |
| 1321 | | if (LOG_PORTS) logerror("%05X:80186 Timer %d count = %04X\n", activecpu_get_pc(), (offset - 0x28) / 4, data16); |
| 1321 | if (LOG_PORTS) logerror("%05X:80186 Timer %d count = %04X\n", cpu_get_pc(space->cpu), (offset - 0x28) / 4, data16); |
| 1322 | 1322 | which = (offset - 0x28) / 4; |
| 1323 | 1323 | internal_timer_update(which, data16, -1, -1, -1); |
| 1324 | 1324 | break; |
| r3659 | r3660 | |
| 1326 | 1326 | case 0x29: |
| 1327 | 1327 | case 0x2d: |
| 1328 | 1328 | case 0x31: |
| 1329 | | if (LOG_PORTS) logerror("%05X:80186 Timer %d max A = %04X\n", activecpu_get_pc(), (offset - 0x29) / 4, data16); |
| 1329 | if (LOG_PORTS) logerror("%05X:80186 Timer %d max A = %04X\n", cpu_get_pc(space->cpu), (offset - 0x29) / 4, data16); |
| 1330 | 1330 | which = (offset - 0x29) / 4; |
| 1331 | 1331 | internal_timer_update(which, -1, data16, -1, -1); |
| 1332 | 1332 | break; |
| 1333 | 1333 | |
| 1334 | 1334 | case 0x2a: |
| 1335 | 1335 | case 0x2e: |
| 1336 | | if (LOG_PORTS) logerror("%05X:80186 Timer %d max B = %04X\n", activecpu_get_pc(), (offset - 0x2a) / 4, data16); |
| 1336 | if (LOG_PORTS) logerror("%05X:80186 Timer %d max B = %04X\n", cpu_get_pc(space->cpu), (offset - 0x2a) / 4, data16); |
| 1337 | 1337 | which = (offset - 0x2a) / 4; |
| 1338 | 1338 | internal_timer_update(which, -1, -1, data16, -1); |
| 1339 | 1339 | break; |
| r3659 | r3660 | |
| 1341 | 1341 | case 0x2b: |
| 1342 | 1342 | case 0x2f: |
| 1343 | 1343 | case 0x33: |
| 1344 | | if (LOG_PORTS) logerror("%05X:80186 Timer %d control = %04X\n", activecpu_get_pc(), (offset - 0x2b) / 4, data16); |
| 1344 | if (LOG_PORTS) logerror("%05X:80186 Timer %d control = %04X\n", cpu_get_pc(space->cpu), (offset - 0x2b) / 4, data16); |
| 1345 | 1345 | which = (offset - 0x2b) / 4; |
| 1346 | 1346 | internal_timer_update(which, -1, -1, -1, data16); |
| 1347 | 1347 | break; |
| 1348 | 1348 | |
| 1349 | 1349 | case 0x50: |
| 1350 | | if (LOG_PORTS) logerror("%05X:80186 upper chip select = %04X\n", activecpu_get_pc(), data16); |
| 1350 | if (LOG_PORTS) logerror("%05X:80186 upper chip select = %04X\n", cpu_get_pc(space->cpu), data16); |
| 1351 | 1351 | i186.mem.upper = data16 | 0xc038; |
| 1352 | 1352 | break; |
| 1353 | 1353 | |
| 1354 | 1354 | case 0x51: |
| 1355 | | if (LOG_PORTS) logerror("%05X:80186 lower chip select = %04X\n", activecpu_get_pc(), data16); |
| 1355 | if (LOG_PORTS) logerror("%05X:80186 lower chip select = %04X\n", cpu_get_pc(space->cpu), data16); |
| 1356 | 1356 | i186.mem.lower = (data16 & 0x3fff) | 0x0038; printf("%X",i186.mem.lower); |
| 1357 | 1357 | break; |
| 1358 | 1358 | |
| 1359 | 1359 | case 0x52: |
| 1360 | | if (LOG_PORTS) logerror("%05X:80186 peripheral chip select = %04X\n", activecpu_get_pc(), data16); |
| 1360 | if (LOG_PORTS) logerror("%05X:80186 peripheral chip select = %04X\n", cpu_get_pc(space->cpu), data16); |
| 1361 | 1361 | i186.mem.peripheral = data16 | 0x0038; |
| 1362 | 1362 | break; |
| 1363 | 1363 | |
| 1364 | 1364 | case 0x53: |
| 1365 | | if (LOG_PORTS) logerror("%05X:80186 middle chip select = %04X\n", activecpu_get_pc(), data16); |
| 1365 | if (LOG_PORTS) logerror("%05X:80186 middle chip select = %04X\n", cpu_get_pc(space->cpu), data16); |
| 1366 | 1366 | i186.mem.middle = data16 | 0x01f8; |
| 1367 | 1367 | break; |
| 1368 | 1368 | |
| 1369 | 1369 | case 0x54: |
| 1370 | | if (LOG_PORTS) logerror("%05X:80186 middle P chip select = %04X\n", activecpu_get_pc(), data16); |
| 1370 | if (LOG_PORTS) logerror("%05X:80186 middle P chip select = %04X\n", cpu_get_pc(space->cpu), data16); |
| 1371 | 1371 | i186.mem.middle_size = data16 | 0x8038; |
| 1372 | 1372 | |
| 1373 | 1373 | temp = (i186.mem.peripheral & 0xffc0) << 4; |
| r3659 | r3660 | |
| 1391 | 1391 | |
| 1392 | 1392 | case 0x60: |
| 1393 | 1393 | case 0x68: |
| 1394 | | if (LOG_PORTS) logerror("%05X:80186 DMA%d lower source address = %04X\n", activecpu_get_pc(), (offset - 0x60) / 8, data16); |
| 1394 | if (LOG_PORTS) logerror("%05X:80186 DMA%d lower source address = %04X\n", cpu_get_pc(space->cpu), (offset - 0x60) / 8, data16); |
| 1395 | 1395 | which = (offset - 0x60) / 8; |
| 1396 | 1396 | // stream_update(dma_stream, 0); |
| 1397 | 1397 | i186.dma[which].source = (i186.dma[which].source & ~0x0ffff) | (data16 & 0x0ffff); |
| r3659 | r3660 | |
| 1399 | 1399 | |
| 1400 | 1400 | case 0x61: |
| 1401 | 1401 | case 0x69: |
| 1402 | | if (LOG_PORTS) logerror("%05X:80186 DMA%d upper source address = %04X\n", activecpu_get_pc(), (offset - 0x61) / 8, data16); |
| 1402 | if (LOG_PORTS) logerror("%05X:80186 DMA%d upper source address = %04X\n", cpu_get_pc(space->cpu), (offset - 0x61) / 8, data16); |
| 1403 | 1403 | which = (offset - 0x61) / 8; |
| 1404 | 1404 | // stream_update(dma_stream, 0); |
| 1405 | 1405 | i186.dma[which].source = (i186.dma[which].source & ~0xf0000) | ((data16 << 16) & 0xf0000); |
| r3659 | r3660 | |
| 1407 | 1407 | |
| 1408 | 1408 | case 0x62: |
| 1409 | 1409 | case 0x6a: |
| 1410 | | if (LOG_PORTS) logerror("%05X:80186 DMA%d lower dest address = %04X\n", activecpu_get_pc(), (offset - 0x62) / 8, data16); |
| 1410 | if (LOG_PORTS) logerror("%05X:80186 DMA%d lower dest address = %04X\n", cpu_get_pc(space->cpu), (offset - 0x62) / 8, data16); |
| 1411 | 1411 | which = (offset - 0x62) / 8; |
| 1412 | 1412 | // stream_update(dma_stream, 0); |
| 1413 | 1413 | i186.dma[which].dest = (i186.dma[which].dest & ~0x0ffff) | (data16 & 0x0ffff); |
| r3659 | r3660 | |
| 1415 | 1415 | |
| 1416 | 1416 | case 0x63: |
| 1417 | 1417 | case 0x6b: |
| 1418 | | if (LOG_PORTS) logerror("%05X:80186 DMA%d upper dest address = %04X\n", activecpu_get_pc(), (offset - 0x63) / 8, data16); |
| 1418 | if (LOG_PORTS) logerror("%05X:80186 DMA%d upper dest address = %04X\n", cpu_get_pc(space->cpu), (offset - 0x63) / 8, data16); |
| 1419 | 1419 | which = (offset - 0x63) / 8; |
| 1420 | 1420 | // stream_update(dma_stream, 0); |
| 1421 | 1421 | i186.dma[which].dest = (i186.dma[which].dest & ~0xf0000) | ((data16 << 16) & 0xf0000); |
| r3659 | r3660 | |
| 1423 | 1423 | |
| 1424 | 1424 | case 0x64: |
| 1425 | 1425 | case 0x6c: |
| 1426 | | if (LOG_PORTS) logerror("%05X:80186 DMA%d transfer count = %04X\n", activecpu_get_pc(), (offset - 0x64) / 8, data16); |
| 1426 | if (LOG_PORTS) logerror("%05X:80186 DMA%d transfer count = %04X\n", cpu_get_pc(space->cpu), (offset - 0x64) / 8, data16); |
| 1427 | 1427 | which = (offset - 0x64) / 8; |
| 1428 | 1428 | // stream_update(dma_stream, 0); |
| 1429 | 1429 | i186.dma[which].count = data16; |
| r3659 | r3660 | |
| 1431 | 1431 | |
| 1432 | 1432 | case 0x65: |
| 1433 | 1433 | case 0x6d: |
| 1434 | | if (LOG_PORTS) logerror("%05X:80186 DMA%d control = %04X\n", activecpu_get_pc(), (offset - 0x65) / 8, data16); |
| 1434 | if (LOG_PORTS) logerror("%05X:80186 DMA%d control = %04X\n", cpu_get_pc(space->cpu), (offset - 0x65) / 8, data16); |
| 1435 | 1435 | which = (offset - 0x65) / 8; |
| 1436 | 1436 | // stream_update(dma_stream, 0); |
| 1437 | 1437 | update_dma_control(which, data16); |
| 1438 | 1438 | break; |
| 1439 | 1439 | |
| 1440 | 1440 | case 0x7f: |
| 1441 | | if (LOG_PORTS) logerror("%05X:80186 relocation register = %04X\n", activecpu_get_pc(), data16); |
| 1441 | if (LOG_PORTS) logerror("%05X:80186 relocation register = %04X\n", cpu_get_pc(space->cpu), data16); |
| 1442 | 1442 | |
| 1443 | 1443 | /* we assume here there that this doesn't happen too often */ |
| 1444 | 1444 | /* plus, we can't really remove the old memory range, so we also assume that it's */ |
| r3659 | r3660 | |
| 1459 | 1459 | break; |
| 1460 | 1460 | |
| 1461 | 1461 | default: |
| 1462 | | logerror("%05X:80186 port %02X = %04X\n", activecpu_get_pc(), offset, data16); |
| 1462 | logerror("%05X:80186 port %02X = %04X\n", cpu_get_pc(space->cpu), offset, data16); |
| 1463 | 1463 | break; |
| 1464 | 1464 | } |
| 1465 | 1465 | } |
| r3659 | r3660 | |
| 1493 | 1493 | *************************************************************/ |
| 1494 | 1494 | |
| 1495 | 1495 | static PIC8259_SET_INT_LINE( compis_pic8259_master_set_int_line ) { |
| 1496 | | cpunum_set_input_line(device->machine, 0, 0, interrupt ? HOLD_LINE : CLEAR_LINE); |
| 1496 | cpu_set_input_line(device->machine->cpu[0], 0, interrupt ? HOLD_LINE : CLEAR_LINE); |
| 1497 | 1497 | } |
| 1498 | 1498 | |
| 1499 | 1499 | |
src/mess/machine/pc8801.c
| r3659 | r3660 | |
| 123 | 123 | } |
| 124 | 124 | if (level >= 0 && level<interrupt_level_reg) |
| 125 | 125 | { |
| 126 | | cpunum_set_input_line(machine, 0, 0, HOLD_LINE); |
| 126 | cpu_set_input_line(machine->cpu[0], 0, HOLD_LINE); |
| 127 | 127 | } |
| 128 | 128 | } |
| 129 | 129 | |
| r3659 | r3660 | |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | /* extension memory */ |
| 393 | | memory_set_bankptr(1, ext_r + 0x0000); |
| 394 | | memory_set_bankptr(2, ext_r + 0x6000); |
| 393 | memory_set_bankptr(machine, 1, ext_r + 0x0000); |
| 394 | memory_set_bankptr(machine, 2, ext_r + 0x6000); |
| 395 | 395 | if(ext_w==NULL) |
| 396 | 396 | { |
| 397 | 397 | /* read only mode */ |
| r3659 | r3660 | |
| 414 | 414 | /* RAM */ |
| 415 | 415 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x0000, 0x5fff, 0, 0, SMH_BANK1); |
| 416 | 416 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x6000, 0x7fff, 0, 0, SMH_BANK2); |
| 417 | | memory_set_bankptr(1, pc8801_mainRAM + 0x0000); |
| 418 | | memory_set_bankptr(2, pc8801_mainRAM + 0x6000); |
| 417 | memory_set_bankptr(machine, 1, pc8801_mainRAM + 0x0000); |
| 418 | memory_set_bankptr(machine, 2, pc8801_mainRAM + 0x6000); |
| 419 | 419 | } |
| 420 | 420 | else |
| 421 | 421 | { |
| r3659 | r3660 | |
| 426 | 426 | if(ROMmode) |
| 427 | 427 | { |
| 428 | 428 | /* N-BASIC */ |
| 429 | | memory_set_bankptr(1, mainROM + 0x0000); |
| 430 | | memory_set_bankptr(2, mainROM + 0x6000); |
| 429 | memory_set_bankptr(machine, 1, mainROM + 0x0000); |
| 430 | memory_set_bankptr(machine, 2, mainROM + 0x6000); |
| 431 | 431 | } |
| 432 | 432 | else |
| 433 | 433 | { |
| 434 | 434 | /* N88-BASIC */ |
| 435 | | memory_set_bankptr(1, mainROM + 0x8000); |
| 435 | memory_set_bankptr(machine, 1, mainROM + 0x8000); |
| 436 | 436 | if(no4throm==1) { |
| 437 | 437 | /* 4th ROM 1 */ |
| 438 | | memory_set_bankptr(2, mainROM + 0x10000 + 0x2000 * no4throm2); |
| 438 | memory_set_bankptr(machine, 2, mainROM + 0x10000 + 0x2000 * no4throm2); |
| 439 | 439 | } else { |
| 440 | | memory_set_bankptr(2, mainROM + 0xe000); |
| 440 | memory_set_bankptr(machine, 2, mainROM + 0xe000); |
| 441 | 441 | } |
| 442 | 442 | } |
| 443 | 443 | } |
| r3659 | r3660 | |
| 447 | 447 | memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0x83ff, 0, 0, (RAMmode || ROMmode) ? SMH_BANK3 : pc8801_read_textwindow); |
| 448 | 448 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0x8000, 0x83ff, 0, 0, (RAMmode || ROMmode) ? SMH_BANK3 : pc8801_write_textwindow); |
| 449 | 449 | |
| 450 | | memory_set_bankptr(4, pc8801_mainRAM + 0x8400); |
| 450 | memory_set_bankptr(machine, 4, pc8801_mainRAM + 0x8400); |
| 451 | 451 | |
| 452 | 452 | if(is_pc8801_vram_select(machine)) |
| 453 | 453 | { |
| r3659 | r3660 | |
| 461 | 461 | memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf000, 0xffff, 0, 0, SMH_BANK6); |
| 462 | 462 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xf000, 0xffff, 0, 0, SMH_BANK6); |
| 463 | 463 | |
| 464 | | memory_set_bankptr(5, pc8801_mainRAM + 0xc000); |
| 464 | memory_set_bankptr(machine, 5, pc8801_mainRAM + 0xc000); |
| 465 | 465 | if(maptvram) |
| 466 | | memory_set_bankptr(6, pc88sr_textRAM); |
| 466 | memory_set_bankptr(machine, 6, pc88sr_textRAM); |
| 467 | 467 | else |
| 468 | | memory_set_bankptr(6, pc8801_mainRAM + 0xf000); |
| 468 | memory_set_bankptr(machine, 6, pc8801_mainRAM + 0xf000); |
| 469 | 469 | } |
| 470 | 470 | } |
| 471 | 471 | |
| r3659 | r3660 | |
| 804 | 804 | /* callback for /INT output from FDC */ |
| 805 | 805 | static void pc8801_fdc_interrupt(int state) |
| 806 | 806 | { |
| 807 | | cpunum_set_input_line(Machine, 1, 0, state ? HOLD_LINE : CLEAR_LINE); |
| 807 | cpu_set_input_line(Machine->cpu[1], 0, state ? HOLD_LINE : CLEAR_LINE); |
| 808 | 808 | } |
| 809 | 809 | |
| 810 | 810 | /* callback for /DRQ output from FDC */ |
src/mess/drivers/ex800.c
| r3659 | r3660 | |
| 188 | 188 | |
| 189 | 189 | static READ8_HANDLER(ex800_porta_r) |
| 190 | 190 | { |
| 191 | | logerror("PA R @%x\n", activecpu_get_pc()); |
| 191 | logerror("PA R @%x\n", cpu_get_pc(space->cpu)); |
| 192 | 192 | return mame_rand(machine); |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | static READ8_HANDLER(ex800_portb_r) |
| 196 | 196 | { |
| 197 | | logerror("PB R @%x\n", activecpu_get_pc()); |
| 197 | logerror("PB R @%x\n", cpu_get_pc(space->cpu)); |
| 198 | 198 | return mame_rand(machine); |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | static READ8_HANDLER(ex800_portc_r) |
| 202 | 202 | { |
| 203 | | logerror("PC R @%x\n", activecpu_get_pc()); |
| 203 | logerror("PC R @%x\n", cpu_get_pc(space->cpu)); |
| 204 | 204 | return mame_rand(machine); |
| 205 | 205 | } |
| 206 | 206 | |
| r3659 | r3660 | |
| 209 | 209 | if (PA6) logerror("BNK0 selected.\n"); |
| 210 | 210 | if (PA7) logerror("BNK1 selected.\n"); |
| 211 | 211 | |
| 212 | | logerror("PA W %x @%x\n", data, activecpu_get_pc()); |
| 212 | logerror("PA W %x @%x\n", data, cpu_get_pc(space->cpu)); |
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | static WRITE8_HANDLER(ex800_portb_w) |
| 216 | 216 | { |
| 217 | 217 | if (data & 3) |
| 218 | | logerror("PB0/1 Line feed @%x\n", activecpu_get_pc()); |
| 218 | logerror("PB0/1 Line feed @%x\n", cpu_get_pc(space->cpu)); |
| 219 | 219 | if (!(data & 4)) |
| 220 | | logerror("PB2 Line feed @%x\n", activecpu_get_pc()); |
| 220 | logerror("PB2 Line feed @%x\n", cpu_get_pc(space->cpu)); |
| 221 | 221 | if (data & 8) |
| 222 | | logerror("PB3 Online LED on @%x\n", activecpu_get_pc()); |
| 222 | logerror("PB3 Online LED on @%x\n", cpu_get_pc(space->cpu)); |
| 223 | 223 | else |
| 224 | | logerror("PB3 Online LED off @%x\n", activecpu_get_pc()); |
| 224 | logerror("PB3 Online LED off @%x\n", cpu_get_pc(space->cpu)); |
| 225 | 225 | if (data & 16) |
| 226 | | logerror("PB4 Serial @%x\n", activecpu_get_pc()); |
| 226 | logerror("PB4 Serial @%x\n", cpu_get_pc(space->cpu)); |
| 227 | 227 | if (data & 32) |
| 228 | | logerror("PB4 Serial @%x\n", activecpu_get_pc()); |
| 228 | logerror("PB4 Serial @%x\n", cpu_get_pc(space->cpu)); |
| 229 | 229 | if (data & 64) |
| 230 | | logerror("PB4 Serial @%x\n", activecpu_get_pc()); |
| 230 | logerror("PB4 Serial @%x\n", cpu_get_pc(space->cpu)); |
| 231 | 231 | if (data & 128) |
| 232 | | logerror("PB3 Paper empty LED on @%x\n", activecpu_get_pc()); |
| 232 | logerror("PB3 Paper empty LED on @%x\n", cpu_get_pc(space->cpu)); |
| 233 | 233 | else |
| 234 | | logerror("PB3 Paper empty LED off @%x\n", activecpu_get_pc()); |
| 234 | logerror("PB3 Paper empty LED off @%x\n", cpu_get_pc(space->cpu)); |
| 235 | 235 | |
| 236 | | // logerror("PB W %x @%x\n", data, activecpu_get_pc()); |
| 236 | // logerror("PB W %x @%x\n", data, cpu_get_pc(space->cpu)); |
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | static WRITE8_HANDLER(ex800_portc_w) |
| r3659 | r3660 | |
| 243 | 243 | else |
| 244 | 244 | beep_set_state(0, 1); |
| 245 | 245 | |
| 246 | | logerror("PC W %x @%x\n", data, activecpu_get_pc()); |
| 246 | logerror("PC W %x @%x\n", data, cpu_get_pc(space->cpu)); |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | |
| r3659 | r3660 | |
| 251 | 251 | |
| 252 | 252 | static READ8_HANDLER(ex800_devsel_r) |
| 253 | 253 | { |
| 254 | | logerror("DEVSEL R @%x with offset %x\n", activecpu_get_pc(), offset); |
| 254 | logerror("DEVSEL R @%x with offset %x\n", cpu_get_pc(space->cpu), offset); |
| 255 | 255 | return mame_rand(machine); |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | static WRITE8_HANDLER(ex800_devsel_w) |
| 259 | 259 | { |
| 260 | | logerror("DEVSEL W %x @%x with offset %x\n", data, activecpu_get_pc(), offset); |
| 260 | logerror("DEVSEL W %x @%x with offset %x\n", data, cpu_get_pc(space->cpu), offset); |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | static READ8_HANDLER(ex800_gate5a_r) |
| 264 | 264 | { |
| 265 | | logerror("GATE5A R @%x with offset %x\n", activecpu_get_pc(), offset); |
| 265 | logerror("GATE5A R @%x with offset %x\n", cpu_get_pc(space->cpu), offset); |
| 266 | 266 | return mame_rand(machine); |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | static WRITE8_HANDLER(ex800_gate5a_w) |
| 270 | 270 | { |
| 271 | | logerror("GATE5A W %x @%x with offset %x\n", data, activecpu_get_pc(), offset); |
| 271 | logerror("GATE5A W %x @%x with offset %x\n", data, cpu_get_pc(space->cpu), offset); |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | static READ8_HANDLER(ex800_iosel_r) |
| 275 | 275 | { |
| 276 | | logerror("IOSEL R @%x with offset %x\n", activecpu_get_pc(), offset); |
| 276 | logerror("IOSEL R @%x with offset %x\n", cpu_get_pc(space->cpu), offset); |
| 277 | 277 | return mame_rand(machine); |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | 280 | static WRITE8_HANDLER(ex800_iosel_w) |
| 281 | 281 | { |
| 282 | | logerror("IOSEL W %x @%x with offset %x\n", data, activecpu_get_pc(), offset); |
| 282 | logerror("IOSEL W %x @%x with offset %x\n", data, cpu_get_pc(space->cpu), offset); |
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | static READ8_HANDLER(ex800_gate7a_r) |
| 286 | 286 | { |
| 287 | | logerror("GATE7A R @%x with offset %x\n", activecpu_get_pc(), offset); |
| 287 | logerror("GATE7A R @%x with offset %x\n", cpu_get_pc(space->cpu), offset); |
| 288 | 288 | return mame_rand(machine); |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | static WRITE8_HANDLER(ex800_gate7a_w) |
| 292 | 292 | { |
| 293 | | logerror("GATE7A W %x @%x with offset %x\n", data, activecpu_get_pc(), offset); |
| 293 | logerror("GATE7A W %x @%x with offset %x\n", data, cpu_get_pc(space->cpu), offset); |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | |
src/mess/drivers/saturn.c
| r3659 | r3660 | |
| 245 | 245 | #if 0 |
| 246 | 246 | /*A-Bus IRQ checks,where they could be located these?*/ |
| 247 | 247 | #define ABUSIRQ(_irq_,_vector_,_mask_) \ |
| 248 | | if(!(stv_scu[40] & _mask_)) { cpunum_set_input_line_and_vector(Machine, 0, _irq_, HOLD_LINE , _vector_); } |
| 248 | if(!(stv_scu[40] & _mask_)) { cpu_set_input_line_and_vector(Machine->cpu[0], _irq_, HOLD_LINE , _vector_); } |
| 249 | 249 | |
| 250 | 250 | if(stv_scu[42] & 1)//IRQ ACK |
| 251 | 251 | { |
| r3659 | r3660 | |
| 541 | 541 | |
| 542 | 542 | if (offset == 0x33) return_data = saturn_region; |
| 543 | 543 | |
| 544 | | if (LOG_SMPC) logerror ("cpu #%d (PC=%08X) SMPC: Read from Byte Offset %02x (%d) Returns %02x\n", cpu_getactivecpu(), activecpu_get_pc(), offset, offset>>1, return_data); |
| 544 | if (LOG_SMPC) logerror ("cpu #%d (PC=%08X) SMPC: Read from Byte Offset %02x (%d) Returns %02x\n", cpu_getactivecpu(), cpu_get_pc(space->cpu), offset, offset>>1, return_data); |
| 545 | 545 | |
| 546 | 546 | |
| 547 | 547 | return return_data; |
| r3659 | r3660 | |
| 569 | 569 | intback_stage = 2; |
| 570 | 570 | } |
| 571 | 571 | smpc_intbackhelper(machine); |
| 572 | | cpunum_set_input_line_and_vector(machine, 0, 8, HOLD_LINE , 0x47); |
| 572 | cpu_set_input_line_and_vector(machine->cpu[0], 8, HOLD_LINE , 0x47); |
| 573 | 573 | } |
| 574 | 574 | |
| 575 | 575 | if ((offset == 1) && (data & 0x40)) |
| r3659 | r3660 | |
| 612 | 612 | if(!(stv_scu[40] & 0x0100)) /*Pad irq*/ |
| 613 | 613 | { |
| 614 | 614 | if(LOG_SMPC) logerror ("Interrupt: PAD irq at scanline %04x, Vector 0x48 Level 0x08\n",scanline); |
| 615 | | cpunum_set_input_line_and_vector(machine, 0, 8, HOLD_LINE , 0x48); |
| 615 | cpu_set_input_line_and_vector(machine->cpu[0], 8, HOLD_LINE , 0x48); |
| 616 | 616 | } |
| 617 | 617 | } |
| 618 | 618 | |
| r3659 | r3660 | |
| 629 | 629 | if(LOG_SMPC) logerror ("SMPC: Slave ON\n"); |
| 630 | 630 | smpc_ram[0x5f]=0x02; |
| 631 | 631 | stv_enable_slave_sh2 = 1; |
| 632 | | cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, CLEAR_LINE); |
| 632 | cpu_set_input_line(machine->cpu[1], INPUT_LINE_RESET, CLEAR_LINE); |
| 633 | 633 | break; |
| 634 | 634 | case 0x03: |
| 635 | 635 | if(LOG_SMPC) logerror ("SMPC: Slave OFF\n"); |
| 636 | 636 | smpc_ram[0x5f]=0x03; |
| 637 | 637 | stv_enable_slave_sh2 = 0; |
| 638 | 638 | cpu_trigger(machine, 1000); |
| 639 | | cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, ASSERT_LINE); |
| 639 | cpu_set_input_line(machine->cpu[1], INPUT_LINE_RESET, ASSERT_LINE); |
| 640 | 640 | break; |
| 641 | 641 | case 0x06: |
| 642 | 642 | if(LOG_SMPC) logerror ("SMPC: Sound ON\n"); |
| r3659 | r3660 | |
| 657 | 657 | case 0x0d: |
| 658 | 658 | if(LOG_SMPC) logerror ("SMPC: System Reset\n"); |
| 659 | 659 | smpc_ram[0x5f]=0x0d; |
| 660 | | cpunum_set_input_line(machine, 0, INPUT_LINE_RESET, PULSE_LINE); |
| 660 | cpu_set_input_line(machine->cpu[0], INPUT_LINE_RESET, PULSE_LINE); |
| 661 | 661 | system_reset(); |
| 662 | 662 | break; |
| 663 | 663 | case 0x0e: |
| r3659 | r3660 | |
| 666 | 666 | cpunum_set_clock(machine, 0, MASTER_CLOCK_352/2); |
| 667 | 667 | cpunum_set_clock(machine, 1, MASTER_CLOCK_352/2); |
| 668 | 668 | cpunum_set_clock(machine, 2, MASTER_CLOCK_352/5); |
| 669 | | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); // ff said this causes nmi, should we set a timer then nmi? |
| 669 | cpu_set_input_line(machine->cpu[0], INPUT_LINE_NMI, PULSE_LINE); // ff said this causes nmi, should we set a timer then nmi? |
| 670 | 670 | break; |
| 671 | 671 | case 0x0f: |
| 672 | 672 | if(LOG_SMPC) logerror ("SMPC: Change Clock to 320\n"); |
| r3659 | r3660 | |
| 674 | 674 | cpunum_set_clock(machine, 0, MASTER_CLOCK_320/2); |
| 675 | 675 | cpunum_set_clock(machine, 1, MASTER_CLOCK_320/2); |
| 676 | 676 | cpunum_set_clock(machine, 2, MASTER_CLOCK_320/5); |
| 677 | | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); // ff said this causes nmi, should we set a timer then nmi? |
| 677 | cpu_set_input_line(machine->cpu[0], INPUT_LINE_NMI, PULSE_LINE); // ff said this causes nmi, should we set a timer then nmi? |
| 678 | 678 | break; |
| 679 | 679 | /*"Interrupt Back"*/ |
| 680 | 680 | case 0x10: |
| r3659 | r3660 | |
| 726 | 726 | { |
| 727 | 727 | // if(LOG_SMPC) logerror ("Interrupt: System Manager (SMPC) at scanline %04x, Vector 0x47 Level 0x08\n",scanline); |
| 728 | 728 | smpc_intbackhelper(machine); |
| 729 | | cpunum_set_input_line_and_vector(machine, 0, 8, HOLD_LINE , 0x47); |
| 729 | cpu_set_input_line_and_vector(machine->cpu[0], 8, HOLD_LINE , 0x47); |
| 730 | 730 | } |
| 731 | 731 | break; |
| 732 | 732 | /* RTC write*/ |
| r3659 | r3660 | |
| 755 | 755 | if(LOG_SMPC) logerror ("SMPC: NMI request\n"); |
| 756 | 756 | smpc_ram[0x5f]=0x18; |
| 757 | 757 | /*NMI is unconditionally requested?*/ |
| 758 | | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); |
| 758 | cpu_set_input_line(machine->cpu[0], INPUT_LINE_NMI, PULSE_LINE); |
| 759 | 759 | break; |
| 760 | 760 | case 0x19: |
| 761 | 761 | if(LOG_SMPC) logerror ("SMPC: NMI Enable\n"); |
| r3659 | r3660 | |
| 771 | 771 | |
| 772 | 772 | break; |
| 773 | 773 | default: |
| 774 | | if(LOG_SMPC) logerror ("cpu #%d (PC=%08X) SMPC: undocumented Command %02x\n", cpu_getactivecpu(), activecpu_get_pc(), data); |
| 774 | if(LOG_SMPC) logerror ("cpu #%d (PC=%08X) SMPC: undocumented Command %02x\n", cpu_getactivecpu(), cpu_get_pc(space->cpu), data); |
| 775 | 775 | } |
| 776 | 776 | |
| 777 | 777 | // we've processed the command, clear status flag |
| r3659 | r3660 | |
| 850 | 850 | if(!(stv_scu[40] & 2))/*VBLANK-OUT*/ |
| 851 | 851 | { |
| 852 | 852 | if(LOG_IRQ) logerror ("Interrupt: VBlank-OUT at scanline %04x, Vector 0x41 Level 0x0e\n",scanline); |
| 853 | | cpunum_set_input_line_and_vector(machine, 0, 0xe, HOLD_LINE , 0x41); |
| 853 | cpu_set_input_line_and_vector(machine->cpu[0], 0xe, HOLD_LINE , 0x41); |
| 854 | 854 | } |
| 855 | 855 | stv_vblank = 0; |
| 856 | 856 | } |
| r3659 | r3660 | |
| 866 | 866 | if((!(stv_scu[40] & 0x10)) && (!(stv_scu[38] & 0x80))) |
| 867 | 867 | { |
| 868 | 868 | if(LOG_IRQ) logerror ("Interrupt: Timer 1 at scanline %04x, Vector 0x44 Level 0x0b\n",scanline); |
| 869 | | cpunum_set_input_line_and_vector(machine, 0, 0xb, HOLD_LINE, 0x44 ); |
| 869 | cpu_set_input_line_and_vector(machine->cpu[0], 0xb, HOLD_LINE, 0x44 ); |
| 870 | 870 | } |
| 871 | 871 | else if((!(stv_scu[40] & 0x10)) && (stv_scu[38] & 0x80)) |
| 872 | 872 | { |
| 873 | 873 | if(timer_1 == (stv_scu[36] & 0x1ff)) |
| 874 | 874 | { |
| 875 | 875 | if(LOG_IRQ) logerror ("Interrupt: Timer 1 at scanline %04x, Vector 0x44 Level 0x0b\n",scanline); |
| 876 | | cpunum_set_input_line_and_vector(machine, 0, 0xb, HOLD_LINE, 0x44 ); |
| 876 | cpu_set_input_line_and_vector(machine->cpu[0], 0xb, HOLD_LINE, 0x44 ); |
| 877 | 877 | } |
| 878 | 878 | } |
| 879 | 879 | } |
| r3659 | r3660 | |
| 882 | 882 | if(!(stv_scu[40] & 8))/*Timer 0*/ |
| 883 | 883 | { |
| 884 | 884 | if(LOG_IRQ) logerror ("Interrupt: Timer 0 at scanline %04x, Vector 0x43 Level 0x0c\n",scanline); |
| 885 | | cpunum_set_input_line_and_vector(machine, 0, 0xc, HOLD_LINE, 0x43 ); |
| 885 | cpu_set_input_line_and_vector(machine->cpu[0], 0xc, HOLD_LINE, 0x43 ); |
| 886 | 886 | } |
| 887 | 887 | } |
| 888 | 888 | |
| r3659 | r3660 | |
| 890 | 890 | if(!(stv_scu[40] & 4))/*HBLANK-IN*/ |
| 891 | 891 | { |
| 892 | 892 | if(LOG_IRQ) logerror ("Interrupt: HBlank-In at scanline %04x, Vector 0x42 Level 0x0d\n",scanline); |
| 893 | | cpunum_set_input_line_and_vector(machine, 0, 0xd, HOLD_LINE , 0x42); |
| 893 | cpu_set_input_line_and_vector(machine->cpu[0], 0xd, HOLD_LINE , 0x42); |
| 894 | 894 | } |
| 895 | 895 | } |
| 896 | 896 | else if(scanline == 224) |
| r3659 | r3660 | |
| 901 | 901 | if(!(stv_scu[40] & 1))/*VBLANK-IN*/ |
| 902 | 902 | { |
| 903 | 903 | if(LOG_IRQ) logerror ("Interrupt: VBlank IN at scanline %04x, Vector 0x40 Level 0x0f\n",scanline); |
| 904 | | cpunum_set_input_line_and_vector(machine, 0, 0xf, HOLD_LINE , 0x40); |
| 904 | cpu_set_input_line_and_vector(machine->cpu[0], 0xf, HOLD_LINE , 0x40); |
| 905 | 905 | } |
| 906 | 906 | stv_vblank = 1; |
| 907 | 907 | |
| r3659 | r3660 | |
| 910 | 910 | if(!(stv_scu[40] & 8))/*Timer 0*/ |
| 911 | 911 | { |
| 912 | 912 | if(LOG_IRQ) logerror ("Interrupt: Timer 0 at scanline %04x, Vector 0x43 Level 0x0c\n",scanline); |
| 913 | | cpunum_set_input_line_and_vector(machine, 0, 0xc, HOLD_LINE, 0x43 ); |
| 913 | cpu_set_input_line_and_vector(machine->cpu[0], 0xc, HOLD_LINE, 0x43 ); |
| 914 | 914 | } |
| 915 | 915 | } |
| 916 | 916 | if(!(stv_scu[40] & 0x2000)) /*Sprite draw end irq*/ |
| 917 | | cpunum_set_input_line_and_vector(machine, 0, 2, HOLD_LINE , 0x4d); |
| 917 | cpu_set_input_line_and_vector(machine->cpu[0], 2, HOLD_LINE , 0x4d); |
| 918 | 918 | } |
| 919 | 919 | } |
| 920 | 920 | |
| r3659 | r3660 | |
| 1061 | 1061 | |
| 1062 | 1062 | if (offset == 31) |
| 1063 | 1063 | { |
| 1064 | | if(LOG_SCU) logerror("(PC=%08x) DMA status reg read\n",activecpu_get_pc()); |
| 1064 | if(LOG_SCU) logerror("(PC=%08x) DMA status reg read\n",cpu_get_pc(space->cpu)); |
| 1065 | 1065 | return stv_scu[offset]; |
| 1066 | 1066 | } |
| 1067 | 1067 | else if ( offset == 35 ) |
| r3659 | r3660 | |
| 1071 | 1071 | } |
| 1072 | 1072 | else if( offset == 41) |
| 1073 | 1073 | { |
| 1074 | | logerror("(PC=%08x) IRQ status reg read\n",activecpu_get_pc()); |
| 1074 | logerror("(PC=%08x) IRQ status reg read\n",cpu_get_pc(space->cpu)); |
| 1075 | 1075 | /*TODO:for now we're activating everything here,but we need to return the proper active irqs*/ |
| 1076 | 1076 | return 0xffffffff; |
| 1077 | 1077 | } |
| 1078 | 1078 | else if( offset == 50 ) |
| 1079 | 1079 | { |
| 1080 | | logerror("(PC=%08x) SCU version reg read\n",activecpu_get_pc()); |
| 1080 | logerror("(PC=%08x) SCU version reg read\n",cpu_get_pc(space->cpu)); |
| 1081 | 1081 | return 0x00000000;/*SCU Version 0*/ |
| 1082 | 1082 | } |
| 1083 | 1083 | else |
| 1084 | 1084 | { |
| 1085 | | if(LOG_SCU) logerror("(PC=%08x) SCU reg read at %d = %08x\n",activecpu_get_pc(),offset,stv_scu[offset]); |
| 1085 | if(LOG_SCU) logerror("(PC=%08x) SCU reg read at %d = %08x\n",cpu_get_pc(space->cpu),offset,stv_scu[offset]); |
| 1086 | 1086 | return stv_scu[offset]; |
| 1087 | 1087 | } |
| 1088 | 1088 | } |
| r3659 | r3660 | |
| 1137 | 1137 | /*Sound IRQ*/ |
| 1138 | 1138 | if(/*(!(stv_scu[40] & 0x40)) &&*/ scsp_to_main_irq == 1) |
| 1139 | 1139 | { |
| 1140 | | //cpunum_set_input_line_and_vector(machine, 0, 9, HOLD_LINE , 0x46); |
| 1140 | //cpu_set_input_line_and_vector(machine->cpu[0], 9, HOLD_LINE , 0x46); |
| 1141 | 1141 | logerror("SCSP: Main CPU interrupt\n"); |
| 1142 | 1142 | #if 0 |
| 1143 | 1143 | if((scu_dst_0 & 0x7ffffff) != 0x05a00000) |
| 1144 | 1144 | { |
| 1145 | 1145 | if(!(stv_scu[40] & 0x1000)) |
| 1146 | 1146 | { |
| 1147 | | cpunum_set_input_line_and_vector(machine, 0, 3, HOLD_LINE, 0x4c); |
| 1147 | cpu_set_input_line_and_vector(machine->cpu[0], 3, HOLD_LINE, 0x4c); |
| 1148 | 1148 | logerror("SCU: Illegal DMA interrupt\n"); |
| 1149 | 1149 | } |
| 1150 | 1150 | } |
| r3659 | r3660 | |
| 1198 | 1198 | /*Sound IRQ*/ |
| 1199 | 1199 | if(/*(!(stv_scu[40] & 0x40)) &&*/ scsp_to_main_irq == 1) |
| 1200 | 1200 | { |
| 1201 | | //cpunum_set_input_line_and_vector(machine, 0, 9, HOLD_LINE , 0x46); |
| 1201 | //cpu_set_input_line_and_vector(machine->cpu[0], 9, HOLD_LINE , 0x46); |
| 1202 | 1202 | logerror("SCSP: Main CPU interrupt\n"); |
| 1203 | 1203 | } |
| 1204 | 1204 | } |
| r3659 | r3660 | |
| 1248 | 1248 | /*Sound IRQ*/ |
| 1249 | 1249 | if(/*(!(stv_scu[40] & 0x40)) &&*/ scsp_to_main_irq == 1) |
| 1250 | 1250 | { |
| 1251 | | //cpunum_set_input_line_and_vector(machine, 0, 9, HOLD_LINE , 0x46); |
| 1251 | //cpu_set_input_line_and_vector(machine->cpu[0], 9, HOLD_LINE , 0x46); |
| 1252 | 1252 | logerror("SCSP: Main CPU interrupt\n"); |
| 1253 | 1253 | } |
| 1254 | 1254 | } |
| r3659 | r3660 | |
| 1299 | 1299 | stv_scu[40] != 0xffffffff) |
| 1300 | 1300 | { |
| 1301 | 1301 | if(LOG_SCU) logerror("cpu #%d (PC=%08X) IRQ mask reg set %08x = %d%d%d%d|%d%d%d%d|%d%d%d%d|%d%d%d%d\n", |
| 1302 | | cpu_getactivecpu(), activecpu_get_pc(), |
| 1302 | cpu_getactivecpu(), cpu_get_pc(space->cpu), |
| 1303 | 1303 | stv_scu[offset], |
| 1304 | 1304 | stv_scu[offset] & 0x8000 ? 1 : 0, /*A-Bus irq*/ |
| 1305 | 1305 | stv_scu[offset] & 0x4000 ? 1 : 0, /*<reserved>*/ |
| r3659 | r3660 | |
| 1427 | 1427 | |
| 1428 | 1428 | if(LOG_SCU) logerror("DMA transfer END\n"); |
| 1429 | 1429 | if(!(stv_scu[40] & 0x800))/*Lv 0 DMA end irq*/ |
| 1430 | | cpunum_set_input_line_and_vector(machine, 0, 5, HOLD_LINE , 0x4b); |
| 1430 | cpu_set_input_line_and_vector(machine->cpu[0], 5, HOLD_LINE , 0x4b); |
| 1431 | 1431 | |
| 1432 | 1432 | if(scu_add_tmp & 0x80000000) |
| 1433 | 1433 | { |
| r3659 | r3660 | |
| 1530 | 1530 | |
| 1531 | 1531 | if(LOG_SCU) logerror("DMA transfer END\n"); |
| 1532 | 1532 | if(!(stv_scu[40] & 0x400))/*Lv 1 DMA end irq*/ |
| 1533 | | cpunum_set_input_line_and_vector(machine, 0, 6, HOLD_LINE , 0x4a); |
| 1533 | cpu_set_input_line_and_vector(machine->cpu[0], 6, HOLD_LINE , 0x4a); |
| 1534 | 1534 | |
| 1535 | 1535 | if(scu_add_tmp & 0x80000000) |
| 1536 | 1536 | { |
| r3659 | r3660 | |
| 1633 | 1633 | |
| 1634 | 1634 | if(LOG_SCU) logerror("DMA transfer END\n"); |
| 1635 | 1635 | if(!(stv_scu[40] & 0x200))/*Lv 2 DMA end irq*/ |
| 1636 | | cpunum_set_input_line_and_vector(machine, 0, 6, HOLD_LINE , 0x49); |
| 1636 | cpu_set_input_line_and_vector(machine->cpu[0], 6, HOLD_LINE , 0x49); |
| 1637 | 1637 | |
| 1638 | 1638 | if(scu_add_tmp & 0x80000000) |
| 1639 | 1639 | { |
| r3659 | r3660 | |
| 1711 | 1711 | }while(job_done == 0); |
| 1712 | 1712 | |
| 1713 | 1713 | if(!(stv_scu[40] & 0x800))/*Lv 0 DMA end irq*/ |
| 1714 | | cpunum_set_input_line_and_vector(machine, 0, 5, HOLD_LINE , 0x4b); |
| 1714 | cpu_set_input_line_and_vector(machine->cpu[0], 5, HOLD_LINE , 0x4b); |
| 1715 | 1715 | |
| 1716 | 1716 | D0MV_0; |
| 1717 | 1717 | } |
| r3659 | r3660 | |
| 1783 | 1783 | }while(job_done == 0); |
| 1784 | 1784 | |
| 1785 | 1785 | if(!(stv_scu[40] & 0x400))/*Lv 1 DMA end irq*/ |
| 1786 | | cpunum_set_input_line_and_vector(machine, 0, 6, HOLD_LINE , 0x4a); |
| 1786 | cpu_set_input_line_and_vector(machine->cpu[0], 6, HOLD_LINE , 0x4a); |
| 1787 | 1787 | |
| 1788 | 1788 | D1MV_0; |
| 1789 | 1789 | } |
| r3659 | r3660 | |
| 1854 | 1854 | }while(job_done == 0); |
| 1855 | 1855 | |
| 1856 | 1856 | if(!(stv_scu[40] & 0x200))/*Lv 2 DMA end irq*/ |
| 1857 | | cpunum_set_input_line_and_vector(machine, 0, 6, HOLD_LINE , 0x49); |
| 1857 | cpu_set_input_line_and_vector(machine->cpu[0], 6, HOLD_LINE , 0x49); |
| 1858 | 1858 | |
| 1859 | 1859 | D2MV_0; |
| 1860 | 1860 | } |
| r3659 | r3660 | |
| 1892 | 1892 | * Enter into Radiant Silver Gun specific menu for a test... */ |
| 1893 | 1893 | static WRITE32_HANDLER( minit_w ) |
| 1894 | 1894 | { |
| 1895 | | logerror("cpu #%d (PC=%08X) MINIT write = %08x\n",cpu_getactivecpu(), activecpu_get_pc(),data); |
| 1895 | logerror("cpu #%d (PC=%08X) MINIT write = %08x\n",cpu_getactivecpu(), cpu_get_pc(space->cpu),data); |
| 1896 | 1896 | cpu_boost_interleave(machine, minit_boost_timeslice, ATTOTIME_IN_USEC(minit_boost)); |
| 1897 | 1897 | cpu_trigger(machine, 1000); |
| 1898 | 1898 | cpunum_set_info_int(1, CPUINFO_INT_SH2_FRT_INPUT, PULSE_LINE); |
| r3659 | r3660 | |
| 1900 | 1900 | |
| 1901 | 1901 | static WRITE32_HANDLER( sinit_w ) |
| 1902 | 1902 | { |
| 1903 | | logerror("cpu #%d (PC=%08X) SINIT write = %08x\n",cpu_getactivecpu(), activecpu_get_pc(),data); |
| 1903 | logerror("cpu #%d (PC=%08X) SINIT write = %08x\n",cpu_getactivecpu(), cpu_get_pc(space->cpu),data); |
| 1904 | 1904 | cpu_boost_interleave(machine, sinit_boost_timeslice, ATTOTIME_IN_USEC(sinit_boost)); |
| 1905 | 1905 | cpunum_set_info_int(0, CPUINFO_INT_SH2_FRT_INPUT, PULSE_LINE); |
| 1906 | 1906 | } |
| r3659 | r3660 | |
| 2162 | 2162 | static MACHINE_RESET( saturn ) |
| 2163 | 2163 | { |
| 2164 | 2164 | // don't let the slave cpu and the 68k go anywhere |
| 2165 | | cpunum_set_input_line(machine, 1, INPUT_LINE_RESET, ASSERT_LINE); |
| 2165 | cpu_set_input_line(machine->cpu[1], INPUT_LINE_RESET, ASSERT_LINE); |
| 2166 | 2166 | stv_enable_slave_sh2 = 0; |
| 2167 | 2167 | cpunum_set_input_line(machine, 2, INPUT_LINE_RESET, ASSERT_LINE); |
| 2168 | 2168 | |