[futurebasic] Re: Mac Number conversion (LSB/MSB)

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 1997 : Group Archive : Group : All Groups

From: tatewake@... (Terence Jordan)
Date: Mon, 8 Dec 1997 18:10:31 -0400
>I just bet someone has a real fast efficient way of turing those digits
>around (they are in binary in the file). If I was still in Z80, I'd do a
>rotate thru the carry. I'm not.

Here's what I've been using:
  DWORDexitval& = (ASC(MID$(ldwdata$,4,1))*256^4)
  DWORDexitval& = DWORDexitval&+(ASC(MID$(ldwdata$,3,1))*256^2)
  DWORDexitval& = DWORDexitval&+(ASC(MID$(ldwdata$,2,1))*256)
  DWORDexitval& = DWORDexitval&+ASC(MID$(ldwdata$,1,1))

of course, you need to read in a 4 character string into ldwdata$

It's been a while since I've used this; but it works like a charm.

It won't compile into a DCOD because of the multiplication statements(and
the power raising statements. I think eventually the numbers become too big
or something.) Weird, eh?

As I recall, you need to subtract &HFFFF from the end result to get a LONG
value.

Good luck...



-- Terence Jordan (tatewake@...)
Inspired Software. http://inspired.netstreet.net/
Macintosh, Dos, Windows, and BeOS software solutions.
Phone: 407-728-7563
............................................
. New: Renegade Space Ninja for Macintosh! .
.      Visit our page for more info.       .
............................................