Exemple #1
0
// -----------------------------------------------------------------------
// software (MCL) and hardware (CP 'CLEAR') reset
void cpu_reset(int hw)
{
    if (hw) {
        for (int i=0 ; i<R_MAX ; i++) {
            regs[i] = 0;
        }
    } else {
        regs[0] = 0;
        regs[R_SR] = 0;
    }

    int_update_mask(0);
    int_clear_all();
    cpu_mod_off();

    mem_reset();

    // TODO: move this before CPU clear routine
    // I/O reset should return when we're sure that I/O won't change CPU state (backlogged interrupts, memory writes, ...)
    // this needs MX reset interrupt to become async
    io_reset();

    // TODO: state = STOP, WAIT=0, jakieś inne rejestry?

    // call even if logging is disabled - user may enable it later
    // and we still want to know if we're running a known OS
    log_check_os();
    log_reset_process();
    log_intlevel_reset();
    log_syscall_reset();
}
Exemple #2
0
/******************************************************************************
**  Function   :  console_reset                
**                                         
**  Objective  :  Reset the system
**                                       
**  Parameters :  type        - machine type 5200, 800, XL/XE
**                system_type - PAL or NTSC
**                ram         - amount of memory to emulate
**                freq        - frequency to run Pokey Sound at
**                                     
**  return     :  NONE
**
******************************************************************************/ 
void console_reset ( e_machine_type type, int system_type, int ram, int freq) {

	console.machine_type = type;
	console.ram_size = ram;
	mem_reset ( );
	antic_init ();
	gtia_init ( system_type );
	pokey_init ( freq );
	pia_init ();
	sio_reset ();
	reset_6502 ();

	if ( system_type == PAL ) {
		console.frames_per_sec = 50;
		console.scanlines = 312;
	}
	else {
		console.frames_per_sec = 60;
		console.scanlines = 262;
	}

	console.option_key_pressed = 0;
	console.start_key_pressed = 0;

	if ( !console.basic_enable && (console.machine_type == MACHINE_TYPE_XL) )
		console.option_key_pressed = 1;

	if ( console.mapping == CART_CASSETTE ) {
		console.start_key_pressed = 2;
	}

} /* end console_reset */
Exemple #3
0
/* CBM-II-specific initialization.  */
void machine_specific_reset(void)
{
    ciacore_reset(machine_context.cia1);
    tpicore_reset(machine_context.tpi1);
    tpicore_reset(machine_context.tpi2);
    acia1_reset();

    sid_reset();

    if (!cbm2_isC500) {
        crtc_reset();
    } else {
        c500_powerline_clk = maincpu_clk + C500_POWERLINE_CYCLES_PER_IRQ;
        alarm_set(c500_powerline_clk_alarm, c500_powerline_clk);
        vicii_reset();
    }
    printer_reset();

    rs232drv_reset();

    drive_reset();
    datasette_reset();

    mem_reset();
}
Exemple #4
0
main(int argc, char **argv)
{
  int i, min, max;

  mem_reset();
  
  for (i=1; i < argc; i++) {
    get_range(argv[i], &min, &max);
    mem_skip(min, max);
  }

  print_mem();
}
Exemple #5
0
void kernel_init() {
  notQuit = 1;
  tid_counter = 0;
	install_interrupt_handlers();
	mem_reset();
	scheduler_init();
  for (int i = 0; i < 64; i++) {
    eventWaitingTask[i] = (TaskDescriptor*) NULL;
  }

  kernel_createtask((int*)&idleTid, LOWEST_PRIORITY, (int)idle_task, 0);

  // Clear Timer4
  *(volatile unsigned int*)(0x80810064) &= ~0x100;
  *(volatile unsigned int*)(0x80810064) |= 0x100;
  asm_enable_cache();
}
Exemple #6
0
void reinit_emulation() {
	printf("\n\n -- REINITIALISATION --\n\n\n");
	mem_reset();
	ic                  = 0,
	pc                  = 0,
	interrupt_period    = 0,
	state_register      = 32,

	// stack is into the area of memory between 0x100 and 0x1ff,
	// starts at 1ff (going downwards)
	stack_pointer       = 0x1FF,
	// Index registers
	x_reg               = 0,
	y_reg               = 0;
  //accumulator
  acc                 = 0;

}
Exemple #7
0
/* CBM-II-specific initialization.  */
void machine_specific_reset(void)
{
    ciacore_reset(machine_context.cia1);
    tpicore_reset(machine_context.tpi1);
    tpicore_reset(machine_context.tpi2);
    acia1_reset();

    sid_reset();

    crtc_reset();

    printer_reset();

    rs232drv_reset();

    drive_reset();
    datasette_reset();

    mem_reset();
}
Exemple #8
0
void SIM_start(void){
	sky_pref_t *pref;
	/* get the current preference for simulator */
	pref = get_skyeye_pref();
	skyeye_config_t* config = get_current_config();
	if(pref->conf_filename)
		skyeye_read_config(pref->conf_filename);

	if(config->arch == NULL){
		skyeye_log(Error_log, __FUNCTION__, "Should provide valid arch option in your config file.\n");
		return;
	}
	generic_arch_t *arch_instance = get_arch_instance(config->arch->arch_name);

	if(config->mach == NULL){
		skyeye_log(Error_log, __FUNCTION__, "Should provide valid mach option in your config file.\n");
		return;
	}

	arch_instance->init();
	
	/* reset all the memory */
	mem_reset();

	config->mach->mach_init(arch_instance, config->mach);
	/* reset current arch_instanc */
	arch_instance->reset();
	/* reset all the values of mach */
	io_reset(arch_instance);
	
	if(pref->exec_file){
		exception_t ret;
		/* 
		 * If no relocation is indicated, we will load elf file by 
		 * virtual address
		 */
		if((((~pref->exec_load_mask) & pref->exec_load_base) == 0x0) &&
			(arch_instance->mmu_write != NULL))
			ret = load_elf(pref->exec_file, Virt_addr);
		else
			ret = load_elf(pref->exec_file, Phys_addr);
	}

	/* set pc from config */
	generic_address_t pc = (config->start_address & pref->exec_load_mask)|pref->exec_load_base; 
	skyeye_log(Info_log, __FUNCTION__, "Set PC to the address 0x%x\n", pc);
	arch_instance->set_pc(pc);

	/* Call bootmach callback */
	exec_callback(Bootmach_callback, arch_instance);	

	pthread_t id;
	create_thread(skyeye_loop, arch_instance, &id);
	
	/* 
	 * At this time, if we set conf file, then we parse it
	 * Or do it later.
	 */

	/*
	if(pref->conf_filename)
		skyeye_read_config(pref->conf_filename);
	*/
#if 0	
	else{
		/* try to run in batch mode */
		if(skyeye_read_config(pref->conf_filename) == No_exp){
Exemple #9
0
/**
 *  Initialize all the gloval variable
 */
static int
init ()
{
	static int done = 0;
	int ret = -1;
	if (!done) {
		done = 1;
		/*some option should init before read config. e.g. uart option. */
#if 0 /*move to common/ctrl related function */
		initialize_all_devices ();
		initialize_all_arch ();
		/* parse skyeye.conf to set skyeye_config */
		skyeye_option_init (&skyeye_config);
		if((ret = skyeye_read_config()) < 0)
			return ret;

#endif

#if 0
		/* we should check if some members of skyeye_config is initialized */
		if(!skyeye_config.arch){
			fprintf(stderr, "arch is not initialization or you have not provide arch option in skyeye.conf.\n");
                        skyeye_exit(-1);
		}
		if(!skyeye_config.mach){
			fprintf(stderr, "mach is not initialization or you have not provide mach option in skyeye.conf.\n");
			skyeye_exit(-1);
		}	
#endif

#if 0 /*move to module loading stage */
		/* initialize register type for gdb server */
		if((ret = init_register_type()) < 0)
			return ret;/* Failed to initialize register type */
#endif

#if 0
		arch_instance =
			(generic_arch_t *) malloc (sizeof (generic_arch_t));
		if (!arch_instance) {
			printf ("malloc error!\n");
			return -1;
		}
		arch_instance->init = skyeye_config.arch->init;
		arch_instance->reset = skyeye_config.arch->reset;
		arch_instance->step_once = skyeye_config.arch->step_once;
		arch_instance->set_pc = skyeye_config.arch->set_pc;
		arch_instance->get_pc = skyeye_config.arch->get_pc;
		arch_instance->ICE_write_byte = skyeye_config.arch->ICE_write_byte;
		arch_instance->ICE_read_byte = skyeye_config.arch->ICE_read_byte;

		arch_instance->init ();
		arch_instance->reset ();
		arch_instance->big_endian = Big_endian;
#endif
#if 0 /* move to module loading stage */
		skyeye_uart_converter_setup();
#endif
#if 0
		if(skyeye_config.code_cov.prof_on)
			cov_init(skyeye_config.code_cov.start, skyeye_config.code_cov.end);
#endif

#if 0
		mem_reset(); /* initialize of memory module */
#endif
	}
	return 1;
}