Re: A92: About Bin files.


[Prev][Next][Index][Thread]

Re: A92: About Bin files.




>It's me again.
>Thanx for all the answers, but Aaron can you tell me how can I create these
>Bin files. ( Mathieu Lacage told me a way to do this but for a Cosinus
>table).
>I mean for example, if I want to store some graphics in it ?


The actual creation of the binary file can be done several ways.
Since you are wanting a graphical solution, a GUI interface would
be the best choice.  Although you could as easily write a program
to convert a known graphical format to your binary file.  Here
is a bitmap with a mask done in assembler:

MyBitmap:
  dc.w        %0000000000000000, %0000001111000000
  dc.w        %0000001111000000, %0000111111110000
  dc.w        %0000111111110000, %0001111111111000
  dc.w        %0001111111111000, %0011111111111100
  dc.w        %0011100110011100, %0111111111111110
  dc.w        %0011100110011100, %0111111111111110
  dc.w        %0111111111111110, %1111111111111111
  dc.w        %0111111111111110, %1111111111111111
  dc.w        %0110011111100110, %1111111111111111
  dc.w        %0110001111000110, %1111111111111111
  dc.w        %0011100000011100, %0111111111111110
  dc.w        %0011110000111100, %0111111111111110
  dc.w        %0001111111111000, %0011111111111100
  dc.w        %0000111111110000, %0001111111111000
  dc.w        %0000001111000000, %0000111111110000
  dc.w        %0000000000000000, %0000001111000000

The binary file that would replace this would be the exact same
data.  Use whatever language you prefer and use the file output
functions.  BE CAREFUL WHEN OUTPUTTING DATA!  Intel systems use
a different ENDIAN than the Motorola 68000.  (I can't remember
which is BIG and which is LITTLE)  Suffice to say, here is an
example of the difference:

Motorola 68000... LONG:   LL LH HL HH

0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 1 2 3 4 5 6 7 8 9 a b c d e f 0 1 2 3 4 5 6 7 8 9 a b c d e f

Intel ... LONG:           HH HL LH LL

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
8 9 a b c d e f 0 1 2 3 4 5 6 7 8 9 a b c d e f 0 1 2 3 4 5 6 7

As you can see, this creates some interesting problems.  Most
of these problems can be fixed by outputting BYTES.  A byte is
stored the same on both systems (bits ordered 0 to 7, L to R).
But if you want to write a WORD or LONG to the file, you have
to use your own function because Intel will mess with the
High/Low arrangement.

That's all you need to worry about.  Here are the basic steps
you need to follow when using the binary file:

* Identify format:  It is essential that you know the format
of the binary data.  For graphics, you need to know what the
renderer needs.  Like in the example above, I was assuming
that the renderer takes two WORDS, a BITMAP and a MASK.  This
wouldn't work if you used another renderer.

* Storage format:  You may elect to use compression of some
fashion.  Just make sure that the original data is in the
proper format, and that the compressed data can be properly
uncompressed such that the original data is intact.

That's all folks!
====
Aaron Hill (Redmond, WA)
E-mail: SeracOhw24@msn.com
IRC Nick: SeracOhw (EF-Net)