|
Xemu [doxygen]
hyppo 0a42be3a057156924bc1b626a687bd6e27349c45 @ Sat 19 Mar 02:15:11 CET 2022
|
Go to the documentation of this file.
46 static int mem_ws_all, mem_ws_m1;
62 #define nick_clock_align()
77 z80ex.internal_int_disable = 0;
100 FATAL(
"FATAL: Unknown CPU type was requested: %d", type);
105 z80ex.z180 ?
"Z180" :
"Z80",
115 static inline void add_ram_segs (
int seg,
int seg_end,
const char *type )
117 while (
seg <= seg_end) {
134 for (a = 0; a < 0xFC; a++) {
142 memset(
memory + (a << 14), 0xFF, 0x4000);
145 while (spec && *spec) {
154 switch (sscanf(spec,
"%x-%x,", &sb, &se)) {
156 DEBUG(
"CONFIG: RAM: requesting single segment %02Xh as %s" NL, sb, type);
157 if (sb >= 0 && sb < 0x100)
158 add_ram_segs(sb, sb, type);
160 DEBUGPRINT(
"CONFIG: RAM: WARNING: ignoring bad single %s segment definition %02X" NL, type, sb);
163 DEBUG(
"CONFIG: RAM: requesting segment range %02Xh-%02Xh as %s" NL, sb, se, type);
164 if (se >= sb && sb >= 0 && se < 0x100)
165 add_ram_segs(sb, se, type);
167 DEBUGPRINT(
"CONFIG: RAM: WARNING: ignoring bad %s segment range definition %02X-%02X" NL, type, sb, se);
170 spec = strchr(spec,
',');
173 int es = (atoi(spec) - 64) >> 4;
178 DEBUG(
"CONFIG: RAM: requesting simple memory range as RAM for %d segments" NL, es);
188 for (
int a = 0; a < 0x100; a++)
190 memset(
memory + (a << 14), 0xFF, 0x4000);
196 int a, sum = 0, from = 0;
197 const char *type = NULL;
198 char dbuf[PATH_MAX + 80];
201 for (a = 0; a < 0x100; a++) {
206 memset(
memory + (a << 14), 0xFF, 0x4000);
212 int s = (a == 0xFF) ? a : a - 1;
214 name =
"(last ROM continues)";
215 snprintf(dbuf,
sizeof dbuf,
"%02X-%02X %s %s", from, s, type,
name ?
name :
"");
228 snprintf(dbuf,
sizeof dbuf,
"RAM: %d segments (%d Kbytes)", sum, sum << 4);
231 #ifdef CONFIG_SDEXT_SUPPORT
241 register int phys = memsegs[
addr >> 14] +
addr;
243 if (phys >= 0x3F0000) {
247 if (mem_ws_all || (m1_state && mem_ws_m1))
249 #ifdef CONFIG_SDEXT_SUPPORT
250 if ((phys & 0x3F0000) == sdext_cart_enabler)
251 return sdext_read_cart(phys & 0xFFFF);
279 register int phys = memsegs[
addr >> 14] +
addr;
280 if (phys >= 0x3F0000) {
283 if (
zxemu_on && phys >= 0x3f9800 && phys <= 0x3f9aff)
290 if (is_ram_seg[phys >> 14])
292 #ifdef CONFIG_SDEXT_SUPPORT
293 else if ((phys & 0x3F0000) == sdext_cart_enabler)
294 sdext_write_cart(phys & 0xFFFF,
value);
297 DEBUG(
"WRITE to NON-decoded memory area %08X" NL, phys);
305 if (
z80ex.z180 && (port16 & 0xFFC0) == z180_port_start) {
306 if (z180_port_start == 0x80)
307 FATAL(
"FATAL: Z180 internal ports configured from 0x80. This conflicts with Dave/Nick, so EP is surely unusable.");
308 return z180_port_read(port16 & 0x3F);
311 port = port16 & 0xFF;
315 #ifdef CONFIG_EPNET_SUPPORT
316 case EPNET_IO_BASE + 0x0:
317 case EPNET_IO_BASE + 0x1:
318 case EPNET_IO_BASE + 0x2:
319 case EPNET_IO_BASE + 0x3:
320 case EPNET_IO_BASE + 0x4:
321 case EPNET_IO_BASE + 0x5:
322 case EPNET_IO_BASE + 0x6:
323 case EPNET_IO_BASE + 0x7:
324 return epnet_read_cpu_port(port - EPNET_IO_BASE);
325 case EPNET_IO_BASE + 0x8:
326 case EPNET_IO_BASE + 0x9:
327 case EPNET_IO_BASE + 0xA:
328 case EPNET_IO_BASE + 0xB:
329 case EPNET_IO_BASE + 0xC:
330 case EPNET_IO_BASE + 0xD:
331 case EPNET_IO_BASE + 0xE:
332 case EPNET_IO_BASE + 0xF:
337 #ifdef CONFIG_EXDOS_SUPPORT
350 case 0x18:
case 0x19:
case 0x1A:
case 0x1B:
case 0x1C:
case 0x1D:
case 0x1E:
case 0x1F:
353 case 0x10:
case 0x14:
case 0x11:
case 0x15:
case 0x12:
case 0x16:
case 0x13:
case 0x17:
354 case 0x18:
case 0x19:
case 0x1A:
case 0x1B:
case 0x1C:
case 0x1D:
case 0x1E:
case 0x1F:
355 DEBUG(
"EXDOS: not compiled with support, port read %02X" NL, port);
359 case 0x40:
case 0x41:
case 0x42:
case 0x43:
case 0x44:
360 DEBUG(
"ZXEMU: reading port %02Xh" NL, port);
372 case 0x80:
case 0x81:
case 0x82:
case 0x83:
case 0x84:
case 0x85:
case 0x86:
case 0x87:
373 case 0x88:
case 0x89:
case 0x8A:
case 0x8B:
case 0x8C:
case 0x8D:
case 0x8E:
case 0x8F:
377 case 0xB0:
case 0xB1:
case 0xB2:
case 0xB3:
388 DEBUGPRINT(
"IO: READ: unhandled port %02Xh read" NL, port);
400 if (
z80ex.z180 && (port16 & 0xFFC0) == z180_port_start) {
401 if (z180_port_start == 0x80)
402 FATAL(
"FATAL: Z180 internal ports configured from 0x80. This conflicts with Dave/Nick, so EP is surely unusable.");
403 z180_port_write(port16 & 0x3F,
value);
407 port = port16 & 0xFF;
414 #ifdef CONFIG_EPNET_SUPPORT
415 case EPNET_IO_BASE + 0x0:
416 case EPNET_IO_BASE + 0x1:
417 case EPNET_IO_BASE + 0x2:
418 case EPNET_IO_BASE + 0x3:
419 case EPNET_IO_BASE + 0x4:
420 case EPNET_IO_BASE + 0x5:
421 case EPNET_IO_BASE + 0x6:
422 case EPNET_IO_BASE + 0x7:
423 epnet_write_cpu_port(port - EPNET_IO_BASE,
value);
425 case EPNET_IO_BASE + 0x8:
426 case EPNET_IO_BASE + 0x9:
427 case EPNET_IO_BASE + 0xA:
428 case EPNET_IO_BASE + 0xB:
429 case EPNET_IO_BASE + 0xC:
430 case EPNET_IO_BASE + 0xD:
431 case EPNET_IO_BASE + 0xE:
432 case EPNET_IO_BASE + 0xF:
437 #ifdef CONFIG_EXDOS_SUPPORT
454 case 0x18:
case 0x19:
case 0x1A:
case 0x1B:
case 0x1C:
case 0x1D:
case 0x1E:
case 0x1F:
458 case 0x10:
case 0x14:
case 0x11:
case 0x15:
case 0x12:
case 0x16:
case 0x13:
case 0x17:
459 case 0x18:
case 0x19:
case 0x1A:
case 0x1B:
case 0x1C:
case 0x1D:
case 0x1E:
case 0x1F:
460 DEBUG(
"EXDOS: not compiled with support, port write %02X with value %02X" NL, port,
value);
465 DEBUG(
"Z180: ignored <no Z180 emulation is active> for writing port = %02Xh, data = %02Xh." NL, port,
value);
491 case 0xA0:
case 0xA1:
case 0xA2:
case 0xA3:
case 0xA4:
case 0xA5:
case 0xA6:
case 0xA7:
492 case 0xA8:
case 0xA9:
case 0xAA:
case 0xAB:
case 0xAC:
case 0xAD:
case 0xAE:
case 0xAF:
498 memsegs[0] =
value << 14;
501 memsegs[1] = (
value << 14) - 0x4000;
504 memsegs[2] = (
value << 14) - 0x8000;
507 memsegs[3] = (
value << 14) - 0xC000;
534 }
else if (
value == 4) {
542 DEBUG(
"DAVE: BF register is written -> W_ALL=%d W_M1=%d CLOCK=%dMHz" NL, mem_ws_all, mem_ws_m1, (
value & 2) ? 12 : 8);
545 case 0x80:
case 0x84:
case 0x88:
case 0x8C:
549 case 0x81:
case 0x85:
case 0x89:
case 0x8D:
553 case 0x82:
case 0x86:
case 0x8A:
case 0x8E:
557 case 0x83:
case 0x87:
case 0x8B:
case 0x8F:
562 case 0xF0:
case 0xF1:
case 0xF2:
case 0xF3:
571 DEBUGPRINT(
"IO: WRITE: unhandled port %02Xh write with data %02Xh" NL, port,
value);
599 memset(ports, 0xFF, 0x100);
604 z180_internal_reset();
630 #ifdef CONFIG_EXDOS_SUPPORT
int sram_save_segment(int seg)
int z80ex_ed_cb(Z80EX_BYTE opcode)
const char * rom_name_tab[0x100]
void zxemu_write_ula(Uint8 hiaddr, Uint8 data)
void nick_set_bias(Uint8 value)
const char UNUSED_SEGMENT[]
Uint8 read_cpu_byte(Uint16 addr)
void z80ex_w_states(unsigned w_states)
void xep_rom_write_support(int towrite)
void printer_port_check_strobe(int level)
void zxemu_attribute_memory_write(Uint16 address, Uint8 data)
void z80ex_pwrite_cb(Z80EX_WORD port16, Z80EX_BYTE value)
void nick_set_lpth(Uint8 value)
void nick_set_border(Uint8 bcol)
void wd_exdos_reset(void)
void apu_write_data(Uint8 data)
Uint8 wd_read_status(void)
int sram_load_segment(int seg)
Uint8 zxemu_read_ula(Uint8 hiaddr)
void z80ex_mwrite_cb(Z80EX_WORD addr, Z80EX_BYTE value)
void set_ep_cpu(int type)
Z80EX_BYTE z80ex_pread_cb(Z80EX_WORD port16)
void primo_emulator_exit(void)
#define DEFAULT_CPU_CLOCK
unsigned short Z80EX_WORD
const char SRAM_SEGMENT[]
void dave_configure_interrupts(Uint8 n)
void write_cpu_byte_by_segmap(Uint16 addr, Uint8 *segmap, Uint8 data)
void nick_set_lptl(Uint8 value)
void wd_send_command(Uint8 value)
Z80EX_CONTEXT z80ex VARALIGN
const char * memory_segment_map[0x100]
const char XEPROM_SEGMENT[]
void wd_write_data(Uint8 value)
void wd_set_exdos_control(Uint8 value)
void apu_write_command(Uint8 cmd)
#define IO16_HI_BYTE(port16)
const char VRAM_SEGMENT[]
#define nick_clock_align()
void printer_disable_covox(void)
void dave_set_clock(void)
void dave_write_audio_register(Uint8 port, Uint8 value)
void primo_switch(Uint8 data)
#define AUDIO_SOURCE_DTM_DAC4
void zxemu_switch(Uint8 data)
Uint8 primo_read_io(Uint8 port)
Z80EX_BYTE z80ex_intread_cb(void)
Uint8 wd_read_exdos_status(void)
Uint8 read_cpu_byte_by_segmap(Uint16 addr, Uint8 *segmap)
void xep_rom_trap(Uint16 pc, Uint8 opcode)
void printer_port_set_data(Uint8 data)
void rtc_set_reg(Uint8 val)
Z80EX_BYTE z80ex_mread_cb(Z80EX_WORD addr, int m1_state)
void rtc_write_reg(Uint8 val)
int ep_set_ram_config(const char *spec)
void primo_write_io(Uint8 port, Uint8 data)
Uint8 apu_read_status(void)
Uint8 nick_get_last_byte(void)
#define PORT_B6_READ_OTHERS