src/mess/video/atarist.c
| r803 | r804 | |
| 20 | 20 | static struct SHIFTER
|
| 21 | 21 | {
|
| 22 | 22 | UINT32 base;
|
| 23 | | UINT32 counter;
|
| 23 | UINT32 ofs;
|
| 24 | 24 | UINT8 sync;
|
| 25 | 25 | UINT8 mode;
|
| 26 | 26 | UINT16 palette[16];
|
| r803 | r804 | |
| 49 | 49 | {
|
| 50 | 50 | case 0: // 320 x 200, 4 Plane
|
| 51 | 51 | color = (BIT(shifter.rr[3], 15) << 3) | (BIT(shifter.rr[2], 15) << 2) | (BIT(shifter.rr[1], 15) << 1) | BIT(shifter.rr[0], 15);
|
| 52 | | // logerror("y %u x %u color %u mode %u\n", y, x, color, shifter.mode);
|
| 53 | |
|
| 52 | |
| 53 | //logerror("y %u x %u color %u mode %u de %u h %u v %u hc %u\n", y, x, color, shifter.mode, shifter.h&&shifter.v, shifter.h, shifter.v, shifter.hcount);
|
| 54 | |
| 54 | 55 | *BITMAP_ADDR16(atarist_bitmap, y, x) = Machine->pens[color];
|
| 55 | 56 | |
| 56 | 57 | shifter.rr[0] <<= 1;
|
| 57 | 58 | shifter.rr[1] <<= 1;
|
| 58 | 59 | shifter.rr[2] <<= 1;
|
| 59 | 60 | shifter.rr[3] <<= 1;
|
| 61 | |
| 60 | 62 | break;
|
| 61 | 63 | |
| 62 | 64 | case 1: // 640 x 200, 2 Plane
|
| 63 | 65 | color = (BIT(shifter.rr[1], 15) << 1) | BIT(shifter.rr[0], 15);
|
| 64 | | // logerror("y %u x %u color %u mode %u\n", y, x, color, shifter.mode);
|
| 65 | 66 | |
| 66 | 67 | *BITMAP_ADDR16(atarist_bitmap, y, x) = Machine->pens[color];
|
| 67 | 68 | |
| r803 | r804 | |
| 79 | 80 | break;
|
| 80 | 81 | |
| 81 | 82 | case 2: // 640 x 400, 1 Plane
|
| 82 | | // logerror("y %u x %u color %u mode %u\n", y, x, color, shifter.mode);
|
| 83 | 83 | // unimplemented
|
| 84 | 84 | break;
|
| 85 | 85 | }
|
| r803 | r804 | |
| 88 | 88 | static TIMER_CALLBACK(atarist_glue_tick)
|
| 89 | 89 | {
|
| 90 | 90 | int de;
|
| 91 | | UINT8 *RAM = memory_region(REGION_CPU1) + shifter.base + shifter.counter;
|
| 91 | UINT8 *RAM = memory_region(REGION_CPU1) + shifter.base + shifter.ofs;
|
| 92 | 92 | |
| 93 | shifter.hcount = video_screen_get_hpos(0) / 4;
|
| 93 | 94 | shifter.vcount = video_screen_get_vpos(0);
|
| 94 | 95 | |
| 95 | 96 | if (shifter.sync & 0x02)
|
| r803 | r804 | |
| 104 | 105 | case ATARIST_HBDSTART_PAL:
|
| 105 | 106 | shifter.h = CLEAR_LINE;
|
| 106 | 107 | break;
|
| 107 | | case ATARIST_HBSTART_PAL/4:
|
| 108 | case 128:
|
| 108 | 109 | cpunum_set_input_line(0, MC68000_IRQ_2, ASSERT_LINE);
|
| 109 | | shifter.hcount = 0;
|
| 110 | 110 | break;
|
| 111 | 111 | }
|
| 112 | 112 | |
| 113 | 113 | switch (shifter.vcount)
|
| 114 | 114 | {
|
| 115 | | case ATARIST_VBSTART_PAL:
|
| 116 | | cpunum_set_input_line(0, MC68000_IRQ_4, ASSERT_LINE);
|
| 117 | | shifter.counter = 0;
|
| 118 | | break;
|
| 119 | 115 | case ATARIST_VBDEND_PAL:
|
| 120 | 116 | shifter.v = ASSERT_LINE;
|
| 121 | 117 | break;
|
| 122 | 118 | case ATARIST_VBDSTART_PAL:
|
| 123 | 119 | shifter.v = CLEAR_LINE;
|
| 124 | 120 | break;
|
| 121 | case ATARIST_VBSTART_PAL:
|
| 122 | cpunum_set_input_line(0, MC68000_IRQ_4, ASSERT_LINE);
|
| 123 | shifter.ofs = 0;
|
| 124 | break;
|
| 125 | 125 | }
|
| 126 | 126 | }
|
| 127 | 127 | else
|
| r803 | r804 | |
| 135 | 135 | case ATARIST_HBDSTART_NTSC:
|
| 136 | 136 | shifter.h = CLEAR_LINE;
|
| 137 | 137 | break;
|
| 138 | | case ATARIST_HBSTART_NTSC/4:
|
| 138 | case 127:
|
| 139 | 139 | cpunum_set_input_line(0, MC68000_IRQ_2, ASSERT_LINE);
|
| 140 | | shifter.hcount = 0;
|
| 141 | 140 | break;
|
| 142 | 141 | }
|
| 143 | 142 | |
| 144 | 143 | switch (shifter.vcount)
|
| 145 | 144 | {
|
| 146 | | case ATARIST_VBSTART_NTSC:
|
| 147 | | shifter.counter = 0;
|
| 148 | | cpunum_set_input_line(0, MC68000_IRQ_4, ASSERT_LINE);
|
| 149 | | break;
|
| 150 | 145 | case ATARIST_VBDEND_NTSC:
|
| 151 | 146 | shifter.v = ASSERT_LINE;
|
| 152 | 147 | break;
|
| 153 | 148 | case ATARIST_VBDSTART_NTSC:
|
| 154 | 149 | shifter.v = CLEAR_LINE;
|
| 155 | 150 | break;
|
| 151 | case ATARIST_VBSTART_NTSC:
|
| 152 | cpunum_set_input_line(0, MC68000_IRQ_4, ASSERT_LINE);
|
| 153 | shifter.ofs = 0;
|
| 154 | break;
|
| 156 | 155 | }
|
| 157 | 156 | }
|
| 158 | 157 | |
| 159 | 158 | de = shifter.h && shifter.v;
|
| 160 | 159 | |
| 161 | 160 | mfp68901_tbi_w(0, de);
|
| 162 | | |
| 163 | | // logerror("shifter base %x\n", shifter.base);
|
| 164 | | // logerror("shifter counter %x\n", shifter.counter);
|
| 165 | | // logerror("shifter bitplane %x\n", shifter.bitplane);
|
| 166 | | shifter.ir[shifter.bitplane] = (RAM[0] << 8) | RAM[1];
|
| 167 | | shifter.counter += 2;
|
| 168 | | shifter.bitplane++;
|
| 169 | 161 |
|
| 170 | | if (shifter.bitplane == 4)
|
| 162 | if (de)
|
| 171 | 163 | {
|
| 172 | | if (de)
|
| 164 | shifter.ir[shifter.bitplane] = (RAM[0] << 8) | RAM[1];
|
| 165 | shifter.ofs += 2;
|
| 166 | shifter.bitplane++;
|
| 167 | |
| 168 | if (shifter.bitplane == 4)
|
| 173 | 169 | {
|
| 170 | shifter.bitplane = 0;
|
| 171 |
|
| 174 | 172 | shifter.rr[0] = shifter.ir[0];
|
| 175 | 173 | shifter.rr[1] = shifter.ir[1];
|
| 176 | 174 | shifter.rr[2] = shifter.ir[2];
|
| r803 | r804 | |
| 178 | 176 | |
| 179 | 177 | shifter.ir[0] = shifter.ir[1] = shifter.ir[2] = shifter.ir[3] = 0;
|
| 180 | 178 | }
|
| 181 | | |
| 182 | | shifter.bitplane = 0;
|
| 183 | 179 | }
|
| 184 | | |
| 185 | | shifter.hcount++;
|
| 186 | 180 | }
|
| 187 | 181 | |
| 188 | 182 | READ16_HANDLER( atarist_shifter_r )
|
| r803 | r804 | |
| 195 | 189 | return (shifter.base >> 8) & 0xff;
|
| 196 | 190 | |
| 197 | 191 | case 0x04:
|
| 198 | | return (shifter.counter >> 16) & 0xff;
|
| 192 | return (shifter.ofs >> 16) & 0xff;
|
| 199 | 193 | case 0x06:
|
| 200 | | return (shifter.counter >> 8) & 0xff;
|
| 194 | return (shifter.ofs >> 8) & 0xff;
|
| 201 | 195 | case 0x08:
|
| 202 | | return shifter.counter & 0xff;
|
| 196 | return shifter.ofs & 0xff;
|
| 203 | 197 | |
| 204 | 198 | case 0x0a:
|
| 205 | 199 | return shifter.sync;
|
| r803 | r804 | |
| 262 | 256 | return shifter.base & 0xfe;
|
| 263 | 257 | |
| 264 | 258 | case 0x04:
|
| 265 | | return (shifter.counter >> 16) & 0x3f;
|
| 259 | return (shifter.ofs >> 16) & 0x3f;
|
| 266 | 260 | case 0x06:
|
| 267 | | return (shifter.counter >> 8) & 0xff;
|
| 261 | return (shifter.ofs >> 8) & 0xff;
|
| 268 | 262 | case 0x08:
|
| 269 | | return shifter.counter & 0xfe;
|
| 263 | return shifter.ofs & 0xfe;
|
| 270 | 264 | |
| 271 | 265 | case 0x0a:
|
| 272 | 266 | return shifter.sync << 8;
|
| r803 | r804 | |
| 303 | 297 | break;
|
| 304 | 298 | |
| 305 | 299 | case 0x04:
|
| 306 | | shifter.counter = (shifter.counter & 0x00ffff) | (data & 0x3f) << 16;
|
| 300 | shifter.ofs = (shifter.ofs & 0x00ffff) | (data & 0x3f) << 16;
|
| 307 | 301 | break;
|
| 308 | 302 | case 0x06:
|
| 309 | | shifter.counter = (shifter.counter & 0xff00ff) | (data & 0xff) << 8;
|
| 303 | shifter.ofs = (shifter.ofs & 0xff00ff) | (data & 0xff) << 8;
|
| 310 | 304 | break;
|
| 311 | 305 | case 0x08:
|
| 312 | | shifter.counter = (shifter.counter & 0xffff00) | (data & 0xfe);
|
| 306 | shifter.ofs = (shifter.ofs & 0xffff00) | (data & 0xfe);
|
| 313 | 307 | break;
|
| 314 | 308 | |
| 315 | 309 | case 0x0a:
|
| r803 | r804 | |
| 341 | 335 | |
| 342 | 336 | VIDEO_START( atarist )
|
| 343 | 337 | {
|
| 344 | | atarist_glue_timer = mame_timer_alloc(atarist_glue_tick);
|
| 345 | 338 | atarist_shifter_timer = mame_timer_alloc(atarist_shifter_tick);
|
| 339 | atarist_glue_timer = mame_timer_alloc(atarist_glue_tick);
|
| 346 | 340 | |
| 347 | | mame_timer_adjust(atarist_glue_timer, time_zero, 0, MAME_TIME_IN_NSEC(500));
|
| 348 | | mame_timer_adjust(atarist_shifter_timer, time_zero, 0, MAME_TIME_IN_NSEC(125));
|
| 341 | mame_timer_adjust(atarist_glue_timer, video_screen_get_time_until_pos(0,0,0), 0, MAME_TIME_IN_HZ(Y2/16)); // 500 ns
|
| 342 | mame_timer_adjust(atarist_shifter_timer, video_screen_get_time_until_pos(0,0,0), 0, MAME_TIME_IN_HZ(Y2/4)); // 125 ns
|
| 349 | 343 | |
| 350 | 344 | atarist_bitmap = auto_bitmap_alloc(Machine->screen[0].width, Machine->screen[0].height, Machine->screen[0].format);
|
| 351 | 345 | |
src/mess/drivers/atarist.c
| r803 | r804 | |
| 20 | 20 | TODO: |
| 21 | 21 | |
| 22 | 22 | - US keyboard layout |
| 23 | | - HD6310 cpu core |
| 23 | - add serial communications to HD63710 cpu core |
| 24 | 24 | - connect keyboard ports to ikbd |
| 25 | 25 | - connect mouse to ikbd |
| 26 | | - connect ikbd to ACIA #0 |
| 27 | 26 | - floppy image device_load |
| 28 | 27 | - MFP interrupts |
| 29 | 28 | - accurate screen timing |
| r803 | r804 | |
| 36 | 35 | */ |
| 37 | 36 | |
| 38 | 37 | #define Y1 2457600.0 |
| 39 | | #define Y2 32084988.0 |
| 40 | | #define Y2_NTSC 32042400.0 |
| 41 | 38 | |
| 42 | 39 | /* WD1772 FDC */ |
| 43 | 40 | |
| r803 | r804 | |
| 318 | 315 | /* Memory Maps */ |
| 319 | 316 | |
| 320 | 317 | static ADDRESS_MAP_START(keyboard_map, ADDRESS_SPACE_PROGRAM, 8) |
| 321 | | AM_RANGE(0x0000, 0x001f) AM_RAM |
| 318 | AM_RANGE(0x0000, 0x001f) AM_READWRITE(hd63701_internal_registers_r, hd63701_internal_registers_w) |
| 322 | 319 | AM_RANGE(0x0080, 0x00ff) AM_RAM |
| 323 | 320 | AM_RANGE(0xf000, 0xffff) AM_ROM |
| 324 | 321 | ADDRESS_MAP_END |
| 325 | 322 | |
| 326 | 323 | static ADDRESS_MAP_START(keyboard_io_map, ADDRESS_SPACE_IO, 8) |
| 327 | | /* AM_RANGE(HD63701_PORT1, HD63701_PORT1) AM_WRITE(hd6301_port1_w) |
| 324 | AM_RANGE(HD63701_PORT1, HD63701_PORT1) AM_WRITE(hd6301_port1_w) |
| 328 | 325 | AM_RANGE(HD63701_PORT2, HD63701_PORT2) AM_READWRITE(hd6301_port2_r, hd6301_port2_w) |
| 329 | 326 | AM_RANGE(HD63701_PORT3, HD63701_PORT3) AM_READ(hd6301_port_3_r) |
| 330 | | AM_RANGE(HD63701_PORT4, HD63701_PORT4) AM_READ(hd6301_port_4_r)*/ |
| 327 | AM_RANGE(HD63701_PORT4, HD63701_PORT4) AM_READ(hd6301_port_4_r) |
| 331 | 328 | ADDRESS_MAP_END |
| 332 | 329 | |
| 333 | 330 | static ADDRESS_MAP_START(st_map, ADDRESS_SPACE_PROGRAM, 16) |