当前位置: 首页>>代码示例>>C++>>正文


C++ FILEIO::Fopen方法代码示例

本文整理汇总了C++中FILEIO::Fopen方法的典型用法代码示例。如果您正苦于以下问题:C++ FILEIO::Fopen方法的具体用法?C++ FILEIO::Fopen怎么用?C++ FILEIO::Fopen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FILEIO的用法示例。


在下文中一共展示了FILEIO::Fopen方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: sizeof

void PC80S31K::initialize()
{
	// init memory
	memset(rom, 0xff, sizeof(rom));
	memset(ram, 0, sizeof(ram));
	memset(rdmy, 0xff, sizeof(rdmy));
	
	// load rom image
	FILEIO* fio = new FILEIO();
	if(fio->Fopen(create_local_path(_T("PC88.ROM")), FILEIO_READ_BINARY)) {
		fio->Fseek(0x14000, FILEIO_SEEK_CUR);
		fio->Fread(rom, sizeof(rom), 1);
		fio->Fclose();
	} else if(fio->Fopen(create_local_path(_T("DISK.ROM")), FILEIO_READ_BINARY)) {
		fio->Fread(rom, sizeof(rom), 1);
		fio->Fclose();
	} else {
		// stop cpu
		d_cpu->write_signal(SIG_CPU_BUSREQ, 1, 1);
	}
	delete fio;
	
	// init memory map
	SET_BANK(0x0000, 0x1fff, wdmy, rom);
	SET_BANK(0x2000, 0x3fff, wdmy, rdmy);
	SET_BANK(0x4000, 0x7fff, ram, ram);
	SET_BANK(0x8000, 0xffff, wdmy, rdmy);
	
	// XM8 version 1.20
	// both drives always set force ready signal
	d_fdc->write_signal(SIG_UPD765A_FREADY, 1, 1);
}
开发者ID:ysei,项目名称:common_source_project-fm7,代码行数:32,代码来源:pc80s31k.cpp

示例2: DEVICE

KANJIROM::KANJIROM(VM *parent_vm, EMU* parent_emu, bool type_2std): DEVICE(parent_vm, parent_emu)
{
	FILEIO *fio;
	read_ok = false;
	
	fio = new FILEIO();
	memset(data_table, 0xff, 0x20000); 
	//	read_table[0].memory = data_table;
	
	if(type_2std) {
		class2 = true;
		if(fio->Fopen(create_local_path(_T("KANJI2.ROM")), FILEIO_READ_BINARY)) {
		  fio->Fread(data_table, 0x20000, 1);
			fio->Fclose();
			read_ok = true;
		}
	} else {
		class2 = false;
		if(fio->Fopen(create_local_path(_T("KANJI1.ROM")), FILEIO_READ_BINARY)) {
		  fio->Fread(data_table, 0x20000, 1);
			fio->Fclose();
			read_ok = true;
		} else if(fio->Fopen(create_local_path(_T("KANJI.ROM")), FILEIO_READ_BINARY)) {
		  fio->Fread(data_table, 0x20000, 1);
			fio->Fclose();
			read_ok = true;
		} 
	}
	kanjiaddr.d = 0;
	delete fio;
	return;
}
开发者ID:ysei,项目名称:common_source_project-fm7,代码行数:32,代码来源:kanjirom.cpp

示例3: initialize

//
// initialize()
// initiailize
//
void DiskSub::initialize()
{
	FILEIO *fio;
	int high;
	int low;
	uint8 *ptr;
	uint8 eor;

	// clear rom & initialize (JR *)
	memset(&memory[0x0000], 0xff, 0x2000);
	memory[0x0000] = 0x18;
	memory[0x0001] = 0xfe;

	// clear higher memory
	memset(&memory[0x8000], 0xff, 0x8000);

	// inititlize 0x2000-0x7fff
	ptr = &memory[0x2000];
	for (high=0; high<0x60; high++) {
		// get xor data
		switch (init_table[high]) {
		case 0:
			eor = 0xf0;
			break;
		case 1:
			eor = 0x0f;
			break;
		case 2:
			eor = 0xff;
			break;
		default:
			eor = 0x00;
			break;
		}

		// fill memory
		for (low=0; low<0x10; low++) {
			memset(ptr, init_pattern[low] ^ eor, 0x10);
			ptr += 0x10;
		}
	}

	// read ROM (both PC88.ROM and DISK.ROM)
	fio = new FILEIO;
	if (fio->Fopen(emu->bios_path(_T("PC88.ROM")), FILEIO_READ_BINARY) == true) {
		fio->Fseek(0x14000, FILEIO_SEEK_CUR);
		fio->Fread(&memory[0], 1, 0x2000);
		fio->Fclose();
	}
	if (fio->Fopen(emu->bios_path(_T("DISK.ROM")), FILEIO_READ_BINARY) ==  true) {
		fio->Fread(&memory[0], 1, 0x2000);
		fio->Fclose();
	}
	delete fio;
}
开发者ID:tkochi,项目名称:xm8,代码行数:59,代码来源:disksub.cpp

