There is some information on the internals under ucsdpsys_fs in http://ucsd-psystem-fs.sourceforge.net/ucsd-psystem-fs-1.22.pdf. Note, the default volume size was 140kb, i.e. one Apple floppy disk (see ucsdpsys_mkfs in the same PDF) which puts the "77 files and no subdirectories" limits into context.
Each directory entry is 26 bytes ...
What was the reason that the UCSD P-system filesystem was designed in such a way[...]
Quick Answer: Simplicity
Like with many early systems, it was all about making access easy by assuming certain structure.
The numbers are a result of the assumed default size entry size.
There's only one directory, no subdirectories and default size was to be 4 blocks ...
Will CODE (pcode 'executables') files from the II. p-System run correctly on the IV. p-System?
Quick answer: No
The roman numeral (I..IV) of the p-code system denotes the underlying p-code engine. They are incompatible with each other. Even though they are quite similar, the binary representation changed with each version.
Making them not (upward) ...
I wonder if you have a copy of the Volition Systems Modula-2 compiler (documentation). The docs and this PC Mag review indicate the compiler was built on top of the UCSD Pascal system (but that does not necessarily mean the tool will compile Pascal, only Modula-2).
The segment dictionary of the code file has an entry that describes the version. See e.g. the Pascal Internal Architecture Guide, p. 28.
I once wrote an UCSD Pascal program that disassembled code files, so writing a similar program to look at that particular field for each segment shouldn't be too difficult.
There are a few basic ways a floppy-drive OS can handle directories:
Reserve a fixed amount of space in both RAM and on disk to hold them. This will make finding files fast, but will require that one reserve RAM to hold all the directory entries one may ever need.
Reserve a fixed amount of space on disk to hold them, but load them into RAM on demand. This ...
The UCSD P-system was originally developed on PDP-11, where the format of DEC RX 8-inch floppy drives had 77 cylinders (tracks) and 26 sectors per track.
There are multiple ways to partition 2 Kb into directory entries, but the fact that the chosen number 77 for the directory entries matches the number of cylinders, indicates a probable attempt to simplify ...