Jump to content
IGNORED

Atari 2600 color codes - HELP! ;)


lazzeri

Recommended Posts

Gentlemen!

 

I'm currently working on a tiny project called AHD - Atari Hacking for Dummies. It is a hacking tool / sprite editor for A2600 that allows sprited editing with a easy-to-use, dumb-proof interface. Detais can be found on the "Hacks" forum.

 

Anyway, i've just finished the routine that allows color changing on some sprites. I mean, with that you'll be able to change individual color of the sprite's line (in some selected sprites only, unfortunately).

 

The problem is that for practical reasons i'm willing to limitate the pallete that can be used by the user for a standard 16 color pallete. And i need some help with the hex codes for some colors :D

 

I still got 3 color with no match, one that do not seems appropriate and a few others that i would like your opinion.

 

With that in mind i've builded the following table:

 

Black &0

Dark Blue &a6

Dark Green &d6

Dark Cyan ???? HELP! :)

Dark Red &46

Violet &36

Brown &12

Light Gray &6 - SEEMS TOO DARK :ponder:

Dark Gray ???? HELP! :)

Light Blue &88

Light Green &c8

Light Cyan ???? HELP! :)

Light Red &48

Pink &5a

Yellow &1e

White &e

 

What do you fine gentlemen think of that colour selection?

 

Thanks in advance, regards,

Lazzeri

Link to comment
Share on other sites

Hi there!

 

The problem is that for practical reasons i'm willing to limitate the pallete that can be used by the user for a standard 16 color pallete.  And i need some help with the hex codes for some colors :D

 

Unless you're programming the tool for windows 3.11, why not use the full palettes and make it even switchable between PAL/NTSC/SECAM?

 

You can download the z26 sources from http://www.whimsey.com/z26/z26.html and you'll find all info you'd need in the file palette.c

 

Greetings,

Manuel

Link to comment
Share on other sites

Unless you're programming the tool for windows 3.11, why not use the full palettes and make it even switchable between PAL/NTSC/SECAM?

Probably because he is using an old DOS based (BASIC?) compiler. Maybe there aren't any libraries that support 256 or more colors.

Link to comment
Share on other sites

:idea: You should check [stella], e.g. here!

 

Wow, you just saved me... :)

 

I've already seen that particular table elsewere but this time it have both hex and RGB info so i guess now i'll be able to finish the job... Thanks Thomas!

 

Regards,

Lazzeri

Link to comment
Share on other sites

Unless you're programming the tool for windows 3.11, why not use the full palettes and make it even switchable between PAL/NTSC/SECAM?

 

Actually Thomas got it right: It is DOS based...

 

I can easily (using RGB) program all the 128 colors Stella can generate, and even display them on a low-res screen (320x200).

Problem is that i do use hi-res screen (640x480) and i'm stuck with the 16 simultaneous colour limitation...

 

I could even use 2 separate display modes, but i'll have to use one with full palette (color change) and one with reduced (sprites display / anim / edition), and the colours wouldn't match. So it do NOT seem viable to use a wider palette...

 

Sh*t... :x

 

Greetings,

  Manuel

 

Thanks,

Lazzeri

Link to comment
Share on other sites

Unless you're programming the tool for windows 3.11, why not use the full palettes (...)

Probably because he is using an old DOS based (BASIC?) compiler. Maybe there aren't any libraries that support 256 or more colors.

 

As i've stated on AHD forum, i'm not a real programmer... :lolblue:

 

Seriously: I'm stuck with the 16 colour pallete on 640 x 480, and if my aim is to use 256 colours i'll have to reduce resolution to 320 x 480 (impossible) OR use a dual-pallete system...

 

I don't thing it would be of any use... Anyway, i guess i still have lots to thing about...

 

Thanks again Thomas,

Lazzeri

Link to comment
Share on other sites

I can easily (using RGB) program all the 128 colors Stella can generate, and even display them on a low-res screen (320x200).  

Problem is that i do use hi-res screen (640x480) and i'm stuck with the 16 simultaneous colour limitation...

What compiler are you using? Maybe there are extensions availably (using VESA) that add more graphic modes. You should try googleing for them.

Link to comment
Share on other sites

Actually Thomas got it right: It is DOS based...

 

I can easily (using RGB) program all the 128 colors Stella can generate, and even display them on a low-res screen (320x200).

Problem is that i do use hi-res screen (640x480) and i'm stuck with the 16 simultaneous colour limitation...

 

I'm not sure which Basic you are using, but you can use the higher VESA modes in QuickBasic or QuickBasic Extended (QB 4, PDS 7.00, or VB-DOS) by calling various BIOS interrupts. There isn't a SCREEN command, but I've written replacements for SCREEN, POINT, LINE and a combo LOCATE/PRINT. Mouse stuff should work fine too. I also have the original C version I wrote if you want it.

 

calamari

 

'Graphics and line drawing routines

'Copyright (C) 2002, 2003 by Jeffry Johnston.

'Released under the GPL.  See license.txt for details

'Ported to QuickBasic from my original C source, 2003



'To load this program:

'In QBX: QBX GRAPHICS.BAS /L QBX

'In QB, it will be something like: QB GRAPHICS.BAS /L QB



DEFINT A-Z