示例4: sizeof

void RP5C01::initialize()
{
#ifndef HAS_RP5C15
	// load ram image
	memset(ram, 0, sizeof(ram));
	
	FILEIO* fio = new FILEIO();
	if(fio->Fopen(emu->bios_path(_T("RP5C01.BIN")), FILEIO_READ_BINARY)) {
		fio->Fread(ram, sizeof(ram), 1);
		fio->Fclose();
	}
	delete fio;
#endif
	
	// initialize rtc
	memset(regs, 0, sizeof(regs));
	regs[0x0a] = 1;
	regs[0x0d] = 8;
	regs[0x0f] = 0xc;
	alarm = pulse_1hz = pulse_16hz = false;
	count_16hz = 0;
	
	emu->get_host_time(&cur_time);
	read_from_cur_time();
	
	// register events
	register_event(this, EVENT_1SEC, 1000000, true, &register_id);
	register_event(this, EVENT_16HZ, 1000000 / 32, true, NULL);
}
开发者ID:meesokim,项目名称:fc-100,代码行数:29,代码来源:rp5c01.cpp

示例5: initialize

void MEMORY::initialize()
{
	memset(rom, 0xff, sizeof(rom));
	memset(rdmy, 0xff, sizeof(rdmy));
	
	// load rom image
	FILEIO* fio = new FILEIO();
	if(fio->Fopen(emu->bios_path(_T("BASIC.ROM")), FILEIO_READ_BINARY)) {
		fio->Fread(rom, sizeof(rom), 1);
		fio->Fclose();
	}
	delete fio;
	
	// set memory map
#ifdef _MAP1010
	SET_BANK(0x0000, 0x5fff, wdmy, rom );
	SET_BANK(0x6000, 0x77ff, vram, vram);
	SET_BANK(0x7800, 0x7fff, wdmy, rdmy);
	SET_BANK(0x8000, 0xffff, ram,  ram );
#else
	SET_BANK(0x0000, 0x5fff, wdmy, rom );
	SET_BANK(0x6000, 0x77ff, vram, vram);
	SET_BANK(0x7800, 0xbfff, wdmy, rdmy);
	SET_BANK(0xc000, 0xffff, ram,  ram );
#endif
}
开发者ID:meesokim,项目名称:fc-100,代码行数:26,代码来源:memory.cpp

示例6: initialize

void DISPLAY::initialize()
{
	scanline = config.scan_line;
	
	// load rom image
	FILEIO* fio = new FILEIO();
	if(fio->Fopen(emu->bios_path(_T("FONT.ROM")), FILEIO_READ_BINARY)) {
		fio->Fread(font, sizeof(font), 1);
		fio->Fclose();
	}
	delete fio;
	
	// create pc palette
#ifdef _LCD
	for(int i = 1; i < 8; i++) {
		palette_pc[i] = RGB_COLOR(48, 56, 16);
	}
	palette_pc[0] = RGB_COLOR(160, 168, 160);
#else
	for(int i = 0; i < 8; i++) {
		palette_pc[i] = RGB_COLOR((i & 2) ? 255 : 0, (i & 4) ? 255 : 0, (i & 1) ? 255 : 0);
	}
#endif
	
	// initialize
	for(int i = 0; i < 16; i++) {
		pal[i] = i & 7;
	}
	mode = text_page = 0;
	cblink = flash_cnt = 0;
	blink = pal_dis = false;
	
	// register event
	register_frame_event(this);
}
开发者ID:meesokim,项目名称:fc-100,代码行数:35,代码来源:display.cpp

