Jump to content

Photo

more colors per card?


37 replies to this topic

#1 CrazyBoss OFFLINE  

CrazyBoss

    Moonsweeper

  • 377 posts
  • Location:Skåne, Sweden

Posted Thu Feb 25, 2016 12:23 PM

Hi

 

Is there a way to make more colors per card ?

 

I only did the fb/bg mode, never tested the cs mode.

 

Is it possible for a card to have more than one color?

 

What is the avantage to use the cs mode?

 

Any one have or can create a cs mode demo in intybasic?

 



#2 GroovyBee OFFLINE  

GroovyBee

    Games Developer

  • 9,821 posts
  • Busy bee!
  • Location:England

Posted Thu Feb 25, 2016 1:00 PM

Is there a way to make more colors per card ?


Not unless you use flicker tricks or overlay a MOB.
 

Is it possible for a card to have more than one color?

 

In colour stack mode you have the choice of 16 foreground colours and 1 of 4 background colours (all taken from the 16 available). You can also advance the colour stack to get the next colour in the stack on a consecutive card basis.
 

What is the avantage to use the cs mode?

 

16 foreground colours without having to resort to inverse video and the full set of background colours but you can only chose 4.
 

Any one have or can create a cs mode demo in intybasic?

Have a look at the the GRAM font handling code because  that uses colour stack (all colours on the stack are black) and foreground/background mode.



#3 CrazyBoss OFFLINE  

CrazyBoss

    Moonsweeper

  • Topic Starter
  • 377 posts
  • Location:Skåne, Sweden

Posted Thu Feb 25, 2016 1:36 PM

ok, what is the idea of the color stack square mode ? something like 4bits in each color?



#4 GroovyBee OFFLINE  

GroovyBee

    Games Developer

  • 9,821 posts
  • Busy bee!
  • Location:England

Posted Thu Feb 25, 2016 1:42 PM

ok, what is the idea of the color stack square mode ? something like 4bits in each color?

 
Not quite. It gives you a resolution of 40x24 (w x h) and each chunky pixel can be one of the first 7 colours (there is a transparent pixel too). Check out this example code for a line drawing routine that works in coloured squares mode.



#5 DZ-Jay OFFLINE  

DZ-Jay

    Quadrunner

  • 12,022 posts
  • The P-Machinery AGE is almost here!
  • Location:NC, USA

Posted Fri Feb 26, 2016 4:45 AM

In colour stack mode you have the choice of 16 foreground colours and 1 of 4 background colours (all taken from the 16 available). You can also advance the colour stack to get the next colour in the stack on a consecutive card basis.

 

 

 

Just to add to this, when painting your cards, you cannot choose freely from the four background colours.  The Color Stack is like a "circular array" of four background colours, so each card will use the current background color of the stack until you advance the stack pointer to the next colour.  Then all cards will use the new background colour until you advance the stack again, and so on.  When the last color is reached, advancing the stack will go back to the first background colour.

 

It requires a bit of trickery to master, but it is very flexible.  The best part is that it allows you to use the entirety of GROM (so no need to copy letters to GRAM), and the full 16 colours for the foreground of each card.

 

Here's a bit of the summary, taken from the "stic.txt" document:

 

  • All 320 GROM pictures are available.
  • For the foreground, the 8 primary colors are available to GROM cards, and all 16 colors are available to GRAM cards.
  • The current point in the color stack determines the background color for the card.
 

 

       -dZ.



#6 fsuinnc OFFLINE  

fsuinnc

    Moonsweeper

  • 487 posts
  • Location:Chapel Hill NC.

Posted Sat Feb 27, 2016 2:35 PM

 

It requires a bit of trickery to master, but it is very flexible.  The best part is that it allows you to use the entirety of GROM (so no need to copy letters to GRAM), and the full 16 colours for the foreground of each card.

 

Here's a bit of the summary, taken from the "stic.txt" document:

 

  • All 320 GROM pictures are available.
  • For the foreground, the 8 primary colors are available to GROM cards, and all 16 colors are available to GRAM cards.
  • The current point in the color stack determines the background color for the card.
 

 

       -dZ.

 

Sorry, I am a bit confused by this. you say you can use the 16 colors for the foreground of each card but then the summary taken from stic.txt says you can only use the 8 primary colors as the foreground colors for GROM.

 

does IntyBASIC support advancing the stack pointer to change to the next background color?

 

