Kumar Balachandran <kumar*xspam*@*xspam*rtp.ericsson.se> wrote:
+---------------
| (Was it IBM where "byte" was never supposed to be used without the number
| of bits).
+---------------
<NOSTALGIA>
You're probably thinking of the DEC PDP-10, where a "byte" could be
(dynamically) *any* width between 1 & 36 bits, and writing programs
required using (at least) two different character sets, 7-bit ASCII
(packed 5 to a word) for text files & terminal I/O and a 6-bit character
set (packed 6 to a word) for communicating filenames to the operating
system.
Look at Common Lisp's "LDB" and "DPB" library routines. Nearly *exactly*
those functions existed as single PDP-10 instructions of the same name.
E.g., here's some code to convert a filename in null-terminated 7-bit
ASCII (a.k.a. "ASCIZ") to SIXBIT [leaving out all the error checking
for name-too-long and illegal-SIXBIT-char]. My apologies if this isn't
exactly correct MACRO-10 syntax; it's been quite a while...
; Call with a0 := either a conventionally pre-decremented byte-pointer
; to an ASCIZ string or a word address; returns v0 := SIXBIT equiv.
; Caveats: No error checking. Modifies a0.
a2six: movei v0, 0 ; initialize result
move t0, [xwd 440600,v0] ;and a pointer to it
tlne a0,-1 ; pointer bits already set in arg?
hrli a0, 440700 ; no, point to non-existent prev. byte
a2six0: ildb t1, a0 ; get next (or first) byte
skipne t1 ; null?
popj p, 0 ; yup, return.
trc t1, 40 ; complement (what will be) the MSB
idpb t1, t0 ; insert into result [in *v0*!]
jrst a2six0 ; and loop
</NOSTALGIA>
-Rob
-----
Rob Warnock, 7L-551 rpw3@sgi.com http://reality.sgi.com/rpw3/
Silicon Graphics, Inc. Phone: 650-933-1673
2011 N. Shoreline Blvd. FAX: 650-933-4392
Mountain View, CA 94043 PP-ASEL-IA