🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.atari.st
Article #39128

Re: Degas file format (again)

#39128
From: to_stdnet
Date: Wed, 31 May 1989 12:54
89 lines
3742 bytes
From: dal@syntel.UUCP (Dale Schumacher)

> In my original posting I asked for the file format of Degas files.  I
> should have said that I was doing a viewer program for a PC with VGA.
> Knowing that the last 16,000 words is a memory map doesn't help me too
> much.  I need to know how the words translate into pixels.

Ah, what you want is the memory-image to pixel relationship for the ST's
video display.  This varies based on the current graphics mode, although
it always takes 32000 bytes.  I'll describe the format in 8-bit bytes
instead of 16-bit words, since you would have a byte-reversal problem
if you read words on the PC from a file created on the ST.  All modes
define pixels starting in the upper left corner of the screen, proceeding
horizontally along the scanline, wrapping around the right edge to the
next scanline down.

Resolution 2, 640x400x1:

	This uses one bit per pixel, black or white.  It's a simple bitmap.
	The MSB of the first byte represents the upper left pixel.  The
	value of a black pixel (0 or 1) depends on the lowest order bit
	of the value for the blue gun for color number 0 in the palette.
	A zero means 0=black and 1=white, but a one means 0=white 1=black.

Resolution 1, 640x200x2:

	This uses two bits per pixel to select a color number from the
	palette.  Each group of 4 bytes defines 16 pixels.  The LSB of
	each color index is in the first pair of bytes, and the MSB is
	is the second pair of bytes.  Thus the MSB of the first byte is
	the LSB of the color index for the upper left pixel, and the
	MSB of the third byte of the MSB of the color index for the
	same pixel.  In the diagram below, A and B are the LSB and MSB
	of the color index for the upper left pixel.

	[A-------][--------][B-------][--------]
	  byte 0    byte 1    byte 2    byte 3

Example:

	Data:

	[01010101][10101010][11111111][00000000]
	
	Pixels:
	
	0=10, 1=11, 2=10, 3=11, 4=10, 5=11, 6=10, 7=11,
	8=01, 9=00, 10=01, 11=00, 12=01, 13=00, 14=01, 15=00

Resolution 0, 320x200x4:

	This uses four bits per pixel to select a color number from the
	palette.  Each group of 8 bytes defines 16 pixels.  The LSB of
	each color index is in bytes 0 and 1, and the MSB is in bytes
	6 and 7.  Thus the MSB of byte 0 is the LSB of the color index
	for the upper left pixel, and the MSB of byte 6 of the MSB of
	the color index for the same pixel.  In the diagram below,
	A, B, C, and D are the LSB through MSB of the color index for
	the upper left pixel.

	[A-------][--------][B-------][--------]
	  byte 0    byte 1    byte 2    byte 3

	[C-------][--------][D-------][--------]
	  byte 4    byte 5    byte 6    byte 7

Example:

	Data:

	[01010101][01010101][00110011][00110011]
	[00001111][00001111][00000000][11111111]
	
	Pixels:
	
	0=0000, 1=0001, 2=0010, 3=0011, 4=0100, 5=0101, 6=0110, 7=0111,
	8=1000, 9=1001, 10=1010, 11=1011, 12=1100, 13=1101, 14=1110, 15=1111

I hope this clears things up.  There's obviously lots of bit twiddling
to do to get individual pixels, but it's really not that complex.

PS.  MSB=Most Significant Bit, LSB=Least Significant Bit :-)

--
      Dale Schumacher                         399 Beacon Ave.
      (alias: Dalnefre')                      St. Paul, MN  55104-3527
      ...bungia!midgard.mn.org!syntel!dal     United States of America
             "I may be competitive, but I'm never ruthless"
 
Technical Details
Message-ID: <846@stag.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!srcsip!tcnet!pwcs!stag!daemon

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!srcsip!tcnet!pwcs!stag!daemon
From: to_stdnet@stag.UUCP
Newsgroups: comp.sys.atari.st
Subject: Re: Degas file format (again)
Message-ID: <846@stag.UUCP>
Date: 31 May 89 12:54:04 GMT
Sender: daemon@stag.UUCP
Lines: 89