Copying the letters to GRAM kind of started after I played Stunt Cycle on real hardware and I didn't like the way the colors looked. I was making changes but wanted the player info on the screen to match the color of the player sprite and this caused me problems.  GB suggested making my own font in GRAM (and then graciously created code to move the existing letters).  I am not sure I understand the stack background pointer but for my purposes I really just want one color (blue) as the background for the whole game but want to allow any other color to be used as the player color and text for scoring, etc. 



#7 GroovyBee OFFLINE  

GroovyBee

    Games Developer

  • 9,821 posts
  • Busy bee!
  • Location:England

Posted Sat Feb 27, 2016 2:39 PM

does IntyBASIC support advancing the stack pointer to change to the next background color?


Yes. Its not handled by IntyBASIC directly. You set a flag in each BACKTAB card to advance the colour stack. I'll put together a quick example in a minute.

#8 GroovyBee OFFLINE  

GroovyBee

    Games Developer

  • 9,821 posts
  • Busy bee!
  • Location:England

Posted Sat Feb 27, 2016 2:57 PM

Here ya go! This code :-
 
    include "constants.bas"

    mode 0, STACK_PINK,STACK_CYAN,STACK_BLUE,STACK_PURPLE
    wait

    #BACKTAB(0)=CS_ADVANCE+(("T"-" ")*8)+CS_WHITE   ' Background from pink to cyan
    #BACKTAB(1)=CS_ADVANCE+(("E"-" ")*8)+CS_YELLOW  ' Background from cyan to blue
    #BACKTAB(2)=CS_ADVANCE+(("S"-" ")*8)+CS_YELLOW  ' Background from blue to purple
    #BACKTAB(3)=CS_ADVANCE+(("T"-" ")*8)+CS_BLACK   ' Background from purple to pink
    ' Rest of screen now has a pink background.
	
    print at SCREENPOS(5,5) color CS_BLACK, "Hello"
	
loop:
    goto loop 
Produces this display :-
shot0000.gif

#9 DZ-Jay OFFLINE  

DZ-Jay

    Quadrunner

  • 12,022 posts
  • The P-Machinery AGE is almost here!
  • Location:NC, USA

Posted Sat Feb 27, 2016 4:04 PM

Sorry, I am a bit confused by this. you say you can use the 16 colors for the foreground of each card but then the summary taken from stic.txt says you can only use the 8 primary colors as the foreground colors for GROM.

 

Sorry for the confusion.  It allows all 16 colours for GRAM cards, but only the first "primary" colours for GROM cards.  It does allow you to use all 230 GROM cards, unlike FG/BG mode.
 

does IntyBASIC support advancing the stack pointer to change to the next background color?

 

It does, inasmuch as it doesn't get in the way of you doing it when POKE'ing a value into the BACKTAB, or using the colour attributes in the PRINT command.  You just have to set bit #13 of the BACKTAB card (CS_ADVANCE in the "constants.bas" file).
 

Copying the letters to GRAM kind of started after I played Stunt Cycle on real hardware and I didn't like the way the colors looked. I was making changes but wanted the player info on the screen to match the color of the player sprite and this caused me problems.  GB suggested making my own font in GRAM (and then graciously created code to move the existing letters).  I am not sure I understand the stack background pointer but for my purposes I really just want one color (blue) as the background for the whole game but want to allow any other color to be used as the player color and text for scoring, etc.

 

Imagine an array of four colours.  Now consider an imaginary cursor moving across the background, from the top-left corner, all the way to the right edge, then over to the next row, and so on.  As the cursor moves, it will "paint" the background of the card using the first colour in the array.  It will continue painting cards the same colour until it finds a card that has the "Advance" bit set, at which point, it will start using the next colour in the array.

 

Now, the cursor is painting the rest of the background, row by row, with the second colour of the array until it finds another card with the "Advance" bit, which will cause it to switch to the third colour in the array.  And on it goes advancing the background colour array (the "Color Stack") every time it finds a card with the "Advance" bit on.  If it reaches the fourth colour, it will cycle back to the first again.

 

This is how the "Color Stack" works.  By judiciously setting the "Advance" bit on specific cards, you can change the background colour of the scene to make it more colourful.  For instance, you could set the top half in blue and the bottom half in green for a "sky and grass" landscape.  Notice that this only sets the background colour of the cards, i.e., their "transparent" pixels; you still have control over the foreground colour of each card individually.

 

Conversely, if you don't set any of the "Advance" bits on any card at all, the entire background will use the first colour in the stack.

 