示例7: initialize

void RTC::initialize()
{
	// load rtc regs image
	memset(regs, 0, sizeof(regs));
	regs[POWON] = 0x10;	// cleared
	
	FILEIO* fio = new FILEIO();
	if(fio->Fopen(create_local_path(_T("RTC.BIN")), FILEIO_READ_BINARY)) {
		fio->Fread(regs + 8, 32, 1);
		fio->Fclose();
	}
	delete fio;
	
	// init registers
//	regs[POWON] &= 0x1f;	// local power on
//	regs[POWOF] = 0x80;	// program power off
	regs[POWON] = 0x10;	// cleared
	regs[POWOF] = 0x20;	// illegal power off
	regs[TCNT] = 0;
	update_checksum();
	
	rtcmr = rtdsr = 0;
	
	// update calendar
	get_host_time(&cur_time);
	read_from_cur_time();
	
	// register event
	register_event_by_clock(this, EVENT_1HZ, CPU_CLOCKS, true, &register_id);
	register_event_by_clock(this, EVENT_32HZ, CPU_CLOCKS >> 5, true, NULL);
}
开发者ID:ysei,项目名称:common_source_project-fm7,代码行数:31,代码来源:rtc.cpp

示例8: load_config

void load_config()
{
	// initial settings
	init_config();
	
	// get application path
	_TCHAR app_path[_MAX_PATH], config_path[_MAX_PATH];
	GetModuleFileName(NULL, app_path, _MAX_PATH);
	int pt = _tcslen(app_path);
	while(pt >= 0 && app_path[pt] != _T('\\')) {
		pt--;
	}
	app_path[pt + 1] = _T('\0');
	
	// load config
	_stprintf(config_path, _T("%s%s.cfg"), app_path, _T(CONFIG_NAME));
	FILEIO* fio = new FILEIO();
	if(fio->Fopen(config_path, FILEIO_READ_BINARY)) {
		fio->Fread((void *)&config, sizeof(config), 1);
		fio->Fclose();
		
		// check config version
		if(!(config.version1 == FILE_VERSION && config.version2 == CONFIG_VERSION)) {
			init_config();
		}
#if defined(USE_BITMAP) || defined(USE_LED)
		config.window_mode = 0;
		config.use_d3d9 = false;
		config.stretch_screen = false;
#endif
		config.cpu_power = 0;
	}
	delete fio;
}
开发者ID:meesokim,项目名称:fc-100,代码行数:34,代码来源:config.cpp

示例9: release

void CMOS::release()
{
	FILEIO* fio = new FILEIO();
	if(fio->Fopen(emu->bios_path(_T("CMOS.BIN")), FILEIO_WRITE_BINARY)) {
		fio->Fwrite(cmos, sizeof(cmos), 1);
		fio->Fclose();
	}
	delete fio;
}
开发者ID:meesokim,项目名称:fc-100,代码行数:9,代码来源:cmos.cpp

示例10: emu

VM::VM(EMU* parent_emu) : emu(parent_emu)
{
	// create devices
	first_device = last_device = NULL;
	dummy = new DEVICE(this, emu);	// must be 1st device
	event = new EVENT(this, emu);	// must be 2nd device
	
	drec = new DATAREC(this, emu);
	cpu = new I8080(this, emu);	// i8085
	memory = new MEMORY(this, emu);
	rtc = new RP5C01(this, emu);
	
	io = new IO(this, emu);
	
	// set contexts
	event->set_context_cpu(cpu);
	event->set_context_sound(drec);
	
	drec->set_context_ear(io, SIG_IO_CMT, 1);
	cpu->set_context_sod(io, SIG_IO_SOD, 1);
	
	io->set_context_cpu(cpu);
	io->set_context_drec(drec);
	io->set_context_rtc(rtc);
	
	// cpu bus
	cpu->set_context_mem(memory);
	cpu->set_context_io(io);
	cpu->set_context_intr(io);
#ifdef USE_DEBUGGER
	cpu->set_context_debugger(new DEBUGGER(this, emu));
#endif
	
	// memory bus
	memset(rom, 0xff, sizeof(rom));
	memset(ram, 0, sizeof(ram));
	
	memory->read_bios(_T("BIOS.ROM"), rom, sizeof(rom));
	
	FILEIO* fio = new FILEIO();
	if(fio->Fopen(create_local_path(_T("RAM.BIN")), FILEIO_READ_BINARY)) {
		fio->Fread(ram, sizeof(ram), 1);
		fio->Fclose();
	}
	delete fio;
	
	memory->set_memory_r(0x0000, 0x7fff, rom);
	memory->set_memory_rw(0x8000, 0xffff, ram);
	memory->set_wait_rw(0x0000, 0xffff, 1);
	
	// initialize all devices
	for(DEVICE* device = first_device; device; device = device->next_device) {
		device->initialize();
	}
}
开发者ID:ysei,项目名称:common_source_project-fm7,代码行数:55,代码来源:fp200.cpp

