[TUHS] Any UNIX With No C In Userland?

Noel Chiappa jnc at mercury.lcs.mit.edu
Thu Mar 6 21:42:18 AEST 2025


    > From: Phil Budne

    > BUT, the basic TCP and IP protocols seem to have been created with a
    > general care that two byte fields should be aligned at multiples of two
    > bytes

Yes, because dealing with a 16-bit field that spans two PDP-11 16-bit words
is a pain (espcially because the PDP-11 does not have a 'load byte into
register _without_ extending the sign bit into the high half' instruction).

Do realize that in addition to the early TCP implementation, the _first_ TCP
router (at that stage, TCP and IP were not separate protocols) was also a
PDP-11 (albeit programmed in BCPL, not MACRO-11).

I remember the extension being a real PITA. To load an un-aligned 16-bit
quantity into R0, one would have had to do something like (assuming a pointer
to the un-aligned 16-bit quantity was in R1):

	MOVB	(R1)+, R0
	SWAB	R0
	BIC	#0377, R0
	BISB	(R1)+, R0

There may have been a better way to do it, but that's the best I can come up
with now; I recall we had to do something like that.

Yes, the 16-bit fields were 16-bit word aligned.

	Noel


More information about the TUHS mailing list