Theiling Online    Sitemap    Conlang Mailing List HQ   

Polysemy in programming langs

From:Mark J. Reed <markjreed@...>
Date:Monday, April 19, 2004, 12:00
Ph.D> As I recall, the shift was always one bit, but you could
Ph.D> specify shifting only the AC or the AC and "link" bit as
Ph.D> a unit.

JWC> Nope, not the PDP-8.  The assembler mnemonics were RAL/RAR (rotate AC
JWC> and link left/right) and RTL/RTR (rotate AC and link twice left/right).

Ph. D may be thinking of other small computers of the era.  For
instance, on the MOS 6502 chip (the brains of the Apple ][, Commodore
and Atari 8-bit computers, and many 1980s stand-up video games), you had
a choice of "Shift" operations (ASL/LSR), which shifted into but not out
of the "link" (the processor status register's carry bit), and
"Rotate" operations (ROL/ROR), which used the link both ways.  So the
correct sequence for a four-byte shift was ASL, ROL, ROL, ROL.

Joe>  How do you logically AND one memory location?  AND adjacent bits? (ie.
Joe> 10111010 > (0)001100)

No, no.  Not unless you're programming in INTERCAL, which is full of
"unary binary" ops that operate on an argument and the 1-bit-shifted version
of the same argument. :)

JWC> No, the AND instruction always used the AC as one of the operands, the
JWC> referenced memory instruction as the other, and put the result in the AC.

More generally, on accumulator-architecture machines, the accumulator is
an implied argument and destination of *all* binary operations.
Accumulatorish for "C <- A + B" is

        LOAD    A               ; copy A's contents into the accumulator
        ADD     B               ; add B's contents to the accumulator
        STORE   C               ; copy the accumulator's contents into C

-Mark

Reply

Ph. D. <phild@...>