Ejemplo n.º 1
0
static inline BYTE io_read(io_source_list_t *list, WORD addr)
{
    io_source_list_t *current = list->next;
    int io_source_counter = 0;
    BYTE realval = 0;
    BYTE retval = 0;
    unsigned int lowest_order = 0xffffffff;

    vicii_handle_pending_alarms_external(0);

    while (current) {
        if (current->device->read != NULL) {
            if ((addr >= current->device->start_address) && (addr <= current->device->end_address)) {
                retval = current->device->read((WORD)(addr & current->device->address_mask));
                if (current->device->io_source_valid) {
                    if (current->device->io_source_prio == IO_PRIO_HIGH) {
                        return retval;
                    }
                    if (io_source_collision_handling == IO_COLLISION_METHOD_DETACH_LAST) {
                        if (current->device->order < lowest_order) {
                            lowest_order = current->device->order;
                            realval = retval;
                        }
                    }
                    if (io_source_collision_handling == IO_COLLISION_METHOD_AND_WIRES) {
                        realval &= retval;
                    }
                    if (current->device->io_source_prio != IO_PRIO_LOW) {
                        io_source_counter++;
                    }
                }
            }
        }
        current = current->next;
    }

    if (io_source_counter == 0) {
        return vicii_read_phi1();
    }

    if (io_source_counter == 1) {
        return retval;
    }

    if (io_source_collision_handling == IO_COLLISION_METHOD_DETACH_ALL) {
        io_source_msg_detach_all(addr, io_source_counter, list);
        return vicii_read_phi1();
    }

    if (io_source_collision_handling == IO_COLLISION_METHOD_DETACH_LAST) {
        io_source_msg_detach_last(addr, io_source_counter, list, lowest_order);
        return realval;
    }

    if (io_source_collision_handling == IO_COLLISION_METHOD_AND_WIRES) {
        io_source_log_collisions(addr, io_source_counter, list);
        return realval;
    }
    return vicii_read_phi1();
}
Ejemplo n.º 2
0
BYTE REGPARM1 actionreplay_io2_read(WORD addr)
{
    if (!ar_active)
        return vicii_read_phi1();

    io_source = IO_SOURCE_ACTION_REPLAY;

    if (export_ram)
        return export_ram0[0x1f00 + (addr & 0xff)];

    switch (roml_bank) {
      case 0:
        return roml_banks[addr & 0x1fff];
      case 1:
        return roml_banks[(addr & 0x1fff) + 0x2000];
      case 2:
        return roml_banks[(addr & 0x1fff) + 0x4000];
      case 3:
        return roml_banks[(addr & 0x1fff) + 0x6000];
    }

    io_source = IO_SOURCE_NONE;

    return 0;
}
Ejemplo n.º 3
0
static BYTE kcs_io2_read(WORD addr)
{
    /* the software reads from df80 at beginning of nmi handler */
    /* to determine the status of GAME and EXROM lines */
    if (addr & 0x80) {
        return ((config & 2) ? 0x80 : 0) | ((config & 1) ? 0 : 0x40) | (vicii_read_phi1() & 0x3f); /* DF80-DFFF actual config */
    }
    return export_ram0[addr & 0x7f];
}
Ejemplo n.º 4
0
static uint8_t ramcart_io1_read(uint16_t addr)
{
    uint8_t retval;

    if (addr == 1 && ramcart_size_kb == 128) {
        retval = vicii_read_phi1() & 0x7e;
        retval += ramcart[addr];
    } else {
        retval = ramcart[addr];
    }

    return retval;
}
Ejemplo n.º 5
0
static BYTE REGPARM1 ramcart_reg_read(WORD addr)
{
	BYTE retval;

	if (addr == 1 && ramcart_size_kb == 128) 
	{
		retval = vicii_read_phi1() & 0x7e;
		retval += ramcart[addr];
	}
	else
		retval = ramcart[addr];

	return retval;
}
Ejemplo n.º 6
0
BYTE REGPARM1 stardos_io2_read(WORD addr)
{
    if(addr==0xdfa1)
    {
        ++cnt_dfa1;
        if(cnt_dfa1>0xff)
        {
            /* disable bank 0 at $8000 */
            cartridge_config_changed(2, 2, CMODE_READ);
            cnt_de61=0;
        }
    }

    return vicii_read_phi1();
}
Ejemplo n.º 7
0
/* peek from i/o area with no side-effects */
static inline BYTE io_peek(io_source_list_t *list, WORD addr)
{
    io_source_list_t *current = list->next;

    while (current) {
        if (addr >= current->device->start_address && addr <= current->device->end_address) {
            if (current->device->peek) {
                return current->device->peek((WORD)(addr & current->device->address_mask));
            } else if (current->device->read) {
                return current->device->read((WORD)(addr & current->device->address_mask));
            }
        }
        current = current->next;
    }

    return vicii_read_phi1();
}
Ejemplo n.º 8
0
static inline BYTE io_read(io_source_list_t *list, WORD addr)
{
    io_source_list_t *current = list->next;
    int io_source_counter = 0;
    int io_source_valid = 0;
    BYTE realval = 0;
    BYTE retval = 0;
    BYTE firstval = 0;
    unsigned int lowest_order = 0xffffffff;

    vicii_handle_pending_alarms_external(0);

    while (current) {
        if (current->device->read != NULL) {
            if ((addr >= current->device->start_address) && (addr <= current->device->end_address)) {
                retval = current->device->read((WORD)(addr & current->device->address_mask));
                if (current->device->io_source_valid) {
                    /* high prio always overrides others, return immediatly */
                    if (current->device->io_source_prio == IO_PRIO_HIGH) {
                        return retval;
                    }
                    if (io_source_valid == 0) {
                        /* on first valid read, initialize intermediate values */
                        firstval = realval = retval;
                        lowest_order = current->device->order;
                        /* do not count low prio, as it will always be overridden by others */
                        if (current->device->io_source_prio != IO_PRIO_LOW) {
                            io_source_counter++;
                        }
                        io_source_valid = 1;
                    } else {
                        /* ignore low prio reads when a real value is present already */
                        if (current->device->io_source_prio == IO_PRIO_LOW) {
                            retval = realval;
                        }
                        if (io_source_collision_handling == IO_COLLISION_METHOD_DETACH_LAST) {
                            if (current->device->order < lowest_order) {
                                lowest_order = current->device->order;
                                realval = retval;
                            }
                        } else if (io_source_collision_handling == IO_COLLISION_METHOD_AND_WIRES) {
                            realval &= retval;
                        }
                        /* do not count low prio, as it will always be overridden by others */
                        if (current->device->io_source_prio != IO_PRIO_LOW) {
                            /* if the nth read returns the same as the first read don't see it as a conflict */
                            if (retval != firstval) {
                                io_source_counter++;
                            }
                        }
                    }
                }
            }
        }
        current = current->next;
    }

    /* no valid I/O source was read, return phi1 */
    if (io_source_valid == 0) {
        return vicii_read_phi1();
    }
    /* only one valid I/O source was read, return value */
    if (!(io_source_counter > 1)) {
        return retval;
    }
    /* more than one I/O source was read, handle collision */
    if (io_source_collision_handling == IO_COLLISION_METHOD_DETACH_ALL) {
        io_source_msg_detach_all(addr, io_source_counter, list);
        return vicii_read_phi1();
    } else if (io_source_collision_handling == IO_COLLISION_METHOD_DETACH_LAST) {
        io_source_msg_detach_last(addr, io_source_counter, list, lowest_order);
        return realval;
    } else if (io_source_collision_handling == IO_COLLISION_METHOD_AND_WIRES) {
        io_source_log_collisions(addr, io_source_counter, list);
        return realval;
    }
    return vicii_read_phi1();
}
Ejemplo n.º 9
0
int ultimax_romh_phi2_read(WORD addr, BYTE *value)
{
    /* default; no cart, open bus */
    *value = vicii_read_phi1();
    return 1;
}
Ejemplo n.º 10
0
/* ultimax read - c000 to cfff */
BYTE ultimax_c000_cfff_read(WORD addr)
{
    /* default; no cart, open bus */
    return vicii_read_phi1();
}
Ejemplo n.º 11
0
/* ROMH read if hirom is selected - mapped to E000 in ultimax */
BYTE ultimax_romh_read_hirom(WORD addr)
{
    return vicii_read_phi1();
}
Ejemplo n.º 12
0
/* ROMH read - mapped to A000 in 16k, to E000 in ultimax */
BYTE romh_read(WORD addr)
{
    return vicii_read_phi1();
}
Ejemplo n.º 13
0
BYTE REGPARM1 actionreplay_io1_read(WORD addr)
{
    return vicii_read_phi1();
}