private void processSegmentTable(MessageLog log, InformationBlock ib, SegmentTable st,
			SegmentedAddressSpace space, Program program, ProgramContext context,
			FileBytes fileBytes, TaskMonitor monitor) throws IOException {
		try {
			Segment[] segments = st.getSegments();
			for (int i = 0; i < segments.length; ++i) {
				String name = (segments[i].isCode() ? "Code" : "Data") + (i + 1);
				Address addr = space.getAddress(segments[i].getSegmentID(), 0);
				boolean r = true;
				boolean w = segments[i].isData() && !segments[i].isReadOnly();
				boolean x = segments[i].isCode();

				int offset = segments[i].getOffsetShiftAligned();
				int length = Short.toUnsignedInt(segments[i].getLength());
				int minalloc = Short.toUnsignedInt(segments[i].getMinAllocSize());
				if (minalloc == 0) {
					minalloc = 0x10000;
				}
				MemoryBlock block;
				if (length > 0) {
					block = MemoryBlockUtils.createInitializedBlock(program, false, name, addr,
						fileBytes, offset, length, "", "", r, w, x, log);
					if (length < minalloc) {
						// Things actually rely on the block being padded out with real 0's, so we
						// must expand it
						byte[] zeros = new byte[minalloc - length];
						MemoryBlock zeroBlock = MemoryBlockUtils.createInitializedBlock(program,
							false, name, addr.add(length), new ByteArrayInputStream(zeros),
							zeros.length, "", "", r, w, x, log, monitor);
						try {
							block = program.getMemory().join(block, zeroBlock); // expand
						}
						catch (MemoryBlockException | LockException | NotFoundException e) {
							throw new IOException(e);
						}
					}
				}
				else {
					block = MemoryBlockUtils.createUninitializedBlock(program, false, name, addr,
						minalloc, "", "", r, w, x, log);
				}

				if (segments[i].is32bit()) {
					Address end = block.getEnd();

					Register opsizeRegister = context.getRegister("opsize");
					Register addrsizeRegister = context.getRegister("addrsize");

					try {
						context.setValue(opsizeRegister, addr, end, BigInteger.valueOf(1));
						context.setValue(addrsizeRegister, addr, end, BigInteger.valueOf(1));
					}
					catch (ContextChangeException e) {
						// ignore since no instruction should exist at time of import
					}
				}

				StringBuffer buff = new StringBuffer();
				buff.append("Segment:    " + (i + 1) + "\n");
				buff.append(
					"Offset:     " + Conv.toHexString(segments[i].getOffsetShiftAligned()) + "\n");
				buff.append("Length:     " + Conv.toHexString(segments[i].getLength()) + "\n");
				buff.append(
					"Min Alloc:  " + Conv.toHexString(segments[i].getMinAllocSize()) + "\n");
				buff.append("Flags:      " + Conv.toHexString(segments[i].getFlagword()) + "\n");
				buff.append(TAB + (segments[i].isCode() ? "Code" : "Data") + "\n");
				buff.append((segments[i].isDiscardable() ? TAB + "Discardable" + "\n" : ""));
				buff.append((segments[i].isExecuteOnly() ? TAB + "Execute Only" + "\n" : ""));
				buff.append((segments[i].isLoaded() ? TAB + "Loaded" + "\n" : ""));
				buff.append(
					(segments[i].isLoaderAllocated() ? TAB + "LoaderAllocated" + "\n" : ""));
				buff.append(TAB + (segments[i].isMoveable() ? "Moveable" : "Fixed") + "\n");
				buff.append(TAB + (segments[i].isPreload() ? "Preload" : "LoadOnCall") + "\n");
				buff.append(TAB +
					(segments[i].isPure() ? "Pure (Shareable)" : "Impure (Non-shareable)") + "\n");
				buff.append((segments[i].isReadOnly() ? TAB + "Read Only" + "\n" : ""));
				buff.append((segments[i].is32bit() ? TAB + "Use 32 Bit" + "\n" : ""));
				CodeUnit cu = program.getListing().getCodeUnitAt(addr);
				cu.setComment(CommentType.PRE, buff.toString());
			}

			for (Segment segment : segments) {
				if (!segment.isCode()) {
					continue;
				}
				Address addr = space.getAddress(segment.getSegmentID(), 0);
				MemoryBlock mb = program.getMemory().getBlock(addr);
				setRegisterDS(ib, st, context, mb.getStart(), mb.getEnd());
			}
		}
		catch (AddressOverflowException e) {
			throw new RuntimeException(e);
		}
	}
A {@link Loader} for processing Microsoft New Executable (NE) files.
Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/NeLoader.java