void sviPPICreate(SviJoyIo* joyIO) { DeviceCallbacks callbacks = { destroy, reset, saveState, loadState }; DebugCallbacks dbgCallbacks = { getDebugInfo, NULL, NULL, NULL }; SviPPI* ppi = malloc(sizeof(SviPPI)); ppi->deviceHandle = deviceManagerRegister(RAM_MAPPER, &callbacks, ppi); ppi->debugHandle = debugDeviceRegister(DBGTYPE_BIOS, langDbgDevPpi(), &dbgCallbacks, ppi); ppi->joyIO = joyIO; ppi->i8255 = i8255Create(peekA, readA, NULL, peekB, readB, NULL, NULL, NULL, writeCLo, NULL, NULL, writeCHi, ppi); ppi->keyClick = audioKeyClickCreate(boardGetMixer()); ppi->dac = dacCreate(boardGetMixer(), DAC_MONO); ioPortRegister(0x98, i8255Read, i8255Write, ppi->i8255); // PPI Port A ioPortRegister(0x99, i8255Read, i8255Write, ppi->i8255); // PPI Port B ioPortRegister(0x96, i8255Read, i8255Write, ppi->i8255); // PPI Port C ioPortRegister(0x97, i8255Read, i8255Write, ppi->i8255); // PPI Mode ioPortRegister(0x9A, readRow, NULL, ppi); // PPI Return Port C (Low) reset(ppi); }
int romMapperMajutsushiCreate(const char* filename, UInt8* romData, int size, int slot, int sslot, int startPage) { DeviceCallbacks callbacks = { destroy, NULL, saveState, loadState }; RomMapperMajutsushi* rm; int i; if (size < 0x8000) { return 0; } rm = malloc(sizeof(RomMapperMajutsushi)); rm->deviceHandle = deviceManagerRegister(ROM_MAJUTSUSHI, &callbacks, rm); slotRegister(slot, sslot, startPage, 4, NULL, NULL, write, destroy, rm); rm->romData = malloc(size); memcpy(rm->romData, romData, size); rm->dac = dacCreate(boardGetMixer(), DAC_MONO); rm->size = size; rm->slot = slot; rm->sslot = sslot; rm->startPage = startPage; rm->romMapper[0] = 0; rm->romMapper[1] = 1; rm->romMapper[2] = 2; rm->romMapper[3] = 3; for (i = 0; i < 4; i++) { slotMapPage(rm->slot, rm->sslot, rm->startPage + i, rm->romData + rm->romMapper[i] * 0x2000, 1, 0); } return 1; }
int romMapperKonamiSynthCreate(const char* filename, UInt8* romData, int size, int slot, int sslot, int startPage) { DeviceCallbacks callbacks = { destroy, NULL, NULL, NULL }; RomMapperKonamiSynth* rm; int i; if (size != 0x8000) { return 0; } rm = malloc(sizeof(RomMapperKonamiSynth)); rm->deviceHandle = deviceManagerRegister(ROM_KONAMISYNTH, &callbacks, rm); slotRegister(slot, sslot, startPage, 4, NULL, NULL, write, destroy, rm); rm->romData = malloc(size); memcpy(rm->romData, romData, size); rm->dac = dacCreate(boardGetMixer(), DAC_MONO); rm->slot = slot; rm->sslot = sslot; rm->startPage = startPage; for (i = 0; i < 4; i++) { slotMapPage(rm->slot, rm->sslot, rm->startPage + i, rm->romData + i * 0x2000, 1, 0); } return 1; }
static void setType(PrinterIO* printerIO) { printerIO->type = thePrinterType; switch (printerIO->type) { case PRN_HOST: printerIO->printerReady = archPrinterCreate(); break; case PRN_FILE: printerIO->file = archFileOpen(theFileName, "w+"); break; case PRN_SIMPL: printerIO->dac = dacCreate(boardGetMixer(), DAC_MONO); break; } }
int romMapperTurboRPcmCreate() { DeviceCallbacks callbacks = { destroy, reset, saveState, loadState }; DebugCallbacks dbgCallbacks = { getDebugInfo, NULL, NULL, NULL }; RomMapperTurboRPcm* rm = malloc(sizeof(RomMapperTurboRPcm)); rm->deviceHandle = deviceManagerRegister(ROM_TURBORPCM, &callbacks, rm); rm->debugHandle = debugDeviceRegister(DBGTYPE_AUDIO, langDbgDevPcm(), &dbgCallbacks, rm); rm->mixer = boardGetMixer(); rm->dac = dacCreate(rm->mixer, DAC_MONO); rm->status = 0; rm->time = 0; ioPortRegister(0xa4, read, write, rm); ioPortRegister(0xa5, read, write, rm); return 1; }