int romMapperSvi328Col80Create(int frameRate, UInt8* romData, int size) { DeviceCallbacks callbacks = {destroy, reset, saveState, loadState}; DebugCallbacks dbgCallbacks = {getDebugInfo, NULL, NULL, NULL}; RomMapperSvi328Col80* svi328col80; if (size != 0x1000) return 0; svi328col80 = malloc(sizeof(RomMapperSvi328Col80)); svi328col80Instance = svi328col80; svi328col80->deviceHandle = deviceManagerRegister(ROM_SVI328COL80, &callbacks, svi328col80); svi328col80->crtc6845 = NULL; svi328col80->crtc6845 = crtc6845Create(frameRate, romData, size, 0x800, 7, 0, 82, 4); svi328col80->debugHandle = debugDeviceRegister(DBGTYPE_VIDEO, langDbgDevSvi80Col(), &dbgCallbacks, svi328col80); ioPortRegister(0x50, NULL, writeIo, svi328col80); ioPortRegister(0x51, readIo, writeIo, svi328col80); ioPortRegister(0x58, readIo, writeIo, svi328col80); reset(svi328col80); return 1; }
int romMapperSvi727Create(char* filename, UInt8* charRom, int charSize, int slot, int sslot, int startPage) { DeviceCallbacks callbacks = { (DeviceCallback)destroy, (DeviceCallback)reset, (DeviceCallback)saveState, (DeviceCallback)loadState }; RomMapperSvi727* rm; int pages = 8; int i; startPage = 0; rm = malloc(sizeof(RomMapperSvi727)); rm->deviceHandle = deviceManagerRegister(ROM_SVI727, &callbacks, rm); slotRegister(slot, sslot, startPage, pages, (SlotRead)read, (SlotRead)read, (SlotWrite)write, (SlotEject)destroy, rm); rm->charData = calloc(1, 0x2000); if (charRom != NULL) { charSize += 0x200; if (charSize > 0x2000) { charSize = 0x2000; } memcpy(rm->charData + 0x200, charRom, charSize - 0x200); } rm->crtc6845 = NULL; rm->crtc6845 = crtc6845Create(50, rm->charData, charSize, 0x0800, 7, 0, 80, 4); rm->slot = slot; rm->sslot = sslot; rm->startPage = startPage; for (i = 0; i < pages; i++) { slotMapPage(slot, sslot, i + startPage, NULL, 0, 0); } ioPortRegister(0x78, NULL, (IoPortWrite)writeIo, rm); ioPortRegister(0x79, (IoPortRead)readIo, (IoPortWrite)writeIo, rm); reset(rm); return 1; }