/* Reset the CRTC chip. */ void crtc_reset(void) { raster_reset(&crtc.raster); alarm_set(crtc.raster_draw_alarm, CRTC_CYCLES_PER_LINE()); crtc.rl_visible = crtc.regs[1]; crtc.rl_sync = crtc.regs[2]; crtc.rl_len = crtc.regs[0]; crtc.prev_rl_visible = crtc.rl_visible; crtc.prev_rl_sync = crtc.rl_sync; crtc.prev_rl_len = crtc.rl_len; crtc.rl_start = maincpu_clk; crtc.frame_start = maincpu_clk; crtc_reset_screen_ptr(); crtc.raster.ycounter = 0; crtc.current_charline = 0; crtc.current_line = 0; /* expected number of rasterlines for next frame */ crtc.framelines = (crtc.regs[4] + 1) * (crtc.regs[9] + 1) + crtc.regs[5]; }
/* Reset the TED chip. */ void ted_reset(void) { /* ted_change_timing();*/ ted_timer_reset(); ted_sound_reset(); raster_reset(&ted.raster); /* FIXME this should be in powerup */ ted.tv_current_line = 0; ted.ted_raster_counter = ted.vsync_line; /* ted_set_geometry();*/ ted.last_emulate_line_clk = 0; ted.draw_clk = ted.draw_cycle; alarm_set(ted.raster_draw_alarm, ted.draw_clk); ted.fetch_clk = TED_FETCH_CYCLE; alarm_set(ted.raster_fetch_alarm, ted.fetch_clk); /* FIXME: I am not sure this is exact emulation. */ ted.raster_irq_line = 0; ted.raster_irq_clk = 0; /* Setup the raster IRQ alarm. The value is `1' instead of `0' because we are at the first line, which has a +1 clock cycle delay in IRQs. */ /* FIXME */ alarm_set(ted.raster_irq_alarm, 1); ted.force_display_state = 0; ted.reverse_mode = 0; /* Remove all the IRQ sources. */ ted.regs[0x0a] = 0; ted.raster.display_ystart = ted.raster.display_ystop = -1; ted.cursor_visible = 0; ted.cursor_phase = 0; ted.fastmode = 1; }
/* Reset the VDC chip */ void vdc_reset(void) { if (vdc.initialized) raster_reset(&vdc.raster); vdc.frame_counter = 0; vdc.screen_text_cols = VDC_SCREEN_MAX_TEXTCOLS; vdc.xsmooth = 0; vdc.regs[0] = 126; vdc.regs[1] = 102; vdc.xchars_total = vdc.regs[0] + 1; vdc_calculate_xsync(); vdc.regs[4] = 39; vdc.regs[5] = 0; vdc.regs[6] = 25; vdc.regs[9] = 7; vdc_update_geometry(); vdc_set_next_alarm((CLOCK)0); }
/* Reset the VIC-I chip. */ void vic_reset(void) { /* vic_change_timing();*/ raster_reset(&vic.raster); /* vic_set_geometry();*/ vic.last_emulate_line_clk = 0; vic.draw_clk = vic.cycles_per_line; alarm_set(vic.raster_draw_alarm, vic.draw_clk); vic.row_counter = 0; vic.memptr = 0; vic.pending_ystart = -1; vic.pending_text_lines = -1; vic.row_offset = -1; vic.area = 0; }
int raster_init(raster_t *raster, unsigned int num_modes) { raster->intialized = 0; raster->modes = lib_malloc(sizeof(raster_modes_t)); raster_modes_init(raster->modes, num_modes); raster_canvas_init(raster); raster_changes_init(raster); raster_reset(raster); raster->display_xstart = raster->display_xstop = 0; raster->display_ystart = raster->display_ystop = 0; raster->cache = NULL; raster->cache_enabled = 0; raster->dont_cache = 1; raster->dont_cache_all = 0; raster->num_cached_lines = 0; raster->fake_draw_buffer_line = NULL; raster->can_disable_border = 0; raster->border_disable = 0; raster->border_color = 0; raster->background_color = 0; raster->idle_background_color = 0; raster->xsmooth_color = 0; memset(raster->gfx_msk, 0, RASTER_GFX_MSK_SIZE); memset(raster->zero_gfx_msk, 0, RASTER_GFX_MSK_SIZE); video_viewport_get(raster->canvas, &raster->viewport, &raster->geometry); raster->canvas->initialized = 1; raster_set_canvas_refresh(raster, 1); return 0; }