/** * Initialize 680x0 emulation */ int Init680x0(void) { currprefs.cpu_level = changed_prefs.cpu_level = ConfigureParams.System.nCpuLevel; switch (currprefs.cpu_level) { case 0 : currprefs.cpu_model = 68000; break; case 1 : currprefs.cpu_model = 68010; break; case 2 : currprefs.cpu_model = 68020; break; case 3 : currprefs.cpu_model = 68030; break; case 4 : currprefs.cpu_model = 68040; break; case 5 : currprefs.cpu_model = 68060; break; default: fprintf (stderr, "Init680x0() : Error, cpu_level unknown\n"); } currprefs.cpu_compatible = changed_prefs.cpu_compatible = ConfigureParams.System.bCompatibleCpu; currprefs.address_space_24 = changed_prefs.address_space_24 = ConfigureParams.System.bAddressSpace24; currprefs.cpu_cycle_exact = changed_prefs.cpu_cycle_exact = ConfigureParams.System.bCycleExactCpu; currprefs.fpu_model = changed_prefs.fpu_model = ConfigureParams.System.n_FPUType; currprefs.fpu_strict = changed_prefs.fpu_strict = ConfigureParams.System.bCompatibleFPU; currprefs.mmu_model = changed_prefs.mmu_model = ConfigureParams.System.bMMU; init_m68k(); return true; }
/** * Initialize 680x0 emulation */ int Init680x0(void) { currprefs.cpu_level = changed_prefs.cpu_level = ConfigureParams.System.nCpuLevel; currprefs.cpu_compatible = changed_prefs.cpu_compatible = ConfigureParams.System.bCompatibleCpu; currprefs.address_space_24 = changed_prefs.address_space_24 = true; init_m68k(); return true; }
int hw_m68k_init(void) { // init breakpoints ti68k_bkpt_clear_exception(); ti68k_bkpt_set_exception(4); // illegal instruction bkpts.mode = bkpts.type = bkpts.id = 0; // init instruction logging bkpts.pc_log_size = 1; //50; bkpts.pc_log = (uint32_t *)malloc(bkpts.pc_log_size * sizeof(uint32_t)); if(bkpts.pc_log == NULL) return ERR_MALLOC; bkpts.pc_rd_ptr = 0; bkpts.pc_wr_ptr = 0; init_m68k(); return 0; }
int uade_main (int argc, char **argv) { quit_program = 0; default_prefs (&currprefs); uade_option (argc, argv); machdep_init (); if (! setup_sound ()) { __android_log_print(ANDROID_LOG_VERBOSE, "UADE", "Sound driver unavailable: Sound output disabled\n"); currprefs.produce_sound = 0; exit(1); } init_sound(); fix_options (); changed_prefs = currprefs; check_prefs_changed_cpu(); memory_init (); custom_init (); /* Must come after memory_init */ reset_frame_rate_hack (); init_m68k(); /* must come after reset_frame_rate_hack (); */ /* compiler_init (); */ if (currprefs.start_debugger) activate_debugger (); m68k_go(); close_sound (); dump_counts (); return 0; }
static void real_main2 (int argc, char **argv) { #if defined (NATMEM_OFFSET) && defined( _WIN32 ) && !defined( NO_WIN32_EXCEPTION_HANDLER ) extern int EvalException ( LPEXCEPTION_POINTERS blah, int n_except ); __try #endif { if (! graphics_setup ()) { exit (1); } if (restart_config[0]) { #ifdef FILESYS free_mountinfo (currprefs.mountinfo); currprefs.mountinfo = alloc_mountinfo (); #endif default_prefs (&currprefs, 0); fix_options (); } #ifdef NATMEM_OFFSET init_shm (); #endif #ifdef FILESYS rtarea_init (); hardfile_install (); #endif if (restart_config[0]) parse_cmdline_and_init_file (argc, argv); else currprefs = changed_prefs; uae_inithrtimer (); sleep_test (); machdep_init (); if (! setup_sound ()) { write_log ("Sound driver unavailable: Sound output disabled\n"); currprefs.produce_sound = 0; } inputdevice_init (); changed_prefs = currprefs; no_gui = ! currprefs.start_gui; if (restart_program == 2) no_gui = 1; else if (restart_program == 3) no_gui = 0; if (! no_gui) { int err = gui_init (); struct uaedev_mount_info *mi = currprefs.mountinfo; currprefs = changed_prefs; currprefs.mountinfo = mi; if (err == -1) { write_log ("Failed to initialize the GUI\n"); if (restart_program == 3) { restart_program = 0; return; } } else if (err == -2) { restart_program = 0; return; } } restart_program = 0; #ifdef JIT if (!(( currprefs.cpu_level >= 2 ) && ( currprefs.address_space_24 == 0 ) && ( currprefs.cachesize ))) canbang = 0; #endif #ifdef _WIN32 logging_init(); /* Yes, we call this twice - the first case handles when the user has loaded a config using the cmd-line. This case handles loads through the GUI. */ #endif fix_options (); changed_prefs = currprefs; #ifdef SAVESTATE savestate_init (); #endif #ifdef SCSIEMU scsidev_install (); #endif #ifdef AUTOCONFIG /* Install resident module to get 8MB chipmem, if requested */ rtarea_setup (); #endif keybuf_init (); /* Must come after init_joystick */ #ifdef AUTOCONFIG expansion_init (); #endif memory_init (); memory_reset (); #ifdef FILESYS filesys_install (); #endif #ifdef AUTOCONFIG bsdlib_install (); emulib_install (); uaeexe_install (); native2amiga_install (); #endif if (custom_init ()) { /* Must come after memory_init */ #ifdef SERIAL_PORT serial_init (); #endif DISK_init (); reset_frame_rate_hack (); init_m68k(); /* must come after reset_frame_rate_hack (); */ gui_update (); if (graphics_init ()) { #ifdef DEBUGGER setup_brkhandler (); if (currprefs.start_debugger && debuggable ()) activate_debugger (); #endif #ifdef WIN32 #ifdef FILESYS filesys_init (); /* New function, to do 'add_filesys_unit()' calls at start-up */ #endif #endif if (sound_available && currprefs.produce_sound > 1 && ! init_audio ()) { write_log ("Sound driver unavailable: Sound output disabled\n"); currprefs.produce_sound = 0; } start_program (); } } } #if defined (NATMEM_OFFSET) && defined( _WIN32 ) && !defined( NO_WIN32_EXCEPTION_HANDLER ) __except( EvalException( GetExceptionInformation(), GetExceptionCode() ) ) { // EvalException does the good stuff... } #endif }
static int real_main2 (int argc, TCHAR **argv) { #ifdef USE_SDL int result = (SDL_Init (SDL_INIT_TIMER | SDL_INIT_JOYSTICK | SDL_INIT_NOPARACHUTE) == 0); if (result) atexit (SDL_Quit); #endif set_config_changed (); if (restart_config[0]) { default_prefs (&currprefs, 0); fixup_prefs (&currprefs); } if (! graphics_setup ()) { write_log (_T("Graphics Setup Failed\n")); exit (1); } if (restart_config[0]) parse_cmdline_and_init_file (argc, argv); else currprefs = changed_prefs; // uae_inithrtimer (); if (!machdep_init ()) { write_log (_T("Machine Init Failed.\n")); restart_program = 0; return -1; } if (console_emulation) { consolehook_config (&currprefs); fixup_prefs (&currprefs); } if (! setup_sound ()) { write_log (_T("Sound driver unavailable: Sound output disabled\n")); currprefs.produce_sound = 0; } inputdevice_init (); changed_prefs = currprefs; no_gui = ! currprefs.start_gui; if (restart_program == 2) no_gui = 1; else if (restart_program == 3) no_gui = 0; restart_program = 0; if (! no_gui && currprefs.start_gui) { int err = gui_init (); currprefs = changed_prefs; set_config_changed (); if (err == -1) { write_log (_T("Failed to initialize the GUI\n")); return -1; } else if (err == -2) { return 1; } } memset (&gui_data, 0, sizeof gui_data); gui_data.cd = -1; gui_data.hd = -1; gui_data.md = -1; #ifdef NATMEM_OFFSET init_shm (); #endif #ifdef PICASSO96 picasso_reset (); #endif fixup_prefs (&currprefs); #ifdef RETROPLATFORM rp_fixup_options (&currprefs); #endif changed_prefs = currprefs; target_run (); /* force sound settings change */ currprefs.produce_sound = 0; savestate_init (); keybuf_init (); /* Must come after init_joystick */ memory_hardreset (2); memory_reset (); #ifdef AUTOCONFIG native2amiga_install (); #endif custom_init (); /* Must come after memory_init */ #ifdef SERIAL_PORT serial_init (); #endif DISK_init (); reset_frame_rate_hack (); init_m68k (); /* must come after reset_frame_rate_hack (); */ gui_update (); if (graphics_init ()) { #ifdef DEBUGGER setup_brkhandler (); if (currprefs.start_debugger && debuggable ()) activate_debugger (); #endif if (!init_audio ()) { if (sound_available && currprefs.produce_sound > 1) { write_log (_T("Sound driver unavailable: Sound output disabled\n")); } currprefs.produce_sound = 0; } start_program (); } return 0; }
/* * Initialization of emulator proper */ static int do_init_machine (void) { #ifdef JIT if (!(( currprefs.cpu_level >= 2 ) && ( currprefs.address_space_24 == 0 ) && ( currprefs.cachesize ))) canbang = 0; #endif #ifdef _WIN32 logging_init(); /* Yes, we call this twice - the first case handles when the user has loaded a config using the cmd-line. This case handles loads through the GUI. */ #endif #ifdef SAVESTATE savestate_init (); #endif #ifdef SCSIEMU scsidev_install (); #endif #ifdef AUTOCONFIG /* Install resident module to get 8MB chipmem, if requested */ rtarea_setup (); #endif keybuf_init (); /* Must come after init_joystick */ #ifdef AUTOCONFIG expansion_init (); #endif memory_init (); memory_reset (); #ifdef FILESYS filesys_install (); #endif #ifdef AUTOCONFIG bsdlib_install (); emulib_install (); uaeexe_install (); native2amiga_install (); #endif if (custom_init ()) { /* Must come after memory_init */ #ifdef SERIAL_PORT serial_init (); #endif DISK_init (); reset_frame_rate_hack (); init_m68k(); /* must come after reset_frame_rate_hack (); */ gui_update (); if (graphics_init ()) { #ifdef DEBUGGER setup_brkhandler (); if (currprefs.start_debugger && debuggable ()) activate_debugger (); #endif #ifdef WIN32 #ifdef FILESYS filesys_init (); /* New function, to do 'add_filesys_unit()' calls at start-up */ #endif #endif if (sound_available && currprefs.produce_sound > 1 && ! audio_init ()) { write_log ("Sound driver unavailable: Sound output disabled\n"); currprefs.produce_sound = 0; } return 1; } } return 0; }
static int real_main2 (int argc, TCHAR **argv) { #ifdef USE_SDL SDL_Init (SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK | SDL_INIT_NOPARACHUTE); #endif set_config_changed (); if (restart_config[0]) { default_prefs (&currprefs, true, 0); fixup_prefs (&currprefs, true); } if (! graphics_setup ()) { exit (1); } #ifdef NATMEM_OFFSET //preinit_shm (); #endif if (restart_config[0]) parse_cmdline_and_init_file (argc, argv); else currprefs = changed_prefs; if (!machdep_init ()) { restart_program = 0; return -1; } if (console_emulation) { consolehook_config (&currprefs); fixup_prefs (&currprefs, true); } if (! setup_sound ()) { write_log (_T("Sound driver unavailable: Sound output disabled\n")); currprefs.produce_sound = 0; } inputdevice_init (); changed_prefs = currprefs; no_gui = ! currprefs.start_gui; if (restart_program == 2) no_gui = 1; else if (restart_program == 3) no_gui = 0; restart_program = 0; if (! no_gui) { int err = gui_init (); currprefs = changed_prefs; set_config_changed (); if (err == -1) { write_log (_T("Failed to initialize the GUI\n")); return -1; } else if (err == -2) { return 1; } } memset (&gui_data, 0, sizeof gui_data); gui_data.cd = -1; gui_data.hd = -1; gui_data.md = (currprefs.cs_cd32nvram || currprefs.cs_cdtvram) ? 0 : -1; logging_init (); /* Yes, we call this twice - the first case handles when the user has loaded a config using the cmd-line. This case handles loads through the GUI. */ #ifdef NATMEM_OFFSET init_shm (); #endif #ifdef WITH_LUA uae_lua_init (); #endif #ifdef PICASSO96 picasso_reset (); #endif #if 0 #ifdef JIT if (!(currprefs.cpu_model >= 68020 && currprefs.address_space_24 == 0 && currprefs.cachesize)) canbang = 0; #endif #endif fixup_prefs (&currprefs, true); #ifdef RETROPLATFORM rp_fixup_options (&currprefs); #endif changed_prefs = currprefs; target_run (); /* force sound settings change */ currprefs.produce_sound = 0; savestate_init (); keybuf_init (); /* Must come after init_joystick */ memory_hardreset (2); memory_reset (); #ifdef AUTOCONFIG native2amiga_install (); #endif custom_init (); /* Must come after memory_init */ #ifdef SERIAL_PORT serial_init (); #endif DISK_init (); #ifdef WITH_PPC uae_ppc_reset(true); #endif reset_frame_rate_hack (); init_m68k (); /* must come after reset_frame_rate_hack (); */ gui_update (); if (graphics_init (true)) { setup_brkhandler (); if (currprefs.start_debugger && debuggable ()) activate_debugger (); if (!init_audio ()) { if (sound_available && currprefs.produce_sound > 1) { write_log (_T("Sound driver unavailable: Sound output disabled\n")); } currprefs.produce_sound = 0; } start_program (); } return 0; }
static int real_main2 (int argc, TCHAR **argv) { #ifdef USE_SDL SDL_Init (SDL_INIT_TIMER | SDL_INIT_AUDIO | SDL_INIT_JOYSTICK | SDL_INIT_NOPARACHUTE); #endif config_changed = 1; if (restart_config[0]) { default_prefs (&currprefs, 0); fixup_prefs (&currprefs); } if (! graphics_setup ()) { exit (1); } #ifdef NATMEM_OFFSET preinit_shm (); #endif if (restart_config[0]) parse_cmdline_and_init_file (argc, argv); else currprefs = changed_prefs; if (!machdep_init ()) { restart_program = 0; return -1; } if (console_emulation) { consolehook_config (&currprefs); fixup_prefs (&currprefs); } if (! setup_sound ()) { write_log (L"Sound driver unavailable: Sound output disabled\n"); currprefs.produce_sound = 0; } inputdevice_init (); changed_prefs = currprefs; no_gui = ! currprefs.start_gui; if (restart_program == 2) no_gui = 1; else if (restart_program == 3) no_gui = 0; restart_program = 0; if (! no_gui) { int err = gui_init (); currprefs = changed_prefs; config_changed = 1; if (err == -1) { write_log (L"Failed to initialize the GUI\n"); return -1; } else if (err == -2) { return 1; } } logging_init (); /* Yes, we call this twice - the first case handles when the user has loaded a config using the cmd-line. This case handles loads through the GUI. */ #ifdef NATMEM_OFFSET init_shm (); #endif #ifdef JIT if (!(currprefs.cpu_model >= 68020 && currprefs.address_space_24 == 0 && currprefs.cachesize)) canbang = 0; #endif fixup_prefs (&currprefs); changed_prefs = currprefs; target_run (); /* force sound settings change */ currprefs.produce_sound = 0; #ifdef AUTOCONFIG rtarea_setup (); #endif #ifdef FILESYS rtarea_init (); uaeres_install (); hardfile_install (); #endif savestate_init (); #ifdef SCSIEMU scsi_reset (); scsidev_install (); #endif #ifdef SANA2 netdev_install (); #endif #ifdef UAESERIAL uaeserialdev_install (); #endif keybuf_init (); /* Must come after init_joystick */ #ifdef AUTOCONFIG expansion_init (); #endif #ifdef FILESYS filesys_install (); #endif memory_init (); memory_reset (); #ifdef AUTOCONFIG #if defined (BSDSOCKET) bsdlib_install (); #endif emulib_install (); uaeexe_install (); native2amiga_install (); #endif custom_init (); /* Must come after memory_init */ #ifdef SERIAL_PORT serial_init (); #endif DISK_init (); reset_frame_rate_hack (); init_m68k (); /* must come after reset_frame_rate_hack (); */ gui_update (); if (graphics_init ()) { setup_brkhandler (); if (currprefs.start_debugger && debuggable ()) activate_debugger (); if (!init_audio ()) { if (sound_available && currprefs.produce_sound > 1) { write_log (L"Sound driver unavailable: Sound output disabled\n"); } currprefs.produce_sound = 0; } start_program (); } return 0; }
static void load_pbobbl2x(void) { int ta,tb,tc; RAMSize=0x80000; if(!(RAM=AllocateMem(0x80000))) return; if(!(ROM=AllocateMem(0x100000))) return; if(!(GFX=AllocateMem(0x3F5D00+0x3EC700))) return; GFX_BG0 = GFX+0x3F5D00; GFX_SPR = GFX+0x000000; tb=0; if(!load_rom("e10-02.rom", ROM, 0xFD740)) return; // 16x16 SPRITES ($3F5D) for(ta=0;ta<0xFD740;ta++){ GFX[tb++]=ROM[ta]&15; GFX[tb++]=ROM[ta]>>4; tb+=2; } tb=2; if(!load_rom("e10-01.rom", ROM, 0xFD740)) return; // 16x16 SPRITES for(ta=0;ta<0xFD740;ta++){ GFX[tb++]=ROM[ta]&15; GFX[tb++]=ROM[ta]>>4; tb+=2; } tb=0; if(!load_rom("e10-07.rom", ROM, 0xFB1C0)) return; // 16x16 TILES ($3EC7) for(ta=0;ta<0xFB1C0;ta+=2){ GFX_BG0[tb++]=ROM[ta]&15; GFX_BG0[tb++]=ROM[ta]>>4; GFX_BG0[tb++]=ROM[ta+1]&15; GFX_BG0[tb++]=ROM[ta+1]>>4; tb+=4; } tb=4; if(!load_rom("e10-06.rom", ROM, 0xFB1C0)) return; // 16x16 TILES for(ta=0;ta<0xFB1C0;ta+=2){ GFX_BG0[tb++]=ROM[ta]&15; GFX_BG0[tb++]=ROM[ta]>>4; GFX_BG0[tb++]=ROM[ta+1]&15; GFX_BG0[tb++]=ROM[ta+1]>>4; tb+=4; } tb=0; if(!load_rom("e10-05.rom", ROM, 0xFB1C0)) return; // 16x16 TILES (MASK) for(ta=0;ta<0xFB1C0;ta+=2){ tc=ROM[ta]; GFX_BG0[tb+7]|=((tc&0x80)>>7)<<4; GFX_BG0[tb+6]|=((tc&0x40)>>6)<<4; GFX_BG0[tb+5]|=((tc&0x20)>>5)<<4; GFX_BG0[tb+4]|=((tc&0x10)>>4)<<4; GFX_BG0[tb+3]|=((tc&0x08)>>3)<<4; GFX_BG0[tb+2]|=((tc&0x04)>>2)<<4; GFX_BG0[tb+1]|=((tc&0x02)>>1)<<4; GFX_BG0[tb+0]|=((tc&0x01)>>0)<<4; tc=ROM[ta+1]; GFX_BG0[tb+7]|=((tc&0x80)>>7)<<5; GFX_BG0[tb+6]|=((tc&0x40)>>6)<<5; GFX_BG0[tb+5]|=((tc&0x20)>>5)<<5; GFX_BG0[tb+4]|=((tc&0x10)>>4)<<5; GFX_BG0[tb+3]|=((tc&0x08)>>3)<<5; GFX_BG0[tb+2]|=((tc&0x04)>>2)<<5; GFX_BG0[tb+1]|=((tc&0x02)>>1)<<5; GFX_BG0[tb+0]|=((tc&0x01)>>0)<<5; tb+=8; } GFX_BG0_SOLID = make_solid_mask_16x16(GFX_BG0, 0x3EC7); GFX_SPR_SOLID = make_solid_mask_16x16(GFX_SPR, 0x3F5D); GFX_BG0_PENS = make_colour_count_16x16(GFX_BG0, 0x3EC7); // Setup 68020 Memory Map // ---------------------- AddF3MemoryMap(0x100000); RAM_BG0=RAM+0x33000; RAM_BG1=RAM+0x32000; RAM_BG2=RAM+0x31000; RAM_BG3=RAM+0x30000; RAM_SCR0=RAM+0x6A006; RAM_SCR1=RAM+0x6A004; RAM_SCR2=RAM+0x6A002; RAM_SCR3=RAM+0x6A000; SCR3_XOFS=0xF640; SCR2_XOFS=0xF740; SCR1_XOFS=0xF840; SCR0_XOFS=0xF940; SCR3_YOFS=0xF400; SCR2_YOFS=0xF400; SCR1_YOFS=0xF400; SCR0_YOFS=0xF400; if(!load_rom("e10.29", RAM, 0x40000)) return; for(ta=0;ta<0x40000;ta++){ ROM[(ta<<2)+0]=RAM[ta]; } if(!load_rom("e10.28", RAM, 0x40000)) return; for(ta=0;ta<0x40000;ta++){ ROM[(ta<<2)+1]=RAM[ta]; } if(!load_rom("e10.27", RAM, 0x40000)) return; for(ta=0;ta<0x40000;ta++){ ROM[(ta<<2)+2]=RAM[ta]; } if(!load_rom("e10.26", RAM, 0x40000)) return; for(ta=0;ta<0x40000;ta++){ ROM[(ta<<2)+3]=RAM[ta]; } // 68000 code M68000ROM = load_region[REGION_ROM2]; if(!(PCMROM=AllocateMem(0x800000))) return; load_be("e10-03.rom",PCMROM,0x200000); load_be("e10-04.rom",PCMROM+0x400000,0x200000); max_banks_this_game=3; //=memory_region_length(REGION_SOUND1)/0x400000; memset(RAM+0x00000,0x00,0x80000); memset(RAM+0x69000,0xFF,0x01000); // EEPROM ACCESS // ------------- WriteWord68k(&ROM[0x0044D2],0x7F00); // raine #$00 <eeprom access> WriteWord68k(&ROM[0x0044D4],0x4ED6); // jmp (a6) // SPEED HACK // ---------- WriteWord68k(&ROM[0x031D4],0x4EF9); // jmp $F8000 WriteLong68k(&ROM[0x031D6],0x000F8000); WriteWord68k(&ROM[0xF8000],0x4EB9); // jsr $0291C <random gen> WriteLong68k(&ROM[0xF8002],0x0000291C); WriteWord68k(&ROM[0xF8006],0x7F02); // raine #$02 <stop cpu> WriteWord68k(&ROM[0xF8008],0x6100-10); // bra.s <loop> F3SystemEEPROMAccess=&F3SysEEPROMAccessMode2; set_colour_mapper(&col_map_xxxx_xxxx_rrrr_rrrr_gggg_gggg_bbbb_bbbb); InitPaletteMap(RAM+0x60000, 0x200, 0x40, 0x8000); // Init tc0003vcu emulation // ------------------------ tc0003vcu.RAM = RAM+0x20000; tc0003vcu.mapper = &Map_24bit_xRGB; tc0003vcu.bmp_x = 64; tc0003vcu.bmp_y = 64; tc0003vcu.bmp_w = 320; tc0003vcu.bmp_h = 232; tc0003vcu.scr_x = 0; tc0003vcu.scr_y = 0; // Init tc0200obj emulation // ------------------------ tc0200obj.RAM = RAM+0x20000; tc0200obj.RAM_B = RAM+0x28000; tc0200obj.GFX = GFX_SPR; tc0200obj.MASK = GFX_SPR_SOLID; tc0200obj.bmp_x = 64; tc0200obj.bmp_y = 64; tc0200obj.bmp_w = 320; tc0200obj.bmp_h = 232; tc0200obj.mapper = &Map_24bit_xRGB; tc0200obj.tile_mask = 0x3FFF; tc0200obj.ofs_x = 0-0x2E; tc0200obj.ofs_y = 0-0x18; tc0200obj.cols = 16; init_tc0200obj(); init_f3_system_ioc(F3_IOC_2P_3BUTTON); init_m68k(); setup_sound_68000(); }
static void load_puchicar(void) { int ta,tb,tc; RAMSize=0x80000; if(!(RAM=AllocateMem(0x80000))) return; if(!(ROM=AllocateMem(0x200000))) return; if(!(GFX=AllocateMem(0xF17A00+0x3F0800))) return; GFX_BG0 = GFX+0xF17A00; GFX_SPR = GFX+0x000000; tb=0; if(!load_rom("e46.06", ROM, 0x200000)) return; // 16x16 SPRITES ($8000) for(ta=0;ta<0x200000;ta++,tb+=4){ WriteWord(&GFX_SPR[tb],((ROM[ta])|(ROM[ta]<<4))&0x0F0F); } tb=2; if(!load_rom("e46.04", ROM, 0x200000)) return; // 16x16 SPRITES for(ta=0;ta<0x200000;ta++,tb+=4){ WriteWord(&GFX_SPR[tb],((ROM[ta])|(ROM[ta]<<4))&0x0F0F); } tb=0; if(!load_rom("e46.02", ROM, 0x200000)) return; // 16x16 SPRITES (MASK) for(ta=0;ta<0x200000;ta++){ tc=ROM[ta]; GFX[tb+3]|=((tc&0x40)>>6)<<4; GFX[tb+2]|=((tc&0x10)>>4)<<4; GFX[tb+1]|=((tc&0x04)>>2)<<4; GFX[tb+0]|=((tc&0x01)>>0)<<4; tb+=4; } tb=0x800000; if(!load_rom("e46.05", ROM, 0x1C5E80)) return; // 16x16 SPRITES ($717A) for(ta=0;ta<0x1C5E80;ta++,tb+=4){ WriteWord(&GFX_SPR[tb],((ROM[ta])|(ROM[ta]<<4))&0x0F0F); } tb=0x800002; if(!load_rom("e46.03", ROM, 0x1C5E80)) return; // 16x16 SPRITES for(ta=0;ta<0x1C5E80;ta++,tb+=4){ WriteWord(&GFX_SPR[tb],((ROM[ta])|(ROM[ta]<<4))&0x0F0F); } tb=0x800000; if(!load_rom("e46.01", ROM, 0x1C5E80)) return; // 16x16 SPRITES (MASK) for(ta=0;ta<0x1C5E80;ta++){ tc=ROM[ta]; GFX[tb+3]|=((tc&0x40)>>6)<<4; GFX[tb+2]|=((tc&0x10)>>4)<<4; GFX[tb+1]|=((tc&0x04)>>2)<<4; GFX[tb+0]|=((tc&0x01)>>0)<<4; tb+=4; } tb=0; if(!load_rom("e46.12", ROM, 0xFC200)) return; // 16x16 TILES ($3F08) for(ta=0;ta<0xFC200;ta+=2,tb+=8){ WriteWord(&GFX_BG0[tb+0],((ROM[ta+0])|(ROM[ta+0]<<4))&0x0F0F); WriteWord(&GFX_BG0[tb+2],((ROM[ta+1])|(ROM[ta+1]<<4))&0x0F0F); } tb=4; if(!load_rom("e46.11", ROM, 0xFC200)) return; // 16x16 TILES for(ta=0;ta<0xFC200;ta+=2,tb+=8){ WriteWord(&GFX_BG0[tb+0],((ROM[ta+0])|(ROM[ta+0]<<4))&0x0F0F); WriteWord(&GFX_BG0[tb+2],((ROM[ta+1])|(ROM[ta+1]<<4))&0x0F0F); } tb=0; if(!load_rom("e46.10", ROM, 0xFC200)) return; // 16x16 TILES (MASK) for(ta=0;ta<0xFC200;ta+=2){ tc=ROM[ta]; GFX_BG0[tb+7]|=((tc&0x80)>>7)<<4; GFX_BG0[tb+6]|=((tc&0x40)>>6)<<4; GFX_BG0[tb+5]|=((tc&0x20)>>5)<<4; GFX_BG0[tb+4]|=((tc&0x10)>>4)<<4; GFX_BG0[tb+3]|=((tc&0x08)>>3)<<4; GFX_BG0[tb+2]|=((tc&0x04)>>2)<<4; GFX_BG0[tb+1]|=((tc&0x02)>>1)<<4; GFX_BG0[tb+0]|=((tc&0x01)>>0)<<4; tc=ROM[ta+1]; GFX_BG0[tb+7]|=((tc&0x80)>>7)<<5; GFX_BG0[tb+6]|=((tc&0x40)>>6)<<5; GFX_BG0[tb+5]|=((tc&0x20)>>5)<<5; GFX_BG0[tb+4]|=((tc&0x10)>>4)<<5; GFX_BG0[tb+3]|=((tc&0x08)>>3)<<5; GFX_BG0[tb+2]|=((tc&0x04)>>2)<<5; GFX_BG0[tb+1]|=((tc&0x02)>>1)<<5; GFX_BG0[tb+0]|=((tc&0x01)>>0)<<5; tb+=8; } GFX_BG0_SOLID = MakeSolidTileMap16x16(GFX_BG0, 0x3F08); GFX_SPR_SOLID = make_solid_mask_16x16(GFX_SPR, 0xF17A); FreeMem(ROM); ROM = load_region[REGION_CPU1]; // Setup 68020 Memory Map // ---------------------- AddF3MemoryMap(0x100000); RAM_BG0=RAM+0x30000; RAM_BG1=RAM+0x32000; RAM_BG2=RAM+0x34000; RAM_BG3=RAM+0x36000; RAM_SCR0=RAM+0x6A000; RAM_SCR1=RAM+0x6A002; RAM_SCR2=RAM+0x6A004; RAM_SCR3=RAM+0x6A006; SCR0_XOFS=0xF600; SCR1_XOFS=0xF700; SCR2_XOFS=0xF800; SCR3_XOFS=0xF900; SCR0_YOFS=0xFF80; SCR1_YOFS=0xFF80; SCR2_YOFS=0xFF80; SCR3_YOFS=0xFF80; // 68000 code M68000ROM = load_region[REGION_ROM2]; if(!(PCMROM=AllocateMem(0xe00004))) return; load_be("e46.09",PCMROM,0x200000); load_be("e46.08",PCMROM+0x400000,0x200000); load_be("e46.07",PCMROM+0x800000,0x200000); max_banks_this_game=6; //=memory_region_length(REGION_SOUND1)/0x400000; memset(PCMROM+0xc00000,0x0,0x200003); memset(RAM+0x00000,0x00,0x80000); memset(RAM+0x69000,0xFF,0x01000); // EEPROM HACKS // ------------ WriteWord68k(&ROM[0x0019C4],0x7F00); // raine #$00 <read/write eeprom> WriteWord68k(&ROM[0x0019C6],0x4ED6); // jmp (a6) // SPEED HACK#1 // ------------ // WriteWord68k(&ROM[0x009DC],0x7F02); // raine #$02 <stop cpu> WriteWord68k(&ROM[0x009A4],0x7F02); // raine #$02 <stop cpu> WriteWord68k(&ROM[0x009A6],0x4E71); // nop WriteWord68k(&ROM[0x009A8],0x4E71); // nop WriteWord68k(&ROM[0x009AA],0x4E71); // nop F3SystemEEPROMAccess=&F3SysEEPROMAccessMode2; set_colour_mapper(&col_map_xxxx_xxxx_rrrr_rrrr_gggg_gggg_bbbb_bbbb); InitPaletteMap(RAM+0x60000, 0x200, 0x40, 0x8000); // Init tc0003vcu emulation // ------------------------ tc0003vcu.RAM = RAM+0x20000; // Mapper disabled tc0003vcu.bmp_x = 64; tc0003vcu.bmp_y = 64; tc0003vcu.bmp_w = 320; tc0003vcu.bmp_h = 232; tc0003vcu.scr_x = 0; tc0003vcu.scr_y = 0; // Init tc0200obj emulation // ------------------------ tc0200obj.RAM = RAM+0x20000; tc0200obj.RAM_B = RAM+0x28000; tc0200obj.GFX = GFX_SPR; tc0200obj.MASK = GFX_SPR_SOLID; tc0200obj.bmp_x = 64; tc0200obj.bmp_y = 64; tc0200obj.bmp_w = 320; tc0200obj.bmp_h = 232; // Mapper disabled tc0200obj.tile_mask = 0xFFFF; tc0200obj.ofs_x = 0-0x2E; tc0200obj.ofs_y = 0-0x18; tc0200obj.cols = 32; init_tc0200obj(); init_f3_system_ioc(F3_IOC_2P_3BUTTON | F3_IOC_TRACKBALL); init_m68k(); setup_sound_68000(); }
void real_main (int argc, char **argv) { #ifdef USE_SDL SDL_Init (SDL_INIT_VIDEO | SDL_INIT_JOYSTICK #if !defined(NO_SOUND) && !defined(GP2X) | SDL_INIT_AUDIO #endif ); #endif /* PocketUAE prefs */ #ifdef GP2X gp2x_init(argc, argv); #endif //loadconfig (1); if (! graphics_setup ()) { exit (1); } rtarea_init (); hardfile_install(); if (! setup_sound ()) { write_log ("Sound driver unavailable: Sound output disabled\n"); produce_sound = 0; } init_joystick (); int err = gui_init (); if (err == -1) { write_log ("Failed to initialize the GUI\n"); } else if (err == -2) { exit (0); } if (sound_available && produce_sound > 1 && ! init_audio ()) { write_log ("Sound driver unavailable: Sound output disabled\n"); produce_sound = 0; } /* Install resident module to get 8MB chipmem, if requested */ rtarea_setup (); keybuf_init (); /* Must come after init_joystick */ #ifdef USE_AUTOCONFIG expansion_init (); #endif memory_init (); filesys_install (); native2amiga_install (); custom_init (); /* Must come after memory_init */ DISK_init (); init_m68k(); #ifndef USE_FAME_CORE compiler_init (); #endif //gui_update (); #ifdef GP2X switch_to_hw_sdl(1); #endif if (graphics_init()) { start_program (); } leave_program (); }
static void load_gekirido(void) { int ta,tb,tc; RAMSize=0x80000; if(!(GFX=AllocateMem(0x698900+0x544800))) return; if(!(RAM=AllocateMem(0x80000))) return; if(!(ROM=AllocateMem(0x1A6240))) return; GFX_BG0 = GFX+0x000000; GFX_SPR = GFX+0x698900; if(!load_rom("E11-03.bin", ROM, 0x151200)) return; // 16x16 SPRITES ($5448) tb=0; for(ta=0; ta<0x151200; ta++,tb+=4) { WriteWord(&GFX_SPR[tb],((ROM[ta])|(ROM[ta]<<4))&0x0F0F); } if(!load_rom("E11-02.bin", ROM, 0x151200)) return; // 16x16 SPRITES tb=2; for(ta=0; ta<0x151200; ta++,tb+=4) { WriteWord(&GFX_SPR[tb],((ROM[ta])|(ROM[ta]<<4))&0x0F0F); } tb=0; if(!load_rom("E11-01.bin", ROM, 0x151200)) return; // 16x16 SPRITES (MASK) for(ta=0; ta<0x151200; ta++) { tc=ROM[ta]; GFX_SPR[tb+3]|=((tc&0x40)>>6)<<4; GFX_SPR[tb+2]|=((tc&0x10)>>4)<<4; GFX_SPR[tb+1]|=((tc&0x04)>>2)<<4; GFX_SPR[tb+0]|=((tc&0x01)>>0)<<4; tb+=4; } tb=0; if(!load_rom("E11-08.bin", ROM, 0x1A6240)) return; // 16x16 TILES ($6989) for(ta=0; ta<0x1A6240; ta+=2,tb+=8) { WriteWord(&GFX_BG0[tb+0],((ROM[ta+0])|(ROM[ta+0]<<4))&0x0F0F); WriteWord(&GFX_BG0[tb+2],((ROM[ta+1])|(ROM[ta+1]<<4))&0x0F0F); } tb=4; if(!load_rom("E11-07.bin", ROM, 0x1A6240)) return; // 16x16 TILES for(ta=0; ta<0x1A6240; ta+=2,tb+=8) { WriteWord(&GFX_BG0[tb+0],((ROM[ta+0])|(ROM[ta+0]<<4))&0x0F0F); WriteWord(&GFX_BG0[tb+2],((ROM[ta+1])|(ROM[ta+1]<<4))&0x0F0F); } tb=0; if(!load_rom("E11-06.bin", ROM, 0x1A6240)) return; // 16x16 TILES (MASK) for(ta=0; ta<0x1A6240; ta+=2) { tc=ROM[ta]; GFX_BG0[tb+7]|=((tc&0x80)>>7)<<4; GFX_BG0[tb+6]|=((tc&0x40)>>6)<<4; GFX_BG0[tb+5]|=((tc&0x20)>>5)<<4; GFX_BG0[tb+4]|=((tc&0x10)>>4)<<4; GFX_BG0[tb+3]|=((tc&0x08)>>3)<<4; GFX_BG0[tb+2]|=((tc&0x04)>>2)<<4; GFX_BG0[tb+1]|=((tc&0x02)>>1)<<4; GFX_BG0[tb+0]|=((tc&0x01)>>0)<<4; tb+=8; } FreeMem(ROM); if(!(ROM=AllocateMem(0x100000))) return; Rotate16x16(GFX_BG0,0x6989); Flip16x16_X(GFX_BG0,0x6989); Rotate16x16(GFX_SPR,0x5448); Flip16x16_X(GFX_SPR,0x5448); GFX_BG0_SOLID = MakeSolidTileMap16x16(GFX_BG0, 0x6989); GFX_SPR_SOLID = make_solid_mask_16x16(GFX_SPR, 0x5448); // Setup 68020 Memory Map // ---------------------- AddF3MemoryMap(0x100000); RAM_BG3=RAM+0x30000; RAM_BG2=RAM+0x31000; RAM_BG1=RAM+0x32000; RAM_BG0=RAM+0x33000; RAM_SCR3=RAM+0x6A000; RAM_SCR2=RAM+0x6A002; RAM_SCR1=RAM+0x6A004; RAM_SCR0=RAM+0x6A006; SCR3_XOFS=0xF900; SCR2_XOFS=0xF800; SCR1_XOFS=0xF700; SCR0_XOFS=0xF600; SCR3_YOFS=0xFF80; SCR2_YOFS=0xF400; SCR1_YOFS=0xF400; SCR0_YOFS=0xFF80; if(!load_rom("E11-12.bin", RAM, 0x40000)) return; for(ta=0; ta<0x40000; ta++) { ROM[(ta<<2)+0]=RAM[ta]; } if(!load_rom("E11-11.bin", RAM, 0x40000)) return; for(ta=0; ta<0x40000; ta++) { ROM[(ta<<2)+1]=RAM[ta]; } if(!load_rom("E11-10.bin", RAM, 0x40000)) return; for(ta=0; ta<0x40000; ta++) { ROM[(ta<<2)+2]=RAM[ta]; } if(!load_rom("E11-09.bin", RAM, 0x40000)) return; for(ta=0; ta<0x40000; ta++) { ROM[(ta<<2)+3]=RAM[ta]; } for(ta=0x104F4; ta<0x124F4; ta+=4) { // swap words tb=ReadWord(&ROM[ta]); WriteWord(&ROM[ta],ReadWord(&ROM[ta+2])); WriteWord(&ROM[ta+2],tb); } Rotate8x8_4bpp(ROM+0x104F4,0x2000>>5); Flip8x8_4bpp_X(ROM+0x104F4,0x2000>>5); for(ta=0x104F4; ta<0x124F4; ta+=4) { // swap words tb=ReadWord(&ROM[ta]); WriteWord(&ROM[ta],ReadWord(&ROM[ta+2])); WriteWord(&ROM[ta+2],tb); } for(ta=0x8EBD8; ta<0x8EC78; ta+=4) { // swap words tb=ReadWord(&ROM[ta]); WriteWord(&ROM[ta],ReadWord(&ROM[ta+2])); WriteWord(&ROM[ta+2],tb); } Rotate8x8_4bpp(ROM+0x8EBD8,0x00A0>>5); Flip8x8_4bpp_X(ROM+0x8EBD8,0x00A0>>5); for(ta=0x8EBD8; ta<0x8EC78; ta+=4) { // swap words tb=ReadWord(&ROM[ta]); WriteWord(&ROM[ta],ReadWord(&ROM[ta+2])); WriteWord(&ROM[ta+2],tb); } for(ta=0xF6820; ta<0xF6D60; ta+=4) { // swap words tb=ReadWord(&ROM[ta]); WriteWord(&ROM[ta],ReadWord(&ROM[ta+2])); WriteWord(&ROM[ta+2],tb); } Rotate8x8_4bpp(ROM+0xF6820,0x0540>>5); Flip8x8_4bpp_X(ROM+0xF6820,0x0540>>5); for(ta=0xF6820; ta<0xF6D60; ta+=4) { // swap words tb=ReadWord(&ROM[ta]); WriteWord(&ROM[ta],ReadWord(&ROM[ta+2])); WriteWord(&ROM[ta+2],tb); } // 68000 code M68000ROM = load_region[REGION_ROM2]; if(!(PCMROM=AllocateMem(0x800000))) return; load_be("e11-04.bin",PCMROM,0x200000); load_be("e11-05.bin",PCMROM+0x400000,0x200000); max_banks_this_game=3; //=memory_region_length(REGION_SOUND1)/0x400000; memset(RAM+0x00000,0x00,0x80000); memset(RAM+0x69000,0xFF,0x01000); // EEPROM HACK // ----------- WriteWord68k(&ROM[0x0044F8],0x7F00); // raine #$00 <eeprom read/write> WriteWord68k(&ROM[0x0044FA],0x4ED6); // jmp (a6) // SPEED HACKS // ----------- WriteWord68k(&ROM[0x002340],0x7F02); // raine #$02 <stop cpu> WriteWord68k(&ROM[0x002342],0x6100-10); // bra.s <loop> F3SystemEEPROMAccess=&F3SysEEPROMAccessMode2; set_colour_mapper(&col_map_xxxx_xxxx_rrrr_rrrr_gggg_gggg_bbbb_bbbb); InitPaletteMap(RAM+0x60000, 0x200, 0x40, 0x8000); // Init tc0003vcu emulation // ------------------------ tc0003vcu.RAM = RAM+0x20000; // Mapper disabled tc0003vcu.bmp_x = 64; tc0003vcu.bmp_y = 64; tc0003vcu.bmp_w = 232; tc0003vcu.bmp_h = 320; tc0003vcu.scr_x = 0; tc0003vcu.scr_y = 0; // Init tc0200obj emulation // ------------------------ tc0200obj.RAM = RAM+0x20000; tc0200obj.RAM_B = RAM+0x28000; tc0200obj.GFX = GFX_SPR; tc0200obj.MASK = GFX_SPR_SOLID; tc0200obj.bmp_x = 64; tc0200obj.bmp_y = 64; tc0200obj.bmp_w = 232; tc0200obj.bmp_h = 320; // Mapper disabled tc0200obj.tile_mask = 0x7FFF; tc0200obj.ofs_x = 0; //-16; //(0-0x0C)-16; // 0x0C 0x1F tc0200obj.ofs_y = 0; //0-0x2E; //(0-0x1F)+15; // 0x1F 0x2E tc0200obj.cols = 32; init_tc0200obj(); init_f3_system_ioc(F3_IOC_2P_3BUTTON); init_m68k(); setup_sound_68000(); }
static int real_main2 (int argc, TCHAR **argv) { #if (defined (_WIN32) || defined (_WIN64)) && !defined (NO_WIN32_EXCEPTION_HANDLER) extern int EvalException (LPEXCEPTION_POINTERS blah, int n_except); __try #endif { #ifdef USE_SDL int result = (SDL_Init (SDL_INIT_TIMER | SDL_INIT_JOYSTICK | SDL_INIT_NOPARACHUTE) == 0); if (result) atexit (SDL_Quit); #endif config_changed = 1; if (restart_config[0]) { default_prefs (&currprefs, 0); fixup_prefs (&currprefs); } if (! graphics_setup ()) { write_log ("Graphics Setup Failed\n"); exit (1); } #ifdef NATMEM_OFFSET preinit_shm (); #endif if (restart_config[0]) parse_cmdline_and_init_file (argc, argv); else currprefs = changed_prefs; uae_inithrtimer (); if (!machdep_init ()) { write_log ("Machine Init Failed.\n"); restart_program = 0; return -1; } if (console_emulation) { consolehook_config (&currprefs); fixup_prefs (&currprefs); } if (! setup_sound ()) { write_log ("Sound driver unavailable: Sound output disabled\n"); currprefs.produce_sound = 0; } inputdevice_init (); changed_prefs = currprefs; no_gui = ! currprefs.start_gui; if (restart_program == 2) no_gui = 1; else if (restart_program == 3) no_gui = 0; restart_program = 0; if (! no_gui) { int err = gui_init (); currprefs = changed_prefs; config_changed = 1; if (err == -1) { write_log ("Failed to initialize the GUI\n"); return -1; } else if (err == -2) { return 1; } } #ifdef NATMEM_OFFSET init_shm (); #endif #ifdef JIT if (!(currprefs.cpu_model >= 68020 && currprefs.address_space_24 == 0 && currprefs.cachesize)) canbang = 0; #endif fixup_prefs (&currprefs); changed_prefs = currprefs; target_run (); /* force sound settings change */ currprefs.produce_sound = 0; #ifdef AUTOCONFIG /* Install resident module to get 8MB chipmem, if requested */ rtarea_setup (); #endif #ifdef FILESYS rtarea_init (); uaeres_install (); hardfile_install (); #endif savestate_init (); #ifdef SCSIEMU scsi_reset (); scsidev_install (); #endif #ifdef SANA2 netdev_install (); #endif #ifdef UAESERIAL uaeserialdev_install (); #endif keybuf_init (); /* Must come after init_joystick */ #ifdef AUTOCONFIG expansion_init (); #endif #ifdef FILESYS filesys_install (); #endif target_startup_sequence (&currprefs); memory_init (); memory_reset (); #ifdef AUTOCONFIG #if defined (BSDSOCKET) bsdlib_install (); #endif emulib_install (); uaeexe_install (); native2amiga_install (); #endif custom_init (); /* Must come after memory_init */ #ifdef SERIAL_PORT serial_init (); #endif DISK_init (); reset_frame_rate_hack (); init_m68k (); /* must come after reset_frame_rate_hack (); */ gui_update (); if (graphics_init ()) { #ifdef DEBUGGER setup_brkhandler (); if (currprefs.start_debugger && debuggable ()) activate_debugger (); #endif if (!init_audio ()) { if (sound_available && currprefs.produce_sound > 1) { write_log ("Sound driver unavailable: Sound output disabled\n"); } currprefs.produce_sound = 0; } start_program (); } } #if (defined (_WIN32) || defined (_WIN64)) && !defined (NO_WIN32_EXCEPTION_HANDLER) #ifdef JIT __except( EvalException( GetExceptionInformation(), GetExceptionCode() ) ) #else __except (DummyException (GetExceptionInformation (), GetExceptionCode ())) #endif { // EvalException does the good stuff... } #endif return 0; }
void real_main (int argc, char **argv) { FILE *hf; #ifdef USE_SDL SDL_Init (SDL_INIT_EVERYTHING | SDL_INIT_NOPARACHUTE); #endif default_prefs (&currprefs); #ifdef SYSTEM_CFGDIR scan_configs (SYSTEM_CFGDIR); #endif /* Can be overriden in graphics_setup, although there's not much of a point. Fullscreen modes are filled in by graphics_setup. */ gfx_windowed_modes = default_windowed_modes; n_windowed_modes = sizeof default_windowed_modes / sizeof *default_windowed_modes; if (! graphics_setup ()) { exit (1); } rtarea_init (); hardfile_install (); scsidev_install (); parse_cmdline_and_init_file (argc, argv); machdep_init (); init_gtod (); if (! setup_sound ()) { write_log ("Sound driver unavailable: Sound output disabled\n"); currprefs.produce_sound = 0; } inputdevice_init (); changed_prefs = currprefs; no_gui = ! currprefs.start_gui; if (! no_gui) { int err = gui_init (1); currprefs = changed_prefs; if (err == -1) { write_log ("Failed to initialize the GUI\n"); } else if (err == -2) { exit (0); } } if (sound_available && currprefs.produce_sound > 1 && ! init_audio ()) { write_log ("Sound driver unavailable: Sound output disabled\n"); currprefs.produce_sound = 0; } fixup_prefs (&currprefs); changed_prefs = currprefs; #ifdef SYSTEM_ROMDIR scan_roms (SYSTEM_ROMDIR, ROMLOC_SYSTEM); #endif scan_roms (currprefs.path_rom, ROMLOC_USER); /* Install resident module to get 8MB chipmem, if requested */ rtarea_setup (); keybuf_init (); /* Must come after init_joystick */ expansion_init (); memory_init (); filesys_install (); bsdlib_install (); emulib_install (); uaeexe_install (); native2amiga_install (); custom_init (); /* Must come after memory_init */ serial_init (); DISK_init (); reset_frame_rate_hack (); init_m68k(); /* must come after reset_frame_rate_hack (); */ gui_update (); if (graphics_init ()) { reset_drawing (); setup_brkhandler (); if (currprefs.start_debugger && debuggable ()) activate_debugger (); start_program (); } leave_program (); }