Re: [Tutor] Bit-level field extraction

2006-05-17 Thread Alan Gauld
> But at least I got to use punched cards. I forget what the other > system > we had in that room was, but I had to use paper tape on that one. I've never actually used punch cards. But I have used punch tape. Where a loop really was a loop! :-) We used them to transmit source code from our pun

Re: [Tutor] Bit-level field extraction

2006-05-17 Thread Terry Carroll
On Tue, 16 May 2006, Alan Gauld wrote: > Hah, if you haven't bootstrapped a VAX using the toggle switches on > the front panel you ain't a real progammer ;-) Not with a VAX, but I had to do that with a TI-980, long, long ago! And once I had it booted, because the assembler was a pretty primitiv

Re: [Tutor] Bit-level field extraction

2006-05-17 Thread Bob Gailer
S W Collier wrote: > You chaps are making me nostalgic; days of the 8080A/Z80/F8/6800 when > I built my first computer. In those days 2K of memory was considered > large for a personal computer. > In 1975 Boeing Computer Services proudly announced the addition of 4 megabytes of memory to one o

Re: [Tutor] Bit-level field extraction

2006-05-17 Thread S W Collier
On Tuesday 16 May 2006 22:41, Alan Gauld wrote: > > Heh, you and me both. I cut my teeth on IBM System/370 > > assembler. Last > > time I had a job where I actually did programming as part of it, > > it was > > System/390 machine code. That's right, machine code, not > > assembler; I'd > > direct

Re: [Tutor] Bit-level field extraction

2006-05-16 Thread Alan Gauld
>> VMASK = 0x14 # 00011000 > > Whoops, a typo I think. VMASK = 0x18 #00011000 > orVMASK = 0x14 #00010100 A typo is being kind. A mistake in reality, that's what happens when I don't have a Python session handy! :-) Fortunately Terry knew what I meant. Alan G.

Re: [Tutor] Bit-level field extraction

2006-05-16 Thread Alan Gauld
> Heh, you and me both. I cut my teeth on IBM System/370 assembler. > Last > time I had a job where I actually did programming as part of it, it > was > System/390 machine code. That's right, machine code, not assembler; > I'd > directly type my hexadecimal programs into low storage at the >

Re: [Tutor] Bit-level field extraction

2006-05-16 Thread S W Collier
On Tuesday 16 May 2006 16:01, Alan Gauld wrote: > Terry, > > Your approach is fine. Personally however I'd just have defined > some constants and done a direct bitwise and - this is the > approach used in the stat module: > > VMASK = 0x14 # 00011000 > VER00 = 0x00 > VER01 = 0x04 > VER10 = 0x10 > V

Re: [Tutor] Bit-level field extraction

2006-05-16 Thread Terry Carroll
On Tue, 16 May 2006, Kent Johnson wrote: > You might be interested in Construct, it aims to make it easy to parse > and create structures based on bit fields: > http://pyconstruct.wikispaces.com/ Thanks, I'll have a look at it. ___ Tutor maillist -

Re: [Tutor] Bit-level field extraction

2006-05-16 Thread Terry Carroll
On Tue, 16 May 2006, Alan Gauld wrote: > Your approach is fine. Personally however I'd just have defined > some constants and done a direct bitwise and - this is the > approach used in the stat module: > > VMASK = 0x14 # 00011000 > VER00 = 0x00 > VER01 = 0x04 > VER10 = 0x10 > VER11 = 0x14 > > v

Re: [Tutor] Bit-level field extraction

2006-05-16 Thread Alan Gauld
ry Carroll" <[EMAIL PROTECTED]> To: Sent: Tuesday, May 16, 2006 6:25 AM Subject: [Tutor] Bit-level field extraction >I want to see if I'm reinventing a wheel here, or maybe doing it > unpythonically. > > I need to extract from a byte (i.e., a one-character string) a field

Re: [Tutor] Bit-level field extraction

2006-05-16 Thread Kent Johnson
Terry Carroll wrote: > I want to see if I'm reinventing a wheel here, or maybe doing it > unpythonically. > > I need to extract from a byte (i.e., a one-character string) a field of an > certain number of bits. For example, a certain byte of an MP3 frame > header has the format xxxVVxxx, where t

[Tutor] Bit-level field extraction

2006-05-15 Thread Terry Carroll
I want to see if I'm reinventing a wheel here, or maybe doing it unpythonically. I need to extract from a byte (i.e., a one-character string) a field of an certain number of bits. For example, a certain byte of an MP3 frame header has the format xxxVVxxx, where the value of VV (00, 01, 10 or 11)