home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.pascal
- Path: sparky!uunet!mcsun!sunic!lth.se!efd.lth.se!d92bo
- From: d92bo@efd.lth.se (Bengt Oehman)
- Subject: Re: Raw Data
- Message-ID: <1992Nov11.134914.27768@lth.se>
- Sender: newsuser@lth.se (LTH network news server)
- Reply-To: d92bo@efd.lth.se (Bengt Oehman)
- Organization: Lund Institute of Technology
- References: <05TqTB1w165w@tsoft.sf-bay.org> <1992Nov6.163908.19859@sbcs.sunysb.edu>
- Date: Wed, 11 Nov 1992 13:49:14 GMT
- Lines: 64
-
- In article <1992Nov6.163908.19859@sbcs.sunysb.edu>, clane@csws2.ic.sunysb.edu (Charles F Lane) writes:
- |> In article <05TqTB1w165w@tsoft.sf-bay.org> bbs.playboy@tsoft.sf-bay.org (Tony Yin) writes:
- |> >Hay...I have a problem. Maybe one of you guys can help me out.
- |> >I'm trying to make a "loader" which is just a simple program to
- |> >display a 320x200x256 picture. I have the raw data which is
- |> >64000 big and I want to put it into the code itself so there is
- |> >no need to load from disk. Is there a way to make it a constand
- |> >cuz I haven't yet figured it out.
-
- |> You can use a pre-initialized array:
- |>
- |> program ShowImage;
- |>
- |> const
- |> ImageData = (2,45,2,63,212,2,0,121, .. 138,0,45);
- |> (**** This array^^^^^^ should have (here goes!) _64000_ byte values ****)
- |> (**** That's a LOT of typing! ****)
- |>
-
- That is surely a LOT of typing, will take an awful lot of space in your source
- code, will take a while to compile, and there is also the risk of a typing
- error in the middle of the data, so the picture gets corrupted.
-
- The correct way to handle this is the following:
- At the DOS-prompt, use BINOBJ to convert binary data into a procedure.
- eg.
- "c:\tp>binobj mydata.bin mydata.obj imagedata"
-
- where mydata.bin is your binary picture, mydata.obj is the object file to
- be linked into your program, and imagedata the name of the procedure which
- contains the data.
-
- In your source code, write the following:
-
- (*$L mydata.obj*)
- Procedure ImageData; EXTERNAL;
-
- (* This will link the external binary file into the 'procedure' ImageData.
- DO NOT try to call this procedure, since it is NOT program code! *)
-
-
- |> begin
- |> Move(ImageData, mem[$a000:$0000], 64000);
- |> end.
-
- This will work, with the following modification:
- BEGIN
- Move(@ImageData, Mem [$A000:$0000], 64000);
- END;
-
- Also, if you use binary objects as large as 64K, you will have to place each
- object in a new unit, since the image data shares segment with the procedures
- and functions of the program. If you place this image in your main block
- (the 'Primary file', which contains the main program), the rest of the
- procedures, functions and constants of the program cannot exceed approximately
- 1K in length, and this is NOT very much to play with.
-
- --------------------------
- Bengt Oehman
- d92bo@efd.lth.se
-
- --------------------------
- "If you wanted a cup of cream and sugar, why did you say you wanted
- a cup of coffee?" -- Douglas Adams
-