|
Xemu [doxygen]
hyppo 0a42be3a057156924bc1b626a687bd6e27349c45 @ Sat 19 Mar 02:15:11 CET 2022
|
Go to the documentation of this file.
23 #define CHARACTER_SET_DEFINER_8X8 const Uint8 vga_font_8x8[2048]
37 static Uint8 *external_image = NULL;
39 static const char _rom_name_closed[] =
"Closed-ROMs";
40 static const char _rom_name_open[] =
"Open-ROMs";
41 static const char _rom_name_xemu[] =
"Xemu-ROMs";
42 static const char _rom_name_bad[] =
"?unknown?";
43 static const char _rom_name_preboot[] =
"?before-boot?";
66 static int rom_detect_try (
const Uint8 *rom,
const Uint8 rom_id )
71 for (
int a = 0; a < 6; a++) {
73 if (*rom >=
'0' && *rom <=
'9')
74 ret = ret * 10 + *
rom -
'0';
85 DEBUGPRINT(
"ROM: version check is disabled (NULL pointer), previous version info: %d" NL,
rom_date);
90 const int res_open = rom_detect_try(
rom + 0x10, 0x4F);
91 const int res_closed = rom_detect_try(
rom + 0x16, 0x56);
96 if (res_open >= 0 && res_closed < 0) {
102 if (res_open < 0 && res_closed >= 0) {
104 if (!strncmp((
const char*)
rom + 0x16 + 7,
"Xemu", 3)) {
111 if (res_open < 0 && res_closed < 0)
112 DEBUGPRINT(
"ROM: version check failed (no leading 'V' or 'O' at ROM ofs $10/$16)" NL);
114 ERROR_WINDOW(
"Serious problem: ROM can be identified both as open and closed ROM?!");
127 static const Uint8 xemu_stub_rom[] = {
128 #include "rom/mega65-xemu-stub-rom.cdata"
137 static const char *msg =
138 "~Your emulated MEGA65 seems to work, welcome to the MEGA65 emulation of the "
139 "X-Emulators (Xemu for short) framework!~ Yes, it's ~Xemu~ and ~not~ Zemu.\n\n"
141 "Use the cursor up/down keys to scroll this message.\n\n"
143 "~Quick jump-start for you:~\n\n"
145 "~TL;DR~ if you don't want to read all of these, you can use Xemu's menu to open "
146 "a web page with your default browser which can help to get the needed ROM. To do this "
147 "right click into the emulator window, choose \"~Help (online)~\" and \"~Xemu MEGA65 help "
148 "page~\" within that sub-menu.\n\n"
150 "~The long story:~\n\n"
152 "This message comes from Xemu's built-in \"stub\" ROM, ready to be replaced with "
153 "some real ROM to be able to do anything useful. The reason you see this running "
154 "now is the fact of lacking MEGA65.ROM file on your emulated SD-card. Once you "
155 "have a MEGA65.ROM file installed it will be used instead.\n\n"
157 "Unfortunately, because of legal "
158 "reasons, it's not possible to include the real ROM. MEGA65 project has an "
159 "on-going effort to write an open-source free ROM called \"~open-ROMs~\" project, "
160 "however it's not yet ready for general usage at all.\n\n"
162 "Thus you ~almost certainly~ "
163 "need the \"proprietary\" ROM, often called \"~closed-ROMs~\" project, it's an enhanced "
164 "and bug-fixed version of the original C65 ROM, with improved BASIC and other "
165 "MEGA65 features. However being a derivate work based on original C65 ROM, it "
166 "cannot be used without the blessing of the repspective owner of the original "
167 "Commodore(TM) rights, it's not freely distributable, and certainly cannot be "
168 "included in an open-source GNU/GPL emulator, like Xemu. That ROM on the other "
169 "hand is legally licensed to any (real) MEGA65 owners by the copyright holders.\n\n"
171 "~About this ROM:~\n\n"
173 "This ROM is an actual machine language code (contained by Xemu) written in "
174 "assembly. Easter egg: if you're patient enough to even read this, you may want to "
175 "try the 's' key, it won't do anything useful now (restart), but may do something "
176 "other in the future. Who knows.\n\n"
178 "Thanks for your patience and understanding.\n\n"
179 "- LGB (Xemu's author)\n\n"
191 strcpy((
char*)
rom + 0x16,
"V920000XemuStubROM! Part of the Xemu project.");
195 rom[0xFFFF] =
rom[0xFFFD] =
rom[0xFFFB] = 0xE0;
199 memcpy(
rom + 0xE000, xemu_stub_rom,
sizeof xemu_stub_rom);
200 const Uint8 normal_colour = 0xF;
201 const Uint8 hi_colour = 7;
202 memset(
rom + 0x10000, 0x20, 0x8000);
203 memset(
rom + 0x18000, normal_colour, 0x8000);
211 colour = (
colour == normal_colour) ? hi_colour : normal_colour;
213 }
else if (c ==
'\n') {
214 pos += 80 - (pos % 80);
217 if (c ==
' ' && *m >
' ') {
218 const int xpos = pos % 80;
228 rom[0x10000 + pos] = c;
232 rom[0x10000 + pos] = 0xFF;
243 DEBUGPRINT(
"ROM: unsetting custom ROM (clear request)" NL);
244 if (external_image) {
245 free(external_image);
246 external_image = NULL;
250 DEBUGPRINT(
"ROM: custom ROM load was OK, setting custom ROM" NL);
251 if (external_image) {
262 DEBUGPRINT(
"ROM: custom ROM setting failed, not touching custom ROM request setting (now: %s)" NL, external_image ?
"SET" :
"UNSET");
285 if (external_image) {
300 goto overriden_but_lie;
308 return rom[0xFFFC] | (
rom[0xFFFD] << 8);
int rom_do_override(Uint8 *rom)
void rom_clear_rom(Uint8 *rom)
void rom_unset_requests(void)
#define XEMU_STUB_ROM_SAVE_FILENAME
void rom_detect_date(const Uint8 *rom)
sha1_hash_str rom_hash_str
int rom_load_custom(const char *fn)
const Uint8 vga_font_8x8[2048]
int rom_initrom_requested
int rom_from_prefdir_allowed
#define ERROR_WINDOW(...)
void rom_clear_reports(void)
int rom_stubrom_requested
const Uint8 meminitdata_initrom[MEMINITDATA_INITROM_SIZE]
#define MEMINITDATA_INITROM_SIZE
void rom_make_xemu_stub_rom(Uint8 *rom, const char *save_file)