On Thu, 16 Feb 95 09:35:00 PST, Doore, Dan [MIS] said:
>  > Perhaps it would be better to do the conversion
> > on the PC end.  What with Photoshop handy, the
> > image could be scaled and converted

> This I do, I use Paint Shop Pro to crop& dither the images,
> a handy palette file of Sam greyscales but the palette still
> gets screwed on conversion, even when I replace the palette
> with greys, it still looks wierd.

I have digitised some images for the Sam, and the process is not pretty!  I
am using a Sun workstation (as everyone should know by now :-) ) and I can
therefore write the file on a Sam disk directly when it is finished.  The
process goes something like...

 1. Use "xv" to scale the image down to fit on the Sam screen.  Note
    that the x-axis has to be reduced by a factor of 1.25 compared to the
    y-axis in order to make the image look OK on a Sam (why on earth did
    they do this - the Spectrum has square pixels but the Sam does not!).
    Also use xv to make the image brighter/darker/whatever if necessary.

 2. Use "PBMPlus" to dither the image.  Now there is a program in this
    toolkit called ppmquant which can either: (a) choose N colours and
    dither the image to those, or (b) dither the image using a specified
    set of colours.  However it can not (c) choose the best N colours
    from a specified set of colours.  So I have to do one followed by the
    other: first dither the image using all 128 Sam colours, then choose
    16 of them.  Unfortunately, the result still isn't coloured with Sam
    colours, and it has been dithered twice.  So I optionally adjust the
    set of colours, and then use the colourmap of the final image to dither
    the original image into a new image (with me so far?...).

 3. I have a RYO program that transforms the image so created into a mode 4
    Sam image.  If the colours are slightly out, the program chooses the
    nearest ones.

It is slightly easier to create a greyscale image.  14 shades of grey can
make a quite respectable image.  I use PBMPlus to change the image into a
greyscale, then dither the image in 14 selected shades of grey.  My program
for transforming an image into a mode 4 Sam picture can automatically adjust
the chosen shades into the "blue-grey" colourscale that the Sam uses.

> > How many simultaneous colors can the SAM display
> > in what graphic modes (the FAQ is not very
> > explicit save the 512x192 mode)?  Can all 128
> > be used?

OK, well...

The Sam has a 128-colour palette.  The bits of the palette are:

      6    5    4    3    2    1    0
   +----+----+----+----+----+----+----+
   | G1 | R1 | B1 | br | G0 | R0 | B0 |
   +----+----+----+----+----+----+----+

where: R, G and B represent colour levels in two bits, with bit 1 being the
       more significant.

       br represents "brightness", which is an extra "half a bit" added to
       each of R, G and B.

The display hardware contains a 16-element colour look-up table (CLUT)
which translates bit values obtained from the display into RGB levels
written in the above format.  Any register of the CLUT may be changed
at any time.  The usual maximum of colours on the screen is therefore
16, but it is possible, by arranging a program to change CLUT registers
at appropriate times during the TV scan, to display a picture with more
colours on screen at once.  The Sam provides a line interrupt which may
be used for this purpose; it triggers at the start of a selected TV scan
line (and can then be changed to trigger at further scan lines in the same
frame).  Changing CLUT registers at line interrupts is supported by Sam
BASIC.  (Btw has anyone noticed that the Sam ROM does not take any notice
of the line interrupt vector?).

I have seen a program which displays pictures with more than 16 colours by
changing the palette in this way, but I have no idea how the pictures were
created to take advantage of this.

Each pixel is recorded as a 4-bit value in mode 4, with the 192 lines of
256 pixels being written in sequence.  Mode 3 is similar except that it
has 512 2-bit pixels on each line, so a mode 3 screen usually contains
only 4 colours.  In modes 1 and 2 the screen is stored in two parts: a
256x192 bitmap and an attribute map.  The attribute map contains for each
"cell" on the screen two 3-bit values giving the interpretations of the
0-bits and the 1-bits which appear in that cell in the bitmap.  It also
contains a "bright" bit which, if set, causes 8 to be added to both 3-bit
values, and a "flash" bit which, if set, causes the two colour values to
be exchanged approximately twice per second [I'm not sure whether there
is a "flash" in mode 2 - anyone?].  In mode 1 the cells are 8x8 pixels,
while in mode 2 the cells are 8x1 pixels.  The attributes are always
recorded in sequence, and in mode 2, so is the bitmap.  In mode 1, the
bitmap is recorded in "Spectrum" order, which is rather complicated.

That any use to you?...

imc

Reply via email to