src/mess/video/zx.c
| r1998 | r1999 | |
| 17 | 17 | ****************************************************************************/ |
| 18 | 18 | |
| 19 | 19 | #include "driver.h" |
| 20 | #include "deprecat.h" |
| 20 | 21 | #include "cpu/z80/z80.h" |
| 21 | 22 | #include "includes/zx.h" |
| 22 | 23 | #include "sound/dac.h" |
| r1998 | r1999 | |
| 52 | 53 | rectangle r; |
| 53 | 54 | bitmap_t *bitmap = tmpbitmap; |
| 54 | 55 | |
| 55 | | new_y = video_screen_get_vpos(0); |
| 56 | | new_x = video_screen_get_hpos(0); |
| 56 | new_y = video_screen_get_vpos(machine->primary_screen); |
| 57 | new_x = video_screen_get_hpos(machine->primary_screen); |
| 57 | 58 | /* logerror("zx_ula_bkgnd: %3d,%3d - %3d,%3d\n", old_x, old_y, new_x, new_y);*/ |
| 58 | 59 | y = old_y; |
| 59 | 60 | for (;;) |
| r1998 | r1999 | |
| 106 | 107 | rectangle r = *video_screen_get_visible_area(screen); |
| 107 | 108 | bitmap_t *bitmap = tmpbitmap; |
| 108 | 109 | |
| 109 | | r.min_y = r.max_y = video_screen_get_vpos(0); |
| 110 | r.min_y = r.max_y = video_screen_get_vpos(machine->primary_screen); |
| 110 | 111 | fillbitmap(bitmap, machine->pens[1], &r); |
| 111 | | logerror("ULA %3d[%d] NMI, R:$%02X, $%04x\n", video_screen_get_vpos(0), ula_scancode_count, (unsigned) cpunum_get_reg(0, Z80_R), (unsigned) cpunum_get_reg(0, Z80_PC)); |
| 112 | logerror("ULA %3d[%d] NMI, R:$%02X, $%04x\n", video_screen_get_vpos(machine->primary_screen), ula_scancode_count, (unsigned) cpunum_get_reg(0, Z80_R), (unsigned) cpunum_get_reg(0, Z80_PC)); |
| 112 | 113 | cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); |
| 113 | 114 | if (++ula_scanline_count == height) |
| 114 | 115 | ula_scanline_count = 0; |
| r1998 | r1999 | |
| 126 | 127 | */ |
| 127 | 128 | if (ula_irq_active) |
| 128 | 129 | { |
| 129 | | logerror("ULA %3d[%d] IRQ, R:$%02X, $%04x\n", video_screen_get_vpos(0), ula_scancode_count, (unsigned) cpunum_get_reg(0, Z80_R), (unsigned) cpunum_get_reg(0, Z80_PC)); |
| 130 | logerror("ULA %3d[%d] IRQ, R:$%02X, $%04x\n", video_screen_get_vpos(machine->primary_screen), ula_scancode_count, (unsigned) cpunum_get_reg(0, Z80_R), (unsigned) cpunum_get_reg(0, Z80_PC)); |
| 130 | 131 | |
| 131 | 132 | ula_irq_active = 0; |
| 132 | 133 | if (++ula_scancode_count == 8) |
| r1998 | r1999 | |
| 151 | 152 | chrgen = memory_region(region); |
| 152 | 153 | ireg = cpunum_get_reg(0, Z80_I) << 8; |
| 153 | 154 | rreg = cpunum_get_reg(0, Z80_R); |
| 154 | | y = video_screen_get_vpos(0); |
| 155 | y = video_screen_get_vpos(Machine->primary_screen); |
| 155 | 156 | |
| 156 | 157 | cycles = 4 * (64 - (rreg & 63)); |
| 157 | 158 | timer_set(ATTOTIME_IN_CYCLES(cycles, 0), NULL, 0, zx_ula_irq); |
src/mess/video/x68k.c
| r1998 | r1999 | |
| 229 | 229 | |
| 230 | 230 | video_screen_configure(machine->primary_screen,sys.crtc.video_width,sys.crtc.video_height,&rect,HZ_TO_ATTOSECONDS(55.45)); |
| 231 | 231 | logerror("video_screen_configure(machine->primary_screen,%i,%i,[%i,%i,%i,%i],55.45)\n",sys.crtc.video_width,sys.crtc.video_height,rect.min_x,rect.min_y,rect.max_x,rect.max_y); |
| 232 | | // x68k_scanline = video_screen_get_vpos(0); |
| 232 | // x68k_scanline = video_screen_get_vpos(machine->primary_screen); |
| 233 | 233 | if(sys.crtc.reg[4] != 0) |
| 234 | 234 | { |
| 235 | 235 | // scantime = ATTOTIME_IN_HZ(55.45) / sys.crtc.reg[4]; |
| r1998 | r1999 | |
| 245 | 245 | sys.crtc.hblank = state; |
| 246 | 246 | if(state == 1) |
| 247 | 247 | { |
| 248 | | int scan = video_screen_get_vpos(0); |
| 248 | int scan = video_screen_get_vpos(machine->primary_screen); |
| 249 | 249 | if(scan > sys.crtc.vend) |
| 250 | 250 | scan = 0; |
| 251 | | hsync_time = video_screen_get_time_until_pos(0,scan+1,sys.crtc.hsync_end); |
| 251 | hsync_time = video_screen_get_time_until_pos(machine->primary_screen,scan+1,sys.crtc.hsync_end); |
| 252 | 252 | timer_adjust_oneshot(scanline_timer, hsync_time, 0); |
| 253 | 253 | } |
| 254 | 254 | if(state == 0) |
| 255 | 255 | { |
| 256 | | hsync_time = video_screen_get_time_until_pos(0,video_screen_get_vpos(0),sys.crtc.hend); |
| 256 | hsync_time = video_screen_get_time_until_pos(machine->primary_screen,video_screen_get_vpos(machine->primary_screen),sys.crtc.hend); |
| 257 | 257 | timer_adjust_oneshot(scanline_timer, hsync_time, 1); |
| 258 | 258 | // if(!(sys.mfp.gpio & 0x40)) // if GPIP6 is active, clear it |
| 259 | 259 | // sys.mfp.gpio |= 0x40; |
| r1998 | r1999 | |
| 277 | 277 | video_screen_update_partial(0,scan); |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | | irq_time = video_screen_get_time_until_pos(0,scan,2); |
| 280 | irq_time = video_screen_get_time_until_pos(machine->primary_screen,scan,2); |
| 281 | 281 | // end of HBlank period clears GPIP6 also? |
| 282 | | end_time = video_screen_get_time_until_pos(0,scan,sys.crtc.hbegin); |
| 282 | end_time = video_screen_get_time_until_pos(machine->primary_screen,scan,sys.crtc.hbegin); |
| 283 | 283 | timer_adjust_oneshot(raster_irq, irq_time, scan); |
| 284 | 284 | timer_set(end_time,NULL,0,x68k_crtc_raster_end); |
| 285 | | logerror("GPIP6: Raster triggered at line %i (%i)\n",scan,video_screen_get_vpos(0)); |
| 285 | logerror("GPIP6: Raster triggered at line %i (%i)\n",scan,video_screen_get_vpos(machine->primary_screen)); |
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | TIMER_CALLBACK(x68k_crtc_vblank_irq) |
| r1998 | r1999 | |
| 297 | 297 | vblank_line = sys.crtc.vend; |
| 298 | 298 | if(vblank_line > sys.crtc.vtotal) |
| 299 | 299 | vblank_line = sys.crtc.vtotal; |
| 300 | | irq_time = video_screen_get_time_until_pos(0,vblank_line,2); |
| 300 | irq_time = video_screen_get_time_until_pos(machine->primary_screen,vblank_line,2); |
| 301 | 301 | timer_adjust_oneshot(vblank_irq, irq_time, 0); |
| 302 | 302 | logerror("CRTC: VBlank on\n"); |
| 303 | 303 | } |
| r1998 | r1999 | |
| 305 | 305 | { |
| 306 | 306 | sys.crtc.vblank = 0; |
| 307 | 307 | vblank_line = sys.crtc.vbegin; |
| 308 | | irq_time = video_screen_get_time_until_pos(0,vblank_line,2); |
| 308 | irq_time = video_screen_get_time_until_pos(machine->primary_screen,vblank_line,2); |
| 309 | 309 | timer_adjust_oneshot(vblank_irq, irq_time, 1); |
| 310 | 310 | logerror("CRTC: VBlank off\n"); |
| 311 | 311 | } |
| r1998 | r1999 | |
| 381 | 381 | if(data != 0) |
| 382 | 382 | { |
| 383 | 383 | attotime irq_time; |
| 384 | | irq_time = video_screen_get_time_until_pos(0,(data - 1) / sys.crtc.vmultiple,2); |
| 384 | irq_time = video_screen_get_time_until_pos(machine->primary_screen,(data - 1) / sys.crtc.vmultiple,2); |
| 385 | 385 | |
| 386 | 386 | if(attotime_to_double(irq_time) > 0) |
| 387 | 387 | timer_adjust_oneshot(raster_irq, irq_time, (data - 1) / sys.crtc.vmultiple); |
src/mess/video/atarist.c
| r1998 | r1999 | |
| 102 | 102 | |
| 103 | 103 | static TIMER_CALLBACK(atarist_shifter_tick) |
| 104 | 104 | { |
| 105 | | int y = video_screen_get_vpos(0); |
| 106 | | int x = video_screen_get_hpos(0); |
| 105 | int y = video_screen_get_vpos(machine->primary_screen); |
| 106 | int x = video_screen_get_hpos(machine->primary_screen); |
| 107 | 107 | |
| 108 | 108 | pen_t pen; |
| 109 | 109 | |
| r1998 | r1999 | |
| 150 | 150 | |
| 151 | 151 | static TIMER_CALLBACK(atarist_glue_tick) |
| 152 | 152 | { |
| 153 | | int y = video_screen_get_vpos(0); |
| 154 | | int x = video_screen_get_hpos(0); |
| 153 | int y = video_screen_get_vpos(machine->primary_screen); |
| 154 | int x = video_screen_get_hpos(machine->primary_screen); |
| 155 | 155 | |
| 156 | 156 | int v = (y >= shifter.y_start) && (y < shifter.y_end); |
| 157 | 157 | int h = (x >= shifter.x_start) && (x < shifter.x_end); |
| r1998 | r1999 | |
| 721 | 721 | atarist_shifter_timer = timer_alloc(atarist_shifter_tick, NULL); |
| 722 | 722 | atarist_glue_timer = timer_alloc(atarist_glue_tick, NULL); |
| 723 | 723 | |
| 724 | | timer_adjust_periodic(atarist_shifter_timer, video_screen_get_time_until_pos(0,0,0), 0, ATTOTIME_IN_HZ(Y2/4)); // 125 ns |
| 725 | | timer_adjust_periodic(atarist_glue_timer, video_screen_get_time_until_pos(0,0,0), 0, ATTOTIME_IN_HZ(Y2/16)); // 500 ns |
| 724 | timer_adjust_periodic(atarist_shifter_timer, video_screen_get_time_until_pos(machine->primary_screen,0,0), 0, ATTOTIME_IN_HZ(Y2/4)); // 125 ns |
| 725 | timer_adjust_periodic(atarist_glue_timer, video_screen_get_time_until_pos(machine->primary_screen,0,0), 0, ATTOTIME_IN_HZ(Y2/16)); // 500 ns |
| 726 | 726 | |
| 727 | 727 | memset(&shifter, 0, sizeof(shifter)); |
| 728 | 728 | |
src/mess/video/apple1.c
| r1998 | r1999 | |
| 179 | 179 | { |
| 180 | 180 | int cursor_x, cursor_y; |
| 181 | 181 | int cursor_scanline; |
| 182 | | double scanline_period = attotime_to_double(video_screen_get_scan_period(0)); |
| 182 | double scanline_period = attotime_to_double(video_screen_get_scan_period(machine->primary_screen)); |
| 183 | 183 | double cursor_hfrac; |
| 184 | 184 | |
| 185 | 185 | /* The video hardware refreshes the screen by reading the |
| r1998 | r1999 | |
| 198 | 198 | for the visible part of the scanline. */ |
| 199 | 199 | cursor_hfrac = (175 + cursor_x * apple1_charlayout.width) / 455; |
| 200 | 200 | |
| 201 | | if (video_screen_get_vpos(0) == cursor_scanline) { |
| 201 | if (video_screen_get_vpos(machine->primary_screen) == cursor_scanline) { |
| 202 | 202 | /* video_screen_get_hpos() doesn't account for the horizontal |
| 203 | 203 | blanking interval; it acts as if the scanline period is |
| 204 | 204 | entirely composed of visible pixel times. However, we can |
| 205 | 205 | still use it to find what fraction of the current scanline |
| 206 | 206 | period has elapsed. */ |
| 207 | | double current_hfrac = video_screen_get_hpos(0) / |
| 207 | double current_hfrac = video_screen_get_hpos(machine->primary_screen) / |
| 208 | 208 | video_screen_get_width(video_screen_first(machine->config)); |
| 209 | 209 | if (current_hfrac < cursor_hfrac) |
| 210 | 210 | return double_to_attotime(scanline_period * (cursor_hfrac - current_hfrac)); |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | return double_to_attotime( |
| 214 | | attotime_to_double(video_screen_get_time_until_pos(0, cursor_scanline, 0)) + |
| 214 | attotime_to_double(video_screen_get_time_until_pos(machine->primary_screen, cursor_scanline, 0)) + |
| 215 | 215 | scanline_period * cursor_hfrac); |
| 216 | 216 | } |
| 217 | 217 | |
src/mess/video/smsvdp.c
| r1998 | r1999 | |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | READ8_HANDLER(sms_vdp_vcount_r) { |
| 170 | | return ( smsvdp.sms_frame_timing[ INIT_VCOUNT ] + video_screen_get_vpos(0) ) & 0xFF; |
| 170 | return ( smsvdp.sms_frame_timing[ INIT_VCOUNT ] + video_screen_get_vpos(machine->primary_screen) ) & 0xFF; |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | READ8_HANDLER(sms_vdp_hcount_r) { |
| 174 | | return video_screen_get_hpos(0) >> 1; |
| 174 | return video_screen_get_hpos(machine->primary_screen) >> 1; |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | void sms_set_ggsmsmode( int mode ) { |
| r1998 | r1999 | |
| 217 | 217 | set_display_settings( machine ); |
| 218 | 218 | |
| 219 | 219 | smsvdp.smsvdp_display_timer = timer_alloc( smsvdp_display_callback , NULL); |
| 220 | | timer_adjust_periodic(smsvdp.smsvdp_display_timer, video_screen_get_time_until_pos( 0, 0, 0 ), 0, video_screen_get_scan_period( 0 )); |
| 220 | timer_adjust_periodic(smsvdp.smsvdp_display_timer, video_screen_get_time_until_pos(machine->primary_screen, 0, 0 ), 0, video_screen_get_scan_period( 0 )); |
| 221 | 221 | return 0; |
| 222 | 222 | } |
| 223 | 223 | |
| r1998 | r1999 | |
| 231 | 231 | static TIMER_CALLBACK(smsvdp_display_callback) |
| 232 | 232 | { |
| 233 | 233 | rectangle rec; |
| 234 | | int vpos = video_screen_get_vpos(0); |
| 234 | int vpos = video_screen_get_vpos(machine->primary_screen); |
| 235 | 235 | int vpos_limit = smsvdp.sms_frame_timing[VERTICAL_BLANKING] + smsvdp.sms_frame_timing[TOP_BLANKING] |
| 236 | 236 | + smsvdp.sms_frame_timing[TOP_BORDER] + smsvdp.sms_frame_timing[ACTIVE_DISPLAY_V] |
| 237 | 237 | + smsvdp.sms_frame_timing[BOTTOM_BORDER] + smsvdp.sms_frame_timing[BOTTOM_BLANKING]; |
| r1998 | r1999 | |
| 261 | 261 | smsvdp.status |= STATUS_HINT; |
| 262 | 262 | if ( smsvdp.reg[0x00] & 0x10 ) { |
| 263 | 263 | /* Delay triggering of interrupt to allow software to read the status bit before the irq */ |
| 264 | | timer_set( video_screen_get_time_until_pos( 0, video_screen_get_vpos(0), video_screen_get_hpos(0) + 1 ), NULL, 0, smsvdp_set_irq ); |
| 264 | timer_set( video_screen_get_time_until_pos(machine->primary_screen, video_screen_get_vpos(machine->primary_screen), video_screen_get_hpos(machine->primary_screen) + 1 ), NULL, 0, smsvdp_set_irq ); |
| 265 | 265 | } |
| 266 | 266 | } |
| 267 | 267 | |
| r1998 | r1999 | |
| 270 | 270 | smsvdp.status |= STATUS_VINT; |
| 271 | 271 | if ( smsvdp.reg[0x01] & 0x20 ) { |
| 272 | 272 | /* Delay triggering of interrupt to allow software to read the status bit before the irq */ |
| 273 | | timer_set( video_screen_get_time_until_pos( 0, video_screen_get_vpos(0), video_screen_get_hpos(0) + 1 ), NULL, 0, smsvdp_set_irq ); |
| 273 | timer_set( video_screen_get_time_until_pos(machine->primary_screen, video_screen_get_vpos(machine->primary_screen), video_screen_get_hpos(machine->primary_screen) + 1 ), NULL, 0, smsvdp_set_irq ); |
| 274 | 274 | } |
| 275 | 275 | } |
| 276 | 276 | if ( video_skip_this_frame() ) { |
| r1998 | r1999 | |
| 305 | 305 | smsvdp.status |= STATUS_HINT; |
| 306 | 306 | if ( smsvdp.reg[0x00] & 0x10 ) { |
| 307 | 307 | /* Delay triggering of interrupt to allow software to read the status bit before the irq */ |
| 308 | | timer_set( video_screen_get_time_until_pos( 0, video_screen_get_vpos(0), video_screen_get_hpos(0) + 1 ), NULL, 0, smsvdp_set_irq ); |
| 308 | timer_set( video_screen_get_time_until_pos(machine->primary_screen, video_screen_get_vpos(machine->primary_screen), video_screen_get_hpos(machine->primary_screen) + 1 ), NULL, 0, smsvdp_set_irq ); |
| 309 | 309 | } |
| 310 | 310 | } else { |
| 311 | 311 | smsvdp.line_counter -= 1; |
src/mess/video/cdp1864.c
| r1998 | r1999 | |
| 30 | 30 | |
| 31 | 31 | static TIMER_CALLBACK(cdp1864_int_tick) |
| 32 | 32 | { |
| 33 | | int scanline = video_screen_get_vpos(0); |
| 33 | int scanline = video_screen_get_vpos(machine->primary_screen); |
| 34 | 34 | |
| 35 | 35 | if (scanline == CDP1864_SCANLINE_INT_START) |
| 36 | 36 | { |
| r1998 | r1999 | |
| 40 | 40 | cdp1864.dmaptr = 0; |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | | timer_adjust_oneshot(cdp1864_int_timer, video_screen_get_time_until_pos(0, CDP1864_SCANLINE_INT_END, 0), 0); |
| 43 | timer_adjust_oneshot(cdp1864_int_timer, video_screen_get_time_until_pos(machine->primary_screen, CDP1864_SCANLINE_INT_END, 0), 0); |
| 44 | 44 | } |
| 45 | 45 | else |
| 46 | 46 | { |
| r1998 | r1999 | |
| 49 | 49 | cpunum_set_input_line(machine, 0, CDP1802_INPUT_LINE_INT, CLEAR_LINE); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | | timer_adjust_oneshot(cdp1864_int_timer, video_screen_get_time_until_pos(0, CDP1864_SCANLINE_INT_START, 0), 0); |
| 52 | timer_adjust_oneshot(cdp1864_int_timer, video_screen_get_time_until_pos(machine->primary_screen, CDP1864_SCANLINE_INT_START, 0), 0); |
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | static TIMER_CALLBACK(cdp1864_efx_tick) |
| 57 | 57 | { |
| 58 | | int scanline = video_screen_get_vpos(0); |
| 58 | int scanline = video_screen_get_vpos(machine->primary_screen); |
| 59 | 59 | |
| 60 | 60 | switch (scanline) |
| 61 | 61 | { |
| 62 | 62 | case CDP1864_SCANLINE_EFX_TOP_START: |
| 63 | 63 | cdp1864_efx = ASSERT_LINE; |
| 64 | | timer_adjust_oneshot(cdp1864_efx_timer, video_screen_get_time_until_pos(0, CDP1864_SCANLINE_EFX_TOP_END, 0), 0); |
| 64 | timer_adjust_oneshot(cdp1864_efx_timer, video_screen_get_time_until_pos(machine->primary_screen, CDP1864_SCANLINE_EFX_TOP_END, 0), 0); |
| 65 | 65 | break; |
| 66 | 66 | |
| 67 | 67 | case CDP1864_SCANLINE_EFX_TOP_END: |
| 68 | 68 | cdp1864_efx = CLEAR_LINE; |
| 69 | | timer_adjust_oneshot(cdp1864_efx_timer, video_screen_get_time_until_pos(0, CDP1864_SCANLINE_EFX_BOTTOM_START, 0), 0); |
| 69 | timer_adjust_oneshot(cdp1864_efx_timer, video_screen_get_time_until_pos(machine->primary_screen, CDP1864_SCANLINE_EFX_BOTTOM_START, 0), 0); |
| 70 | 70 | break; |
| 71 | 71 | |
| 72 | 72 | case CDP1864_SCANLINE_EFX_BOTTOM_START: |
| 73 | 73 | cdp1864_efx = ASSERT_LINE; |
| 74 | | timer_adjust_oneshot(cdp1864_efx_timer, video_screen_get_time_until_pos(0, CDP1864_SCANLINE_EFX_BOTTOM_END, 0), 0); |
| 74 | timer_adjust_oneshot(cdp1864_efx_timer, video_screen_get_time_until_pos(machine->primary_screen, CDP1864_SCANLINE_EFX_BOTTOM_END, 0), 0); |
| 75 | 75 | break; |
| 76 | 76 | |
| 77 | 77 | case CDP1864_SCANLINE_EFX_BOTTOM_END: |
| 78 | 78 | cdp1864_efx = CLEAR_LINE; |
| 79 | | timer_adjust_oneshot(cdp1864_efx_timer, video_screen_get_time_until_pos(0, CDP1864_SCANLINE_EFX_TOP_START, 0), 0); |
| 79 | timer_adjust_oneshot(cdp1864_efx_timer, video_screen_get_time_until_pos(machine->primary_screen, CDP1864_SCANLINE_EFX_TOP_START, 0), 0); |
| 80 | 80 | break; |
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | static TIMER_CALLBACK(cdp1864_dma_tick) |
| 85 | 85 | { |
| 86 | | int scanline = video_screen_get_vpos(0); |
| 86 | int scanline = video_screen_get_vpos(machine->primary_screen); |
| 87 | 87 | |
| 88 | 88 | if (cdp1864.dmaout) |
| 89 | 89 | { |
| r1998 | r1999 | |
| 117 | 117 | |
| 118 | 118 | void cdp1864_dma_w(UINT8 data) |
| 119 | 119 | { |
| 120 | | int sx = video_screen_get_hpos(0) + 4; |
| 121 | | int y = video_screen_get_vpos(0); |
| 120 | int sx = video_screen_get_hpos(Machine->primary_screen) + 4; |
| 121 | int y = video_screen_get_vpos(Machine->primary_screen); |
| 122 | 122 | int x; |
| 123 | 123 | |
| 124 | 124 | for (x = 0; x < 8; x++) |
| r1998 | r1999 | |
| 180 | 180 | |
| 181 | 181 | MACHINE_RESET( cdp1864 ) |
| 182 | 182 | { |
| 183 | | timer_adjust_oneshot(cdp1864_int_timer, video_screen_get_time_until_pos(0, CDP1864_SCANLINE_INT_START, 0), 0); |
| 184 | | timer_adjust_oneshot(cdp1864_efx_timer, video_screen_get_time_until_pos(0, CDP1864_SCANLINE_EFX_TOP_START, 0), 0); |
| 183 | timer_adjust_oneshot(cdp1864_int_timer, video_screen_get_time_until_pos(machine->primary_screen, CDP1864_SCANLINE_INT_START, 0), 0); |
| 184 | timer_adjust_oneshot(cdp1864_efx_timer, video_screen_get_time_until_pos(machine->primary_screen, CDP1864_SCANLINE_EFX_TOP_START, 0), 0); |
| 185 | 185 | timer_adjust_oneshot(cdp1864_dma_timer, ATTOTIME_IN_CYCLES(CDP1864_CYCLES_DMA_START, 0), 0); |
| 186 | 186 | |
| 187 | 187 | cdp1864.disp = 0; |
src/mess/video/odyssey2.c
| r1998 | r1999 | |
| 549 | 549 | tmp_bitmap = auto_bitmap_alloc( width, height, video_screen_get_format(screen) ); |
| 550 | 550 | |
| 551 | 551 | i824x_line_timer = timer_alloc( i824x_scanline_callback, NULL ); |
| 552 | | timer_adjust_periodic( i824x_line_timer, video_screen_get_time_until_pos( 0, 1, I824X_START_ACTIVE_SCAN ), 0, video_screen_get_scan_period( 0 ) ); |
| 552 | timer_adjust_periodic( i824x_line_timer, video_screen_get_time_until_pos(machine->primary_screen, 1, I824X_START_ACTIVE_SCAN ), 0, video_screen_get_scan_period( 0 ) ); |
| 553 | 553 | |
| 554 | 554 | i824x_hblank_timer = timer_alloc( i824x_hblank_callback, NULL ); |
| 555 | | timer_adjust_periodic( i824x_hblank_timer, video_screen_get_time_until_pos( 0, 1, I824X_END_ACTIVE_SCAN + 18 ), 0, video_screen_get_scan_period( 0 ) ); |
| 555 | timer_adjust_periodic( i824x_hblank_timer, video_screen_get_time_until_pos(machine->primary_screen, 1, I824X_END_ACTIVE_SCAN + 18 ), 0, video_screen_get_scan_period( 0 ) ); |
| 556 | 556 | } |
| 557 | 557 | |
| 558 | 558 | /*************************************************************************** |
src/mess/video/cdp1861.c
| r1998 | r1999 | |
| 21 | 21 | |
| 22 | 22 | static TIMER_CALLBACK(cdp1861_int_tick) |
| 23 | 23 | { |
| 24 | | int scanline = video_screen_get_vpos(0); |
| 24 | int scanline = video_screen_get_vpos(machine->primary_screen); |
| 25 | 25 | |
| 26 | 26 | if (scanline == CDP1861_SCANLINE_INT_START) |
| 27 | 27 | { |
| r1998 | r1999 | |
| 30 | 30 | cpunum_set_input_line(machine, 0, CDP1802_INPUT_LINE_INT, HOLD_LINE); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | | timer_adjust_oneshot(cdp1861_int_timer, video_screen_get_time_until_pos(0, CDP1861_SCANLINE_INT_END, 0), 0); |
| 33 | timer_adjust_oneshot(cdp1861_int_timer, video_screen_get_time_until_pos(machine->primary_screen, CDP1861_SCANLINE_INT_END, 0), 0); |
| 34 | 34 | } |
| 35 | 35 | else |
| 36 | 36 | { |
| r1998 | r1999 | |
| 39 | 39 | cpunum_set_input_line(machine, 0, CDP1802_INPUT_LINE_INT, CLEAR_LINE); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | | timer_adjust_oneshot(cdp1861_int_timer, video_screen_get_time_until_pos(0, CDP1861_SCANLINE_INT_START, 0), 0); |
| 42 | timer_adjust_oneshot(cdp1861_int_timer, video_screen_get_time_until_pos(machine->primary_screen, CDP1861_SCANLINE_INT_START, 0), 0); |
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | static TIMER_CALLBACK(cdp1861_efx_tick) |
| 47 | 47 | { |
| 48 | | int scanline = video_screen_get_vpos(0); |
| 48 | int scanline = video_screen_get_vpos(machine->primary_screen); |
| 49 | 49 | |
| 50 | 50 | switch (scanline) |
| 51 | 51 | { |
| 52 | 52 | case CDP1861_SCANLINE_EFX_TOP_START: |
| 53 | 53 | cdp1861_efx = ASSERT_LINE; |
| 54 | | timer_adjust_oneshot(cdp1861_efx_timer, video_screen_get_time_until_pos(0, CDP1861_SCANLINE_EFX_TOP_END, 0), 0); |
| 54 | timer_adjust_oneshot(cdp1861_efx_timer, video_screen_get_time_until_pos(machine->primary_screen, CDP1861_SCANLINE_EFX_TOP_END, 0), 0); |
| 55 | 55 | break; |
| 56 | 56 | |
| 57 | 57 | case CDP1861_SCANLINE_EFX_TOP_END: |
| 58 | 58 | cdp1861_efx = CLEAR_LINE; |
| 59 | | timer_adjust_oneshot(cdp1861_efx_timer, video_screen_get_time_until_pos(0, CDP1861_SCANLINE_EFX_BOTTOM_START, 0), 0); |
| 59 | timer_adjust_oneshot(cdp1861_efx_timer, video_screen_get_time_until_pos(machine->primary_screen, CDP1861_SCANLINE_EFX_BOTTOM_START, 0), 0); |
| 60 | 60 | break; |
| 61 | 61 | |
| 62 | 62 | case CDP1861_SCANLINE_EFX_BOTTOM_START: |
| 63 | 63 | cdp1861_efx = ASSERT_LINE; |
| 64 | | timer_adjust_oneshot(cdp1861_efx_timer, video_screen_get_time_until_pos(0, CDP1861_SCANLINE_EFX_BOTTOM_END, 0), 0); |
| 64 | timer_adjust_oneshot(cdp1861_efx_timer, video_screen_get_time_until_pos(machine->primary_screen, CDP1861_SCANLINE_EFX_BOTTOM_END, 0), 0); |
| 65 | 65 | break; |
| 66 | 66 | |
| 67 | 67 | case CDP1861_SCANLINE_EFX_BOTTOM_END: |
| 68 | 68 | cdp1861_efx = CLEAR_LINE; |
| 69 | | timer_adjust_oneshot(cdp1861_efx_timer, video_screen_get_time_until_pos(0, CDP1861_SCANLINE_EFX_TOP_START, 0), 0); |
| 69 | timer_adjust_oneshot(cdp1861_efx_timer, video_screen_get_time_until_pos(machine->primary_screen, CDP1861_SCANLINE_EFX_TOP_START, 0), 0); |
| 70 | 70 | break; |
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | static TIMER_CALLBACK(cdp1861_dma_tick) |
| 75 | 75 | { |
| 76 | | int scanline = video_screen_get_vpos(0); |
| 76 | int scanline = video_screen_get_vpos(machine->primary_screen); |
| 77 | 77 | |
| 78 | 78 | if (cdp1861.dmaout) |
| 79 | 79 | { |
| r1998 | r1999 | |
| 107 | 107 | |
| 108 | 108 | void cdp1861_dma_w(UINT8 data) |
| 109 | 109 | { |
| 110 | | int sx = video_screen_get_hpos(0) + 4; |
| 111 | | int y = video_screen_get_vpos(0); |
| 110 | int sx = video_screen_get_hpos(Machine->primary_screen) + 4; |
| 111 | int y = video_screen_get_vpos(Machine->primary_screen); |
| 112 | 112 | int x; |
| 113 | 113 | |
| 114 | 114 | for (x = 0; x < 8; x++) |
| r1998 | r1999 | |
| 121 | 121 | |
| 122 | 122 | MACHINE_RESET( cdp1861 ) |
| 123 | 123 | { |
| 124 | | timer_adjust_oneshot(cdp1861_int_timer, video_screen_get_time_until_pos(0, CDP1861_SCANLINE_INT_START, 0), 0); |
| 125 | | timer_adjust_oneshot(cdp1861_efx_timer, video_screen_get_time_until_pos(0, CDP1861_SCANLINE_EFX_TOP_START, 0), 0); |
| 124 | timer_adjust_oneshot(cdp1861_int_timer, video_screen_get_time_until_pos(machine->primary_screen, CDP1861_SCANLINE_INT_START, 0), 0); |
| 125 | timer_adjust_oneshot(cdp1861_efx_timer, video_screen_get_time_until_pos(machine->primary_screen, CDP1861_SCANLINE_EFX_TOP_START, 0), 0); |
| 126 | 126 | timer_adjust_oneshot(cdp1861_dma_timer, ATTOTIME_IN_CYCLES(CDP1861_CYCLES_DMA_START, 0), 0); |
| 127 | 127 | |
| 128 | 128 | cdp1861.disp = 0; |
src/mess/video/kc.c
| r1998 | r1999 | |
| 7 | 7 | ***************************************************************************/ |
| 8 | 8 | |
| 9 | 9 | #include "driver.h" |
| 10 | #include "deprecat.h" |
| 10 | 11 | #include "includes/kc.h" |
| 11 | 12 | #include "eventlst.h" |
| 12 | 13 | |
| r1998 | r1999 | |
| 111 | 112 | /* set new blink state - record blink state in event list */ |
| 112 | 113 | void kc85_video_set_blink_state(int data) |
| 113 | 114 | { |
| 114 | | EventList_AddItemOffset(KC85_VIDEO_EVENT_SET_BLINK_STATE, ((data & 0x01)<<7), ATTOTIME_TO_CYCLES(0, attotime_mul(video_screen_get_scan_period(0), video_screen_get_vpos(0)))); |
| 115 | EventList_AddItemOffset(KC85_VIDEO_EVENT_SET_BLINK_STATE, ((data & 0x01)<<7), ATTOTIME_TO_CYCLES(0, attotime_mul(video_screen_get_scan_period(Machine->primary_screen), video_screen_get_vpos(Machine->primary_screen)))); |
| 115 | 116 | } |
| 116 | 117 | |
| 117 | 118 | |
| r1998 | r1999 | |
| 548 | 549 | /* process remainder */ |
| 549 | 550 | kc85_common_vh_process_lines(machine, &video_update, cycles_remaining_in_frame); |
| 550 | 551 | EventList_Reset(); |
| 551 | | EventList_SetOffsetStartTime ( ATTOTIME_TO_CYCLES(0, attotime_mul(video_screen_get_scan_period(0), video_screen_get_vpos(0))) ); |
| 552 | EventList_SetOffsetStartTime ( ATTOTIME_TO_CYCLES(0, attotime_mul(video_screen_get_scan_period(machine->primary_screen), video_screen_get_vpos(machine->primary_screen))) ); |
| 552 | 553 | } |
| 553 | 554 | |
| 554 | 555 | |
| r1998 | r1999 | |
| 571 | 572 | { |
| 572 | 573 | pItem = EventList_GetFirstItem(); |
| 573 | 574 | EventList_Reset(); |
| 574 | | EventList_SetOffsetStartTime ( ATTOTIME_TO_CYCLES(0, attotime_mul(video_screen_get_scan_period(0), video_screen_get_vpos(0))) ); |
| 575 | EventList_SetOffsetStartTime ( ATTOTIME_TO_CYCLES(0, attotime_mul(video_screen_get_scan_period(machine->primary_screen), video_screen_get_vpos(machine->primary_screen))) ); |
| 575 | 576 | logerror ("Event log reset in callback fn.\n"); |
| 576 | 577 | } |
| 577 | 578 | } |
src/mess/machine/zx.c
| r1998 | r1999 | |
| 16 | 16 | #define DEBUG_ZX81_PORTS 1 |
| 17 | 17 | #define DEBUG_ZX81_VSYNC 1 |
| 18 | 18 | |
| 19 | | #define LOG_ZX81_IOR(_comment) { if (DEBUG_ZX81_PORTS) logerror("ZX81 IOR: %04x, Data: %02x, Scanline: %d (%s)\n", offset, data, video_screen_get_vpos(0), _comment); } |
| 20 | | #define LOG_ZX81_IOW(_comment) { if (DEBUG_ZX81_PORTS) logerror("ZX81 IOW: %04x, Data: %02x, Scanline: %d (%s)\n", offset, data, video_screen_get_vpos(0), _comment); } |
| 21 | | #define LOG_ZX81_VSYNC { if (DEBUG_ZX81_VSYNC) logerror("VSYNC starts in scanline: %d\n", video_screen_get_vpos(0)); } |
| 19 | #define LOG_ZX81_IOR(_comment) { if (DEBUG_ZX81_PORTS) logerror("ZX81 IOR: %04x, Data: %02x, Scanline: %d (%s)\n", offset, data, video_screen_get_vpos(machine->primary_screen), _comment); } |
| 20 | #define LOG_ZX81_IOW(_comment) { if (DEBUG_ZX81_PORTS) logerror("ZX81 IOW: %04x, Data: %02x, Scanline: %d (%s)\n", offset, data, video_screen_get_vpos(machine->primary_screen), _comment); } |
| 21 | #define LOG_ZX81_VSYNC { if (DEBUG_ZX81_VSYNC) logerror("VSYNC starts in scanline: %d\n", video_screen_get_vpos(machine->primary_screen)); } |
| 22 | 22 | |
| 23 | 23 | static UINT8 zx_tape_bit = 0x80; |
| 24 | 24 | |
| r1998 | r1999 | |
| 94 | 94 | zx_ula_bkgnd(machine, 1); |
| 95 | 95 | if (ula_frame_vsync == 2) |
| 96 | 96 | { |
| 97 | | cpu_spinuntil_time(video_screen_get_time_until_pos(0, height - 1, 0)); |
| 97 | cpu_spinuntil_time(video_screen_get_time_until_pos(machine->primary_screen, height - 1, 0)); |
| 98 | 98 | ula_scanline_count = height - 1; |
| 99 | | logerror ("S: %d B: %d\n", video_screen_get_vpos(0), video_screen_get_hpos(0)); |
| 99 | logerror ("S: %d B: %d\n", video_screen_get_vpos(machine->primary_screen), video_screen_get_hpos(machine->primary_screen)); |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | LOG_ZX81_IOW("ULA IRQs on"); |
src/mess/machine/apple2gs.c
| r1998 | r1999 | |
| 798 | 798 | // make sure we're in the 65816's context |
| 799 | 799 | cpuintrf_push_context(0); |
| 800 | 800 | |
| 801 | | scanline = video_screen_get_vpos(0); |
| 801 | scanline = video_screen_get_vpos(machine->primary_screen); |
| 802 | 802 | |
| 803 | 803 | video_screen_update_partial(0, scanline); |
| 804 | 804 | |
| r1998 | r1999 | |
| 832 | 832 | adb_check_mouse(machine); |
| 833 | 833 | |
| 834 | 834 | /* call Apple II interrupt handler */ |
| 835 | | if ((video_screen_get_vpos(0) % 8) == 7) |
| 835 | if ((video_screen_get_vpos(machine->primary_screen) % 8) == 7) |
| 836 | 836 | apple2_interrupt(machine, 0); |
| 837 | 837 | } |
| 838 | 838 | |
| 839 | | timer_adjust_oneshot(apple2gs_scanline_timer, video_screen_get_time_until_pos(0, (scanline+1)%262, 0), 0); |
| 839 | timer_adjust_oneshot(apple2gs_scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, (scanline+1)%262, 0), 0); |
| 840 | 840 | |
| 841 | 841 | cpuintrf_pop_context(); |
| 842 | 842 | } |
| r1998 | r1999 | |
| 933 | 933 | // apple2gs_get_vpos - return the correct vertical counter value for the current scanline, |
| 934 | 934 | // keeping borders in mind. |
| 935 | 935 | |
| 936 | | static int apple2gs_get_vpos(void) |
| 936 | static int apple2gs_get_vpos(running_machine *machine) |
| 937 | 937 | { |
| 938 | 938 | int result, scan; |
| 939 | 939 | static const UINT8 top_border_vert[BORDER_TOP] = |
| r1998 | r1999 | |
| 943 | 943 | |
| 944 | 944 | }; |
| 945 | 945 | |
| 946 | | scan = video_screen_get_vpos(0); |
| 946 | scan = video_screen_get_vpos(machine->primary_screen); |
| 947 | 947 | |
| 948 | 948 | if (scan < BORDER_TOP) |
| 949 | 949 | { |
| r1998 | r1999 | |
| 966 | 966 | switch(offset) |
| 967 | 967 | { |
| 968 | 968 | case 0x19: /* C019 - RDVBLBAR */ |
| 969 | | result = (video_screen_get_vpos(0) >= (192+BORDER_TOP)) ? 0x80 : 0x00; |
| 969 | result = (video_screen_get_vpos(machine->primary_screen) >= (192+BORDER_TOP)) ? 0x80 : 0x00; |
| 970 | 970 | break; |
| 971 | 971 | |
| 972 | 972 | case 0x22: /* C022 - TBCOLOR */ |
| r1998 | r1999 | |
| 1007 | 1007 | break; |
| 1008 | 1008 | |
| 1009 | 1009 | case 0x2E: /* C02E - VERTCNT */ |
| 1010 | | result = apple2gs_get_vpos() >> 1; |
| 1010 | result = apple2gs_get_vpos(machine) >> 1; |
| 1011 | 1011 | break; |
| 1012 | 1012 | |
| 1013 | 1013 | case 0x2F: /* C02F - HORIZCNT */ |
| 1014 | | result = video_screen_get_hpos(0) / 11; |
| 1014 | result = video_screen_get_hpos(machine->primary_screen) / 11; |
| 1015 | 1015 | if (result > 0) |
| 1016 | 1016 | { |
| 1017 | 1017 | result += 0x40; |
| 1018 | 1018 | } |
| 1019 | 1019 | |
| 1020 | | if (apple2gs_get_vpos() & 1) |
| 1020 | if (apple2gs_get_vpos(machine) & 1) |
| 1021 | 1021 | { |
| 1022 | 1022 | result |= 0x80; |
| 1023 | 1023 | } |
| r1998 | r1999 | |
| 1728 | 1728 | timer_adjust_oneshot(apple2gs_scanline_timer, attotime_never, 0); |
| 1729 | 1729 | |
| 1730 | 1730 | // fire on scanline zero |
| 1731 | | timer_adjust_oneshot(apple2gs_scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0); |
| 1731 | timer_adjust_oneshot(apple2gs_scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, 0, 0), 0); |
| 1732 | 1732 | } |
| 1733 | 1733 | |
| 1734 | 1734 | MACHINE_START( apple2gs ) |
src/mess/machine/mac.c
| r1998 | r1999 | |
| 1192 | 1192 | int val = 0; |
| 1193 | 1193 | |
| 1194 | 1194 | /* video beam in display (! VBLANK && ! HBLANK basically) */ |
| 1195 | | if (video_screen_get_vpos(0) >= MAC_V_VIS) |
| 1195 | if (video_screen_get_vpos(machine->primary_screen) >= MAC_V_VIS) |
| 1196 | 1196 | val |= 0x40; |
| 1197 | 1197 | |
| 1198 | 1198 | if (has_adb()) |
| r1998 | r1999 | |
| 1329 | 1329 | timer_set(attotime_zero, NULL, 0, set_memory_overlay_callback); |
| 1330 | 1330 | |
| 1331 | 1331 | mac_scanline_timer = timer_alloc(mac_scanline_tick, NULL); |
| 1332 | | timer_adjust_oneshot(mac_scanline_timer, video_screen_get_time_until_pos(0, 0, 0), 0); |
| 1332 | timer_adjust_oneshot(mac_scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, 0, 0), 0); |
| 1333 | 1333 | } |
| 1334 | 1334 | |
| 1335 | 1335 | |
| r1998 | r1999 | |
| 1465 | 1465 | |
| 1466 | 1466 | mac_sh_updatebuffer(); |
| 1467 | 1467 | |
| 1468 | | scanline = video_screen_get_vpos(0); |
| 1468 | scanline = video_screen_get_vpos(machine->primary_screen); |
| 1469 | 1469 | if (scanline == MAC_V_VIS) |
| 1470 | 1470 | mac_vblank_irq(); |
| 1471 | 1471 | |
| r1998 | r1999 | |
| 1473 | 1473 | if (!(scanline % 10)) |
| 1474 | 1474 | mouse_callback(machine); |
| 1475 | 1475 | |
| 1476 | | timer_adjust_oneshot(mac_scanline_timer, video_screen_get_time_until_pos(0, (scanline+1) % MAC_V_TOTAL, 0), 0); |
| 1476 | timer_adjust_oneshot(mac_scanline_timer, video_screen_get_time_until_pos(machine->primary_screen, (scanline+1) % MAC_V_TOTAL, 0), 0); |
| 1477 | 1477 | |
| 1478 | 1478 | cpuintrf_pop_context(); |
| 1479 | 1479 | } |
src/mess/machine/coco.c
| r1998 | r1999 | |
| 103 | 103 | /*common vars/calls */ |
| 104 | 104 | static UINT8 *coco_rom; |
| 105 | 105 | static int dclg_state, dclg_output_h, dclg_output_v, dclg_timer; |
| 106 | | static UINT8 (*update_keyboard)(void); |
| 106 | static UINT8 (*update_keyboard)(running_machine *machine); |
| 107 | 107 | static emu_timer *update_keyboard_timer; |
| 108 | 108 | static emu_timer *mux_sel1_timer; |
| 109 | 109 | static emu_timer *mux_sel2_timer; |
| r1998 | r1999 | |
| 816 | 816 | coco3_recalc_irq(machine); |
| 817 | 817 | |
| 818 | 818 | if (LOG_INT_COCO3) |
| 819 | | logerror("CoCo3 Interrupt: Raising IRQ; scanline=%i\n", video_screen_get_vpos(0)); |
| 819 | logerror("CoCo3 Interrupt: Raising IRQ; scanline=%i\n", video_screen_get_vpos(machine->primary_screen)); |
| 820 | 820 | } |
| 821 | 821 | if ((coco3_gimereg[0] & 0x10) && (coco3_gimereg[3] & mask)) |
| 822 | 822 | { |
| r1998 | r1999 | |
| 824 | 824 | coco3_recalc_firq(machine); |
| 825 | 825 | |
| 826 | 826 | if (LOG_INT_COCO3) |
| 827 | | logerror("CoCo3 Interrupt: Raising FIRQ; scanline=%i\n", video_screen_get_vpos(0)); |
| 827 | logerror("CoCo3 Interrupt: Raising FIRQ; scanline=%i\n", video_screen_get_vpos(machine->primary_screen)); |
| 828 | 828 | } |
| 829 | 829 | } |
| 830 | 830 | } |
| r1998 | r1999 | |
| 1021 | 1021 | coco_hiresjoy_ytransitiontime = attotime_zero; |
| 1022 | 1022 | } |
| 1023 | 1023 | coco_hiresjoy_ca = data; |
| 1024 | | (*update_keyboard)(); |
| 1024 | (*update_keyboard)(Machine); |
| 1025 | 1025 | } |
| 1026 | 1026 | |
| 1027 | 1027 | static int coco_hiresjoy_readone(attotime transitiontime) |
| r1998 | r1999 | |
| 1195 | 1195 | static TIMER_CALLBACK(coco_update_sel1_timerproc) |
| 1196 | 1196 | { |
| 1197 | 1197 | mux_sel1 = param;; |
| 1198 | | (*update_keyboard)(); |
| 1198 | (*update_keyboard)(machine); |
| 1199 | 1199 | soundmux_update(); |
| 1200 | 1200 | } |
| 1201 | 1201 | |
| r1998 | r1999 | |
| 1207 | 1207 | static TIMER_CALLBACK(coco_update_sel2_timerproc) |
| 1208 | 1208 | { |
| 1209 | 1209 | mux_sel2 = param; |
| 1210 | | (*update_keyboard)(); |
| 1210 | (*update_keyboard)(machine); |
| 1211 | 1211 | soundmux_update(); |
| 1212 | 1212 | } |
| 1213 | 1213 | |
| r1998 | r1999 | |
| 1226 | 1226 | |
| 1227 | 1227 | |
| 1228 | 1228 | |
| 1229 | | static UINT8 coco_update_keyboard(void) |
| 1229 | static UINT8 coco_update_keyboard(running_machine *machine) |
| 1230 | 1230 | { |
| 1231 | 1231 | UINT8 porta = 0x7F, port_za = 0x7f; |
| 1232 | 1232 | int joyval; |
| r1998 | r1999 | |
| 1284 | 1284 | break; |
| 1285 | 1285 | |
| 1286 | 1286 | case INPUTDEVICE_DIECOM_LIGHTGUN: |
| 1287 | | if( (video_screen_get_vpos(0) == readinputportbytag_safe("dclg_y", 0)) ) |
| 1287 | if( (video_screen_get_vpos(machine->primary_screen) == readinputportbytag_safe("dclg_y", 0)) ) |
| 1288 | 1288 | { |
| 1289 | 1289 | /* If gun is pointing at the current scan line, set hit bit and cache horizontal timer value */ |
| 1290 | 1290 | dclg_output_h |= 0x02; |
| r1998 | r1999 | |
| 1297 | 1297 | if( (dclg_state == 7) ) |
| 1298 | 1298 | { |
| 1299 | 1299 | /* While in state 7, prepare to chech next video frame for a hit */ |
| 1300 | | dclg_time = video_screen_get_time_until_pos(0, readinputportbytag_safe("dclg_y", 0), 0); |
| 1300 | dclg_time = video_screen_get_time_until_pos(machine->primary_screen, readinputportbytag_safe("dclg_y", 0), 0); |
| 1301 | 1301 | } |
| 1302 | 1302 | |
| 1303 | 1303 | break; |
| r1998 | r1999 | |
| 1332 | 1332 | |
| 1333 | 1333 | |
| 1334 | 1334 | |
| 1335 | | static UINT8 coco3_update_keyboard(void) |
| 1335 | static UINT8 coco3_update_keyboard(running_machine *machine) |
| 1336 | 1336 | { |
| 1337 | 1337 | /* the CoCo 3 keyboard update routine must also check for the GIME EI1 interrupt */ |
| 1338 | 1338 | UINT8 porta; |
| 1339 | | porta = coco_update_keyboard(); |
| 1340 | | coco3_raise_interrupt(Machine, COCO3_INT_EI1, ((porta & 0x7F) == 0x7F) ? CLEAR_LINE : ASSERT_LINE); |
| 1339 | porta = coco_update_keyboard(machine); |
| 1340 | coco3_raise_interrupt(machine, COCO3_INT_EI1, ((porta & 0x7F) == 0x7F) ? CLEAR_LINE : ASSERT_LINE); |
| 1341 | 1341 | return porta; |
| 1342 | 1342 | } |
| 1343 | 1343 | |
| 1344 | 1344 | |
| 1345 | 1345 | |
| 1346 | 1346 | /* three functions that update the keyboard in varying ways */ |
| 1347 | | static WRITE8_HANDLER ( d_pia0_pb_w ) { (*update_keyboard)(); } |
| 1348 | | INPUT_CHANGED(coco_keyboard_changed) { (*update_keyboard)(); } |
| 1349 | | static TIMER_CALLBACK(coco_update_keyboard_timerproc) { (*update_keyboard)(); } |
| 1347 | static WRITE8_HANDLER ( d_pia0_pb_w ) { (*update_keyboard)(machine); } |
| 1348 | INPUT_CHANGED(coco_keyboard_changed) { (*update_keyboard)(machine); } |
| 1349 | static TIMER_CALLBACK(coco_update_keyboard_timerproc) { (*update_keyboard)(machine); } |
| 1350 | 1350 | |
| 1351 | 1351 | static WRITE8_HANDLER ( d_pia0_pa_w ) |
| 1352 | 1352 | { |
| r1998 | r1999 | |
| 1460 | 1460 | cassette_output(cassette_device_image(), ((int) dac - 0x80) / 128.0); |
| 1461 | 1461 | } |
| 1462 | 1462 | |
| 1463 | | (*update_keyboard)(); |
| 1463 | (*update_keyboard)(machine); |
| 1464 | 1464 | |
| 1465 | 1465 | if (get_input_device(INPUTPORT_RIGHT_JOYSTICK) == INPUTDEVICE_HIRES_INTERFACE) |
| 1466 | 1466 | coco_hiresjoy_w(dac >= 0x80); |
src/mess/machine/nes_mmc.c
| r1998 | r1999 | |
| 632 | 632 | |
| 633 | 633 | if (IRQ_enable && !blanked && (IRQ_count == 0) && priorCount) |
| 634 | 634 | { |
| 635 | | logerror("irq fired, scanline: %d (MAME %d, beam pos: %d)\n", scanline, video_screen_get_vpos(0), video_screen_get_hpos(0)); |
| 635 | logerror("irq fired, scanline: %d (MAME %d, beam pos: %d)\n", scanline, video_screen_get_vpos(Machine->primary_screen), video_screen_get_hpos(Machine->primary_screen)); |
| 636 | 636 | cpunum_set_input_line(Machine, 0, M6502_IRQ_LINE, HOLD_LINE); |
| 637 | 637 | // timer_adjust_oneshot(nes_irq_timer, ATTOTIME_IN_CYCLES(4, 0), 0); |
| 638 | 638 | } |
| r1998 | r1999 | |
| 4324 | 4324 | |
| 4325 | 4325 | if (IRQ_enable && !blanked && (IRQ_count == 0) && priorCount) |
| 4326 | 4326 | { |
| 4327 | | logerror("irq fired, scanline: %d (MAME %d, beam pos: %d)\n", scanline, video_screen_get_vpos(0), video_screen_get_hpos(0)); |
| 4327 | logerror("irq fired, scanline: %d (MAME %d, beam pos: %d)\n", scanline, video_screen_get_vpos(Machine->primary_screen), video_screen_get_hpos(Machine->primary_screen)); |
| 4328 | 4328 | cpunum_set_input_line(Machine, 0, M6502_IRQ_LINE, HOLD_LINE); |
| 4329 | 4329 | } |
| 4330 | 4330 | } |
| r1998 | r1999 | |
| 4830 | 4830 | |
| 4831 | 4831 | if (IRQ_enable && !blanked && (IRQ_count == 0) && priorCount) |
| 4832 | 4832 | { |
| 4833 | | logerror("irq fired, scanline: %d (MAME %d, beam pos: %d)\n", scanline, video_screen_get_vpos(0), video_screen_get_hpos(0)); |
| 4833 | logerror("irq fired, scanline: %d (MAME %d, beam pos: %d)\n", scanline, video_screen_get_vpos(Machine->primary_screen), video_screen_get_hpos(Machine->primary_screen)); |
| 4834 | 4834 | cpunum_set_input_line(Machine, 0, M6502_IRQ_LINE, HOLD_LINE); |
| 4835 | 4835 | } |
| 4836 | 4836 | } |
src/mess/machine/osborne1.c
| r1998 | r1999 | |
| 309 | 309 | //}; |
| 310 | 310 | |
| 311 | 311 | static TIMER_CALLBACK(osborne1_video_callback) { |
| 312 | | int y = video_screen_get_vpos(0); |
| 312 | int y = video_screen_get_vpos(machine->primary_screen); |
| 313 | 313 | |
| 314 | 314 | /* Check for start of frame */ |
| 315 | 315 | if ( y == 0 ) { |
| r1998 | r1999 | |
| 357 | 357 | beep_set_state( 0, 0 ); |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | | timer_adjust_oneshot(osborne1.video_timer, video_screen_get_time_until_pos( 0, y + 1, 0 ), 0); |
| 360 | timer_adjust_oneshot(osborne1.video_timer, video_screen_get_time_until_pos(machine->primary_screen, y + 1, 0 ), 0); |
| 361 | 361 | } |
| 362 | 362 | |
| 363 | 363 | /* |
| r1998 | r1999 | |
| 434 | 434 | memset( mess_ram + 0x10000, 0xFF, 0x1000 ); |
| 435 | 435 | |
| 436 | 436 | osborne1.video_timer = timer_alloc( osborne1_video_callback , NULL); |
| 437 | | timer_adjust_oneshot(osborne1.video_timer, video_screen_get_time_until_pos( 0, 1, 0 ), 0); |
| 437 | timer_adjust_oneshot(osborne1.video_timer, video_screen_get_time_until_pos(machine->primary_screen, 1, 0 ), 0); |
| 438 | 438 | pia_1_ca1_w( machine, 0, 0 ); |
| 439 | 439 | |
| 440 | 440 | timer_set( attotime_zero, NULL, 0, setup_beep ); |
src/mess/drivers/x68k.c
| r1998 | r1999 | |
| 952 | 952 | { |
| 953 | 953 | case 0x00: // GPIP - General purpose I/O register (read-only) |
| 954 | 954 | ret = 0x23; |
| 955 | | if(video_screen_get_vpos(0) == sys.crtc.reg[9]) |
| 955 | if(video_screen_get_vpos(machine->primary_screen) == sys.crtc.reg[9]) |
| 956 | 956 | ret |= 0x40; |
| 957 | 957 | if(sys.crtc.vblank == 0) |
| 958 | 958 | ret |= 0x10; // Vsync signal (low if in vertical retrace) |
| 959 | 959 | // if(sys.mfp.isrb & 0x08) |
| 960 | 960 | // ret |= 0x08; // FM IRQ signal |
| 961 | | if(video_screen_get_hpos(0) > sys.crtc.width - 32) |
| 961 | if(video_screen_get_hpos(machine->primary_screen) > sys.crtc.width - 32) |
| 962 | 962 | ret |= 0x80; // Hsync signal |
| 963 | 963 | // logerror("MFP: [%08x] Reading offset %i (ret=%02x)\n",activecpu_get_pc(),offset,ret); |
| 964 | 964 | return ret; // bit 5 is always 1 |
| r1998 | r1999 | |
| 1911 | 1911 | nec765_reset(0); |
| 1912 | 1912 | mfp_init(); |
| 1913 | 1913 | |
| 1914 | | x68k_scanline = video_screen_get_vpos(0);// = sys.crtc.reg[6]; // Vertical start |
| 1914 | x68k_scanline = video_screen_get_vpos(machine->primary_screen);// = sys.crtc.reg[6]; // Vertical start |
| 1915 | 1915 | |
| 1916 | 1916 | // start VBlank timer |
| 1917 | 1917 | sys.crtc.vblank = 1; |
| 1918 | | irq_time = video_screen_get_time_until_pos(0,sys.crtc.reg[6],2); |
| 1918 | irq_time = video_screen_get_time_until_pos(machine->primary_screen,sys.crtc.reg[6],2); |
| 1919 | 1919 | timer_adjust_oneshot(vblank_irq, irq_time, 0); |
| 1920 | 1920 | |
| 1921 | 1921 | // start HBlank timer |
| 1922 | | timer_adjust_oneshot(scanline_timer, video_screen_get_scan_period(0), 1); |
| 1922 | timer_adjust_oneshot(scanline_timer, video_screen_get_scan_period(machine->primary_screen), 1); |
| 1923 | 1923 | |
| 1924 | 1924 | sys.mfp.gpio = 0xfb; |
| 1925 | 1925 | } |
src/mess/drivers/spectrum.c
| r1998 | r1999 | |
| 190 | 190 | if ((Changed & 0x07)!=0) |
| 191 | 191 | { |
| 192 | 192 | /* yes - send event */ |
| 193 | | EventList_AddItemOffset(0x0fe, data & 0x07, ATTOTIME_TO_CYCLES(0,attotime_mul(video_screen_get_scan_period(0), video_screen_get_vpos(0)))); |
| 193 | EventList_AddItemOffset(0x0fe, data & 0x07, ATTOTIME_TO_CYCLES(0,attotime_mul(video_screen_get_scan_period(machine->primary_screen), video_screen_get_vpos(machine->primary_screen)))); |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | if ((Changed & (1<<4))!=0) |
| r1998 | r1999 | |
| 330 | 330 | if ((offset & 0xff)==0xdf) |
| 331 | 331 | return spectrum_port_df_r(machine, offset); |
| 332 | 332 | |
| 333 | | return video_screen_get_vpos(0)<193 ? spectrum_colorram[(video_screen_get_vpos(0)&0xf8)<<2]:0xff; |
| 333 | return video_screen_get_vpos(machine->primary_screen)<193 ? spectrum_colorram[(video_screen_get_vpos(machine->primary_screen)&0xf8)<<2]:0xff; |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | static WRITE8_HANDLER ( spectrum_port_w ) |
| r1998 | r1999 | |
| 473 | 473 | if ((offset & 0xff)==0xdf) |
| 474 | 474 | return spectrum_port_df_r(machine, offset); |
| 475 | 475 | |
| 476 | | return video_screen_get_vpos(0)<193 ? spectrum_128_screen_location[0x1800|(video_screen_get_vpos(0)&0xf8)<<2]:0xff; |
| 476 | return video_screen_get_vpos(machine->primary_screen)<193 ? spectrum_128_screen_location[0x1800|(video_screen_get_vpos(machine->primary_screen)&0xf8)<<2]:0xff; |
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | static WRITE8_HANDLER ( spectrum_128_port_w ) |
| r1998 | r1999 | |
| 759 | 759 | } |
| 760 | 760 | } |
| 761 | 761 | |
| 762 | | return video_screen_get_vpos(0)<193 ? spectrum_128_screen_location[0x1800|(video_screen_get_vpos(0)&0xf8)<<2]:0xff; |
| 762 | return video_screen_get_vpos(machine->primary_screen)<193 ? spectrum_128_screen_location[0x1800|(video_screen_get_vpos(machine->primary_screen)&0xf8)<<2]:0xff; |
| 763 | 763 | } |
| 764 | 764 | |
| 765 | 765 | static WRITE8_HANDLER ( spectrum_plus3_port_w ) |
src/mess/drivers/amstrad.c
| r1998 | r1999 | |
| 1009 | 1009 | 0 x |*/ |
| 1010 | 1010 | case 0x01: { |
| 1011 | 1011 | #ifdef AMSTRAD_VIDEO_EVENT_LIST |
| 1012 | | EventList_AddItemOffset((EVENT_LIST_CODE_GA_COLOUR<<6) | PenIndex, AmstradCPC_PenColours[PenIndex], TIME_TO_CYCLES(0,video_screen_get_vpos(0)*video_screen_get_scan_period(0))); |
| 1012 | EventList_AddItemOffset((EVENT_LIST_CODE_GA_COLOUR<<6) | PenIndex, AmstradCPC_PenColours[PenIndex], TIME_TO_CYCLES(0,video_screen_get_vpos(machine->primary_screen)*video_screen_get_scan_period(machine->primary_screen))); |
| 1013 | 1013 | #else |
| 1014 | 1014 | amstrad_vh_update_colour(machine, amstrad_GateArray_PenSelected, (dataToGateArray & 0x1F)); |
| 1015 | 1015 | #endif |
| r1998 | r1999 | |
| 1080 | 1080 | /* b1b0 mode change? */ |
| 1081 | 1081 | if (((amstrad_GateArray_ModeAndRomConfiguration & 0x03)^(Previous_GateArray_ModeAndRomConfiguration & 0x03)) != 0) { |
| 1082 | 1082 | #ifdef AMSTRAD_VIDEO_EVENT_LIST |
| 1083 | | EventList_AddItemOffset((EVENT_LIST_CODE_GA_MODE<<6) , amstrad_GateArray_ModeAndRomConfiguration & 0x03, TIME_TO_CYCLES(0,video_screen_get_vpos(0)*video_screen_get_scan_period(0))); |
| 1083 | EventList_AddItemOffset((EVENT_LIST_CODE_GA_MODE<<6) , amstrad_GateArray_ModeAndRomConfiguration & 0x03, TIME_TO_CYCLES(0,video_screen_get_vpos(machine->primary_screen)*video_screen_get_scan_period(machine->primary_screen))); |
| 1084 | 1084 | #else |
| 1085 | 1085 | amstrad_vh_update_mode(amstrad_GateArray_ModeAndRomConfiguration & 0x03); |
| 1086 | 1086 | #endif |
| r1998 | r1999 | |
| 1357 | 1357 | switch ((offset & 0x0300) >> 8) { // r1r0 |
| 1358 | 1358 | case 0x00: {/* Select internal 6845 register Write Only */ |
| 1359 | 1359 | #ifdef AMSTRAD_VIDEO_EVENT_LIST |
| 1360 | | EventList_AddItemOffset((EVENT_LIST_CODE_CRTC_INDEX_WRITE<<6), data, TIME_TO_CYCLES(0,video_screen_get_vpos(0)*video_screen_get_scan_period(0))); |
| 1360 | EventList_AddItemOffset((EVENT_LIST_CODE_CRTC_INDEX_WRITE<<6), data, TIME_TO_CYCLES(0,video_screen_get_vpos(machine->primary_screen)*video_screen_get_scan_period(machine->primary_screen))); |
| 1361 | 1361 | #endif |
| 1362 | 1362 | m6845_address_w(0,data); |
| 1363 | 1363 | if(amstrad_system_type != SYSTEM_CPC) |
| r1998 | r1999 | |
| 1366 | 1366 | } break; |
| 1367 | 1367 | case 0x01: {/* Write to selected internal 6845 register Write Only */ |
| 1368 | 1368 | #ifdef AMSTRAD_VIDEO_EVENT_LIST |
| 1369 | | EventList_AddItemOffset((EVENT_LIST_CODE_CRTC_WRITE<<6), data, TIME_TO_CYCLES(0,video_screen_get_vpos(0)*video_screen_get_scan_period(0))); |
| 1369 | EventList_AddItemOffset((EVENT_LIST_CODE_CRTC_WRITE<<6), data, TIME_TO_CYCLES(0,video_screen_get_vpos(machine->primary_screen)*video_screen_get_scan_period(machine->primary_screen))); |
| 1370 | 1370 | #endif |
| 1371 | 1371 | // logerror("m6845 register (%02d : %04x)\n", selected_m6845_address, (data&0x3F)); |
| 1372 | 1372 | m6845_register_w(0,data); |