Brad Parker wrote:
An obscure unibus & pdp-11 question:
Does "clr" always do a DATIP (i.e. read-modify-write) on all 11's?
It does on my 11/44. Something tells me I've seen threads (long ago) on
this and the perils of using clr as opposed to "mov #0," when talking to
hardware.
The rl01 bootstrap does it talking to rl11 registers, which tripped me
up for a bit.
-brad
On all the discrete logic 11s and LSI11 the CLR instr does a
DATI(P)/DATO sequence. This was done so that only one decode flow was
necessary for the single operand instructions that modified the
destination (ie, CLR/COM/INC/DEC/NEG/ROR/ROL/ASR/ASL/SWAB/ADC/SBC/SXT).
TST is a specical case, read source but don't write. CLR is the only
instruction that technically does not need to read the source operand,
but they did the read anyway and just ignored the value.
According to the PDP-11 CPU handbooks, the J-11 based designs did the
extra optimization so a CLR does not do the read, only the write cycle
(see item #36 in later handbooks).
So if your hardware can't tolerate a read access to a register, then you
can do a MOV #0,ADR instead of CLR ADR (and make a note in your code why
so some poor soul 30 years from now understands why you are doing a
non-optimal MOV #0,xxx!)
Don