예제 #1
0
void supercard_mem_init(struct drive_context_s *drv, unsigned int type)
{
    drivecpud_context_t *cpud = drv->cpud;

    DBG(("supercard_mem_init <type:%d> <sc:%d>\n", type, drv->drive->supercard));

    if (!drv->drive->supercard) {
        return;
    }

    /* Setup additional supercard rom */
    switch (type) {
    case DRIVE_TYPE_1540:
    case DRIVE_TYPE_1541:
    case DRIVE_TYPE_1541II:
    case DRIVE_TYPE_1570:
    case DRIVE_TYPE_1571:
    case DRIVE_TYPE_1571CR:
        drivemem_set_func(cpud, 0x10, 0x18, supercard_read, NULL, supercard_rom, 0x100017fd);
        break;
    default:
        break;
    }
}
예제 #2
0
void memieee_init(struct drive_context_s *drv, unsigned int type)
{
    drivecpud_context_t *cpud = drv->cpud;

    switch (type) {
    case DRIVE_TYPE_2031: 
        drv->cpu->pageone = drv->drive->drive_ram + 0x100;
        drivemem_set_func(cpud, 0x00, 0x01, drive_read_zero, drive_store_zero, NULL, drv->drive->drive_ram, 0x000007fd);
        drivemem_set_func(cpud, 0x01, 0x08, drive_read_2031ram, drive_store_2031ram, NULL, &drv->drive->drive_ram[0x0100], 0x000007fd);
        drivemem_set_func(cpud, 0x18, 0x1c, via1d2031_read, via1d2031_store, via1d2031_peek, NULL, 0);
        drivemem_set_func(cpud, 0x1c, 0x20, via2d_read, via2d_store, via2d_peek, NULL, 0);
        drivemem_set_func(cpud, 0x80, 0x100, drive_read_rom, NULL, NULL, drv->drive->trap_rom, 0x8000bffd);
        return;
    case DRIVE_TYPE_1001:
        drv->cpu->pageone = drv->drive->drive_ram;
        drivemem_set_func(cpud, 0x00, 0x02, drive_read_1001zero_ram, drive_store_1001zero_ram, NULL, drv->drive->drive_ram, 0x000000fd);
        drivemem_set_func(cpud, 0x02, 0x04, drive_read_1001_io, drive_store_1001_io, drive_peek_1001_io, NULL, 0);
        drivemem_set_func(cpud, 0x04, 0x06, drive_read_1001zero_ram, drive_store_1001zero_ram, NULL, drv->drive->drive_ram, 0x040004fd);
        drivemem_set_func(cpud, 0x06, 0x08, drive_read_1001_io, drive_store_1001_io, drive_peek_1001_io, NULL, 0);
        drivemem_set_func(cpud, 0x08, 0x0a, drive_read_1001zero_ram, drive_store_1001zero_ram, NULL, drv->drive->drive_ram, 0x080008fd);
        drivemem_set_func(cpud, 0x0a, 0x0c, drive_read_1001_io, drive_store_1001_io, drive_peek_1001_io, NULL, 0);
        drivemem_set_func(cpud, 0x0c, 0x0e, drive_read_1001zero_ram, drive_store_1001zero_ram, NULL, drv->drive->drive_ram, 0x0c000cfd);
        drivemem_set_func(cpud, 0x0e, 0x10, drive_read_1001_io, drive_store_1001_io, drive_peek_1001_io, NULL, 0);
        drivemem_set_func(cpud, 0x10, 0x18, drive_read_1001buffer1_ram, drive_store_1001buffer1_ram, NULL, &drv->drive->drive_ram[0x0100], 0x100017fd);
        drivemem_set_func(cpud, 0x18, 0x20, drive_read_1001buffer1_ram, drive_store_1001buffer1_ram, NULL, &drv->drive->drive_ram[0x0100], 0x18001ffd);
        drivemem_set_func(cpud, 0x20, 0x28, drive_read_1001buffer1_ram, drive_store_1001buffer1_ram, NULL, &drv->drive->drive_ram[0x0100], 0x200027fd);
        drivemem_set_func(cpud, 0x28, 0x30, drive_read_1001buffer1_ram, drive_store_1001buffer1_ram, NULL, &drv->drive->drive_ram[0x0100], 0x28002ffd);
        drivemem_set_func(cpud, 0x30, 0x38, drive_read_1001buffer2_ram, drive_store_1001buffer2_ram, NULL, &drv->drive->drive_ram[0x0900], 0x300037fd);
        drivemem_set_func(cpud, 0x38, 0x40, drive_read_1001buffer2_ram, drive_store_1001buffer2_ram, NULL, &drv->drive->drive_ram[0x0900], 0x38003ffd);
        drivemem_set_func(cpud, 0x40, 0x48, drive_read_1001buffer2_ram, drive_store_1001buffer2_ram, NULL, &drv->drive->drive_ram[0x0900], 0x400047fd);
        drivemem_set_func(cpud, 0x48, 0x50, drive_read_1001buffer2_ram, drive_store_1001buffer2_ram, NULL, &drv->drive->drive_ram[0x0900], 0x48004ffd);
        drivemem_set_func(cpud, 0x80, 0x100, drive_read_rom, NULL, NULL, drv->drive->trap_rom, 0x8000fffd);
        return;
    case DRIVE_TYPE_8050:
    case DRIVE_TYPE_8250:
        drv->cpu->pageone = drv->drive->drive_ram;
        drivemem_set_func(cpud, 0x00, 0x02, drive_read_1001zero_ram, drive_store_1001zero_ram, NULL, drv->drive->drive_ram, 0x000000fd);
        drivemem_set_func(cpud, 0x02, 0x04, drive_read_1001_io, drive_store_1001_io, drive_peek_1001_io, NULL, 0);
        drivemem_set_func(cpud, 0x04, 0x06, drive_read_1001zero_ram, drive_store_1001zero_ram, NULL, drv->drive->drive_ram, 0x040004fd);
        drivemem_set_func(cpud, 0x06, 0x08, drive_read_1001_io, drive_store_1001_io, drive_peek_1001_io, NULL, 0);
        drivemem_set_func(cpud, 0x08, 0x0a, drive_read_1001zero_ram, drive_store_1001zero_ram, NULL, drv->drive->drive_ram, 0x080008fd);
        drivemem_set_func(cpud, 0x0a, 0x0c, drive_read_1001_io, drive_store_1001_io, drive_peek_1001_io, NULL, 0);
        drivemem_set_func(cpud, 0x0c, 0x0e, drive_read_1001zero_ram, drive_store_1001zero_ram, NULL, drv->drive->drive_ram, 0x0c000cfd);
        drivemem_set_func(cpud, 0x0e, 0x10, drive_read_1001_io, drive_store_1001_io, drive_peek_1001_io, NULL, 0);
        drivemem_set_func(cpud, 0x10, 0x14, drive_read_2040buffer1_ram, drive_store_2040buffer1_ram, NULL, &drv->drive->drive_ram[0x0100], 0x100013fd);
        drivemem_set_func(cpud, 0x14, 0x18, drive_read_2040buffer1_ram, drive_store_2040buffer1_ram, NULL, &drv->drive->drive_ram[0x0100], 0x140017fd);
        drivemem_set_func(cpud, 0x18, 0x1c, drive_read_2040buffer1_ram, drive_store_2040buffer1_ram, NULL, &drv->drive->drive_ram[0x0100], 0x18001bfd);
        drivemem_set_func(cpud, 0x1c, 0x20, drive_read_2040buffer1_ram, drive_store_2040buffer1_ram, NULL, &drv->drive->drive_ram[0x0100], 0x1c001ffd);
        drivemem_set_func(cpud, 0x20, 0x34, drive_read_2040buffer2_ram, drive_store_2040buffer2_ram, NULL, &drv->drive->drive_ram[0x0500], 0x200023fd);
        drivemem_set_func(cpud, 0x24, 0x38, drive_read_2040buffer2_ram, drive_store_2040buffer2_ram, NULL, &drv->drive->drive_ram[0x0500], 0x240027fd);
        drivemem_set_func(cpud, 0x28, 0x3c, drive_read_2040buffer2_ram, drive_store_2040buffer2_ram, NULL, &drv->drive->drive_ram[0x0500], 0x28002bfd);
        drivemem_set_func(cpud, 0x2c, 0x40, drive_read_2040buffer2_ram, drive_store_2040buffer2_ram, NULL, &drv->drive->drive_ram[0x0500], 0x2c002ffd);
        drivemem_set_func(cpud, 0x30, 0x34, drive_read_2040buffer3_ram, drive_store_2040buffer3_ram, NULL, &drv->drive->drive_ram[0x0900], 0x300033fd);
        drivemem_set_func(cpud, 0x34, 0x38, drive_read_2040buffer3_ram, drive_store_2040buffer3_ram, NULL, &drv->drive->drive_ram[0x0900], 0x340037fd);
        drivemem_set_func(cpud, 0x38, 0x3c, drive_read_2040buffer3_ram, drive_store_2040buffer3_ram, NULL, &drv->drive->drive_ram[0x0900], 0x38003bfd);
        drivemem_set_func(cpud, 0x3c, 0x40, drive_read_2040buffer3_ram, drive_store_2040buffer3_ram, NULL, &drv->drive->drive_ram[0x0900], 0x3c003ffd);
        drivemem_set_func(cpud, 0x40, 0x44, drive_read_2040buffer4_ram, drive_store_2040buffer4_ram, NULL, &drv->drive->drive_ram[0x0d00], 0x400043fd);
        drivemem_set_func(cpud, 0x44, 0x48, drive_read_2040buffer4_ram, drive_store_2040buffer4_ram, NULL, &drv->drive->drive_ram[0x0d00], 0x440047fd);
        drivemem_set_func(cpud, 0x48, 0x4c, drive_read_2040buffer4_ram, drive_store_2040buffer4_ram, NULL, &drv->drive->drive_ram[0x0d00], 0x48004bfd);
        drivemem_set_func(cpud, 0x4c, 0x50, drive_read_2040buffer4_ram, drive_store_2040buffer4_ram, NULL, &drv->drive->drive_ram[0x0d00], 0x4c004ffd);
        drivemem_set_func(cpud, 0x80, 0x100, drive_read_rom, NULL, NULL, drv->drive->trap_rom, 0x8000fffd);
        return;
    case DRIVE_TYPE_2040:
        drivemem_set_func(cpud, 0x60, 0x80, drive_read_rom, NULL, NULL, &drv->drive->trap_rom[0x2000], 0x60007ffd);
        drivemem_set_func(cpud, 0xe0, 0x100, drive_read_rom, NULL, NULL, &drv->drive->trap_rom[0x2000], 0xe000fffd);
        break;
    case DRIVE_TYPE_3040:
    case DRIVE_TYPE_4040:
        drivemem_set_func(cpud, 0x50, 0x80, drive_read_rom, NULL, NULL, &drv->drive->trap_rom[0x1000], 0x50007ffd);
        drivemem_set_func(cpud, 0xd0, 0x100, drive_read_rom, NULL, NULL, &drv->drive->trap_rom[0x1000], 0xd000fffd);
        break;
    default:
        return;
    }

    drv->cpu->pageone = drv->drive->drive_ram;
    drivemem_set_func(cpud, 0x00, 0x02, drive_read_1001zero_ram, drive_store_1001zero_ram, NULL, drv->drive->drive_ram, 0x000000fd);
    drivemem_set_func(cpud, 0x02, 0x04, drive_read_1001_io, drive_store_1001_io, drive_peek_1001_io, NULL, 0);
    drivemem_set_func(cpud, 0x04, 0x06, drive_read_1001zero_ram, drive_store_1001zero_ram, NULL, drv->drive->drive_ram, 0x040004fd);
    drivemem_set_func(cpud, 0x06, 0x08, drive_read_1001_io, drive_store_1001_io, drive_peek_1001_io, NULL, 0);
    drivemem_set_func(cpud, 0x08, 0x0a, drive_read_1001zero_ram, drive_store_1001zero_ram, NULL, drv->drive->drive_ram, 0x080008fd);
    drivemem_set_func(cpud, 0x0a, 0x0c, drive_read_1001_io, drive_store_1001_io, drive_peek_1001_io, NULL, 0);
    drivemem_set_func(cpud, 0x0c, 0x0e, drive_read_1001zero_ram, drive_store_1001zero_ram, NULL, drv->drive->drive_ram, 0x0c000cfd);
    drivemem_set_func(cpud, 0x0e, 0x10, drive_read_1001_io, drive_store_1001_io, drive_peek_1001_io, NULL, 0);
    drivemem_set_func(cpud, 0x10, 0x14, drive_read_2040buffer1_ram, drive_store_2040buffer1_ram, NULL, &drv->drive->drive_ram[0x0100], 0x100013fd);
    drivemem_set_func(cpud, 0x14, 0x18, drive_read_2040buffer1_ram, drive_store_2040buffer1_ram, NULL, &drv->drive->drive_ram[0x0100], 0x140017fd);
    drivemem_set_func(cpud, 0x18, 0x1c, drive_read_2040buffer1_ram, drive_store_2040buffer1_ram, NULL, &drv->drive->drive_ram[0x0100], 0x18001bfd);
    drivemem_set_func(cpud, 0x1c, 0x20, drive_read_2040buffer1_ram, drive_store_2040buffer1_ram, NULL, &drv->drive->drive_ram[0x0100], 0x1c001ffd);
    drivemem_set_func(cpud, 0x20, 0x34, drive_read_2040buffer2_ram, drive_store_2040buffer2_ram, NULL, &drv->drive->drive_ram[0x0500], 0x200023fd);
    drivemem_set_func(cpud, 0x24, 0x38, drive_read_2040buffer2_ram, drive_store_2040buffer2_ram, NULL, &drv->drive->drive_ram[0x0500], 0x240027fd);
    drivemem_set_func(cpud, 0x28, 0x3c, drive_read_2040buffer2_ram, drive_store_2040buffer2_ram, NULL, &drv->drive->drive_ram[0x0500], 0x28002bfd);
    drivemem_set_func(cpud, 0x2c, 0x40, drive_read_2040buffer2_ram, drive_store_2040buffer2_ram, NULL, &drv->drive->drive_ram[0x0500], 0x2c002ffd);
    drivemem_set_func(cpud, 0x30, 0x34, drive_read_2040buffer3_ram, drive_store_2040buffer3_ram, NULL, &drv->drive->drive_ram[0x0900], 0x300033fd);
    drivemem_set_func(cpud, 0x34, 0x38, drive_read_2040buffer3_ram, drive_store_2040buffer3_ram, NULL, &drv->drive->drive_ram[0x0900], 0x340037fd);
    drivemem_set_func(cpud, 0x38, 0x3c, drive_read_2040buffer3_ram, drive_store_2040buffer3_ram, NULL, &drv->drive->drive_ram[0x0900], 0x38003bfd);
    drivemem_set_func(cpud, 0x3c, 0x40, drive_read_2040buffer3_ram, drive_store_2040buffer3_ram, NULL, &drv->drive->drive_ram[0x0900], 0x3c003ffd);
    drivemem_set_func(cpud, 0x40, 0x44, drive_read_2040buffer4_ram, drive_store_2040buffer4_ram, NULL, &drv->drive->drive_ram[0x0d00], 0x400043fd);
    drivemem_set_func(cpud, 0x44, 0x48, drive_read_2040buffer4_ram, drive_store_2040buffer4_ram, NULL, &drv->drive->drive_ram[0x0d00], 0x440047fd);
    drivemem_set_func(cpud, 0x48, 0x4c, drive_read_2040buffer4_ram, drive_store_2040buffer4_ram, NULL, &drv->drive->drive_ram[0x0d00], 0x48004bfd);
    drivemem_set_func(cpud, 0x4c, 0x50, drive_read_2040buffer4_ram, drive_store_2040buffer4_ram, NULL, &drv->drive->drive_ram[0x0d00], 0x4c004ffd);
    drivemem_set_func(cpud, 0x80, 0x82, drive_read_1001zero_ram, drive_store_1001zero_ram, NULL, drv->drive->drive_ram, 0x000000fd);
    drivemem_set_func(cpud, 0x82, 0x84, drive_read_1001_io, drive_store_1001_io, drive_peek_1001_io, NULL, 0);
    drivemem_set_func(cpud, 0x84, 0x86, drive_read_1001zero_ram, drive_store_1001zero_ram, NULL, drv->drive->drive_ram, 0x040004fd);
    drivemem_set_func(cpud, 0x86, 0x88, drive_read_1001_io, drive_store_1001_io, drive_peek_1001_io, NULL, 0);
    drivemem_set_func(cpud, 0x88, 0x8a, drive_read_1001zero_ram, drive_store_1001zero_ram, NULL, drv->drive->drive_ram, 0x080008fd);
    drivemem_set_func(cpud, 0x8a, 0x8c, drive_read_1001_io, drive_store_1001_io, drive_peek_1001_io, NULL, 0);
    drivemem_set_func(cpud, 0x8c, 0x8e, drive_read_1001zero_ram, drive_store_1001zero_ram, NULL, drv->drive->drive_ram, 0x0c000cfd);
    drivemem_set_func(cpud, 0x8e, 0x90, drive_read_1001_io, drive_store_1001_io, drive_peek_1001_io, NULL, 0);
    drivemem_set_func(cpud, 0x90, 0x94, drive_read_2040buffer1_ram, drive_store_2040buffer1_ram, NULL, &drv->drive->drive_ram[0x0100], 0x900093fd);
    drivemem_set_func(cpud, 0x94, 0x98, drive_read_2040buffer1_ram, drive_store_2040buffer1_ram, NULL, &drv->drive->drive_ram[0x0100], 0x940097fd);
    drivemem_set_func(cpud, 0x98, 0x9c, drive_read_2040buffer1_ram, drive_store_2040buffer1_ram, NULL, &drv->drive->drive_ram[0x0100], 0x98009bfd);
    drivemem_set_func(cpud, 0x9c, 0xa0, drive_read_2040buffer1_ram, drive_store_2040buffer1_ram, NULL, &drv->drive->drive_ram[0x0100], 0x9c009ffd);
    drivemem_set_func(cpud, 0xa0, 0xb4, drive_read_2040buffer2_ram, drive_store_2040buffer2_ram, NULL, &drv->drive->drive_ram[0x0500], 0xa000a3fd);
    drivemem_set_func(cpud, 0xa4, 0xb8, drive_read_2040buffer2_ram, drive_store_2040buffer2_ram, NULL, &drv->drive->drive_ram[0x0500], 0xa400a7fd);
    drivemem_set_func(cpud, 0xa8, 0xbc, drive_read_2040buffer2_ram, drive_store_2040buffer2_ram, NULL, &drv->drive->drive_ram[0x0500], 0xa800abfd);
    drivemem_set_func(cpud, 0xac, 0xc0, drive_read_2040buffer2_ram, drive_store_2040buffer2_ram, NULL, &drv->drive->drive_ram[0x0500], 0xac00affd);
    drivemem_set_func(cpud, 0xb0, 0xb4, drive_read_2040buffer3_ram, drive_store_2040buffer3_ram, NULL, &drv->drive->drive_ram[0x0900], 0xb000b3fd);
    drivemem_set_func(cpud, 0xb4, 0xb8, drive_read_2040buffer3_ram, drive_store_2040buffer3_ram, NULL, &drv->drive->drive_ram[0x0900], 0xb400b7fd);
    drivemem_set_func(cpud, 0xb8, 0xbc, drive_read_2040buffer3_ram, drive_store_2040buffer3_ram, NULL, &drv->drive->drive_ram[0x0900], 0xb800bbfd);
    drivemem_set_func(cpud, 0xbc, 0xc0, drive_read_2040buffer3_ram, drive_store_2040buffer3_ram, NULL, &drv->drive->drive_ram[0x0900], 0xbc00bffd);
    drivemem_set_func(cpud, 0xc0, 0xc4, drive_read_2040buffer4_ram, drive_store_2040buffer4_ram, NULL, &drv->drive->drive_ram[0x0d00], 0xc000c3fd);
    drivemem_set_func(cpud, 0xc4, 0xc8, drive_read_2040buffer4_ram, drive_store_2040buffer4_ram, NULL, &drv->drive->drive_ram[0x0d00], 0xc400c7fd);
    drivemem_set_func(cpud, 0xc8, 0xcc, drive_read_2040buffer4_ram, drive_store_2040buffer4_ram, NULL, &drv->drive->drive_ram[0x0d00], 0xc800cbfd);
    drivemem_set_func(cpud, 0xcc, 0xd0, drive_read_2040buffer4_ram, drive_store_2040buffer4_ram, NULL, &drv->drive->drive_ram[0x0d00], 0xcc00cffd);
}
예제 #3
0
파일: memiec.c 프로젝트: QaDeS/droidsound
void memiec_init(struct drive_context_s *drv, unsigned int type)
{
    unsigned int j;
    drivecpud_context_t *cpud;

    cpud = drv->cpud;

    if (type == DRIVE_TYPE_1541 || type == DRIVE_TYPE_1541II
            || type == DRIVE_TYPE_1570 || type == DRIVE_TYPE_1571
            || type == DRIVE_TYPE_1571CR || type == DRIVE_TYPE_1581) {

        /* Setup drive RAM.  */
        switch (type) {
        case DRIVE_TYPE_1541:
        case DRIVE_TYPE_1541II:
            for (j = 0; j < 0x80; j += 0x20) {
                drivemem_set_func(cpud, 0x00 + j, 0x08 + j,
                                  drive_read_ram, drive_store_ram);
            }
            break;
        case DRIVE_TYPE_1570:
        case DRIVE_TYPE_1571:
        case DRIVE_TYPE_1571CR:
            drivemem_set_func(cpud, 0x00, 0x10,
                              drive_read_ram, drive_store_ram);
            break;
        case DRIVE_TYPE_1581:
            drivemem_set_func(cpud, 0x00, 0x20,
                              drive_read_1581ram, drive_store_1581ram);
            break;
        }

        drv->cpu->pageone = cpud->drive_ram + 0x100;

        cpud->read_func_nowatch[0] = drive_read_zero;
        cpud->store_func_nowatch[0] = drive_store_zero;

        /* Setup drive ROM.  */
        drivemem_set_func(cpud, 0x80, 0x100, drive_read_rom, NULL);
    }

    /* Setup 1541, 1541-II VIAs.  */
    if (type == DRIVE_TYPE_1541 || type == DRIVE_TYPE_1541II) {
        for (j = 0; j < 0x80; j += 0x20) {
            drivemem_set_func(cpud, 0x18 + j, 0x1c + j,
                              via1d1541_read, via1d1541_store);
            drivemem_set_func(cpud, 0x1c + j, 0x20 + j,
                              via2d_read, via2d_store);
        }
    }

    /* Setup 1571 VIA1, VIA2, WD1770 and CIA.  */
    if (type == DRIVE_TYPE_1570 || type == DRIVE_TYPE_1571
            || type == DRIVE_TYPE_1571CR) {
        drivemem_set_func(cpud, 0x18, 0x1c, via1d1541_read, via1d1541_store);
        drivemem_set_func(cpud, 0x1c, 0x20, via2d_read, via2d_store);
        drivemem_set_func(cpud, 0x20, 0x30, wd1770d_read, wd1770d_store);
        drivemem_set_func(cpud, 0x40, 0x80, cia1571_read, cia1571_store);
    }

    /* Setup 1581 CIA.  */
    if (type == DRIVE_TYPE_1581) {
        drivemem_set_func(cpud, 0x40, 0x60, cia1581_read, cia1581_store);
        drivemem_set_func(cpud, 0x60, 0x80, wd1770d_read, wd1770d_store);
    }

    if (!rom_loaded)
        return;

    /* Setup RAM expansions */
    if (type == DRIVE_TYPE_1541 || type == DRIVE_TYPE_1541II) {
        if (drv->drive->drive_ram2_enabled) {
            realloc_expram(&drv->drive->drive_ram_expand2, 0x2000);
            drivemem_set_func(cpud, 0x20, 0x40,
                              drive_read_ram2, drive_store_ram2);
        }
        if (drv->drive->drive_ram4_enabled) {
            realloc_expram(&drv->drive->drive_ram_expand4, 0x2000);
            drivemem_set_func(cpud, 0x40, 0x60,
                              drive_read_ram4, drive_store_ram4);
        }
    }

    if (type == DRIVE_TYPE_1570 || type == DRIVE_TYPE_1571
            || type == DRIVE_TYPE_1571CR) {
        if (drv->drive->drive_ram4_enabled) {
            realloc_expram(&drv->drive->drive_ram_expand4, 0x2000);
            drivemem_set_func(cpud, 0x48, 0x60,
                              drive_read_ram4, drive_store_ram4);
        }
    }

    if (type == DRIVE_TYPE_1541 || type == DRIVE_TYPE_1541II
            || type == DRIVE_TYPE_1570 || type == DRIVE_TYPE_1571
            || type == DRIVE_TYPE_1571CR) {
        if (drv->drive->drive_ram6_enabled) {
            realloc_expram(&drv->drive->drive_ram_expand6, 0x2000);
            drivemem_set_func(cpud, 0x60, 0x80,
                              drive_read_ram6, drive_store_ram6);
        }
    }

    if (type == DRIVE_TYPE_1541 || type == DRIVE_TYPE_1541II) {
        if (drv->drive->drive_ram8_enabled) {
            realloc_expram(&drv->drive->drive_ram_expand8, 0x2000);
            drivemem_set_func(cpud, 0x80, 0xa0,
                              drive_read_ram8, drive_store_ram8);
        }
        if (drv->drive->drive_rama_enabled) {
            realloc_expram(&drv->drive->drive_ram_expanda, 0x2000);
            drivemem_set_func(cpud, 0xa0, 0xc0,
                              drive_read_rama, drive_store_rama);
        }
    }
}
예제 #4
0
파일: memiec.c 프로젝트: OpenEmu/VICE-Core
void memiec_init(struct drive_context_s *drv, unsigned int type)
{
    drivecpud_context_t *cpud = drv->cpud;

    switch (type) {
    case DRIVE_TYPE_1540:
    case DRIVE_TYPE_1541:
    case DRIVE_TYPE_1541II:
        drv->cpu->pageone = drv->drive->drive_ram + 0x100;
        drivemem_set_func(cpud, 0x00, 0x01, drive_read_zero, drive_store_zero, NULL, drv->drive->drive_ram, 0x000007fd);
        drivemem_set_func(cpud, 0x01, 0x08, drive_read_1541ram, drive_store_1541ram, NULL, &drv->drive->drive_ram[0x0100], 0x000007fd);
        drivemem_set_func(cpud, 0x18, 0x1c, via1d1541_read, via1d1541_store, via1d1541_peek, NULL, 0);
        drivemem_set_func(cpud, 0x1c, 0x20, via2d_read, via2d_store, via2d_peek, NULL, 0);
        if (drv->drive->drive_ram2_enabled) {
            drivemem_set_func(cpud, 0x20, 0x40, drive_read_ram, drive_store_ram, NULL, &drv->drive->drive_ram[0x2000], 0x20003ffd);
        } else {
            drivemem_set_func(cpud, 0x20, 0x28, drive_read_1541ram, drive_store_1541ram, NULL, drv->drive->drive_ram, 0x200027fd);
            drivemem_set_func(cpud, 0x38, 0x3c, via1d1541_read, via1d1541_store, via1d1541_peek, NULL, 0);
            drivemem_set_func(cpud, 0x3c, 0x40, via2d_read, via2d_store, via2d_peek, NULL, 0);
        }
        if (drv->drive->drive_ram4_enabled) {
            drivemem_set_func(cpud, 0x40, 0x60, drive_read_ram, drive_store_ram, NULL, &drv->drive->drive_ram[0x4000], 0x40005ffd);
        } else {
            drivemem_set_func(cpud, 0x40, 0x48, drive_read_1541ram, drive_store_1541ram, NULL, drv->drive->drive_ram, 0x400047fd);
            drivemem_set_func(cpud, 0x58, 0x5c, via1d1541_read, via1d1541_store, via1d1541_peek, NULL, 0);
            drivemem_set_func(cpud, 0x5c, 0x60, via2d_read, via2d_store, via2d_peek, NULL, 0);
        }
        if (drv->drive->drive_ram6_enabled) {
            drivemem_set_func(cpud, 0x60, 0x80, drive_read_ram, drive_store_ram, NULL, &drv->drive->drive_ram[0x6000], 0x60007ffd);
        } else {
            drivemem_set_func(cpud, 0x60, 0x68, drive_read_1541ram, drive_store_1541ram, NULL, drv->drive->drive_ram, 0x600067fd);
            drivemem_set_func(cpud, 0x78, 0x7c, via1d1541_read, via1d1541_store, via1d1541_peek, NULL, 0);
            drivemem_set_func(cpud, 0x7c, 0x80, via2d_read, via2d_store, via2d_peek, NULL, 0);
        }
        if (drv->drive->drive_ram8_enabled) {
            drivemem_set_func(cpud, 0x80, 0xa0, drive_read_ram, drive_store_ram, NULL, &drv->drive->drive_ram[0x8000], 0x80009ffd);
        } else {
            drivemem_set_func(cpud, 0x80, 0xa0, drive_read_rom, NULL, NULL, drv->drive->trap_rom, 0x80009ffd);
        }
        if (drv->drive->drive_rama_enabled) {
            drivemem_set_func(cpud, 0xa0, 0xc0, drive_read_ram, drive_store_ram, NULL, &drv->drive->drive_ram[0xa000], 0xa000bffd);
        } else {
            drivemem_set_func(cpud, 0xa0, 0xc0, drive_read_rom, NULL, NULL, &drv->drive->trap_rom[0x2000], 0xa000bffd);
        }
        drivemem_set_func(cpud, 0xc0, 0x100, drive_read_rom, NULL, NULL, &drv->drive->trap_rom[0x4000], 0xc000fffd);
        break;
    case DRIVE_TYPE_1570:
    case DRIVE_TYPE_1571:
    case DRIVE_TYPE_1571CR:
        drv->cpu->pageone = drv->drive->drive_ram + 0x100;
        drivemem_set_func(cpud, 0x00, 0x01, drive_read_zero, drive_store_zero, NULL, drv->drive->drive_ram, 0x000007fd);
        drivemem_set_func(cpud, 0x01, 0x08, drive_read_1541ram, drive_store_1541ram, NULL, &drv->drive->drive_ram[0x0100], 0x000007fd);
        drivemem_set_func(cpud, 0x08, 0x10, drive_read_1541ram, drive_store_1541ram, NULL, drv->drive->drive_ram, 0x08000ffd);
        drivemem_set_func(cpud, 0x18, 0x1c, via1d1541_read, via1d1541_store, via1d1541_peek, NULL, 0);
        drivemem_set_func(cpud, 0x1c, 0x20, via2d_read, via2d_store, via2d_peek, NULL, 0);
        drivemem_set_func(cpud, 0x20, 0x30, wd1770d_read, wd1770d_store, wd1770d_peek, NULL, 0);
        if (drv->drive->drive_ram4_enabled) {
            drivemem_set_func(cpud, 0x40, 0x48, cia1571_read, cia1571_store, cia1571_peek, NULL, 0);
            drivemem_set_func(cpud, 0x48, 0x60, drive_read_ram, drive_store_ram, NULL, &drv->drive->drive_ram[0x4000], 0x48005ffd);
        } else {
            drivemem_set_func(cpud, 0x40, 0x60, cia1571_read, cia1571_store, cia1571_peek, NULL, 0);
        }
        if (drv->drive->drive_ram6_enabled) {
            drivemem_set_func(cpud, 0x60, 0x80, drive_read_ram, drive_store_ram, NULL, &drv->drive->drive_ram[0x6000], 0x60007ffd);
        } else {
            drivemem_set_func(cpud, 0x60, 0x80, cia1571_read, cia1571_store, cia1571_peek, NULL, 0);
        }
        drivemem_set_func(cpud, 0x80, 0x100, drive_read_rom, NULL, NULL, drv->drive->trap_rom, 0x8000fffd);
        break;
    case DRIVE_TYPE_1581:
        drv->cpu->pageone = drv->drive->drive_ram + 0x100;
        drivemem_set_func(cpud, 0x00, 0x01, drive_read_zero, drive_store_zero, NULL, drv->drive->drive_ram, 0x00001ffd);
        drivemem_set_func(cpud, 0x01, 0x20, drive_read_ram, drive_store_ram, NULL, &drv->drive->drive_ram[0x0100], 0x00001ffd);
        drivemem_set_func(cpud, 0x40, 0x60, cia1581_read, cia1581_store, cia1581_peek, NULL, 0);
        drivemem_set_func(cpud, 0x60, 0x80, wd1770d_read, wd1770d_store, wd1770d_peek, NULL, 0);
        drivemem_set_func(cpud, 0x80, 0x100, drive_read_rom, NULL, NULL, drv->drive->trap_rom, 0x8000fffd);
        break;
    case DRIVE_TYPE_2000:
    case DRIVE_TYPE_4000:
        drv->cpu->pageone = drv->drive->drive_ram + 0x100;
        drivemem_set_func(cpud, 0x00, 0x01, drive_read_zero, drive_store_zero, NULL, drv->drive->drive_ram, 0x00003ffd);
        drivemem_set_func(cpud, 0x01, 0x40, drive_read_ram, drive_store_ram, NULL, &drv->drive->drive_ram[0x0100], 0x00003ffd);
        drivemem_set_func(cpud, 0x40, 0x4c, via4000_read, via4000_store, via4000_peek, NULL, 0);
        drivemem_set_func(cpud, 0x4e, 0x50, pc8477d_read, pc8477d_store, pc8477d_peek, NULL, 0);
        drivemem_set_func(cpud, 0x50, 0x80, drive_read_ram, drive_store_ram, NULL, &drv->drive->drive_ram[0x5000], 0x50007ffd);
        drivemem_set_func(cpud, 0x80, 0x100, drive_read_rom, NULL, NULL, drv->drive->trap_rom, 0x8000fffd);
        /* for performance reasons it's only this page */
        drivemem_set_func(cpud, 0xf0, 0xf1, drive_read_rom_ds1216, NULL, NULL, &drv->drive->trap_rom[0x7000], 0x8000fffd);
        break;
    default:
        return;
    }
}