5 ms·
Unix Programmer's Manual, First Edition (1971)
- segfaultbuserr 6y agoTIL the "switch" keyword in C was originally a PDP-11 assembly helper subroutine in the Unix system library (this was written before the invention of C). It explains everything about C's behavior. NAME switch -- switch on value SYNOPSIS (switch value in r0) jsr r5,switch; swtab (not—found return) swtab: val1; lab1; valn; labn ..; 0 DESCRIPTION switch compares the value of r0 against each of the vali; if a match is found, control is transferred to the corresponding lab. (after popping the stack once). If no match has been found by the time a null labi occurs, switch returns.
- vincent-manis 6y agoAnd I think that this switch subroutine mirrors one way of compiling the BCPL switchon statement (on which C's switch statement was explicitly modelled), though the BCPL compiler I used in the mid-1970s was smarter if the cases formed a compact integer sequence. C was based upon B, which was based upon BCPL. Clearly, the Bell Labs crew were trying to give themselves some BCPL goodness, even in assembly language.
- pjmlp 6y agoAnd BCPL was desiged as very thin language just to be good enough to write the CPL compiler, it was never planned to be used to write full applications. Bootstrap CPL.
- contingencies 6y agoBCPL (1967), B (1969), PDP-11 (1970), C (1972).
- smlckz 6y agoHere you can read the source code of first edition unix: https://minnie.tuhs.org/cgi-bin/utree.pl?file=V1 https://minnie.tuhs.org/cgi-bin/utree.pl?file=V1 Where can we learn the PDP assembly to be able to understand these historical source code?
- kencausey 6y agohttps://en.wikipedia.org/wiki/MACRO-11 https://en.wikipedia.org/wiki/MACRO-11 and linked from that page http://bitsavers.trailing-edge.com/pdf/dec/pdp11/rsx11/RSX11M_V2/DEC-11-OIMRA-A-D_MACRO_75.pdf http://bitsavers.trailing-edge.com/pdf/dec/pdp11/rsx11/RSX11... There are probably better references, but that's what I found in a quick look.
- segfaultbuserr 6y agoRead the official manual - PDP-11/40 Processor Handbook. https://pdos.csail.mit.edu/6.828/2005/readings/pdp11-40.pdf https://pdos.csail.mit.edu/6.828/2005/readings/pdp11-40.pdf The PDP-11 instruction set is small and elegant.
- Shared404 6y agoFrom the manual: > The PDP-11/40 was designed to fit a broad range of applications, from small stand alone situations ... to large multi-user, multi-task applications requiring up to 124K of addressable memory space. I'm young, and it's crazy to look back and see how far we've come.
- tyingq 6y agoFor some context, the PDP-11/40 debuted in 1973, and was $40k in 1973 dollars which is $233k inflation adjusted for today. There wasn't much available for a "home computer" at the time, but the Kenbak-1 might be a good example for comparison of what one would have cost. It was $750, or $4400 inflation adjusted. It had 256 bytes of memory.
- gjvnq 6y ago> The PDP-11 instruction set is small and elegant. Scared PDP-endianess sounds...
- anthk 6y agoIf you want something still usable nowadays, get Unix Programming Environment, and "The C Programming Languge, 2nd Edition". Both complement each other really well.
- ChrisArchitect 6y agoold url http://cm.bell-labs.com/cm/cs/who/dmr/manintro.html http://cm.bell-labs.com/cm/cs/who/dmr/manintro.html 9 years ago discussion: https://news.ycombinator.com/item?id=3106204 https://news.ycombinator.com/item?id=3106204