src/mess/video/astrocde.c
| r1964 | r1965 | |
| 34 | 34 | static int LastShifter = 0; |
| 35 | 35 | static int astrocade_mode = 0; |
| 36 | 36 | |
| 37 | static UINT8 interrupt_vector = 0; |
| 38 | |
| 39 | static int screen_interrupt_enabled; |
| 40 | static int screen_interrupt_mode; |
| 41 | static int screen_interrupt_line = 0; |
| 42 | |
| 43 | static int lightpen_interrupt_enabled; |
| 44 | static int lightpen_interrupt_mode; |
| 45 | |
| 46 | |
| 37 | 47 | /* These are the bits of the Magic Register */ |
| 38 | 48 | static const unsigned char SHIFT_MASK = 0x03; |
| 39 | 49 | static const unsigned char ROTATE_MASK = 0x04; |
| r1964 | r1965 | |
| 42 | 52 | static const unsigned char XOR_MASK = 0x20; |
| 43 | 53 | static const unsigned char FLOP_MASK = 0x40; |
| 44 | 54 | |
| 45 | | /* ======================================================================= */ |
| 46 | 55 | |
| 47 | | enum { FAKE_BLK,FAKE_YLW,FAKE_BLU,FAKE_RED,FAKE_WHT }; |
| 48 | 56 | |
| 57 | /************************************* |
| 58 | * |
| 59 | * Palette |
| 60 | * |
| 61 | *************************************/ |
| 62 | |
| 49 | 63 | PALETTE_INIT( astrocade ) |
| 50 | 64 | { |
| 51 | 65 | /* This routine builds a palette using a transformation from */ |
| r1964 | r1965 | |
| 112 | 126 | } |
| 113 | 127 | } |
| 114 | 128 | |
| 115 | | WRITE8_HANDLER( astrocade_vertical_blank_w ) |
| 129 | |
| 130 | |
| 131 | /************************************* |
| 132 | * |
| 133 | * Interrupts |
| 134 | * |
| 135 | *************************************/ |
| 136 | |
| 137 | WRITE8_HANDLER( astrocade_interrupt_enable_w ) |
| 116 | 138 | { |
| 117 | | VerticalBlank = data; |
| 139 | screen_interrupt_enabled = data & 0x08; |
| 140 | screen_interrupt_mode = data & 0x04; |
| 141 | |
| 142 | lightpen_interrupt_enabled = data & 0x02; |
| 143 | lightpen_interrupt_mode = data & 0x01; |
| 144 | |
| 145 | LOG(("Interrupt Flag set to %02x\n",data & 0x0f)); |
| 118 | 146 | } |
| 119 | 147 | |
| 120 | | READ8_HANDLER( astrocade_intercept_r ) |
| 148 | |
| 149 | WRITE8_HANDLER( astrocade_interrupt_w ) |
| 121 | 150 | { |
| 122 | | int res; |
| 151 | /* in low res mode, only bits 1-7 are used */ |
| 152 | screen_interrupt_line = astrocade_mode ? data : data >> 1; |
| 153 | |
| 154 | LOG(("Scanline interrupt set to %02x\n", screen_interrupt_line)); |
| 155 | } |
| 123 | 156 | |
| 124 | | res = collision; |
| 125 | | collision = 0; |
| 126 | 157 | |
| 127 | | return res; |
| 158 | WRITE8_HANDLER( astrocade_interrupt_vector_w ) |
| 159 | { |
| 160 | interrupt_vector = data; |
| 128 | 161 | } |
| 129 | 162 | |
| 130 | 163 | |
| 131 | | READ8_HANDLER( astrocade_video_retrace_r ) |
| 164 | |
| 165 | /************************************* |
| 166 | * |
| 167 | * VBlank |
| 168 | * |
| 169 | *************************************/ |
| 170 | |
| 171 | WRITE8_HANDLER( astrocade_vertical_blank_w ) |
| 132 | 172 | { |
| 133 | | return video_screen_get_vpos(0); |
| 173 | VerticalBlank = data; |
| 134 | 174 | } |
| 135 | 175 | |
| 136 | 176 | |
| 137 | | /* Switches colour registers at this zone - 40 zones */ |
| 138 | | /* Also sets the background colors */ |
| 139 | | |
| 140 | | WRITE8_HANDLER ( astrocade_colour_split_w ) |
| 177 | READ8_HANDLER( astrocade_video_retrace_r ) |
| 141 | 178 | { |
| 142 | | ColourSplit = data&0x3f; |
| 179 | return video_screen_get_vpos(0); |
| 180 | } |
| 143 | 181 | |
| 144 | | if (astrocade_mode == 1) |
| 145 | | ColourSplit <<= 1; |
| 146 | 182 | |
| 147 | | BackgroundData = ((data&0xc0) >> 6) * 0x55; |
| 148 | 183 | |
| 149 | | LOG(("Colour split set to %02d\n",ColourSplit)); |
| 150 | | } |
| 184 | /************************************* |
| 185 | * |
| 186 | * Screen mode |
| 187 | * |
| 188 | *************************************/ |
| 151 | 189 | |
| 152 | | /* This selects commercial (high res, arcade) or |
| 153 | | consumer (low res, astrocade) mode */ |
| 190 | /*------------------------------------------------- |
| 191 | astrocade_mode_w - this selects commercial |
| 192 | (high res, arcade) or consumer |
| 193 | (low res, astrocade) mode |
| 194 | -------------------------------------------------*/ |
| 154 | 195 | |
| 155 | 196 | WRITE8_HANDLER( astrocade_mode_w ) |
| 156 | 197 | { |
| r1964 | r1965 | |
| 163 | 204 | visarea.min_x = 0; |
| 164 | 205 | visarea.max_x = 319; |
| 165 | 206 | visarea.min_y = 0; |
| 166 | | visarea.max_y = 203; |
| 207 | visarea.max_y = 255; |
| 167 | 208 | |
| 168 | 209 | video_screen_configure(0, 455, 268, &visarea, HZ_TO_ATTOSECONDS(XTAL_Y1/2) * 268 * 455); |
| 169 | 210 | } |
| r1964 | r1965 | |
| 173 | 214 | visarea.min_x = 0; |
| 174 | 215 | visarea.max_x = 159; |
| 175 | 216 | visarea.min_y = 0; |
| 176 | | visarea.max_y = 101; |
| 217 | visarea.max_y = 127; |
| 177 | 218 | |
| 178 | 219 | video_screen_configure(0, 455, 134, &visarea, HZ_TO_ATTOSECONDS(XTAL_Y1/4) * 134 * 455); |
| 179 | 220 | } |
| 180 | 221 | } |
| 181 | 222 | |
| 182 | | WRITE8_HANDLER ( astrocade_colour_register_w ) |
| 223 | |
| 224 | |
| 225 | /************************************* |
| 226 | * |
| 227 | * Collisions |
| 228 | * |
| 229 | *************************************/ |
| 230 | |
| 231 | READ8_HANDLER( astrocade_intercept_r ) |
| 183 | 232 | { |
| 233 | int res; |
| 234 | |
| 235 | res = collision; |
| 236 | collision = 0; |
| 237 | |
| 238 | return res; |
| 239 | } |
| 240 | |
| 241 | |
| 242 | |
| 243 | /************************************* |
| 244 | * |
| 245 | * Colors |
| 246 | * |
| 247 | *************************************/ |
| 248 | |
| 249 | /*------------------------------------------------- |
| 250 | astrocade_colour_split_w - switches colour |
| 251 | registers at this zone - 40 zones |
| 252 | also sets the background colors |
| 253 | -------------------------------------------------*/ |
| 254 | |
| 255 | WRITE8_HANDLER ( astrocade_colour_split_w ) |
| 256 | { |
| 257 | ColourSplit = data&0x3f; |
| 258 | |
| 259 | if (astrocade_mode == 1) |
| 260 | ColourSplit <<= 1; |
| 261 | |
| 262 | BackgroundData = ((data&0xc0) >> 6) * 0x55; |
| 263 | |
| 264 | LOG(("Colour split set to %02d\n", ColourSplit)); |
| 265 | } |
| 266 | |
| 267 | WRITE8_HANDLER( astrocade_colour_register_w ) |
| 268 | { |
| 184 | 269 | if(Colour[offset] != data) |
| 185 | 270 | { |
| 186 | 271 | Colour[offset] = data; |
| r1964 | r1965 | |
| 213 | 298 | } |
| 214 | 299 | |
| 215 | 300 | |
| 216 | | WRITE8_HANDLER ( astrocade_magic_expand_color_w ) |
| 301 | |
| 302 | /************************************* |
| 303 | * |
| 304 | * Magic RAM |
| 305 | * |
| 306 | *************************************/ |
| 307 | |
| 308 | WRITE8_HANDLER( astrocade_magic_expand_color_w ) |
| 217 | 309 | { |
| 218 | 310 | //LOG(("%04x: magic_expand_color = %02x\n",cpu_getpc(),data)); |
| 219 | 311 | |
| r1964 | r1965 | |
| 221 | 313 | } |
| 222 | 314 | |
| 223 | 315 | |
| 224 | | WRITE8_HANDLER ( astrocade_magic_control_w ) |
| 316 | WRITE8_HANDLER( astrocade_magic_control_w ) |
| 225 | 317 | { |
| 226 | 318 | //LOG(("%04x: magic_control = %02x\n",cpu_getpc(),data)); |
| 227 | 319 | |
| r1964 | r1965 | |
| 231 | 323 | magic_control = data; |
| 232 | 324 | } |
| 233 | 325 | |
| 234 | | WRITE8_HANDLER ( astrocade_magicram_w ) |
| 326 | |
| 327 | WRITE8_HANDLER( astrocade_magicram_w ) |
| 235 | 328 | { |
| 236 | 329 | unsigned int data1,shift,bits,bibits,stib,k,old_data; |
| 237 | 330 | |
| r1964 | r1965 | |
| 353 | 446 | } |
| 354 | 447 | |
| 355 | 448 | |
| 449 | |
| 450 | /************************************* |
| 451 | * |
| 452 | * Video update and interrupts |
| 453 | * |
| 454 | *************************************/ |
| 455 | |
| 356 | 456 | VIDEO_UPDATE( astrocde ) |
| 357 | 457 | { |
| 358 | 458 | int line = video_screen_get_vpos(0); |
| r1964 | r1965 | |
| 362 | 462 | |
| 363 | 463 | int i; |
| 364 | 464 | |
| 465 | /* scanline interrupt? */ |
| 466 | if (screen_interrupt_enabled && (line == screen_interrupt_line)) |
| 467 | cpunum_set_input_line_and_vector(machine, 0, 0, |
| 468 | screen_interrupt_mode ? ASSERT_LINE : HOLD_LINE, interrupt_vector); |
| 469 | else |
| 470 | cpunum_set_input_line(machine, 0, 0, CLEAR_LINE); |
| 471 | |
| 365 | 472 | LeftLineColour[line] = LeftColourCheck; |
| 366 | 473 | RightLineColour[line] = RightColourCheck; |
| 367 | | |
| 474 | |
| 368 | 475 | for (i = 0; i < num_bytes; i++, memloc++) |
| 369 | 476 | { |
| 370 | 477 | int data, x; |
src/mess/machine/astrocde.c
| r1964 | r1965 | |
| 1 | | /************************************************************************** |
| 2 | | |
| 3 | | Interrupt System Hardware for Bally/Midway games |
| 4 | | |
| 5 | | Mike@Dissfulfils.co.uk |
| 6 | | |
| 7 | | **************************************************************************/ |
| 8 | | |
| 9 | | #include "driver.h" |
| 10 | | #include "includes/astrocde.h" |
| 11 | | #include "cpu/z80/z80.h" |
| 12 | | |
| 13 | | #ifdef MAME_DEBUG |
| 14 | | #define VERBOSE 1 |
| 15 | | #else |
| 16 | | #define VERBOSE 0 |
| 17 | | #endif |
| 18 | | #define LOG(x) do { if (VERBOSE) logerror x; } while (0) |
| 19 | | |
| 20 | | |
| 21 | | /**************************************************************************** |
| 22 | | * Scanline Interrupt System |
| 23 | | ****************************************************************************/ |
| 24 | | |
| 25 | | static emu_timer *scanline_timer; |
| 26 | | |
| 27 | | static int NextScanInt=0; /* Normal */ |
| 28 | | |
| 29 | | static int screen_interrupts_enabled; |
| 30 | | static int screen_interrupt_mode; |
| 31 | | static int lightpen_interrupts_enabled; |
| 32 | | static int lightpen_interrupt_mode; |
| 33 | | |
| 34 | | |
| 35 | | WRITE8_HANDLER ( astrocade_interrupt_enable_w ) |
| 36 | | { |
| 37 | | |
| 38 | | screen_interrupts_enabled = data & 0x08; |
| 39 | | screen_interrupt_mode = data & 0x04; |
| 40 | | lightpen_interrupts_enabled = data & 0x02; |
| 41 | | lightpen_interrupt_mode = data & 0x01; |
| 42 | | |
| 43 | | LOG(("Interrupt Flag set to %02x\n",data & 0x0f)); |
| 44 | | } |
| 45 | | |
| 46 | | WRITE8_HANDLER ( astrocade_interrupt_w ) |
| 47 | | { |
| 48 | | /* A write to 0F triggers an interrupt at that scanline */ |
| 49 | | |
| 50 | | LOG(("Scanline interrupt set to %02x\n",data)); |
| 51 | | |
| 52 | | /* in low res mode, bits 1-7 are used */ |
| 53 | | NextScanInt = machine->screen[0].height == 134 ? data >> 1 : data; |
| 54 | | } |
| 55 | | |
| 56 | | |
| 57 | | static TIMER_CALLBACK( astrocde_scanline_callback ) |
| 58 | | { |
| 59 | | int scanline = video_screen_get_vpos(0); |
| 60 | | |
| 61 | | /* scanline interrupt? */ |
| 62 | | if (screen_interrupts_enabled && (screen_interrupt_mode == 0) && (scanline == NextScanInt)) |
| 63 | | cpunum_set_input_line(machine, 0, 0, HOLD_LINE); |
| 64 | | |
| 65 | | /* are we on the last scanline? */ |
| 66 | | if (++scanline == machine->screen[0].height) |
| 67 | | scanline = 0; |
| 68 | | |
| 69 | | /* wait for next scanline */ |
| 70 | | timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(0, scanline, 0), 0); |
| 71 | | } |
| 72 | | |
| 73 | | |
| 74 | | WRITE8_HANDLER( astrocade_interrupt_vector_w ) |
| 75 | | { |
| 76 | | cpunum_set_input_line_vector(0, 0, data); |
| 77 | | cpunum_set_input_line(machine, 0, 0, CLEAR_LINE); |
| 78 | | } |
| 79 | | |
| 80 | | |
| 81 | | MACHINE_RESET( astrocde ) |
| 82 | | { |
| 83 | | /* wait for the first scanline */ |
| 84 | | timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0); |
| 85 | | } |
| 86 | | |
| 87 | | |
| 88 | | DRIVER_INIT( astrocde ) |
| 89 | | { |
| 90 | | scanline_timer = timer_alloc(astrocde_scanline_callback, NULL); |
| 91 | | } |
src/mess/drivers/astrocde.c
| r1964 | r1965 | |
| 227 | 227 | MDRV_CPU_PROGRAM_MAP(astrocade_mem, 0) |
| 228 | 228 | MDRV_CPU_IO_MAP(astrocade_io, 0) |
| 229 | 229 | |
| 230 | | MDRV_MACHINE_RESET(astrocde) |
| 231 | | |
| 232 | 230 | /* video hardware */ |
| 233 | 231 | MDRV_SCREEN_ADD("main", RASTER) |
| 234 | 232 | MDRV_SCREEN_RAW_PARAMS(XTAL_Y1/2, 455, 0, 320, 268, 0, 204) |
| 235 | 233 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 234 | |
| 236 | 235 | MDRV_PALETTE_LENGTH(8*32) |
| 237 | 236 | MDRV_PALETTE_INIT(astrocade) |
| 238 | 237 | |
| r1964 | r1965 | |
| 285 | 284 | * |
| 286 | 285 | *************************************/ |
| 287 | 286 | |
| 288 | | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ |
| 289 | | CONS( 1978, astrocde, 0, 0, astrocde, astrocde, astrocde, astrocde, "Bally Manufacturing", "Bally Professional Arcade", 0) |
| 290 | | CONS( 1977, astrocdw, astrocde, 0, astrocde, astrocde, astrocde, astrocde, "Bally Manufacturing", "Bally Computer System", 0) |
| 287 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ |
| 288 | CONS( 1978, astrocde, 0, 0, astrocde, astrocde, 0, astrocde, "Bally Manufacturing", "Bally Professional Arcade", 0) |
| 289 | CONS( 1977, astrocdw, astrocde, 0, astrocde, astrocde, 0, astrocde, "Bally Manufacturing", "Bally Computer System", 0) |