Ejemplo n.º 1
0
int romMapperNationalFdcCreate(const char* filename, UInt8* romData, 
                               int size, int slot, int sslot, int startPage) 
{
    DeviceCallbacks callbacks = { destroy, NULL, saveState, loadState };
    RomMapperNationalFdc* rm;
    int pages = 4;
    int i;

    if ((startPage + pages) > 8) {
        return 0;
    }

    rm = malloc(sizeof(RomMapperNationalFdc));

    rm->deviceHandle = deviceManagerRegister(ROM_NATIONALFDC, &callbacks, rm);
    slotRegister(slot, sslot, startPage, pages, read, peek, write, destroy, rm);

    rm->romData = malloc(size);
    memcpy(rm->romData, romData, size);
    
    rm->slot  = slot;
    rm->sslot = sslot;
    rm->startPage  = startPage;

    for (i = 0; i < pages; i++) {
        slotMapPage(slot, sslot, i + startPage, NULL, 0, 0);
    }

    rm->fdc = wd2793Create(FDC_TYPE_WD2793);

    reset(rm);

    return 1;
}
Ejemplo n.º 2
0
int svi328FdcCreate(void) 
{
    DeviceCallbacks callbacks = {
        (DeviceCallback)destroy,
        (DeviceCallback)reset,
        (DeviceCallback)saveState,
        (DeviceCallback)loadState
    };
    DebugCallbacks dbgCallbacks = { (void(*)(void*,DbgDevice*))getDebugInfo, NULL, NULL, NULL };
    Svi328Fdc* rm;

    rm = malloc(sizeof(Svi328Fdc));
    
    rm->deviceHandle = deviceManagerRegister(ROM_SVI328FDC, &callbacks, rm);
    rm->debugHandle = debugDeviceRegister(DBGTYPE_PORT, langDbgDevSviFdc(), &dbgCallbacks, rm);

    ioPortRegister(0x30, (IoPortRead)readIo, (IoPortWrite)writeIo, rm);
    ioPortRegister(0x31, (IoPortRead)readIo, (IoPortWrite)writeIo, rm);
    ioPortRegister(0x32, (IoPortRead)readIo, (IoPortWrite)writeIo, rm);
    ioPortRegister(0x33, (IoPortRead)readIo, (IoPortWrite)writeIo, rm);
    ioPortRegister(0x34, (IoPortRead)readIo, (IoPortWrite)writeIo, rm);
    ioPortRegister(0x38, (IoPortRead)readIo, (IoPortWrite)writeIo, rm);

    rm->fdc = wd2793Create(FDC_TYPE_WD2793);

    reset(rm);

    return 1;
}
Ejemplo n.º 3
0
int romMapperMicrosolCreate(char* filename, UInt8* romData, 
                            int size, int slot, int sslot, int startPage) 
{
    DeviceCallbacks callbacks = { destroy, reset, saveState, loadState };
    DebugCallbacks dbgCallbacks = { getDebugInfo, NULL, NULL, NULL };
    Microsol* rm;
    int pages = size / 0x2000;
    int i;

    rm = malloc(sizeof(Microsol));

    rm->deviceHandle = deviceManagerRegister(ROM_MICROSOL, &callbacks, rm);
    rm->debugHandle = debugDeviceRegister(DBGTYPE_BIOS, langDbgDevFdcMicrosol(), &dbgCallbacks, rm);

    slotRegister(slot, sslot, startPage, 4, NULL, NULL, NULL, destroy, rm);

    size = (size + 0x3fff) & ~0x3fff;

    rm->romData = malloc(size);
    memcpy(rm->romData, romData, size);
    rm->slot  = slot;
    rm->sslot = sslot;
    rm->startPage  = startPage;

    for (i = 0; i < pages; i++) {
        slotMapPage(slot, sslot, i + startPage, rm->romData + 0x2000 * i, 1, 0);
    }
    
    ioPortRegister(0xd0, readIo, writeIo, rm);
    ioPortRegister(0xd1, readIo, writeIo, rm);
    ioPortRegister(0xd2, readIo, writeIo, rm);
    ioPortRegister(0xd3, readIo, writeIo, rm);
    ioPortRegister(0xd4, readIo, writeIo, rm);

    rm->fdc = wd2793Create(FDC_TYPE_WD2793);

    reset(rm);

    return 1;
}