示例11: Init

//
// Init()
// initialize
//
bool Font::Init(SDL_Window *win)
{
	FILEIO fio;
	_TCHAR *path;
	EMU_SDL *wrapper;
	Uint32 loop;

	// save window
	window = win;

	// check rom
	if (CheckROM() == false) {
		return false;
	}

	// get EMU_SDL instance
	wrapper = app->GetWrapper();

	// kanji 1
	path = wrapper->get_bios_path(KANJI1_FILE);
	if (fio.Fopen(path, FILEIO_READ_BINARY) == true) {
		fio.Fread(kanji_rom, 1, sizeof(kanji_rom) / 2);
		fio.Fclose();
	}

	// kanji 2
	path = wrapper->get_bios_path(KANJI2_FILE);
	if (fio.Fopen(path, FILEIO_READ_BINARY) == true) {
		fio.Fread(&kanji_rom[sizeof(kanji_rom) / 2], 1, sizeof(kanji_rom) / 2);
		fio.Fclose();
	}

	// shift-jis to kanji rom offst
	for (loop=0x8000; loop<0xa000; loop++) {
		kanji_offset[loop - 0x8000] = JisToOffset(SjisToJis(loop));
	}
	for (loop=0xe000; loop<0x10000; loop++) {
		kanji_offset[loop - 0xc000] = JisToOffset(SjisToJis(loop));
	}

	return true;
}
开发者ID:tkochi,项目名称:xm8,代码行数:46,代码来源:font.cpp

示例12: FILEIO

void KANJIPAC2::initialize(int id)
{
	FILEIO* fio = new FILEIO();
	if(fio->Fopen(emu->bios_path(_T("KANJI.ROM")), FILEIO_READ_BINARY)) {
		fio->Fread(rom, sizeof(rom), 1);
		fio->Fclose();
	}
	delete fio;
	
	ptr = 0;
}
开发者ID:meesokim,项目名称:fc-100,代码行数:11,代码来源:kanjipac2.cpp

示例13: initialize

void ROMPACK::initialize()
{
	memset(rom, 0xff, sizeof(rom));
	
	FILEIO* fio = new FILEIO();
	if(fio->Fopen(emu->bios_path(_T("ROMPACK.ROM")), FILEIO_READ_BINARY)) {
		fio->Fread(rom, sizeof(rom), 1);
		fio->Fclose();
	}
	delete fio;
}
开发者ID:meesokim,项目名称:fc-100,代码行数:11,代码来源:rompack.cpp

示例14: initialize

void CMOS::initialize()
{
	// load cmos image
	memset(cmos, 0, sizeof(cmos));
	
	FILEIO* fio = new FILEIO();
	if(fio->Fopen(emu->bios_path(_T("CMOS.BIN")), FILEIO_READ_BINARY)) {
		fio->Fread(cmos, sizeof(cmos), 1);
		fio->Fclose();
	}
	delete fio;
}
开发者ID:meesokim,项目名称:fc-100,代码行数:12,代码来源:cmos.cpp

示例15: FILEIO

void RP5C01::release()
{
#ifndef HAS_RP5C15
	// save ram image
	FILEIO* fio = new FILEIO();
	if(fio->Fopen(emu->bios_path(_T("RP5C01.BIN")), FILEIO_WRITE_BINARY)) {
		fio->Fwrite(ram, sizeof(ram), 1);
		fio->Fclose();
	}
	delete fio;
#endif
}
开发者ID:meesokim,项目名称:fc-100,代码行数:12,代码来源:rp5c01.cpp


注:本文中的FILEIO::Fopen方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。