home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / pascal / 6480 < prev    next >
Encoding:
Text File  |  1992-11-11  |  2.9 KB  |  77 lines

  1. Newsgroups: comp.lang.pascal
  2. Path: sparky!uunet!mcsun!sunic!lth.se!efd.lth.se!d92bo
  3. From: d92bo@efd.lth.se (Bengt Oehman)
  4. Subject: Re: Raw Data
  5. Message-ID: <1992Nov11.134914.27768@lth.se>
  6. Sender: newsuser@lth.se (LTH network news server)
  7. Reply-To: d92bo@efd.lth.se (Bengt Oehman)
  8. Organization: Lund Institute of Technology
  9. References: <05TqTB1w165w@tsoft.sf-bay.org> <1992Nov6.163908.19859@sbcs.sunysb.edu>
  10. Date: Wed, 11 Nov 1992 13:49:14 GMT
  11. Lines: 64
  12.  
  13. In article <1992Nov6.163908.19859@sbcs.sunysb.edu>, clane@csws2.ic.sunysb.edu (Charles F Lane) writes:
  14. |> In article <05TqTB1w165w@tsoft.sf-bay.org> bbs.playboy@tsoft.sf-bay.org (Tony Yin) writes:
  15. |> >Hay...I have a problem. Maybe one of you guys can help me out.
  16. |> >I'm trying to make a "loader" which is just a simple program to
  17. |> >display a 320x200x256 picture. I have the raw data which is
  18. |> >64000 big and I want to put it into the code itself so there is
  19. |> >no need to load from disk. Is there a way to make it a constand
  20. |> >cuz I haven't yet figured it out.
  21.  
  22. |> You can use a pre-initialized array:
  23. |> 
  24. |> program ShowImage;
  25. |> 
  26. |> const
  27. |>  ImageData = (2,45,2,63,212,2,0,121, .. 138,0,45);
  28. |> (**** This array^^^^^^ should have (here goes!) _64000_ byte values  ****)
  29. |> (**** That's a LOT of typing!                                        ****)
  30. |> 
  31.  
  32. That is surely a LOT of typing, will take an awful lot of space in your source
  33. code, will take a while to compile, and there is also the risk of a typing
  34. error in the middle of the data, so the picture gets corrupted.
  35.  
  36. The correct way to handle this is the following:
  37. At the DOS-prompt, use BINOBJ to convert binary data into a procedure.
  38. eg.
  39.     "c:\tp>binobj mydata.bin mydata.obj imagedata"
  40.  
  41. where mydata.bin is your binary picture, mydata.obj is the object file to
  42. be linked into your program, and imagedata the name of the procedure which
  43. contains the data.
  44.  
  45. In your source code, write the following:
  46.  
  47. (*$L mydata.obj*)
  48. Procedure ImageData; EXTERNAL;
  49.  
  50. (* This will link the external binary file into the 'procedure' ImageData.
  51.    DO NOT try to call this procedure, since it is NOT program code!        *)
  52.  
  53.  
  54. |> begin
  55. |>  Move(ImageData, mem[$a000:$0000], 64000);
  56. |> end.
  57.  
  58. This will work, with the following modification:
  59.   BEGIN
  60.     Move(@ImageData, Mem [$A000:$0000], 64000);
  61.   END;
  62.  
  63. Also, if you use binary objects as large as 64K, you will have to place each
  64. object in a new unit, since the image data shares segment with the procedures
  65. and functions of the program. If you place this image in your main block
  66. (the 'Primary file', which contains the main program), the rest of the
  67. procedures, functions and constants of the program cannot exceed approximately
  68. 1K in length, and this is NOT very much to play with.
  69.  
  70. --------------------------
  71.     Bengt Oehman
  72.     d92bo@efd.lth.se
  73.  
  74. --------------------------
  75. "If you wanted a cup of cream and sugar, why did you say you wanted
  76.  a cup of coffee?" -- Douglas Adams
  77.