image from file to print in command prompt

Started by frankeinstein, August 19, 2011, 08:40:45 PM

Previous topic - Next topic

frankeinstein

hello there,

i am currently taking a class in assembly programming and fortunately we are making a game as a project requirement for the course.

don't worry, what i'll be asking is not the game itself. i just want to ask how can i print an image from file to command prompt?

i read something about plotting pixels but what i want to rpint is not from the .asm file but from that image file..

is there a way about this?

and also, my laptop says that my system didn't support video mode so i can't use the 13h function. but i was able to run it in DosBox.

is it enough?


thanks for reading... and answering of course.

hope i can make a way through this..  :U

MichaelW

What type of image file, and what do you mean by "print"?
eschew obfuscation

jj2007

Printing pixels under DOS is not an easy task. Google for Allegro putpixel()

FORTRANS

Hi,

   Normally you convert an image format to a printer control
language and send that to the printer.  If you meant "print" to
the display screen from your program, then you have to decode
the image and write, pixel by pixel, to the video card memory.

Regards,

Steve N.

frankeinstein

my meaning of print is to display on the screen..

may be i change my mind on having my hero character and villain (for the game) to be on image files and just load it on screen...

it is just that i have no idea yet about how to store the elements of the game..

do you know ways how people make their games?


FORTRANS

Hi,

   The easiest way to start might be to load files for images.
Storing the image in your program makes it a bit more work to
update things.  And it increases the size of your program.

   The advantage to putting the image into the data part of
your program is that you can have it decoded and ready to
display.

   People have done either or both in their programs.  It is up
to you to decide what is best for your program.

Regards,

Steve N.

dedndave

unless your instructor requires that you use 16-bit code, switching to 32-bit would make things easier
it is somewhat difficult to set up and use high-res, high-color video modes
also, the win32 API gives you built-in functions to decode most image types
for example, if you are working with JPEG's, writing a 16-bit JPEG decoder is a nightmare

it isn't so bad in 32-bit
if you have the masm32 package installed, have a look at
\masm32\examples\exampl07\car

FORTRANS

Quote from: dedndave on August 20, 2011, 01:25:01 PM
it is somewhat difficult to set up and use high-res, high-color video modes
[...]
for example, if you are working with JPEG's, writing a 16-bit JPEG decoder is a nightmare

Hi Dave,

   Set up is not bad with a VESA BIOS.  Use can be a bit
of bookkeeping archana to get around the 64k segment limit.

   But you did remind me of something.  Stefan Peichl wrote
LxPic to display pictures on many different systems.  I started
to use it because it is useful on my HP 200LX.  It decodes JPEG's
better than most on that platform.

Quoting from the LxPic documentation:

"LxPic is a very small, powerful and fast DOS picture viewer.
It has just 20 KB code and runs in 64 KB of memory on any 8086
compatible computer. It supports all display modes from early
CGA up to the latest 2048x1536 QXGA True Color (32bit) screens."

   And for writing your own programs:

"LxPic has an interface to use it as a 'subroutine' in other
programs. See PROGRAMMERS INTERFACE section of this document-
ation for further information."

DOS Palmtop Freeware

Cheers,

Steve N.