src/mess/video/atarist.c
| r1344 | r1345 | |
| 30 | 30 | int bitplane; |
| 31 | 31 | int shift; |
| 32 | 32 | int h, v; |
| 33 | int de; |
| 33 | 34 | } shifter; |
| 34 | 35 | |
| 35 | 36 | static emu_timer *atarist_glue_timer; |
| 36 | 37 | static emu_timer *atarist_shifter_timer; |
| 37 | | static mame_bitmap *atarist_bitmap; |
| 38 | 38 | |
| 39 | pen_t INLINE atarist_shift_mode_0(void) |
| 40 | { |
| 41 | int color = (BIT(shifter.rr[3], 15) << 3) | (BIT(shifter.rr[2], 15) << 2) | (BIT(shifter.rr[1], 15) << 1) | BIT(shifter.rr[0], 15); |
| 42 | |
| 43 | shifter.rr[0] <<= 1; |
| 44 | shifter.rr[1] <<= 1; |
| 45 | shifter.rr[2] <<= 1; |
| 46 | shifter.rr[3] <<= 1; |
| 47 | |
| 48 | return Machine->pens[color]; |
| 49 | } |
| 50 | |
| 51 | pen_t INLINE atarist_shift_mode_1(void) |
| 52 | { |
| 53 | int color = (BIT(shifter.rr[1], 15) << 1) | BIT(shifter.rr[0], 15); |
| 54 | |
| 55 | shifter.rr[0] <<= 1; |
| 56 | shifter.rr[1] <<= 1; |
| 57 | shifter.shift++; |
| 58 | |
| 59 | if (shifter.shift == 15) |
| 60 | { |
| 61 | shifter.rr[0] = shifter.rr[2]; |
| 62 | shifter.rr[1] = shifter.rr[3]; |
| 63 | shifter.rr[2] = shifter.rr[3] = 0; |
| 64 | shifter.shift = 0; |
| 65 | } |
| 66 | |
| 67 | return Machine->pens[color]; |
| 68 | } |
| 69 | |
| 70 | pen_t INLINE atarist_shift_mode_2(void) |
| 71 | { |
| 72 | // not implemented |
| 73 | return Machine->pens[0]; |
| 74 | } |
| 75 | |
| 39 | 76 | static TIMER_CALLBACK(atarist_shifter_tick) |
| 40 | 77 | { |
| 41 | 78 | int y = video_screen_get_vpos(0); |
| 42 | 79 | int x = video_screen_get_hpos(0); |
| 43 | | int color; |
| 44 | 80 | |
| 81 | pen_t pen; |
| 82 | |
| 45 | 83 | switch (shifter.mode) |
| 46 | 84 | { |
| 47 | | case 0: // 320 x 200, 4 Plane |
| 48 | | color = (BIT(shifter.rr[3], 15) << 3) | (BIT(shifter.rr[2], 15) << 2) | (BIT(shifter.rr[1], 15) << 1) | BIT(shifter.rr[0], 15); |
| 49 | | |
| 50 | | *BITMAP_ADDR32(atarist_bitmap, y, x) = Machine->pens[color]; |
| 51 | | |
| 52 | | shifter.rr[0] <<= 1; |
| 53 | | shifter.rr[1] <<= 1; |
| 54 | | shifter.rr[2] <<= 1; |
| 55 | | shifter.rr[3] <<= 1; |
| 85 | case 0: |
| 86 | pen = atarist_shift_mode_0(); |
| 56 | 87 | break; |
| 57 | 88 | |
| 58 | | case 1: // 640 x 200, 2 Plane |
| 59 | | color = (BIT(shifter.rr[1], 15) << 1) | BIT(shifter.rr[0], 15); |
| 60 | | |
| 61 | | *BITMAP_ADDR32(atarist_bitmap, y, x) = Machine->pens[color]; |
| 62 | | |
| 63 | | shifter.rr[0] <<= 1; |
| 64 | | shifter.rr[1] <<= 1; |
| 65 | | shifter.shift++; |
| 66 | | |
| 67 | | if (shifter.shift == 15) |
| 68 | | { |
| 69 | | shifter.rr[0] = shifter.rr[2]; |
| 70 | | shifter.rr[1] = shifter.rr[3]; |
| 71 | | shifter.rr[2] = shifter.rr[3] = 0; |
| 72 | | shifter.shift = 0; |
| 73 | | } |
| 89 | case 1: |
| 90 | pen = atarist_shift_mode_1(); |
| 74 | 91 | break; |
| 75 | 92 | |
| 76 | | case 2: // 640 x 400, 1 Plane |
| 77 | | // unimplemented |
| 93 | case 2: |
| 94 | pen = atarist_shift_mode_2(); |
| 78 | 95 | break; |
| 79 | 96 | } |
| 97 | |
| 98 | *BITMAP_ADDR32(tmpbitmap, y, x) = pen; |
| 80 | 99 | } |
| 81 | 100 | |
| 82 | 101 | static TIMER_CALLBACK(atarist_glue_tick) |
| 83 | 102 | { |
| 84 | | UINT8 *RAM = memory_region(REGION_CPU1) + shifter.ofs; |
| 85 | | |
| 103 | int vcount = video_screen_get_vpos(0); |
| 86 | 104 | int hcount = video_screen_get_hpos(0) / 4; |
| 87 | | int vcount = video_screen_get_vpos(0); |
| 88 | 105 | |
| 89 | 106 | int de; |
| 90 | 107 | |
| r1344 | r1345 | |
| 161 | 178 | |
| 162 | 179 | de = shifter.h && shifter.v; |
| 163 | 180 | |
| 164 | | mfp68901_tbi_w(0, de); |
| 181 | if (de != shifter.de) |
| 182 | { |
| 183 | mfp68901_tbi_w(0, de); |
| 184 | shifter.de = de; |
| 185 | } |
| 165 | 186 | |
| 166 | 187 | if (de) |
| 167 | 188 | { |
| 189 | UINT8 *RAM = memory_region(REGION_CPU1) + shifter.ofs; |
| 190 | |
| 168 | 191 | shifter.ir[shifter.bitplane] = (RAM[1] << 8) | RAM[0]; |
| 169 | 192 | shifter.bitplane++; |
| 170 | 193 | shifter.ofs += 2; |
| r1344 | r1345 | |
| 375 | 398 | UINT32 srcbuf; |
| 376 | 399 | } blitter; |
| 377 | 400 | |
| 378 | | static emu_timer *blitter_timer; |
| 379 | | |
| 380 | 401 | static void atarist_blitter_source(void) |
| 381 | 402 | { |
| 382 | 403 | UINT8 *RAM = memory_region(REGION_CPU1) + blitter.src; |
| r1344 | r1345 | |
| 681 | 702 | if ((data >> 8) & ATARIST_BLITTER_CTRL_BUSY) |
| 682 | 703 | { |
| 683 | 704 | int nops = BLITTER_NOPS[blitter.op][blitter.hop]; // each NOP takes 4 cycles |
| 684 | | timer_pulse(ATTOTIME_IN_HZ((Y2/4)/(4*nops)), 0, atarist_blitter_tick); |
| 705 | timer_set(ATTOTIME_IN_HZ((Y2/4)/(4*nops)), 0, atarist_blitter_tick); |
| 685 | 706 | } |
| 686 | 707 | } |
| 687 | 708 | } |
| r1344 | r1345 | |
| 697 | 718 | { |
| 698 | 719 | atarist_shifter_timer = timer_alloc(atarist_shifter_tick); |
| 699 | 720 | atarist_glue_timer = timer_alloc(atarist_glue_tick); |
| 700 | | blitter_timer = timer_alloc(atarist_blitter_tick); |
| 701 | 721 | |
| 722 | timer_adjust(atarist_shifter_timer, video_screen_get_time_until_pos(0,0,0), 0, ATTOTIME_IN_HZ(Y2/4)); // 125 ns |
| 702 | 723 | timer_adjust(atarist_glue_timer, video_screen_get_time_until_pos(0,0,4), 0, ATTOTIME_IN_HZ(Y2/16)); // 500 ns |
| 703 | | timer_adjust(atarist_shifter_timer, video_screen_get_time_until_pos(0,0,0), 0, ATTOTIME_IN_HZ(Y2/4)); // 125 ns |
| 704 | 724 | |
| 705 | | atarist_bitmap = auto_bitmap_alloc(Machine->screen[0].width, Machine->screen[0].height, Machine->screen[0].format); |
| 706 | | |
| 707 | 725 | memset(&shifter, 0, sizeof(shifter)); |
| 708 | 726 | |
| 709 | 727 | state_save_register_global(shifter.base); |
| r1344 | r1345 | |
| 719 | 737 | state_save_register_global(shifter.shift); |
| 720 | 738 | state_save_register_global(shifter.h); |
| 721 | 739 | state_save_register_global(shifter.v); |
| 740 | state_save_register_global(shifter.de); |
| 722 | 741 | |
| 723 | 742 | state_save_register_global_array(blitter.halftone); |
| 724 | 743 | state_save_register_global(blitter.src_inc_x); |
| r1344 | r1345 | |
| 738 | 757 | state_save_register_global(blitter.ctrl); |
| 739 | 758 | state_save_register_global(blitter.skew); |
| 740 | 759 | |
| 741 | | state_save_register_bitmap("video", 0, "atarist_bitmap", atarist_bitmap); |
| 760 | video_start_generic_bitmapped(machine); |
| 742 | 761 | } |
| 743 | | |
| 744 | | VIDEO_UPDATE( atarist ) |
| 745 | | { |
| 746 | | copybitmap(bitmap, atarist_bitmap, 0, 0, 0, 0, cliprect, TRANSPARENCY_NONE, 0); |
| 747 | | |
| 748 | | return 0; |
| 749 | | } |
src/mess/drivers/atarist.c
| r1344 | r1345 | |
| 1752 | 1752 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) |
| 1753 | 1753 | MDRV_PALETTE_LENGTH(16) |
| 1754 | 1754 | MDRV_VIDEO_START( atarist ) |
| 1755 | | MDRV_VIDEO_UPDATE( atarist ) |
| 1755 | MDRV_VIDEO_UPDATE( generic_bitmapped ) |
| 1756 | 1756 | |
| 1757 | 1757 | MDRV_SCREEN_ADD("main", 0) |
| 1758 | 1758 | MDRV_SCREEN_RAW_PARAMS(Y2/4, ATARIST_HTOT_PAL, ATARIST_HBEND_PAL, ATARIST_HBSTART_PAL, ATARIST_VTOT_PAL, ATARIST_VBEND_PAL, ATARIST_VBSTART_PAL) |
| r1344 | r1345 | |
| 1789 | 1789 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) |
| 1790 | 1790 | MDRV_PALETTE_LENGTH(512) |
| 1791 | 1791 | MDRV_VIDEO_START( atarist ) |
| 1792 | | MDRV_VIDEO_UPDATE( atarist ) |
| 1792 | MDRV_VIDEO_UPDATE( generic_bitmapped ) |
| 1793 | 1793 | |
| 1794 | 1794 | MDRV_SCREEN_ADD("main", 0) |
| 1795 | 1795 | MDRV_SCREEN_RAW_PARAMS(Y2/4, ATARIST_HTOT_PAL, ATARIST_HBEND_PAL, ATARIST_HBSTART_PAL, ATARIST_VTOT_PAL, ATARIST_VBEND_PAL, ATARIST_VBSTART_PAL) |