Another amazing find by @larsbrinkhoff is this #LAP6 source code printout: https://bitsavers.org/pdf/washingtonUniversity/linc/LAP6_Manuscript_Listings_May67.pdf

It was good to see probably the most hardcore #LINC program out there in its original source form. But looking into this we found an oddity that uncovered some ingenious #RealProgrammer tricks that Mary Allen Wilkes used in her code.

Take a look at the attached screenshot here. This is a section from the `MSDISPLY.M` "manuscript" (text/source code) file for the main LAP6 editor. The first column is the memory location (in octal), second column is the octal value for the instruction line, and to the right of that is the source code in LINC assembly.

The code is full of subroutines, which make use of the fact that the first 16 memory locations are treated as a sort of register file, and the `JMP` instruction stores a return pointer in "register" 0 so that a `JMP 0` is basically `RET`. The only mnemonics that are in this code are `JMP`, `LDA`, `SAE`, and `XSK`.

`LDA i` loads the next word in the code into the accumulator, `SAE i` skips an instruction if the accumulator is equal to the next word in the code, and `XSK i 0` checks to see if the address in register 0 has overflowed somehow. The details of this subroutine are less interesting than all of the other lines.

Some of the lines have text like `BIGGEST BLOCK USED IN WA` and `MAXIMUM LN`, which the assembler has assigned the value `0000`, presumably because they are invalid instructions in LAP6 assembly. I guess that's a neat trick: bad memonics can make a handy self-documenting null value!

But take a look at line `524`:

```
524 0011 CURRENT LN
```

That's a bit of a novelty. How did `CURRENT LN` assemble to the value `0011` (9, decimal)?

Well remember that Mary Allen Wilkes had a strong hand on the LINC ISA: she wrote the emulator that could run LINC code before the hardware was anywhere near functional. She also wrote the assembler for this ISA on that emulator. She had direct control of both parts of this chain, and so she made it so that the LINC Assembly Program only checked two letters to see if it was a valid mnemonic: the middle letter was ignored for uniqueness!

So the word `CURRENT` basically matched the regex `^C.R`, and the assembler put the instruction for the `CLR` mnemonic, which is `0011`! (Incidentally this clears the accumulator when run as an opcode rather than an operand).

I'm still not sure how it picked the values. Somehow at one point she uses the text `TAPE INSTR` to match the `SCR` instruction (`0340` if you're curious). So my regex above wasn't the only way it could match mnemonics.

But now that I know that only the first and third letters are unique in combination, the whole instruction set begins to make more sense to me.

#RetroComputing #MaryAllenWilkes

Hey #RetroComputing folks! I'm running #LAP6 on @larsbrinkhoff's #LINC emulator! #VintageComputing #PDP12