Esempio n. 1
0
static BYTE REGPARM1 ross_io1_read(WORD addr)
{
    cart_romhbank_set_slotmain(1);
    cart_romlbank_set_slotmain(1);
    currbank = 1;
    return 0;
}
Esempio n. 2
0
static void rexep256_io2_store(WORD addr, BYTE value)
{
    BYTE eprom_bank, test_value, eprom_part = 0;

    if ((addr & 0xff) == 0xa0) {
        regval = value;
        eprom_bank = (value & 0xf);
        if (eprom_bank > 7) {
            return;
        }

        test_value = (value & 0xf0) >> 4;
        if (test_value > 3) {
            return;
        }

        if (rexep256_eprom[eprom_bank] == 0x2000) {
            eprom_part = 0;
        }
        if (rexep256_eprom[eprom_bank] == 0x4000) {
            eprom_part = test_value & 1;
        }
        if (rexep256_eprom[eprom_bank] == 0x8000) {
            eprom_part = test_value;
        }

        cart_romlbank_set_slotmain(rexep256_eprom_roml_bank_offset[eprom_bank] + eprom_part + 1);
    }
Esempio n. 3
0
static uint8_t ross_io1_read(uint16_t addr)
{
    if (ross_is_32k) {
        cart_romhbank_set_slotmain(1);
        cart_romlbank_set_slotmain(1);
        currbank = 1;
    }
    return 0;
}
Esempio n. 4
0
static BYTE dinamic_io1_read(WORD addr)
{
    DBG(("@ $%04x io1 rd %04x (bank: %02x)\n", reg_pc, addr, addr & 0x0f));
    if ((addr & 0x0f) == addr) {
        cart_romlbank_set_slotmain(addr & 0x0f);
        cart_romhbank_set_slotmain(addr & 0x0f);
        currbank = addr & 0x0f;
    }
    return 0;
}
Esempio n. 5
0
static void ocean_io1_store(WORD addr, BYTE value)
{
    regval = value;
    currbank = value & 0x3f;
    cart_romhbank_set_slotmain(currbank);
    cart_romlbank_set_slotmain(currbank);
    cart_set_port_exrom_slotmain(1);
    cart_set_port_game_slotmain(1);
    cart_set_port_phi1_slotmain(0);
    cart_set_port_phi2_slotmain(0);
    cart_port_config_changed_slotmain();
}
Esempio n. 6
0
static void REGPARM2 magicdesk_io1_store(WORD addr, BYTE value)
{
    cart_romlbank_set_slotmain(value & 0x3f);
    cart_set_port_game_slotmain(0);
    if (value & 0x80) {
        cart_set_port_exrom_slotmain(0);
    } else {
        /* turn off cart ROM */
        cart_set_port_exrom_slotmain(1);
    }
    currbank = value & (0x3f | 0x80);
    cart_port_config_changed_slotmain();
}
Esempio n. 7
0
static void magicdesk_io1_store(WORD addr, BYTE value)
{
    regval = value & 0x8f;
    cart_romlbank_set_slotmain(value & 0x0f);
    cart_set_port_game_slotmain(0);
    if (value & 0x80) {
        /* turn off cart ROM */
        cart_set_port_exrom_slotmain(0);
    } else {
        cart_set_port_exrom_slotmain(1);
    }
    cart_port_config_changed_slotmain();
    DBG(("MAGICDESK: Reg: %02x (Bank: %d, %s)\n", regval, (regval & 0x0f), (regval & 0x80) ? "disabled" : "enabled"));
}
Esempio n. 8
0
static void magicdesk_io1_store(uint16_t addr, uint8_t value)
{
    regval = value & (0x80 | bankmask);
    cart_romlbank_set_slotmain(value & bankmask);
    cart_set_port_game_slotmain(0);
    if (value & 0x80) {
        /* turn off cart ROM */
        cart_set_port_exrom_slotmain(0);
    } else {
        cart_set_port_exrom_slotmain(1);
    }
    cart_port_config_changed_slotmain();
    DBG(("MAGICDESK: Reg: %02x (Bank: %d of %d, %s)\n", regval, (regval & bankmask), bankmask + 1, (regval & 0x80) ? "disabled" : "enabled"));
}
Esempio n. 9
0
static void REGPARM2 supergames_io2_store(WORD addr, BYTE value)
{
    cart_romhbank_set_slotmain(value & 3);
    cart_romlbank_set_slotmain(value & 3);
    currbank = value & 3;

    if (value & 0x4) {
        cart_set_port_exrom_slotmain(1);
        cart_set_port_game_slotmain(0);
    } else {
        cart_set_port_exrom_slotmain(1);
        cart_set_port_game_slotmain(1);
    }
    if (value == 0xc) {
        cart_set_port_exrom_slotmain(0);
        cart_set_port_game_slotmain(0);
    }
    cart_port_config_changed_slotmain();
}
Esempio n. 10
0
static void easyflash_io1_store(WORD addr, BYTE value)
{
    BYTE mem_mode;

    switch (addr & 2) {
        case 0:
            /* bank register */
            easyflash_register_00 = (BYTE)(value & EASYFLASH_BANK_MASK);
            break;
        default:
            /* mode register */
            easyflash_register_02 = value & 0x87; /* we only remember led, mode, exrom, game */
            mem_mode = easyflash_memconfig[(easyflash_jumper << 3) | (easyflash_register_02 & 0x07)];
            cart_config_changed_slotmain(mem_mode, mem_mode, CMODE_READ);
            /* TODO: change led */
            /* (value & 0x80) -> led on if true, led off if false */
    }
    cart_romhbank_set_slotmain(easyflash_register_00);
    cart_romlbank_set_slotmain(easyflash_register_00);
    cart_port_config_changed_slotmain();
}
Esempio n. 11
0
/*
    attach cartridge image

    type == -1  NONE
    type ==  0  CRT format

    returns -1 on error, 0 on success
*/
int cartridge_attach_image(int type, const char *filename)
{
    BYTE *rawcart;
    char *abs_filename;
    int carttype = CARTRIDGE_NONE;
    int cartid = CARTRIDGE_NONE;
    int oldmain = CARTRIDGE_NONE;
    int slotmain = 0;

    if (filename == NULL) {
        return -1;
    }

    /* Attaching no cartridge always works. */
    if (type == CARTRIDGE_NONE || *filename == '\0') {
        return 0;
    }

    if (archdep_path_is_relative(filename)) {
        archdep_expand_path(&abs_filename, filename);
    } else {
        abs_filename = lib_stralloc(filename);
    }

    if (type == CARTRIDGE_CRT) {
        carttype = crt_getid(abs_filename);
        if (carttype == -1) {
            log_message(LOG_DEFAULT, "CART: '%s' is not a valid CRT file.", abs_filename);
            lib_free(abs_filename);
            return -1;
        }
    } else {
        carttype = type;
    }
    DBG(("CART: cartridge_attach_image type: %d ID: %d\n", type, carttype));

    /* allocate temporary array */
    rawcart = lib_malloc(C64CART_IMAGE_LIMIT);

/*  cart should always be detached. there is no reason for doing fancy checks
    here, and it will cause problems incase a cart MUST be detached before
    attaching another, or even itself. (eg for initialization reasons)

    most obvious reason: attaching a different ROM (software) for the same
    cartridge (hardware) */

    slotmain = cart_is_slotmain(carttype);
    if (slotmain) {
        /* if the cart to be attached is in the "Main Slot", detach whatever
           cart currently is in the "Main Slot" */
        oldmain = cart_getid_slotmain();
        if (oldmain != CARTRIDGE_NONE) {
            DBG(("CART: detach slot main ID: %d\n", oldmain));
            cartridge_detach_image(oldmain);
        }
    }
    if (oldmain != carttype) {
        DBG(("CART: detach %s ID: %d\n", slotmain ? "slot main" : "other slot", carttype));
        cartridge_detach_image(carttype);
    }

    if (type == CARTRIDGE_CRT) {
        DBG(("CART: attach CRT ID: %d '%s'\n", carttype, filename));
        cartid = crt_attach(abs_filename, rawcart);
        if (cartid == CARTRIDGE_NONE) {
            goto exiterror;
        }
        if (type < 0) {
            DBG(("CART: attach generic CRT ID: %d\n", type));
        }
    } else {
        DBG(("CART: attach BIN ID: %d '%s'\n", carttype, filename));
        cartid = carttype;
        if (cart_bin_attach(carttype, abs_filename, rawcart) < 0) {
            goto exiterror;
        }
    }

    if (cart_is_slotmain(cartid)) {
        DBG(("cartridge_attach MAIN ID: %d\n", cartid));
        mem_cartridge_type = cartid;
        cart_romhbank_set_slotmain(0);
        cart_romlbank_set_slotmain(0);
    } else {
        DBG(("cartridge_attach (other) ID: %d\n", cartid));
    }

    DBG(("CART: attach RAW ID: %d\n", cartid));
    cart_attach(cartid, rawcart);

    cart_power_off();

    if (cart_is_slotmain(cartid)) {
        /* "Main Slot" */
        DBG(("CART: set main slot ID: %d type: %d\n", carttype, type));
        c64cart_type = type;
        if (type == CARTRIDGE_CRT) {
            crttype = carttype;
        }
        util_string_set(&cartfile, abs_filename);
    }

    DBG(("CART: cartridge_attach_image type: %d ID: %d done.\n", type, carttype));
    lib_free(rawcart);
    log_message(LOG_DEFAULT, "CART: attached '%s' as ID %d.", abs_filename, carttype);
    lib_free(abs_filename);
    return 0;

exiterror:
    DBG(("CART: error\n"));
    lib_free(rawcart);
    log_message(LOG_DEFAULT, "CART: could not attach '%s'.", abs_filename);
    lib_free(abs_filename);
    return -1;
}
Esempio n. 12
0
void se5_config_setup(BYTE *rawcart)
{
    memcpy(roml_banks, rawcart, SE5_CART_SIZE);
    cart_config_changed_slotmain(0, 0, CMODE_READ);
    cart_romlbank_set_slotmain(0);
}
Esempio n. 13
0
void se5_config_init(void)
{
    cart_config_changed_slotmain(0, 0, CMODE_READ);
    cart_romlbank_set_slotmain(0);
}