Write.java

package builder.netsiddev.commands;

import static server.netsiddev.NetworkSIDProtocol.*;

public class Write {

    private final int cycles;
    private final int reg;
    private final byte data;

    public Write(int cycles, int reg, byte data) {
        if (cycles < 0 || cycles > MAX_CYCLE_DELAY) {
            throw new IllegalArgumentException("Write delay must be between 0 and 65535 cycles");
        }
        if (reg < 0 || reg > MAX_EXTENDED_SID_ADDRESS && !isFmAddress(reg)) {
            throw new IllegalArgumentException("Invalid SID or FM write address: " + reg);
        }
        this.cycles = cycles;
        this.reg = reg;
        this.data = data;
    }

    public int getCycles() {
        return cycles;
    }

    public int getReg() {
        return reg;
    }

    public byte getData() {
        return data;
    }
}