[futurebasic] Re: [FB] Huh?

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : January 2002 : Group Archive : Group : All Groups

From: Jay <jktr@...>
Date: Fri, 4 Jan 02 11:52:21 -0600
>> However, if this is really BCD, then the first byte holds a mantissa and
>> an exponent, but no digits, so it may be the 2nd half of the second byte
>> and the 1st half of the 3rd byte that you really want to get to.
>> 
>> e-e
>> =J= a  y
>
>And in english this means ?
>
I'm assuming you have a 4-byte BCD variable that you want to extract 
individual digits from. The way you have set it up, it appears you are 
expecting the first digit to appear in the first byte:
>> BEGIN RECORD NumVersion
>> DIM majorRev AS UInt8/*1st part of version number in BCD*/

My understanding of BCD indicates the first byte will tell you only the 
sign and what power of 10 (the exponent) to multiply the following digits 
by. That means you may need to rearrange your record something like this:

BEGIN RECORD NumVersion
DIM exponent as UInt8          // You don't need to access this
DIM majorAndMinorRev AS UInt8 // First 2 digits
DIM BugRevAndStage AS UInt8  // Next 2 digits
DIM NonRelAndXtra AS UInt8 // 1-digit stage code & non-released version
END RECORD


Then:
Major  = NumVersVar.majorAndMinorRev >> 4
minor  = NumVersVar.majorAndMinorRev AND 15
BugRev = BugRevAndStage >> 4
Stage  = BugRevAndStage AND 15
NonRel = NonRelAndXtra >> 4

If your NumVersion number is 123456 then digits 1 & 2 will be in the 
second byte, meaning this is Major revision 1, minor revision 2, etc. Let 
me know if this is making any sense.

 e-e
 =J= a  y
  "