src/mess/machine/lynx.c
| r3646 | r3647 | |
| 1364 | 1364 | { |
| 1365 | 1365 | if ( ( lynx_timer[which].cntrl1 & 0x80 ) && ( which != 4 ) ) { // irq flag handling later |
| 1366 | 1366 | mikey.data[0x81] |= ( 1 << which ); |
| 1367 | | cpunum_set_input_line(machine, 0, M65SC02_IRQ_LINE, ASSERT_LINE); |
| 1367 | cpu_set_input_line(machine->cpu[0], M65SC02_IRQ_LINE, ASSERT_LINE); |
| 1368 | 1368 | } |
| 1369 | 1369 | switch ( which ) { |
| 1370 | 1370 | case 0: |
| r3646 | r3647 | |
| 1545 | 1545 | if (uart.serctl & 0x80) |
| 1546 | 1546 | { |
| 1547 | 1547 | mikey.data[0x81] |= 0x10; |
| 1548 | | cpunum_set_input_line(machine, 0, M65SC02_IRQ_LINE, ASSERT_LINE); |
| 1548 | cpu_set_input_line(machine->cpu[0], M65SC02_IRQ_LINE, ASSERT_LINE); |
| 1549 | 1549 | } |
| 1550 | 1550 | } |
| 1551 | 1551 | |
| r3646 | r3647 | |
| 1701 | 1701 | mikey.data[0x81] &= ~data; // clear interrupt source |
| 1702 | 1702 | logerror("mikey write %.2x %.2x\n", offset, data); |
| 1703 | 1703 | if (!mikey.data[0x81]) |
| 1704 | | cpunum_set_input_line(machine, 0, M65SC02_IRQ_LINE, CLEAR_LINE); |
| 1704 | cpu_set_input_line(machine->cpu[0], M65SC02_IRQ_LINE, CLEAR_LINE); |
| 1705 | 1705 | break; |
| 1706 | 1706 | |
| 1707 | 1707 | /* Is this correct? */ |
| r3646 | r3647 | |
| 1794 | 1794 | memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xfd00, 0xfdff, 0, 0, (data & 2) ? SMH_BANK2 : mikey_write); |
| 1795 | 1795 | |
| 1796 | 1796 | if (data & 1) |
| 1797 | | memory_set_bankptr(1, lynx_mem_fc00); |
| 1797 | memory_set_bankptr(machine, 1, lynx_mem_fc00); |
| 1798 | 1798 | if (data & 2) |
| 1799 | | memory_set_bankptr(2, lynx_mem_fd00); |
| 1800 | | memory_set_bank(3, (data & 4) ? 1 : 0); |
| 1801 | | memory_set_bank(4, (data & 8) ? 1 : 0); |
| 1799 | memory_set_bankptr(machine, 2, lynx_mem_fd00); |
| 1800 | memory_set_bank(machine, 3, (data & 4) ? 1 : 0); |
| 1801 | memory_set_bank(machine, 4, (data & 8) ? 1 : 0); |
| 1802 | 1802 | } |
| 1803 | 1803 | |
| 1804 | 1804 | static void lynx_reset(running_machine *machine) |
| r3646 | r3647 | |
| 1806 | 1806 | int i; |
| 1807 | 1807 | lynx_memory_config_w(machine, 0, 0); |
| 1808 | 1808 | |
| 1809 | | cpunum_set_input_line(machine, 0, M65SC02_IRQ_LINE, CLEAR_LINE); |
| 1809 | cpu_set_input_line(machine->cpu[0], M65SC02_IRQ_LINE, CLEAR_LINE); |
| 1810 | 1810 | |
| 1811 | 1811 | memset(&suzy, 0, sizeof(suzy)); |
| 1812 | 1812 | memset(&mikey, 0, sizeof(mikey)); |
| r3646 | r3647 | |
| 1849 | 1849 | state_save_register_global_pointer(lynx_mem_fe00, lynx_mem_fe00_size); |
| 1850 | 1850 | state_save_register_postload(machine, lynx_postload, NULL); |
| 1851 | 1851 | |
| 1852 | | memory_configure_bank(3, 0, 1, memory_region(machine, "main") + 0x0000, 0); |
| 1853 | | memory_configure_bank(3, 1, 1, lynx_mem_fe00, 0); |
| 1854 | | memory_configure_bank(4, 0, 1, memory_region(machine, "main") + 0x01fa, 0); |
| 1855 | | memory_configure_bank(4, 1, 1, lynx_mem_fffa, 0); |
| 1852 | memory_configure_bank(machine, 3, 0, 1, memory_region(machine, "main") + 0x0000, 0); |
| 1853 | memory_configure_bank(machine, 3, 1, 1, lynx_mem_fe00, 0); |
| 1854 | memory_configure_bank(machine, 4, 0, 1, memory_region(machine, "main") + 0x01fa, 0); |
| 1855 | memory_configure_bank(machine, 4, 1, 1, lynx_mem_fffa, 0); |
| 1856 | 1856 | |
| 1857 | 1857 | memset(&suzy, 0, sizeof(suzy)); |
| 1858 | 1858 | |
src/mess/machine/mtx.c
| r3646 | r3647 | |
| 63 | 63 | |
| 64 | 64 | INTERRUPT_GEN( mtx_interrupt ) |
| 65 | 65 | { |
| 66 | | TMS9928A_interrupt(machine); |
| 66 | TMS9928A_interrupt(device->machine); |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | |
| r3646 | r3647 | |
| 134 | 134 | READ8_HANDLER( mtx_strobe_r ) |
| 135 | 135 | { |
| 136 | 136 | if (mtx_prt_strobe == 0) |
| 137 | | printer_output(mtx_printer_image(machine), mtx_prt_data); |
| 137 | printer_output(mtx_printer_image(space->machine), mtx_prt_data); |
| 138 | 138 | |
| 139 | 139 | mtx_prt_strobe = 1; |
| 140 | 140 | |
| r3646 | r3647 | |
| 146 | 146 | { |
| 147 | 147 | mtx_prt_strobe = 0; |
| 148 | 148 | |
| 149 | | return MTX_PRT_NOERROR | (printer_is_ready(mtx_printer_image(machine)) |
| 149 | return MTX_PRT_NOERROR | (printer_is_ready(mtx_printer_image(space->machine)) |
| 150 | 150 | ? MTX_PRT_SELECTED : 0); |
| 151 | 151 | } |
| 152 | 152 | |
| r3646 | r3647 | |
| 172 | 172 | { |
| 173 | 173 | UINT8 data = 0xff; |
| 174 | 174 | |
| 175 | | if (!(key_sense & 0x01)) data &= input_port_read(machine, "keyboard_low_0"); |
| 176 | | if (!(key_sense & 0x02)) data &= input_port_read(machine, "keyboard_low_1"); |
| 177 | | if (!(key_sense & 0x04)) data &= input_port_read(machine, "keyboard_low_2"); |
| 178 | | if (!(key_sense & 0x08)) data &= input_port_read(machine, "keyboard_low_3"); |
| 179 | | if (!(key_sense & 0x10)) data &= input_port_read(machine, "keyboard_low_4"); |
| 180 | | if (!(key_sense & 0x20)) data &= input_port_read(machine, "keyboard_low_5"); |
| 181 | | if (!(key_sense & 0x40)) data &= input_port_read(machine, "keyboard_low_6"); |
| 182 | | if (!(key_sense & 0x80)) data &= input_port_read(machine, "keyboard_low_7"); |
| 175 | if (!(key_sense & 0x01)) data &= input_port_read(space->machine, "keyboard_low_0"); |
| 176 | if (!(key_sense & 0x02)) data &= input_port_read(space->machine, "keyboard_low_1"); |
| 177 | if (!(key_sense & 0x04)) data &= input_port_read(space->machine, "keyboard_low_2"); |
| 178 | if (!(key_sense & 0x08)) data &= input_port_read(space->machine, "keyboard_low_3"); |
| 179 | if (!(key_sense & 0x10)) data &= input_port_read(space->machine, "keyboard_low_4"); |
| 180 | if (!(key_sense & 0x20)) data &= input_port_read(space->machine, "keyboard_low_5"); |
| 181 | if (!(key_sense & 0x40)) data &= input_port_read(space->machine, "keyboard_low_6"); |
| 182 | if (!(key_sense & 0x80)) data &= input_port_read(space->machine, "keyboard_low_7"); |
| 183 | 183 | |
| 184 | 184 | return data; |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | READ8_HANDLER( mtx_key_hi_r ) |
| 188 | 188 | { |
| 189 | | UINT8 data = input_port_read(machine, "country_code"); |
| 189 | UINT8 data = input_port_read(space->machine, "country_code"); |
| 190 | 190 | |
| 191 | | if (!(key_sense & 0x01)) data &= input_port_read(machine, "keyboard_high_0"); |
| 192 | | if (!(key_sense & 0x02)) data &= input_port_read(machine, "keyboard_high_1"); |
| 193 | | if (!(key_sense & 0x04)) data &= input_port_read(machine, "keyboard_high_2"); |
| 194 | | if (!(key_sense & 0x08)) data &= input_port_read(machine, "keyboard_high_3"); |
| 195 | | if (!(key_sense & 0x10)) data &= input_port_read(machine, "keyboard_high_4"); |
| 196 | | if (!(key_sense & 0x20)) data &= input_port_read(machine, "keyboard_high_5"); |
| 197 | | if (!(key_sense & 0x40)) data &= input_port_read(machine, "keyboard_high_6"); |
| 198 | | if (!(key_sense & 0x80)) data &= input_port_read(machine, "keyboard_high_7"); |
| 191 | if (!(key_sense & 0x01)) data &= input_port_read(space->machine, "keyboard_high_0"); |
| 192 | if (!(key_sense & 0x02)) data &= input_port_read(space->machine, "keyboard_high_1"); |
| 193 | if (!(key_sense & 0x04)) data &= input_port_read(space->machine, "keyboard_high_2"); |
| 194 | if (!(key_sense & 0x08)) data &= input_port_read(space->machine, "keyboard_high_3"); |
| 195 | if (!(key_sense & 0x10)) data &= input_port_read(space->machine, "keyboard_high_4"); |
| 196 | if (!(key_sense & 0x20)) data &= input_port_read(space->machine, "keyboard_high_5"); |
| 197 | if (!(key_sense & 0x40)) data &= input_port_read(space->machine, "keyboard_high_6"); |
| 198 | if (!(key_sense & 0x80)) data &= input_port_read(space->machine, "keyboard_high_7"); |
| 199 | 199 | |
| 200 | 200 | return data; |
| 201 | 201 | } |
| r3646 | r3647 | |
| 211 | 211 | static void mtx_ctc_interrupt(const device_config *device, int state) |
| 212 | 212 | { |
| 213 | 213 | // logerror("mtx_ctc_interrupt: %02x\n", state); |
| 214 | | cpunum_set_input_line(device->machine, 0, 0, state); |
| 214 | cpu_set_input_line(device->machine->cpu[0], 0, state); |
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | READ8_DEVICE_HANDLER( mtx_ctc_r ) |
| r3646 | r3647 | |
| 312 | 312 | UINT8 ram_page = data >> 0 & 0x0f; |
| 313 | 313 | |
| 314 | 314 | /* set rom bank (switches between basic and assembler rom or cartridges) */ |
| 315 | | memory_set_bank(machine, 2, rom_page); |
| 315 | memory_set_bank(space->machine, 2, rom_page); |
| 316 | 316 | |
| 317 | 317 | /* set ram bank, for invalid pages a nop-handler will be installed */ |
| 318 | 318 | if (ram_page >= mess_ram_size/0x8000) |
| 319 | 319 | { |
| 320 | | memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4000, 0x7fff, 0, 0, SMH_NOP, SMH_NOP); |
| 321 | | memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0xbfff, 0, 0, SMH_NOP, SMH_NOP); |
| 320 | memory_install_readwrite8_handler(cpu_get_address_space(space->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4000, 0x7fff, 0, 0, SMH_NOP, SMH_NOP); |
| 321 | memory_install_readwrite8_handler(cpu_get_address_space(space->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0xbfff, 0, 0, SMH_NOP, SMH_NOP); |
| 322 | 322 | } |
| 323 | 323 | else if (ram_page + 1 == mess_ram_size/0x8000) |
| 324 | 324 | { |
| 325 | | memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4000, 0x7fff, 0, 0, SMH_NOP, SMH_NOP); |
| 326 | | memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0xbfff, 0, 0, SMH_BANK4, SMH_BANK4); |
| 327 | | memory_set_bank(4, ram_page); |
| 325 | memory_install_readwrite8_handler(cpu_get_address_space(space->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4000, 0x7fff, 0, 0, SMH_NOP, SMH_NOP); |
| 326 | memory_install_readwrite8_handler(cpu_get_address_space(space->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0xbfff, 0, 0, SMH_BANK4, SMH_BANK4); |
| 327 | memory_set_bank(space->machine, 4, ram_page); |
| 328 | 328 | } |
| 329 | 329 | else |
| 330 | 330 | { |
| 331 | | memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4000, 0x7fff, 0, 0, SMH_BANK3, SMH_BANK3); |
| 332 | | memory_install_readwrite8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0xbfff, 0, 0, SMH_BANK4, SMH_BANK4); |
| 333 | | memory_set_bank(3, ram_page); |
| 334 | | memory_set_bank(4, ram_page); |
| 331 | memory_install_readwrite8_handler(cpu_get_address_space(space->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x4000, 0x7fff, 0, 0, SMH_BANK3, SMH_BANK3); |
| 332 | memory_install_readwrite8_handler(cpu_get_address_space(space->machine->cpu[0], ADDRESS_SPACE_PROGRAM), 0x8000, 0xbfff, 0, 0, SMH_BANK4, SMH_BANK4); |
| 333 | memory_set_bank(space->machine, 3, ram_page); |
| 334 | memory_set_bank(space->machine, 4, ram_page); |
| 335 | 335 | } |
| 336 | 336 | } |
| 337 | 337 | |
| r3646 | r3647 | |
| 348 | 348 | /* configure memory */ |
| 349 | 349 | memory_set_bankptr(machine, 1, memory_region(machine, "user1")); |
| 350 | 350 | memory_configure_bank(machine, 2, 0, 8, memory_region(machine, "user2"), 0x2000); |
| 351 | | memory_configure_bank(3, 0, mess_ram_size/0x4000/2, mess_ram, 0x4000); |
| 352 | | memory_configure_bank(4, 0, mess_ram_size/0x4000/2, mess_ram + mess_ram_size/2, 0x4000); |
| 351 | memory_configure_bank(machine, 3, 0, mess_ram_size/0x4000/2, mess_ram, 0x4000); |
| 352 | memory_configure_bank(machine, 4, 0, mess_ram_size/0x4000/2, mess_ram + mess_ram_size/2, 0x4000); |
| 353 | 353 | |
| 354 | 354 | /* setup tms9928a */ |
| 355 | 355 | TMS9928A_configure(&tms9928a_interface); |
| r3646 | r3647 | |
| 357 | 357 | |
| 358 | 358 | DRIVER_INIT( rs128 ) |
| 359 | 359 | { |
| 360 | const device_config *device; |
| 361 | const address_space *space; |
| 362 | |
| 360 | 363 | DRIVER_INIT_CALL(mtx512); |
| 361 | 364 | |
| 362 | 365 | /* install handlers for dart interface */ |
| 363 | | memory_install_readwrite8_device_handler(device_list_find_by_tag(machine->config->devicelist, Z80DART, "z80dart"), 0, ADDRESS_SPACE_IO, 0x0c, 0x0d, 0, 0, mtx_dart_data_r, mtx_dart_data_w); |
| 364 | | memory_install_readwrite8_device_handler(device_list_find_by_tag(machine->config->devicelist, Z80DART, "z80dart"), 0, ADDRESS_SPACE_IO, 0x0e, 0x0f, 0, 0, mtx_dart_control_r, mtx_dart_control_w); |
| 366 | device = device_list_find_by_tag(machine->config->devicelist, Z80DART, "z80dart"); |
| 367 | space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO); |
| 368 | memory_install_readwrite8_device_handler(space, device, 0x0c, 0x0d, 0, 0, mtx_dart_data_r, mtx_dart_data_w); |
| 369 | memory_install_readwrite8_device_handler(space, device, 0x0e, 0x0f, 0, 0, mtx_dart_control_r, mtx_dart_control_w); |
| 365 | 370 | } |
| 366 | 371 | |
| 367 | 372 | MACHINE_RESET( rs128 ) |