This is why I said that it required a bit of "trickery."  You can get very "organic" looking artwork by mixing foreground and background colours in clever ways, advancing the stack at special points as needed.

 

Does this make sense?  The best thing I find of Color Stack mode is that it allows the use of the full GROM, that means all sorts of geometric shapes, which can be used to enhance the scene -- that is, in addition to GRAM.  In FG/BG mode, you only get 64 cards of GRAM and upper-case letters in GROM.

 

   -dZ.



#10 fsuinnc OFFLINE  

fsuinnc

    Moonsweeper

  • 487 posts
  • Location:Chapel Hill NC.

Posted Sat Feb 27, 2016 6:28 PM

Here ya go! This code :-
 

    include "constants.bas"

    mode 0, STACK_PINK,STACK_CYAN,STACK_BLUE,STACK_PURPLE
    wait

    #BACKTAB(0)=CS_ADVANCE+(("T"-" ")*8)+CS_WHITE   ' Background from pink to cyan
    #BACKTAB(1)=CS_ADVANCE+(("E"-" ")*8)+CS_YELLOW  ' Background from cyan to blue
    #BACKTAB(2)=CS_ADVANCE+(("S"-" ")*8)+CS_YELLOW  ' Background from blue to purple
    #BACKTAB(3)=CS_ADVANCE+(("T"-" ")*8)+CS_BLACK   ' Background from purple to pink
    ' Rest of screen now has a pink background.
	
    print at SCREENPOS(5,5) color CS_BLACK, "Hello"
	
loop:
    goto loop 
Produces this display :-
attachicon.gifshot0000.gif

 

thanks.  very nice example as usual.



#11 fsuinnc OFFLINE  

fsuinnc

    Moonsweeper

  • 487 posts
  • Location:Chapel Hill NC.

Posted Sat Feb 27, 2016 6:35 PM

 

Does this make sense?  The best thing I find of Color Stack mode is that it allows the use of the full GROM, that means all sorts of geometric shapes, which can be used to enhance the scene -- that is, in addition to GRAM.  In FG/BG mode, you only get 64 cards of GRAM and upper-case letters in GROM.

 

   -dZ.

Yes, this makes perfect sense. Thanks.

 

I have looked over the IntyBasic manual and also constants.bas (repeatedly) and I sometimes see or notice different things like

 

Display starts in color-stack mode, each card of the 20x12 screen can have the
bit 13 set to 1 so it avances current pointer to color-stack and changes the
background color.
 
In order to change the 4 color-stack predefined values, you should use this:
 
    MODE 0,1,2,3,4  ' Select blue color as initial color and load other 3 colors
 
But they don't make sense to me so my eyes glaze over and I move on. I did not realize that bit 13 being set matched to cs_advance and that I could use multiple background colors on the same screen.  Now it makes sense and I realize I can simplify my screens by taking advantage of this.  
 
Awesome!


#12 DZ-Jay OFFLINE  

DZ-Jay

    Quadrunner

  • 12,022 posts
  • The P-Machinery AGE is almost here!
  • Location:NC, USA

Posted Sat Feb 27, 2016 7:08 PM

 

Yes, this makes perfect sense. Thanks.

 

I have looked over the IntyBasic manual and also constants.bas (repeatedly) and I sometimes see or notice different things like

 

Display starts in color-stack mode, each card of the 20x12 screen can have the
bit 13 set to 1 so it avances current pointer to color-stack and changes the
background color.
 
In order to change the 4 color-stack predefined values, you should use this:
 
    MODE 0,1,2,3,4  ' Select blue color as initial color and load other 3 colors
 
But they don't make sense to me so my eyes glaze over and I move on. I did not realize that bit 13 being set matched to cs_advance and that I could use multiple background colors on the same screen.  Now it makes sense and I realize I can simplify my screens by taking advantage of this.  
 
Awesome!

 

 

One thing to note is that, as opposed to FG/BG mode, in Color Stack mode you cannot randomly change the background colour; it must be in order as defined in the stack.  That is, you can advance the stack pointer to the next colour, but you cannot skip colours.

 

This is where the clever "trickery" comes in.  There are techniques you can use like "reverse video" (where you reverse the foreground and background pixels of a card) that let you "skip" a colour, or use a colour in the stack in a different way.

 

Here's a description I wrote some time ago on this technique, and here's an example where I applied it.

 

     -dZ.


Edited by DZ-Jay, Sat Feb 27, 2016 7:15 PM.


#13 First Spear OFFLINE  