DECLARE SUB graphicsMode ()

DECLARE SUB drawLine (X1, Y1, X2, Y2, COLR)

DECLARE SUB drawPoint (X, Y, COLR)

DECLARE SUB drawText (Y, X, S$, COLR)

DECLARE SUB textMode ()

TYPE RegType 'for CALL INTERRUPT

 ax    AS INTEGER

 bx    AS INTEGER

 cx    AS INTEGER

 dx    AS INTEGER

 bp    AS INTEGER

 si    AS INTEGER

 di    AS INTEGER

 flags AS INTEGER

END TYPE

DECLARE SUB Interrupt (intnum AS INTEGER, inregs AS RegType, outregs AS RegType)

COMMON SHARED BANKOLD



'switch to graphics mode

CALL graphicsMode



'draw some lines

FOR Y = 344 TO 599: CALL drawLine(0, Y, 799, Y, Y MOD 256): NEXT Y

FOR Y = 0 TO 9: CALL drawLine(0, 100 + 10 * Y, 799, 100 + 11 * Y, 15): NEXT Y

CALL drawLine(0, 0, 799, 599, 1)

CALL drawLine(799, 0, 0, 599, 2)

CALL drawLine(0, 0, 0, 599, 3)

CALL drawLine(0, 599, 799, 599, 4)

CALL drawLine(799, 599, 799, 0, 5)

CALL drawLine(799, 0, 0, 0, 6)



'draw some points

FOR I = 0 TO 799: CALL drawPoint(I, 100 * SIN(6.28 * I / 799) + 200, 4): NEXT I



'draw some text

CALL drawText(3, 43, "Graphics test", 15)



'pause for keypress

DO: LOOP WHILE INKEY$ = ""



'go back to text mode then exit

CALL textMode

PRINT "Back in text mode"

END



SUB drawLine (X1, Y1, X2, Y2, COLR)

 'This routine uses a standard y=mx+b plot.

 'The axis (x or y) with the longest distance is chosen.  There are

 'two reasons:  1) Since there are only as many points plotted as on one

 'axis or the other, choosing the smaller axis would mean having small

 'gaps in the line.  2) It also makes drawing vertical lines possible.

 'Normally that is impossible because the slope would try to divide by

 'zero.  But, we can instead plot x=my+b.



 XL = ABS(X2 - X1)

 YL = ABS(Y2 - Y1)

 IF XL >= YL THEN

   IF X1 < X2 THEN

     XB = X1: YB = Y1

   ELSE

     XB = X2: YB = Y2

   END IF

   M! = (Y2 - Y1) / (X2 - X1)'slope

   FOR X = 0 TO XL

     Y = CINT(M! * X)

     CALL drawPoint(X + XB, Y + YB, COLR) 'y=mx+b

   NEXT X

 ELSE

   IF Y1 < Y2 THEN

     XB = X1: YB = Y1

   ELSE

     XB = X2: YB = Y2

   END IF

   M! = (X2 - X1) / (Y2 - Y1)'slope

   FOR Y = 0 TO YL

     X = CINT(M! * Y)

     CALL drawPoint(X + XB, Y + YB, COLR) 'x=my+b

   NEXT Y

 END IF

END SUB



SUB drawPoint (X, Y, COLR)

 'ldiv_t location=ldiv(800*y+x,65536);

 LOCATION& = 800& * Y + X

 BANK = LOCATION&  65536

 DIM regs AS RegType

 IF BANK <> BANKOLD THEN

   regs.ax = &H4F05           'CPU VIDEO MEMORY CONTROL

   regs.bx = &H0              'BH=00h select video memory window

   regs.dx = BANK             'window address in granularity units

   Interrupt &H10, regs, regs 'call BIOS

   BANKOLD = BANK

 END IF

 POKE LOCATION& MOD 65536, COLR

END SUB



SUB drawText (Y, X, S$, COLR)

 DIM regs AS RegType

 regs.ax = &H200            'SET CURSOR POSITION

 regs.bx = &H0              'page 0

 regs.dx = 256 * Y + X      'row & column

 Interrupt &H10, regs, regs 'call BIOS

 FOR N = 1 TO LEN(S$)

   LETTER = ASC(MID$(S$, N, 1))

   regs.ax = &HE00 + LETTER   'TELETYPE OUTPUT / character to display

   regs.bx = COLR             'page 0 / color

   Interrupt &H10, regs, regs 'call BIOS

 NEXT N

END SUB



SUB graphicsMode

 DIM regs AS RegType

 regs.ax = &H4F02           'SET SuperVGA VIDEO MODE

 regs.bx = &H103            'VESA video mode 800x600x256 colors

 Interrupt &H10, regs, regs 'call BIOS

 regs.ax = &H1124           'GRAPHICS MODE CHARACTER GENERATOR 8x16 CHARS

 regs.bx = &H3              '43 lines (really 37.5 but who's counting?)

 Interrupt &H10, regs, regs 'call BIOS

 DEF SEG = &HA000: BANKOLD = 0

END SUB



SUB textMode

 DIM regs AS RegType

 regs.ax = &H3              'SET VIDEO MODE, BIOS 80x25x16 colors

 Interrupt &H10, regs, regs 'call BIOS

 CLS : DEF SEG

END SUB

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...