public void writeStackValue(int relativeOffset, int size, long value) throws Exception {
		long offset = readRegister(stackPtrReg).longValue() + relativeOffset;
		byte[] bytes = new byte[size];
		converter.getBytes(value, size, bytes, 0);
		writeMemory(stackMemorySpace.getAddress(offset), bytes);
	}
Write a value onto the stack

@param relativeOffset offset relative to current stack pointer
@param size data size in bytes
@param value
@throws Exception error occurs reading stack pointer
Ghidra/Framework/Emulation/src/main/java/ghidra/app/emulator/EmulatorHelper.java