src/mess/includes/astrocde.h
| r1897 | r1898 | |
| 10 | 10 | |
| 11 | 11 | /*----------- defined in machine/astrocde.c -----------*/ |
| 12 | 12 | |
| 13 | | extern WRITE8_HANDLER( astrocade_interrupt_enable_w ); |
| 14 | | extern WRITE8_HANDLER( astrocade_interrupt_w ); |
| 15 | | extern INTERRUPT_GEN( astrocade_interrupt ); |
| 13 | WRITE8_HANDLER( astrocade_interrupt_enable_w ); |
| 14 | WRITE8_HANDLER( astrocade_interrupt_w ); |
| 16 | 15 | WRITE8_HANDLER ( astrocade_interrupt_vector_w ); |
| 16 | MACHINE_RESET( astrocde ); |
| 17 | DRIVER_INIT( astrocde ); |
| 17 | 18 | |
| 18 | 19 | |
| 19 | 20 | /*----------- defined in video/astrocde.c -----------*/ |
src/mess/video/astrocde.c
| r1897 | r1898 | |
| 112 | 112 | palette_set_color_rgb(machine, i*8+j, floor(R+.5), floor(G+.5), floor(B+.5)); |
| 113 | 113 | } |
| 114 | 114 | } |
| 115 | | |
| 116 | | /* Set the fake colortable for the dip switch menus, etc. */ |
| 117 | 115 | } |
| 118 | 116 | |
| 119 | | WRITE8_HANDLER ( astrocade_vertical_blank_w ) |
| 117 | WRITE8_HANDLER( astrocade_vertical_blank_w ) |
| 120 | 118 | { |
| 121 | 119 | VerticalBlank = data; |
| 122 | 120 | } |
| 123 | 121 | |
| 124 | | READ8_HANDLER ( astrocade_intercept_r ) |
| 122 | READ8_HANDLER( astrocade_intercept_r ) |
| 125 | 123 | { |
| 126 | 124 | int res; |
| 127 | 125 | |
| r1897 | r1898 | |
| 132 | 130 | } |
| 133 | 131 | |
| 134 | 132 | |
| 135 | | READ8_HANDLER ( astrocade_video_retrace_r ) |
| 133 | READ8_HANDLER( astrocade_video_retrace_r ) |
| 136 | 134 | { |
| 137 | | extern int CurrentScan; |
| 138 | | |
| 139 | | return CurrentScan; |
| 135 | return video_screen_get_vpos(0); |
| 140 | 136 | } |
| 141 | 137 | |
| 138 | |
| 142 | 139 | /* Switches colour registers at this zone - 40 zones */ |
| 143 | 140 | /* Also sets the background colors */ |
| 144 | 141 | |
src/mess/machine/astrocde.c
| r1897 | r1898 | |
| 22 | 22 | * Scanline Interrupt System |
| 23 | 23 | ****************************************************************************/ |
| 24 | 24 | |
| 25 | | int CurrentScan=0; |
| 25 | static emu_timer *scanline_timer; |
| 26 | |
| 26 | 27 | static int NextScanInt=0; /* Normal */ |
| 27 | 28 | |
| 28 | 29 | static int screen_interrupts_enabled; |
| r1897 | r1898 | |
| 39 | 40 | lightpen_interrupts_enabled = data & 0x02; |
| 40 | 41 | lightpen_interrupt_mode = data & 0x01; |
| 41 | 42 | |
| 42 | | LOG(("Interrupt Flag set to %02x\n",data & 0x0f)); |
| 43 | LOG(("Interrupt Flag set to %02x\n",data & 0x0f)); |
| 43 | 44 | } |
| 44 | 45 | |
| 45 | 46 | WRITE8_HANDLER ( astrocade_interrupt_w ) |
| r1897 | r1898 | |
| 51 | 52 | NextScanInt = data; |
| 52 | 53 | } |
| 53 | 54 | |
| 54 | | INTERRUPT_GEN( astrocade_interrupt ) |
| 55 | |
| 56 | static TIMER_CALLBACK( astrocde_scanline_callback ) |
| 55 | 57 | { |
| 56 | | CurrentScan++; |
| 58 | int scanline = video_screen_get_vpos(0); |
| 59 | |
| 60 | /* draw if we are in the visable area */ |
| 61 | if (scanline < machine->screen[0].visarea.max_y) |
| 62 | astrocade_copy_line(scanline); |
| 63 | |
| 64 | /* scanline interrupt? */ |
| 65 | if (screen_interrupts_enabled && (screen_interrupt_mode == 0) && (scanline == NextScanInt)) |
| 66 | cpunum_set_input_line(machine, 0, 0, HOLD_LINE); |
| 57 | 67 | |
| 58 | | if (CurrentScan == machine->config->cpu[0].vblank_interrupts_per_frame) |
| 59 | | CurrentScan = 0; |
| 68 | /* are we on the last scanline? */ |
| 69 | if (++scanline == machine->screen[0].height) |
| 70 | scanline = 0; |
| 60 | 71 | |
| 61 | | if (CurrentScan < 204) astrocade_copy_line(CurrentScan); |
| 62 | | |
| 63 | | /* Scanline interrupt enabled ? */ |
| 64 | | if ((screen_interrupts_enabled) && (screen_interrupt_mode == 0) |
| 65 | | && (CurrentScan == NextScanInt)) |
| 66 | | cpunum_set_input_line(machine, 0, 0, HOLD_LINE); |
| 72 | /* wait for next scanline */ |
| 73 | timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(0, scanline, 0), 0); |
| 67 | 74 | } |
| 68 | 75 | |
| 76 | |
| 69 | 77 | WRITE8_HANDLER( astrocade_interrupt_vector_w ) |
| 70 | 78 | { |
| 71 | 79 | cpunum_set_input_line_vector(0, 0, data); |
| 72 | 80 | cpunum_set_input_line(machine, 0, 0, CLEAR_LINE); |
| 73 | 81 | } |
| 82 | |
| 83 | |
| 84 | MACHINE_RESET( astrocde ) |
| 85 | { |
| 86 | /* wait for the first scanline */ |
| 87 | timer_adjust_oneshot(scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0); |
| 88 | } |
| 89 | |
| 90 | |
| 91 | DRIVER_INIT( astrocde ) |
| 92 | { |
| 93 | scanline_timer = timer_alloc(astrocde_scanline_callback, NULL); |
| 94 | } |
src/mess/drivers/astrocde.c
| r1897 | r1898 | |
| 226 | 226 | MDRV_CPU_ADD(Z80, 1789000) /* 1.789 Mhz */ |
| 227 | 227 | MDRV_CPU_PROGRAM_MAP(astrocade_mem, 0) |
| 228 | 228 | MDRV_CPU_IO_MAP(astrocade_io, 0) |
| 229 | | MDRV_CPU_VBLANK_INT_HACK(astrocade_interrupt, 256) |
| 230 | | MDRV_INTERLEAVE(1) |
| 231 | 229 | |
| 230 | MDRV_MACHINE_RESET(astrocde) |
| 231 | |
| 232 | 232 | /* video hardware */ |
| 233 | 233 | MDRV_SCREEN_ADD("main", RASTER) |
| 234 | 234 | MDRV_SCREEN_REFRESH_RATE(60) |
| 235 | 235 | MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 236 | 236 | MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) |
| 237 | | MDRV_SCREEN_SIZE(320, 204) |
| 237 | MDRV_SCREEN_SIZE(320, 256) |
| 238 | 238 | MDRV_SCREEN_VISIBLE_AREA(0, 320-1, 0, 204-1) |
| 239 | 239 | MDRV_PALETTE_LENGTH(8*32) |
| 240 | 240 | MDRV_PALETTE_INIT( astrocade ) |
| r1897 | r1898 | |
| 288 | 288 | * |
| 289 | 289 | *************************************/ |
| 290 | 290 | |
| 291 | | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ |
| 292 | | CONS( 1978, astrocde, 0, 0, astrocde, astrocde, 0, astrocde, "Bally Manufacturing", "Bally Professional Arcade", 0) |
| 293 | | CONS( 1977, astrocdw, astrocde, 0, astrocde, astrocde, 0, astrocde, "Bally Manufacturing", "Bally Computer System", 0) |
| 291 | /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT CONFIG COMPANY FULLNAME FLAGS */ |
| 292 | CONS( 1978, astrocde, 0, 0, astrocde, astrocde, astrocde, astrocde, "Bally Manufacturing", "Bally Professional Arcade", 0) |
| 293 | CONS( 1977, astrocdw, astrocde, 0, astrocde, astrocde, astrocde, astrocde, "Bally Manufacturing", "Bally Computer System", 0) |