static void writeIo(Microsol* rm, UInt16 ioPort, UInt8 value) { switch (ioPort) { case 0xd0: wd2793SetCommandReg(rm->fdc, value); break; case 0xd1: wd2793SetTrackReg(rm->fdc, value); break; case 0xd2: wd2793SetSectorReg(rm->fdc, value); break; case 0xd3: wd2793SetDataReg(rm->fdc, value); break; case 0xd4: switch (value & 0x0f) { case 1: wd2793SetDrive(rm->fdc, 0); wd2793SetMotor(rm->fdc, value & 0x20); break; case 2: wd2793SetDrive(rm->fdc, 1); wd2793SetMotor(rm->fdc, value & 0x20); break; case 4: wd2793SetDrive(rm->fdc, 2); wd2793SetMotor(rm->fdc, 0); break; case 8: wd2793SetDrive(rm->fdc, 3); wd2793SetMotor(rm->fdc, 0); break; default: wd2793SetDrive(rm->fdc, -1); wd2793SetMotor(rm->fdc, 0); } wd2793SetSide(rm->fdc, value & 0x10 ? 1 : 0); break; } }
static void writeIo(Svi328Fdc* rm, UInt16 ioPort, UInt8 value) { switch (ioPort) { case 0x30: wd2793SetCommandReg(rm->fdc, value); break; case 0x31: wd2793SetTrackReg(rm->fdc, value); break; case 0x32: wd2793SetSectorReg(rm->fdc, value); break; case 0x33: wd2793SetDataReg(rm->fdc, value); break; case 0x34: rm->drvSelect = value & 0x3f; switch (value & 3) { case 1: wd2793SetDrive(rm->fdc, 0); wd2793SetMotor(rm->fdc, 1); break; case 2: wd2793SetDrive(rm->fdc, 1); wd2793SetMotor(rm->fdc, 1); break; default: wd2793SetDrive(rm->fdc, -1); wd2793SetMotor(rm->fdc, 0); } break; case 0x38: wd2793SetDensity(rm->fdc, value & 0x01 ? 1:0); wd2793SetSide(rm->fdc, value & 0x02 ? 1:0); break; } }
static void write(RomMapperPhilipsFdc* rm, UInt16 address, UInt8 value) { switch (address & 0x3fff) { case 0x3ff8: wd2793SetCommandReg(rm->fdc, value); break; case 0x3ff9: wd2793SetTrackReg(rm->fdc, value); break; case 0x3ffa: wd2793SetSectorReg(rm->fdc, value); break; case 0x3ffb: wd2793SetDataReg(rm->fdc, value); break; case 0x3ffc: rm->sideReg = value; wd2793SetSide(rm->fdc, value & 1); break; case 0x3ffd: switch (value & 3) { case 0: case 2: wd2793SetDrive(rm->fdc, 0); wd2793SetMotor(rm->fdc, value & 0x80); break; case 1: wd2793SetDrive(rm->fdc, 1); wd2793SetMotor(rm->fdc, value & 0x80); break; default: wd2793SetDrive(rm->fdc, -1); wd2793SetMotor(rm->fdc, 0); } break; } }
static void write(RomMapperNationalFdc* rm, UInt16 address, UInt8 value) { switch (address & 0x3fc7) { case 0x3f80: wd2793SetCommandReg(rm->fdc, value); break; case 0x3f81: wd2793SetTrackReg(rm->fdc, value); break; case 0x3f82: wd2793SetSectorReg(rm->fdc, value); break; case 0x3f83: wd2793SetDataReg(rm->fdc, value); break; case 0x3f84: case 0x3f85: case 0x3f86: case 0x3f87: switch (value & 3) { case 1: wd2793SetDrive(rm->fdc, 0); wd2793SetMotor(rm->fdc, value & 0x08); break; case 2: wd2793SetDrive(rm->fdc, 1); wd2793SetMotor(rm->fdc, value & 0x08); break; default: wd2793SetDrive(rm->fdc, -1); wd2793SetMotor(rm->fdc, 0); } wd2793SetSide(rm->fdc, value & 0x04 ? 1 : 0); break; } }