def get_romb_offset(rom_slot, rom_split, rom_bases, roms_file=False):
    """
    Get ROM slot offset in SPI Flash or ROMS.ZX1 file
    :param rom_slot: ROM slot index
    :param rom_split: Slot number where rom binary data is split in two
    :param rom_bases: Offsets for ROM binary data
    :param roms_file: If True, add extra offset as in ROM.ZX1 file
    """
    if rom_slot < rom_split:
        rom_base = int(rom_bases[0])
        rom_offset = rom_base + rom_slot * 16384
    else:
        rom_base = int(rom_bases[4])
        rom_offset = rom_base + (rom_slot - rom_split) * 16384

    if roms_file:
        rom_offset += 1

    return rom_offset