First Spear

    Stargunner

  • 1,366 posts
  • Location:Somewhere in Uptown

Posted Thu Mar 3, 2016 8:50 PM

Someone please "sticky" this thread. I asked these questions about a year ago, and it was good to have a refresher today.



#14 dalves OFFLINE  

dalves

    Chopper Commander

  • 154 posts

Posted Thu Aug 4, 2016 8:08 AM

I don't know if anyone is still checking this thread, but as a beginner I've been looking for an easy way to change the background color of the whole screen. I've been looking at a lot of the demo roms out there and checking the code, but so many of them will always have a black background. I wanted to try to switch the background color from the "Brown" of my title screen to black or another color using color stack mode. Any guidance would be appreciated.



#15 GroovyBee OFFLINE  

GroovyBee

    Games Developer

  • 9,821 posts
  • Busy bee!
  • Location:England

Posted Thu Aug 4, 2016 9:14 AM

Did you try experimenting with the code I posted earlier?



#16 dalves OFFLINE  

dalves

    Chopper Commander

  • 154 posts

Posted Thu Aug 4, 2016 9:24 AM

Hahahahaha, sorry, but no I haven't. Okay, so I haven't tried every example I've found. :)

 

I didn't know if your code was designed more for changing the background and foreground of the text. I'll give it a shot and see what I can find through experimenting with it. I just wasn't sure if there was a simple command or method that I might be missing.



#17 GroovyBee OFFLINE  

GroovyBee

    Games Developer

  • 9,821 posts
  • Busy bee!
  • Location:England

Posted Thu Aug 4, 2016 9:29 AM

All you need to do is set up the mode and colours in the stack, perform a wait command (to ensure the screen mode has changed)  and then write CS_ADVANCE (from constants.bas) into the #BACKTAB array at the screen positions you want the change to occur at. If there are cards in the foreground you'll have to add CS_ADVANCE to the card data thats already there.



#18 dalves OFFLINE  

dalves

    Chopper Commander

  • 154 posts

Posted Thu Aug 4, 2016 9:32 AM

Thanks a bunch. I'll give that a shot.



#19 dalves OFFLINE  

dalves

    Chopper Commander

  • 154 posts

Posted Thu Aug 4, 2016 12:38 PM

When I try to build the rom with the code as is, it says "Using array without previous DIM, autoassigning DIM (10) in line 6".

 

I always hate asking newbie questions like this. :( 


Edited by dalves, Thu Aug 4, 2016 1:08 PM.


#20 GroovyBee OFFLINE  

GroovyBee

    Games Developer

  • 9,821 posts
  • Busy bee!
  • Location:England

Posted Thu Aug 4, 2016 1:08 PM

Its been included with IntyBASIC for a while now. What version are you using?

#21 dalves OFFLINE  

dalves

    Chopper Commander

  • 154 posts

Posted Thu Aug 4, 2016 1:21 PM

I'm using IntyBASIC SDK 1.0.1. I tried downloading what appeared to be an updated version of the constants.bas and put it un the lib folder, but still get the same error.



#22 GroovyBee OFFLINE  

GroovyBee

    Games Developer

  • 9,821 posts
  • Busy bee!
  • Location:England

Posted Thu Aug 4, 2016 1:23 PM

You need the compiler that has the built in #BACKTAB array. You'll also have to update the prologue and epilogue files too. I'll find the post where I explained how to do all that.



#23 GroovyBee OFFLINE  

GroovyBee

    Games Developer

  • 9,821 posts
  • Busy bee!
  • Location:England

Posted Thu Aug 4, 2016 1:28 PM

Heres the instructions on how to patch the SDK to the latest one :-

http://atariage.com/...-3#entry3331569



#24 Kiwi OFFLINE  

Kiwi

    Stargunner

  • 1,651 posts

Posted Thu Aug 4, 2016 1:48 PM

poking byte data to the colorstack register will change the background color. 

 

example:

POKE $28,$07
POKE $29,$00

 

Makes sure it after a wait command.

 

My kaboom clone game color cycle rapidly by changing the color stack value during the explosion scene. 



#25 dalves OFFLINE  

dalves

    Chopper Commander

  • 154 posts

Posted Thu Aug 4, 2016 2:07 PM

Thanks for the info. I've downloaded the files and will follow your instructions and see if that gets me up and running. Thanks again...

 

 

(I just tried it and everything runs perfect now. Thanks so much for the help. :) )


Edited by dalves, Thu Aug 4, 2016 2:15 PM.





0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users