src/mess/machine/apple2gs.c
| r1636 | r1637 | |
| 148 | 148 | static INT8 apple2gs_mouse_dy; |
| 149 | 149 | static mess_image *apple2gs_cur_slot6_image; |
| 150 | 150 | static emu_timer *apple2gs_scanline_timer; |
| 151 | static emu_timer *apple2gs_clock_timer; |
| 152 | static emu_timer *apple2gs_qsecond_timer; |
| 151 | 153 | |
| 152 | 154 | |
| 153 | 155 | /* ----------------------------------------------------------------------- |
| r1636 | r1637 | |
| 346 | 348 | } |
| 347 | 349 | |
| 348 | 350 | |
| 351 | /* Clock interrupt */ |
| 352 | static TIMER_CALLBACK( apple2gs_clock_tick ) |
| 353 | { |
| 354 | if ((apple2gs_vgcint & 0x04) && !(apple2gs_vgcint & 0x40)) |
| 355 | { |
| 356 | apple2gs_vgcint |= 0xc0; |
| 357 | apple2gs_add_irq(IRQ_VGC_SECOND); |
| 358 | } |
| 359 | } |
| 360 | |
| 361 | |
| 362 | /* Quarter-second interrupt */ |
| 363 | static TIMER_CALLBACK( apple2gs_qsecond_tick ) |
| 364 | { |
| 365 | if ((apple2gs_inten & 0x10) && !(apple2gs_intflag & 0x10)) |
| 366 | { |
| 367 | apple2gs_intflag |= 0x10; |
| 368 | apple2gs_add_irq(IRQ_INTEN_QSECOND); |
| 369 | } |
| 370 | } |
| 371 | |
| 372 | |
| 349 | 373 | /* ----------------------------------------------------------------------- |
| 350 | 374 | * ADB |
| 351 | 375 | * ----------------------------------------------------------------------- */ |
| r1636 | r1637 | |
| 766 | 790 | } |
| 767 | 791 | |
| 768 | 792 | |
| 769 | | |
| 770 | 793 | static TIMER_CALLBACK(apple2gs_scanline_tick) |
| 771 | 794 | { |
| 772 | 795 | int scanline; |
| 773 | | int current_frame; |
| 774 | 796 | |
| 775 | 797 | // make sure we're in the 65816's context |
| 776 | 798 | cpuintrf_push_context(0); |
| r1636 | r1637 | |
| 793 | 815 | } |
| 794 | 816 | } |
| 795 | 817 | |
| 796 | | if (scanline == BORDER_TOP) |
| 818 | if (scanline == (192+BORDER_TOP)) |
| 797 | 819 | { |
| 798 | | current_frame = cpu_getcurrentframe(); |
| 799 | | |
| 800 | | /* quarter second interrupt */ |
| 801 | | if ((apple2gs_inten & 0x10) && !(apple2gs_intflag & 0x10) && ((current_frame % 15) == 0)) |
| 802 | | { |
| 803 | | apple2gs_intflag |= 0x10; |
| 804 | | apple2gs_add_irq(IRQ_INTEN_QSECOND); |
| 805 | | } |
| 806 | | |
| 807 | | /* one second interrupt */ |
| 808 | | if ((apple2gs_vgcint & 0x04) && !(apple2gs_vgcint & 0x40) && ((current_frame % 60) == 0)) |
| 809 | | { |
| 810 | | apple2gs_vgcint |= 0xc0; |
| 811 | | apple2gs_add_irq(IRQ_VGC_SECOND); |
| 812 | | } |
| 813 | | } |
| 814 | | else if (scanline == (192+BORDER_TOP)) |
| 815 | | { |
| 816 | 820 | /* VBL interrupt */ |
| 817 | 821 | if ((apple2gs_inten & 0x08) && !(apple2gs_intflag & 0x08)) |
| 818 | 822 | { |
| r1636 | r1637 | |
| 1718 | 1722 | |
| 1719 | 1723 | MACHINE_RESET( apple2gs ) |
| 1720 | 1724 | { |
| 1725 | apple2gs_clock_timer = timer_alloc(apple2gs_clock_tick, NULL); |
| 1726 | timer_adjust(apple2gs_clock_timer, ATTOTIME_IN_SEC(1), 0, ATTOTIME_IN_SEC(1)); |
| 1727 | |
| 1728 | apple2gs_qsecond_timer = timer_alloc(apple2gs_qsecond_tick, NULL); |
| 1729 | timer_adjust(apple2gs_qsecond_timer, ATTOTIME_IN_USEC(266700), 0, ATTOTIME_IN_USEC(266700)); |
| 1730 | |
| 1721 | 1731 | apple2gs_scanline_timer = timer_alloc(apple2gs_scanline_tick, NULL); |
| 1722 | 1732 | timer_adjust(apple2gs_scanline_timer, attotime_never, 0, attotime_never); |
| 1723 | 1733 | |