src/mess/drivers/apexc.c
| r3633 | r3634 | |
| 22 | 22 | |
| 23 | 23 | /* |
| 24 | 24 | APEXC RAM loading/saving from cylinder image |
| 25 | | |
| 25 | |
| 26 | 26 | Note that, in an actual APEXC, the RAM contents are not read from the cylinder : |
| 27 | 27 | the cylinder IS the RAM. |
| 28 | 28 | |
| r3633 | r3634 | |
| 207 | 207 | if (apexc_tapes[1].fd) |
| 208 | 208 | image_fwrite(apexc_tapes[1].fd, & data5, 1); |
| 209 | 209 | |
| 210 | | apexc_teletyper_putchar(machine, data & 0x1f); /* display on screen */ |
| 210 | apexc_teletyper_putchar(space->machine, data & 0x1f); /* display on screen */ |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | /* |
| r3633 | r3634 | |
| 326 | 326 | */ |
| 327 | 327 | static INTERRUPT_GEN( apexc_interrupt ) |
| 328 | 328 | { |
| 329 | const address_space* space = cpu_get_address_space(device->machine->cpu[0],ADDRESS_SPACE_PROGRAM); |
| 329 | 330 | UINT32 edit_keys; |
| 330 | 331 | int control_keys; |
| 331 | 332 | |
| r3633 | r3634 | |
| 336 | 337 | |
| 337 | 338 | |
| 338 | 339 | /* read new state of edit keys */ |
| 339 | | edit_keys = (input_port_read(machine, "data1") << 16) | input_port_read(machine, "data2"); |
| 340 | edit_keys = (input_port_read(device->machine, "data1") << 16) | input_port_read(device->machine, "data2"); |
| 340 | 341 | |
| 341 | 342 | /* toggle data reg according to transitions */ |
| 342 | 343 | panel_data_reg ^= edit_keys & (~ old_edit_keys); |
| r3633 | r3634 | |
| 346 | 347 | |
| 347 | 348 | |
| 348 | 349 | /* read new state of control keys */ |
| 349 | | control_keys = input_port_read(machine, "panel"); |
| 350 | control_keys = input_port_read(device->machine, "panel"); |
| 350 | 351 | |
| 351 | 352 | /* compute transitions */ |
| 352 | 353 | control_transitions = control_keys & (~ old_control_keys); |
| r3633 | r3634 | |
| 355 | 356 | |
| 356 | 357 | if (control_transitions & panel_run) |
| 357 | 358 | { /* toggle run/stop state */ |
| 358 | | cpunum_set_reg(0, APEXC_STATE, ! cpunum_get_reg(0, APEXC_STATE)); |
| 359 | cpu_set_reg(device, APEXC_STATE, ! cpu_get_reg(device, APEXC_STATE)); |
| 359 | 360 | } |
| 360 | 361 | |
| 361 | 362 | while (control_transitions & (panel_CR | panel_A | panel_R | panel_ML | panel_HB)) |
| r3633 | r3634 | |
| 397 | 398 | /* read/write register #reg_id */ |
| 398 | 399 | if (control_keys & panel_write) |
| 399 | 400 | /* write reg */ |
| 400 | | cpunum_set_reg(0, reg_id, panel_data_reg); |
| 401 | cpu_set_reg(device, reg_id, panel_data_reg); |
| 401 | 402 | else |
| 402 | 403 | /* read reg */ |
| 403 | | panel_data_reg = cpunum_get_reg(0, reg_id); |
| 404 | panel_data_reg = cpu_get_reg(device, reg_id); |
| 404 | 405 | } |
| 405 | 406 | } |
| 406 | 407 | |
| 407 | 408 | if (control_transitions & panel_mem) |
| 408 | 409 | { /* read/write memory */ |
| 409 | 410 | |
| 410 | | if (control_keys & panel_write) |
| 411 | if (control_keys & panel_write) { |
| 411 | 412 | /* write memory */ |
| 412 | | apexc_writemem(cpunum_get_reg(0, APEXC_ML_FULL), panel_data_reg); |
| 413 | | else |
| 413 | memory_write_dword_32be(space, cpu_get_reg(device, APEXC_ML_FULL)<<2, panel_data_reg); |
| 414 | } |
| 415 | else { |
| 414 | 416 | /* read memory */ |
| 415 | | panel_data_reg = apexc_readmem(cpunum_get_reg(0, APEXC_ML_FULL)); |
| 417 | panel_data_reg = memory_read_dword_32be(space, cpu_get_reg(device, APEXC_ML_FULL)<<2); |
| 418 | } |
| 416 | 419 | } |
| 417 | 420 | |
| 418 | 421 | /* remember new state of control keys */ |
| r3633 | r3634 | |
| 539 | 542 | |
| 540 | 543 | apexc_draw_led(bitmap, 0, 0, 1); |
| 541 | 544 | |
| 542 | | apexc_draw_led(bitmap, 0, 8, cpunum_get_reg(0, APEXC_STATE)); |
| 545 | apexc_draw_led(bitmap, 0, 8, cpu_get_reg(screen->machine->cpu[0], APEXC_STATE)); |
| 543 | 546 | |
| 544 | 547 | for (i=0; i<32; i++) |
| 545 | 548 | { |
src/mess/drivers/apf.c
| r3633 | r3634 | |
| 53 | 53 | |
| 54 | 54 | UINT8 data=~0; |
| 55 | 55 | if (!(pad_data & 0x08)) |
| 56 | | data &= input_port_read(machine, "joy3"); |
| 56 | data &= input_port_read(space->machine, "joy3"); |
| 57 | 57 | if (!(pad_data & 0x04)) |
| 58 | | data &= input_port_read(machine, "joy2"); |
| 58 | data &= input_port_read(space->machine, "joy2"); |
| 59 | 59 | if (!(pad_data & 0x02)) |
| 60 | | data &= input_port_read(machine, "joy1"); |
| 60 | data &= input_port_read(space->machine, "joy1"); |
| 61 | 61 | if (!(pad_data & 0x01)) |
| 62 | | data &= input_port_read(machine, "joy0"); |
| 62 | data &= input_port_read(space->machine, "joy0"); |
| 63 | 63 | |
| 64 | 64 | return data; |
| 65 | 65 | } |
| r3633 | r3634 | |
| 207 | 207 | |
| 208 | 208 | data = 0x000; |
| 209 | 209 | |
| 210 | | if (cassette_input(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" )) > 0.0038) |
| 210 | if (cassette_input(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" )) > 0.0038) |
| 211 | 211 | data =(1<<7); |
| 212 | 212 | |
| 213 | 213 | return data; |
| r3633 | r3634 | |
| 251 | 251 | static const char *keynames[] = { "key0", "key1", "key2", "key3", "key4", "key5", "key6", "key7" }; |
| 252 | 252 | |
| 253 | 253 | keyboard_line = data & 0x07; |
| 254 | | keyboard_data = input_port_read(machine, keynames[keyboard_line]); |
| 254 | keyboard_data = input_port_read(space->machine, keynames[keyboard_line]); |
| 255 | 255 | |
| 256 | 256 | /* bit 4: cassette motor control */ |
| 257 | | cassette_change_state(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" ), |
| 257 | cassette_change_state(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" ), |
| 258 | 258 | (data & 0x10) ? CASSETTE_MOTOR_ENABLED : CASSETTE_MOTOR_DISABLED, |
| 259 | 259 | CASSETTE_MASK_MOTOR); |
| 260 | 260 | |
| 261 | 261 | /* bit 6: cassette write */ |
| 262 | | cassette_output(device_list_find_by_tag( machine->config->devicelist, CASSETTE, "cassette" ), |
| 262 | cassette_output(device_list_find_by_tag( space->machine->config->devicelist, CASSETTE, "cassette" ), |
| 263 | 263 | (data & 0x40) ? -1.0 : 1.0); |
| 264 | 264 | } |
| 265 | 265 | |
| r3633 | r3634 | |
| 362 | 362 | |
| 363 | 363 | static WRITE8_HANDLER(apf_wd179x_command_w) |
| 364 | 364 | { |
| 365 | | wd17xx_command_w(machine, offset,~data); |
| 365 | wd17xx_command_w(space, offset,~data); |
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | static WRITE8_HANDLER(apf_wd179x_track_w) |
| 369 | 369 | { |
| 370 | | wd17xx_track_w(machine, offset,~data); |
| 370 | wd17xx_track_w(space, offset,~data); |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | static WRITE8_HANDLER(apf_wd179x_sector_w) |
| 374 | 374 | { |
| 375 | | wd17xx_sector_w(machine, offset,~data); |
| 375 | wd17xx_sector_w(space, offset,~data); |
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | static WRITE8_HANDLER(apf_wd179x_data_w) |
| 379 | 379 | { |
| 380 | | wd17xx_data_w(machine, offset,~data); |
| 380 | wd17xx_data_w(space, offset,~data); |
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | static READ8_HANDLER(apf_wd179x_status_r) |
| 384 | 384 | { |
| 385 | | return ~wd17xx_status_r(machine, offset); |
| 385 | return ~wd17xx_status_r(space, offset); |
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | static READ8_HANDLER(apf_wd179x_track_r) |
| 389 | 389 | { |
| 390 | | return ~wd17xx_track_r(machine, offset); |
| 390 | return ~wd17xx_track_r(space, offset); |
| 391 | 391 | } |
| 392 | 392 | |
| 393 | 393 | static READ8_HANDLER(apf_wd179x_sector_r) |
| 394 | 394 | { |
| 395 | | return ~wd17xx_sector_r(machine, offset); |
| 395 | return ~wd17xx_sector_r(space, offset); |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | static READ8_HANDLER(apf_wd179x_data_r) |
| 399 | 399 | { |
| 400 | | return wd17xx_data_r(machine, offset); |
| 400 | return wd17xx_data_r(space, offset); |
| 401 | 401 | } |
| 402 | 402 | |
| 403 | 403 | static ADDRESS_MAP_START(apf_imagination_map, ADDRESS_SPACE_PROGRAM, 8) |