<nallen05@gmail.com> wrote:
+---------------
| On Mar 10, 3:14 am, rpw3@rpw3.org (Rob Warnock) wrote:
| > As an ex-*PDP-10*[1] assembler programmer, ;-}
| > I'd probably go for this: ...
| > (defun pack (b01 b234 b5678)
| > (dpb b5678 (byte 5 5)
| > (dpb b234 (byte 3 2)
| > b01)))
...
| > Or the more-imperative equivalent:
| > (defun pack (b01 b234 b5678)
| > (setf (ldb (byte 3 2) b01) b234)
| > (setf (ldb (byte 5 5) b01) b5678)
| > b01)
...
| > [1] See CLHS LBD & DPB:
| > Historically, the name ``ldb'' comes from a DEC PDP-10
| > assembly language instruction meaning ``load byte.''
| > Historically, the name ``dpb'' comes from a DEC PDP-10
| > assembly language instruction meaning ``deposit byte.''
|
| OMG what does any of this goat barf mean? ;-) I guess I've got some
| reading to do...
+---------------
A good quick reference on PDP-10 byte stuff is here:
http://pdp10.nocrew.org/docs/instruction-set/Byte.html
Byte instructions
In the PDP-10 a "byte" is some number of contiguous bits within
one word. A byte pointer is a quantity (which occupies a whole
word) which describes the location of a byte. There are three
parts to the description of a byte: the word (i.e., address) in
which the byte occurs, the position of the byte within the word,
and the length of the byte.
A byte pointer has the following format: ...
The Common Lisp LDB & DPB functions [together with BYTE, which
makes byte specifiers, though reversing the order of P & S]
were modelled on the PDP-10 byte instructions, though providing
a functional interface rather than a purely imperative one.
Very useful for low-level bit-banging of hardware registers
and protocol blocks...
-Rob
-----
Rob Warnock <rpw3@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607