Hacker News new | ask | show | jobs
by zh3 1105 days ago
RT-11 on the PDP-11 (all in PDP-11 assembler). Back in the early 80's you could rebuild it in several different ways, depending on whether you wanted it "single job" (as it was back then) or not.

As an example, here's the PDP-11 assembler to convert a binary number to decimal ASCII (no idea who wrote it, but they certainly made every word count):-

  CNV10:  MOV     R0,-(SP)     ;Subroutine to convert Binary # in R0
  1$:     CLR     R0           ;to Decimal ASCII by repetitive
          INC     R0           ;subtraction. The remainder for each
  2$:     SUB     #10.,@SP     ;radix is made into ASCII and pushed
          BGE     1$           ;on the stack, then the routine calls
          ADD     #72,@SP      ;itself. The code at 2$ pops the ASCII
          DEC     R0           ;digits off the stack and into the out-
          BEQ     2$           ;put buffer, eventually returning to
          CALL    CNV10        ;the calling program. This is a VERY
          MOVB    (SP)+,(R1)+  ;useful routine, is short and is
          RETURN               ;memory efficient.
Courtesy bitsavers.org (http://www.bitsavers.org/pdf/dec/pdp11/rt11/v5.6_Aug91/AA-PD...)