src/mess/machine/trs80.c
| r4443 | r4444 | |
| 41 | 41 | #define IRQ_TIMER 0x80 /* RTC on Model I */ |
| 42 | 42 | #define IRQ_RTC 0x04 /* RTC on Model 4 */ |
| 43 | 43 | #define IRQ_FDC 0x40 /* FDC on Model 1 */ |
| 44 | | static UINT8 irq_status = 0; |
| 44 | #define CASS_RISE 0x01 /* high speed cass on Model III/4) */ |
| 45 | #define CASS_FALL 0x02 /* high speed cass on Model III/4) */ |
| 45 | 46 | |
| 46 | 47 | #define MAX_LUMPS 192 /* crude storage units - don't now much about it */ |
| 47 | 48 | #define MAX_GRANULES 8 /* lumps consisted of granules.. aha */ |
| r4443 | r4444 | |
| 61 | 62 | #define FH TRS80_FONT_H |
| 62 | 63 | #define MODEL4_MASTER_CLOCK 20275200 |
| 63 | 64 | |
| 64 | | static double old_cassette_val; |
| 65 | 65 | static UINT8 cassette_data; |
| 66 | 66 | static emu_timer *cassette_data_timer; |
| 67 | 67 | static const device_config *trs80_printer; |
| r4443 | r4444 | |
| 72 | 72 | |
| 73 | 73 | static TIMER_CALLBACK( cassette_data_callback ) |
| 74 | 74 | { |
| 75 | static double old_cassette_val; |
| 75 | 76 | double new_val = cassette_input(trs80_cass); |
| 76 | 77 | |
| 77 | 78 | /* Check for HI-LO transition */ |
| 78 | 79 | if ( old_cassette_val > -0.2 && new_val < -0.2 ) |
| 79 | 80 | { |
| 80 | 81 | cassette_data |= 0x80; |
| 82 | if (trs80_mask & CASS_FALL) |
| 83 | { |
| 84 | cassette_data = 0; |
| 85 | trs80_int |= CASS_FALL; |
| 86 | cpu_set_input_line(machine->cpu[0], 0, HOLD_LINE); |
| 87 | } |
| 81 | 88 | } |
| 89 | else |
| 90 | if ( old_cassette_val < -0.2 && new_val > -0.2 ) |
| 91 | { |
| 92 | if (trs80_mask & CASS_RISE) |
| 93 | { |
| 94 | cassette_data = 1; |
| 95 | trs80_int |= CASS_RISE; |
| 96 | cpu_set_input_line(machine->cpu[0], 0, HOLD_LINE); |
| 97 | } |
| 98 | } |
| 99 | |
| 82 | 100 | old_cassette_val = new_val; |
| 83 | 101 | } |
| 84 | 102 | |
| r4443 | r4444 | |
| 247 | 265 | d1 Cass 1500 baud Falling |
| 248 | 266 | d0 Cass 1500 baud Rising */ |
| 249 | 267 | |
| 268 | cpu_set_input_line(space->machine->cpu[0], 0, CLEAR_LINE); |
| 250 | 269 | return ~(trs80_mask & trs80_int); |
| 251 | 270 | } |
| 252 | 271 | |
| r4443 | r4444 | |
| 352 | 371 | d6..d1 info from write of port EC |
| 353 | 372 | d0 High-speed data (not emulated yet) */ |
| 354 | 373 | |
| 355 | | trs80_int &= 0xfc; /* clear cassette interrupts */ |
| 374 | trs80_int &= 0xfc; /* clear cassette interrupts */ |
| 375 | |
| 356 | 376 | return trs80_port_ec | cassette_data; |
| 357 | 377 | } |
| 358 | 378 | |
| r4443 | r4444 | |
| 573 | 593 | |
| 574 | 594 | INTERRUPT_GEN( trs80_timer_interrupt ) |
| 575 | 595 | { |
| 576 | | if( (trs80_int & IRQ_TIMER) == 0 ) |
| 596 | if (trs80_mask & IRQ_TIMER) |
| 577 | 597 | { |
| 578 | 598 | trs80_int |= IRQ_TIMER; |
| 579 | 599 | cpu_set_input_line(device, 0, HOLD_LINE); |
| r4443 | r4444 | |
| 582 | 602 | |
| 583 | 603 | INTERRUPT_GEN( trs80m4_rtc_interrupt ) |
| 584 | 604 | { |
| 585 | | /* This enables the processing of interrupts, particularly the clock and the flashing cursor. |
| 586 | | We alternately raise and lower the INT line. The OS counts one tick for each interrupt. |
| 587 | | There are 30 ticks per second. */ |
| 605 | /* This enables the processing of interrupts for the clock and the flashing cursor. |
| 606 | The OS counts one tick for each interrupt. There are 30 ticks per second. */ |
| 588 | 607 | |
| 589 | | if (irq_status) |
| 608 | if (trs80_mask & IRQ_RTC) |
| 590 | 609 | { |
| 591 | | irq_status = 0; |
| 592 | | cpu_set_input_line(device, 0, CLEAR_LINE); |
| 593 | | } |
| 594 | | else |
| 595 | | { |
| 596 | 610 | trs80_int |= IRQ_RTC; |
| 597 | | irq_status = 1; |
| 598 | 611 | cpu_set_input_line(device, 0, HOLD_LINE); |
| 599 | 612 | } |
| 600 | 613 | } |
| 601 | 614 | |
| 602 | 615 | static void trs80_fdc_interrupt_internal(running_machine *machine) |
| 603 | 616 | { |
| 604 | | if ((trs80_int & IRQ_FDC) == 0) |
| 617 | if (trs80_mask & IRQ_FDC) |
| 605 | 618 | { |
| 606 | 619 | trs80_int |= IRQ_FDC; |
| 607 | 620 | cpu_set_input_line(machine->cpu[0], 0, HOLD_LINE); |
src/mess/drivers/trs80.c
| r4443 | r4444 | |
| 462 | 462 | MDRV_CPU_MODIFY( "maincpu" ) |
| 463 | 463 | MDRV_CPU_PROGRAM_MAP( model3_map, 0 ) |
| 464 | 464 | MDRV_CPU_IO_MAP( model3_io, 0 ) |
| 465 | | MDRV_CPU_PERIODIC_INT(trs80m4_rtc_interrupt, 60) |
| 465 | MDRV_CPU_PERIODIC_INT(trs80m4_rtc_interrupt, 30) |
| 466 | MDRV_VIDEO_UPDATE( trs80m4 ) |
| 467 | MDRV_SCREEN_MODIFY("screen") |
| 468 | MDRV_SCREEN_SIZE(80*FW, 24*FH) |
| 469 | MDRV_SCREEN_VISIBLE_AREA(0*FW,80*FW-1,0*FH,24*FH-1) |
| 466 | 470 | MACHINE_DRIVER_END |
| 467 | 471 | |
| 468 | 472 | static MACHINE_DRIVER_START( sys80 ) |
| r4443 | r4444 | |
| 484 | 488 | static MACHINE_DRIVER_START( radionic ) |
| 485 | 489 | MDRV_IMPORT_FROM( model1 ) |
| 486 | 490 | MDRV_VIDEO_UPDATE( radionic ) |
| 491 | MDRV_SCREEN_MODIFY("screen") |
| 492 | MDRV_SCREEN_SIZE(64*8, 16*16) |
| 493 | MDRV_SCREEN_VISIBLE_AREA(0*8,64*8-1,0*16,16*16-1) |
| 487 | 494 | MACHINE_DRIVER_END |
| 488 | 495 | |
| 489 | 496 | |