Meaning of unsigned char

C

Chris Dollin

(Increasingly off-topic, so this is the last post I'll
make in this thread about PDP-11s.)

Ancient_Hacker said:
IIRC ALL the two-operand instructions had a bit that controlled whether
the instruction worked on words or bytes. So you had not only MOVB,
but ADDB, SUBB, XORB, CLRB, BISB, BICB, ROLB, etc.... all of which
operated on bytes, in memory or in the lower byte of a register.

That's not how I remembered it, so I checked, and neither of us is
completely wrong ...

Not /all/ the two-operand instructions had byte forms; in particular,
ADD and SUB and MUL and DIV didn't. (I learned PDP-11 assembler on
a machine with no MUL and DIV, in fact, and no XOR either I think.)

So arithmetic on bytes had to be done by putting them into words
(typically, but I suppose not necessarily, registers - there was of
course the stack to hand), and if you used MOVB, it sign-extended.

Except - INC and DEC had -B forms, so adding/subtracting 1 to a char
variable /could/ be done with INCB and DECB. But if that was part of
a conditional -- eg `if (++byte == 128)` -- then the code would have
to go the long way round anyway.
I
guess the reason I misspoke about "byte registers" is that the handy
little pocket-guide to PDP-11 instructions has the registers
partitioned in half. And they certainly behave as 8-bit registers if
you set that bit.

It's an interesting compromise behaviour, since if you do a (non-MOV)
byte operation on a register with bits set in the top byte it (apparently;
I didn't remember this, but bits of the web apparently do) leaves those
bits alone.
You're also correct in that there was no separate "unsigned arithmetic"
mode per se, you just had to interpret the sign and overflow states
differently when using unsigned numbers. This became a really big
deal once folks could afford more than 32K of memory-- I remember a lot
of address comparisons broke once addresses could go "negative".

Yeah. BHI not BGT, etc ...

.... which I wasn't thinking of as "something special", but clearly it
is.

So you're "unsigned arithmetic" is my "unsigned comparison", and I
think we can be reconciled.
 
G

gw7rib

Frederick said:
As an aside, I wasn't aware that my use of "retardation" would cause such a
flurry. If the group would rather that I not use it in such a context, I'll
gladly oblige.

Since you ask, I would rather that you did not use such terms, please.

Paul.
 
K

Keith Thompson

Since you ask, I would rather that you did not use such terms, please.

As would I.

And if you'd care to apologize to me personally for accusing me of
fascism, that would be a welcome gesture.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,242
Latest member
KendrickKo

Latest Threads

Top