src/mess/machine/osborne1.c
| r3629 | r3630 | |
| 85 | 85 | switch( offset & 0x0F00 ) |
| 86 | 86 | { |
| 87 | 87 | case 0x100: /* Floppy */ |
| 88 | | data = wd17xx_r( machine, offset ); |
| 88 | data = wd17xx_r( space, offset ); |
| 89 | 89 | break; |
| 90 | 90 | case 0x200: /* Keyboard */ |
| 91 | 91 | /* Row 0 */ |
| 92 | | if ( offset & 0x01 ) data &= input_port_read(machine, "ROW0"); |
| 92 | if ( offset & 0x01 ) data &= input_port_read(space->machine, "ROW0"); |
| 93 | 93 | /* Row 1 */ |
| 94 | | if ( offset & 0x02 ) data &= input_port_read(machine, "ROW1"); |
| 94 | if ( offset & 0x02 ) data &= input_port_read(space->machine, "ROW1"); |
| 95 | 95 | /* Row 2 */ |
| 96 | | if ( offset & 0x04 ) data &= input_port_read(machine, "ROW3"); |
| 96 | if ( offset & 0x04 ) data &= input_port_read(space->machine, "ROW3"); |
| 97 | 97 | /* Row 3 */ |
| 98 | | if ( offset & 0x08 ) data &= input_port_read(machine, "ROW4"); |
| 98 | if ( offset & 0x08 ) data &= input_port_read(space->machine, "ROW4"); |
| 99 | 99 | /* Row 4 */ |
| 100 | | if ( offset & 0x10 ) data &= input_port_read(machine, "ROW5"); |
| 100 | if ( offset & 0x10 ) data &= input_port_read(space->machine, "ROW5"); |
| 101 | 101 | /* Row 5 */ |
| 102 | | if ( offset & 0x20 ) data &= input_port_read(machine, "ROW2"); |
| 102 | if ( offset & 0x20 ) data &= input_port_read(space->machine, "ROW2"); |
| 103 | 103 | /* Row 6 */ |
| 104 | | if ( offset & 0x40 ) data &= input_port_read(machine, "ROW6"); |
| 104 | if ( offset & 0x40 ) data &= input_port_read(space->machine, "ROW6"); |
| 105 | 105 | /* Row 7 */ |
| 106 | | if ( offset & 0x80 ) data &= input_port_read(machine, "ROW7"); |
| 106 | if ( offset & 0x80 ) data &= input_port_read(space->machine, "ROW7"); |
| 107 | 107 | break; |
| 108 | 108 | case 0x900: /* IEEE488 PIA */ |
| 109 | | data = pia_0_r( machine, offset & 0x03 ); |
| 109 | data = pia_0_r( space, offset & 0x03 ); |
| 110 | 110 | break; |
| 111 | 111 | case 0xA00: /* Serial */ |
| 112 | 112 | break; |
| 113 | 113 | case 0xC00: /* Video PIA */ |
| 114 | | data = pia_1_r( machine, offset & 0x03 ); |
| 114 | data = pia_1_r( space, offset & 0x03 ); |
| 115 | 115 | break; |
| 116 | 116 | } |
| 117 | 117 | } |
| r3629 | r3630 | |
| 136 | 136 | switch( offset & 0x0F00 ) |
| 137 | 137 | { |
| 138 | 138 | case 0x100: /* Floppy */ |
| 139 | | wd17xx_w( machine, offset, data ); |
| 139 | wd17xx_w( space, offset, data ); |
| 140 | 140 | break; |
| 141 | 141 | case 0x900: /* IEEE488 PIA */ |
| 142 | | pia_0_w( machine, offset & 0x03, data ); |
| 142 | pia_0_w( space, offset & 0x03, data ); |
| 143 | 143 | break; |
| 144 | 144 | case 0xA00: /* Serial */ |
| 145 | 145 | break; |
| 146 | 146 | case 0xC00: /* Video PIA */ |
| 147 | | pia_1_w( machine, offset & 0x03, data ); |
| 147 | pia_1_w( space, offset & 0x03, data ); |
| 148 | 148 | break; |
| 149 | 149 | } |
| 150 | 150 | } |
| r3629 | r3630 | |
| 195 | 195 | } |
| 196 | 196 | if ( osborne1.bank2_enabled ) |
| 197 | 197 | { |
| 198 | | memory_set_bankptr( 1, memory_region(machine, "main") ); |
| 199 | | memory_set_bankptr( 2, osborne1.empty_4K ); |
| 200 | | memory_set_bankptr( 3, osborne1.empty_4K ); |
| 198 | memory_set_bankptr(space->machine,1, memory_region(space->machine, "main") ); |
| 199 | memory_set_bankptr(space->machine,2, osborne1.empty_4K ); |
| 200 | memory_set_bankptr(space->machine,3, osborne1.empty_4K ); |
| 201 | 201 | } |
| 202 | 202 | else |
| 203 | 203 | { |
| 204 | | memory_set_bankptr( 1, mess_ram ); |
| 205 | | memory_set_bankptr( 2, mess_ram + 0x1000 ); |
| 206 | | memory_set_bankptr( 3, mess_ram + 0x3000 ); |
| 204 | memory_set_bankptr(space->machine,1, mess_ram ); |
| 205 | memory_set_bankptr(space->machine,2, mess_ram + 0x1000 ); |
| 206 | memory_set_bankptr(space->machine,3, mess_ram + 0x3000 ); |
| 207 | 207 | } |
| 208 | 208 | osborne1.bank4_ptr = mess_ram + ( ( osborne1.bank3_enabled ) ? 0x10000 : 0xF000 ); |
| 209 | | memory_set_bankptr( 4, osborne1.bank4_ptr ); |
| 209 | memory_set_bankptr(space->machine,4, osborne1.bank4_ptr ); |
| 210 | 210 | osborne1.bankswitch = offset; |
| 211 | 211 | osborne1.in_irq_handler = 0; |
| 212 | 212 | } |
| r3629 | r3630 | |
| 218 | 218 | { |
| 219 | 219 | if ( ! osborne1.bank2_enabled ) |
| 220 | 220 | { |
| 221 | | opbase->mask = 0x0fff; |
| 221 | direct->mask = 0x0fff; |
| 222 | 222 | direct->decrypted = mess_ram + 0x2000; |
| 223 | 223 | direct->raw = mess_ram + 0x2000; |
| 224 | | opbase->mem_min = 0x2000; |
| 225 | | opbase->mem_max = 0x2fff; |
| 224 | direct->min = 0x2000; |
| 225 | direct->max = 0x2fff; |
| 226 | 226 | return ~0; |
| 227 | 227 | } |
| 228 | 228 | } |
| r3629 | r3630 | |
| 338 | 338 | |
| 339 | 339 | static TIMER_CALLBACK(osborne1_video_callback) |
| 340 | 340 | { |
| 341 | const address_space* space = cpu_get_address_space(machine->cpu[0],ADDRESS_SPACE_PROGRAM); |
| 341 | 342 | int y = video_screen_get_vpos(machine->primary_screen); |
| 342 | 343 | |
| 343 | 344 | /* Check for start of frame */ |
| r3629 | r3630 | |
| 346 | 347 | /* Clear CA1 on video PIA */ |
| 347 | 348 | osborne1.start_y = ( osborne1.new_start_y - 1 ) & 0x1F; |
| 348 | 349 | osborne1.charline = 0; |
| 349 | | pia_1_ca1_w( machine, 0, 0 ); |
| 350 | pia_1_ca1_w( space, 0, 0 ); |
| 350 | 351 | } |
| 351 | 352 | if ( y == 240 ) |
| 352 | 353 | { |
| 353 | 354 | /* Set CA1 on video PIA */ |
| 354 | | pia_1_ca1_w( machine, 0, 0xFF ); |
| 355 | pia_1_ca1_w( space, 0, 0xFF ); |
| 355 | 356 | } |
| 356 | 357 | if ( y < 240 ) |
| 357 | 358 | { |
| r3629 | r3630 | |
| 479 | 480 | |
| 480 | 481 | MACHINE_RESET( osborne1 ) |
| 481 | 482 | { |
| 483 | const address_space* space = cpu_get_address_space(machine->cpu[0],ADDRESS_SPACE_PROGRAM); |
| 482 | 484 | /* Initialize memory configuration */ |
| 483 | | osborne1_bankswitch_w( machine, 0x00, 0 ); |
| 485 | osborne1_bankswitch_w( space, 0x00, 0 ); |
| 484 | 486 | |
| 485 | 487 | osborne1.pia_0_irq_state = FALSE; |
| 486 | 488 | osborne1.pia_1_irq_state = FALSE; |
| r3629 | r3630 | |
| 494 | 496 | |
| 495 | 497 | osborne1.video_timer = timer_alloc( osborne1_video_callback , NULL); |
| 496 | 498 | timer_adjust_oneshot(osborne1.video_timer, video_screen_get_time_until_pos(machine->primary_screen, 1, 0 ), 0); |
| 497 | | pia_1_ca1_w( machine, 0, 0 ); |
| 499 | pia_1_ca1_w( space, 0, 0 ); |
| 498 | 500 | |
| 499 | 501 | timer_set( attotime_zero, NULL, 0, setup_beep ); |
| 500 | 502 | |
| 501 | | memory_set_direct_update_handler( 0, osborne1_opbase ); |
| 503 | memory_set_direct_update_handler( space, osborne1_opbase ); |
| 502 | 504 | } |
| 503 | 505 | |
| 504 | 506 | |
| r3629 | r3630 | |
| 533 | 535 | { |
| 534 | 536 | /* Enable ROM and I/O when IRQ is acknowledged */ |
| 535 | 537 | UINT8 old_bankswitch = osborne1.bankswitch; |
| 536 | | osborne1_bankswitch_w( device->machine, 0, 0 ); |
| 538 | const address_space* space = cpu_get_address_space(device->machine->cpu[0],ADDRESS_SPACE_PROGRAM); |
| 539 | |
| 540 | osborne1_bankswitch_w( space, 0, 0 ); |
| 537 | 541 | osborne1.bankswitch = old_bankswitch; |
| 538 | 542 | osborne1.in_irq_handler = 1; |
| 539 | 543 | return 0xF8; |