|
Xemu [doxygen]
hyppo 0a42be3a057156924bc1b626a687bd6e27349c45 @ Sat 19 Mar 02:15:11 CET 2022
|
Go to the documentation of this file.
26 static const Uint8 xep_rom_image[] = {
27 #include "xemu/../rom/ep128/xep_rom.hex"
32 static int reloading = 0;
35 static FILE *sram_open (
int seg,
const char *mode,
char *path )
38 snprintf(
fn,
sizeof fn,
"@sram-%02X.seg",
seg);
47 char path[PATH_MAX + 1];
48 FILE *f = sram_open(
seg,
"wb", path);
49 DEBUGPRINT(
"MEM: SRAM: saving SRAM segment %02Xh to file %s" NL,
seg, path);
51 ERROR_WINDOW(
"Cannot create file for saving SRAM segment %02Xh because of file I/O error: %s\nFile name was: %s",
seg,
ERRSTR(), path);
54 a = fwrite(
memory + (
seg << 14), 0x4000, 1, f);
56 ERROR_WINDOW(
"Cannot save SRAM segment %02Xh because of file I/O error: %s\nFile name was: %s",
seg,
ERRSTR(), path);
66 char path[PATH_MAX + 1];
67 FILE *f = sram_open(
seg,
"rb", path);
68 DEBUGPRINT(
"MEM: SRAM: loading SRAM segment %02Xh from file %s" NL,
seg, path);
70 ERROR_WINDOW(
"Cannot open file for loading SRAM segment %02Xh because of file I/O error: %s\nFile name was: %s",
seg,
ERRSTR(), path);
73 a = fread(
memory + (
seg << 14), 0x4000, 1, f);
75 ERROR_WINDOW(
"Cannot load SRAM segment %02Xh because of file I/O error: %s\nFile name was: %s",
seg,
ERRSTR(), path);
85 for (a = 0; a < 0x100; a++ )
97 char path[PATH_MAX + 1];
107 memset(
memory, 0xFF, 0x400000);
116 if (!strcasecmp(
name,
"XEP") &&
seg) {
118 DEBUG(
"CONFIG: ROM: segment %02Xh assigned to internal XEP ROM" NL,
seg);
122 ERROR_WINDOW(
"XEP ROM forced segment assignment cannot be done since segment %02X is not unused",
seg);
133 DEBUG(
"CONFIG: ROM: ... file path is %s" NL, path);
145 ret = fread(
memory + (lseg << 14), 1, 0x4000, f);
147 DEBUG(
"CONFIG: ROM: ... trying read 0x4000 bytes in segment %02Xh, result is %d" NL, lseg, ret);
149 ERROR_WINDOW(
"Cannot read ROM image \"%s\" (to be used in segment %02Xh): %s", path, lseg,
ERRSTR());
153 }
else if (ret == 0) {
157 ERROR_WINDOW(
"Null-sized ROM image \"%s\" (to be used in segment %02Xh).", path, lseg);
161 }
else if (ret != 0x4000) {
164 ERROR_WINDOW(
"Bad ROM image \"%s\": not multiple of 16K bytes!", path);
182 ERROR_WINDOW(
"Fatal ROM image error: No ROM defined for segment 00h, no EXOS is requested!");
187 if (config_getopt_int(
"xeprom")) {
196 DEBUGPRINT(
"CONFIG: ROM: XEP ROM is disabled by configuration!" NL);
197 INFO_WINDOW(
"XEP internal ROM image is disabled by configuration.\nXep128 will work, but no XEP feature will be available.");
210 DEBUGPRINT(
"CONFIG: ROM: XEP internal ROM image CANNOT be installed because segment %02Xh is used!!" NL,
xep_rom_seg);
211 ERROR_WINDOW(
"XEP internal ROM image cannot be installed.\nXep128 will work, but no XEP feature will be available.");
int sram_save_segment(int seg)
const char * rom_name_tab[0x100]
const char UNUSED_SEGMENT[]
int sram_load_segment(int seg)
void * config_getopt(const char *name, const int subopt, void *value)
const char SRAM_SEGMENT[]
FILE * open_emu_file(const char *name, const char *mode, char *pathbuffer)
const char * memory_segment_map[0x100]
const char XEPROM_SEGMENT[]
void xep_set_default_device_name(const char *name)
#define ERROR_WINDOW(...)
const char VRAM_SEGMENT[]
void config_getopt_pointed(void *st_in, void *value)
void forget_emu_file(const char *path)
int sram_save_all_segments(void)