|
Xemu [doxygen]
hyppo 0a42be3a057156924bc1b626a687bd6e27349c45 @ Sat 19 Mar 02:15:11 CET 2022
|
Go to the documentation of this file.
44 static int mem_ws_all, mem_ws_m1;
60 #define nick_clock_align()
75 z80ex.internal_int_disable = 0;
98 FATAL(
"FATAL: Unknown CPU type was requested: %d", type);
103 z80ex.z180 ?
"Z180" :
"Z80",
113 static inline void add_ram_segs (
int seg,
int seg_end,
const char *type )
115 while (
seg <= seg_end) {
132 for (a = 0; a < 0xFC; a++) {
140 memset(
memory + (a << 14), 0xFF, 0x4000);
143 while (spec && *spec) {
152 switch (sscanf(spec,
"%x-%x,", &sb, &se)) {
154 DEBUG(
"CONFIG: RAM: requesting single segment %02Xh as %s" NL, sb, type);
155 if (sb >= 0 && sb < 0x100)
156 add_ram_segs(sb, sb, type);
158 DEBUGPRINT(
"CONFIG: RAM: WARNING: ignoring bad single %s segment definition %02X" NL, type, sb);
161 DEBUG(
"CONFIG: RAM: requesting segment range %02Xh-%02Xh as %s" NL, sb, se, type);
162 if (se >= sb && sb >= 0 && se < 0x100)
163 add_ram_segs(sb, se, type);
165 DEBUGPRINT(
"CONFIG: RAM: WARNING: ignoring bad %s segment range definition %02X-%02X" NL, type, sb, se);
168 spec = strchr(spec,
',');
171 int es = (atoi(spec) - 64) >> 4;
176 DEBUG(
"CONFIG: RAM: requesting simple memory range as RAM for %d segments" NL, es);
187 int a, sum = 0, from = 0;
188 const char *type = NULL;
189 char dbuf[PATH_MAX + 80];
192 for (a = 0; a < 0x100; a++) {
197 memset(
memory + (a << 14), 0xFF, 0x4000);
203 int s = (a == 0xFF) ? a : a - 1;
205 name =
"(last ROM continues)";
206 snprintf(dbuf,
sizeof dbuf,
"%02X-%02X %s %s", from, s, type,
name ?
name :
"");
220 snprintf(dbuf,
sizeof dbuf,
"RAM: %d segments (%d Kbytes)", sum, sum << 4);
223 #ifdef CONFIG_SDEXT_SUPPORT
233 register int phys = memsegs[
addr >> 14] +
addr;
235 if (phys >= 0x3F0000) {
239 if (mem_ws_all || (m1_state && mem_ws_m1))
241 #ifdef CONFIG_SDEXT_SUPPORT
242 if ((phys & 0x3F0000) == sdext_cart_enabler)
243 return sdext_read_cart(phys & 0xFFFF);
271 register int phys = memsegs[
addr >> 14] +
addr;
272 if (phys >= 0x3F0000) {
275 if (
zxemu_on && phys >= 0x3f9800 && phys <= 0x3f9aff)
282 if (is_ram_seg[phys >> 14])
284 #ifdef CONFIG_SDEXT_SUPPORT
285 else if ((phys & 0x3F0000) == sdext_cart_enabler)
286 sdext_write_cart(phys & 0xFFFF,
value);
289 DEBUG(
"WRITE to NON-decoded memory area %08X" NL, phys);
297 if (
z80ex.z180 && (port16 & 0xFFC0) == z180_port_start) {
298 if (z180_port_start == 0x80)
299 FATAL(
"FATAL: Z180 internal ports configured from 0x80. This conflicts with Dave/Nick, so EP is surely unusable.");
300 return z180_port_read(port16 & 0x3F);
303 port = port16 & 0xFF;
307 #ifdef CONFIG_EPNET_SUPPORT
308 case EPNET_IO_BASE + 0x0:
309 case EPNET_IO_BASE + 0x1:
310 case EPNET_IO_BASE + 0x2:
311 case EPNET_IO_BASE + 0x3:
312 case EPNET_IO_BASE + 0x4:
313 case EPNET_IO_BASE + 0x5:
314 case EPNET_IO_BASE + 0x6:
315 case EPNET_IO_BASE + 0x7:
316 return epnet_read_cpu_port(port - EPNET_IO_BASE);
317 case EPNET_IO_BASE + 0x8:
318 case EPNET_IO_BASE + 0x9:
319 case EPNET_IO_BASE + 0xA:
320 case EPNET_IO_BASE + 0xB:
321 case EPNET_IO_BASE + 0xC:
322 case EPNET_IO_BASE + 0xD:
323 case EPNET_IO_BASE + 0xE:
324 case EPNET_IO_BASE + 0xF:
329 #ifdef CONFIG_EXDOS_SUPPORT
342 case 0x18:
case 0x19:
case 0x1A:
case 0x1B:
case 0x1C:
case 0x1D:
case 0x1E:
case 0x1F:
345 case 0x10:
case 0x14:
case 0x11:
case 0x15:
case 0x12:
case 0x16:
case 0x13:
case 0x17:
346 case 0x18:
case 0x19:
case 0x1A:
case 0x1B:
case 0x1C:
case 0x1D:
case 0x1E:
case 0x1F:
347 DEBUG(
"EXDOS: not compiled with support, port read %02X" NL, port);
351 case 0x40:
case 0x41:
case 0x42:
case 0x43:
case 0x44:
352 DEBUG(
"ZXEMU: reading port %02Xh" NL, port);
364 case 0x80:
case 0x81:
case 0x82:
case 0x83:
case 0x84:
case 0x85:
case 0x86:
case 0x87:
365 case 0x88:
case 0x89:
case 0x8A:
case 0x8B:
case 0x8C:
case 0x8D:
case 0x8E:
case 0x8F:
369 case 0xB0:
case 0xB1:
case 0xB2:
case 0xB3:
380 DEBUGPRINT(
"IO: READ: unhandled port %02Xh read" NL, port);
392 if (
z80ex.z180 && (port16 & 0xFFC0) == z180_port_start) {
393 if (z180_port_start == 0x80)
394 FATAL(
"FATAL: Z180 internal ports configured from 0x80. This conflicts with Dave/Nick, so EP is surely unusable.");
395 z180_port_write(port16 & 0x3F,
value);
399 port = port16 & 0xFF;
406 #ifdef CONFIG_EPNET_SUPPORT
407 case EPNET_IO_BASE + 0x0:
408 case EPNET_IO_BASE + 0x1:
409 case EPNET_IO_BASE + 0x2:
410 case EPNET_IO_BASE + 0x3:
411 case EPNET_IO_BASE + 0x4:
412 case EPNET_IO_BASE + 0x5:
413 case EPNET_IO_BASE + 0x6:
414 case EPNET_IO_BASE + 0x7:
415 epnet_write_cpu_port(port - EPNET_IO_BASE,
value);
417 case EPNET_IO_BASE + 0x8:
418 case EPNET_IO_BASE + 0x9:
419 case EPNET_IO_BASE + 0xA:
420 case EPNET_IO_BASE + 0xB:
421 case EPNET_IO_BASE + 0xC:
422 case EPNET_IO_BASE + 0xD:
423 case EPNET_IO_BASE + 0xE:
424 case EPNET_IO_BASE + 0xF:
429 #ifdef CONFIG_EXDOS_SUPPORT
446 case 0x18:
case 0x19:
case 0x1A:
case 0x1B:
case 0x1C:
case 0x1D:
case 0x1E:
case 0x1F:
450 case 0x10:
case 0x14:
case 0x11:
case 0x15:
case 0x12:
case 0x16:
case 0x13:
case 0x17:
451 case 0x18:
case 0x19:
case 0x1A:
case 0x1B:
case 0x1C:
case 0x1D:
case 0x1E:
case 0x1F:
452 DEBUG(
"EXDOS: not compiled with support, port write %02X with value %02X" NL, port,
value);
457 DEBUG(
"Z180: ignored <no Z180 emulation is active> for writing port = %02Xh, data = %02Xh." NL, port,
value);
483 case 0xA0:
case 0xA1:
case 0xA2:
case 0xA3:
case 0xA4:
case 0xA5:
case 0xA6:
case 0xA7:
484 case 0xA8:
case 0xA9:
case 0xAA:
case 0xAB:
case 0xAC:
case 0xAD:
case 0xAE:
case 0xAF:
490 memsegs[0] =
value << 14;
493 memsegs[1] = (
value << 14) - 0x4000;
496 memsegs[2] = (
value << 14) - 0x8000;
499 memsegs[3] = (
value << 14) - 0xC000;
526 }
else if (
value == 4) {
534 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);
537 case 0x80:
case 0x84:
case 0x88:
case 0x8C:
541 case 0x81:
case 0x85:
case 0x89:
case 0x8D:
545 case 0x82:
case 0x86:
case 0x8A:
case 0x8E:
549 case 0x83:
case 0x87:
case 0x8B:
case 0x8F:
554 case 0xF0:
case 0xF1:
case 0xF2:
case 0xF3:
563 DEBUGPRINT(
"IO: WRITE: unhandled port %02Xh write with data %02Xh" NL, port,
value);
591 memset(ports, 0xFF, 0x100);
596 z180_internal_reset();
622 #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[]
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)
#define nick_clock_align()
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