DAT longs tinto bytes, Would someone smack me?
Oldbitcollector (Jeff)
Posts: 8,091
I've starring at some DAT longs that I need to convert to DAT bytes.
The conversion is on the tip of my fingers, but I can't remember what it should look like.
Could someone write a DAT "BYTES" example of the sample below?
Utimately I'm working on the determination of how this looks as bytes in @tiles, but one step at a time.
Thanks
Jeff
The conversion is on the tip of my fingers, but I can't remember what it should look like.
Could someone write a DAT "BYTES" example of the sample below?
DAT tiles '' name=FONT_0, palette=0 long $000FFF00 long $00F00FF0 long $0FF000FF long $0FF000FF long $0FF000FF long $00FF00F0 long $000FFF00 long $00000000
Utimately I'm working on the determination of how this looks as bytes in @tiles, but one step at a time.
Thanks
Jeff
Comments
Perhaps it's my conversion routines.. back to the drawing board...
-Phil
That explains why my characters are suddenly looking reversed
Ok, here's what I'm doing..
I've got a file I'm opening using FSRW which contains LONG style entries. (000FFF00 might be on a line)
I'm reading the first byte into "b", then the second byte into "c"
Then I'm passing them into this lovely routine.. (I'm sure there is a MUCH MORE elegant way to do this, but my brain thinks like this chunk of code.)
PST has a neat little "StrToBase" object which does this nicely.
I've got mine ultra complex routine working now thanks to you and Phil, but I'll also grab that StrToBase and see if we can do this conversion a little more intelligently than throw rocks at it.
Jeff
Here's my much shorter version.. I'll probably replace it with some decent math after I've had some sleep.
Just a hint. You can use:
The same thing written differently:
Do the same sort of thing with "A".."F".
Using this sort of arrangement you could shorten your case lists down to two groups each.
I know there are many versions of this sort of conversion floating around on the forum.
I was just going to start playing with that challenge after some coffee this morning. I've only downed half a cup and your message makes perfect sense. Your hint was TOO good.
Thanks again!