Jump to content
IGNORED

IntyBASIC Foreground Color Change in CS Mode?


Recommended Posts

In Color Stack Mode, background is black on the entire stack. Attempting to change foeground color of a tile works fine if the color is from 0-7, but the higher numbered colors (for example CS_BROWN) are not working. I am pretty sure this goes back to "magic numbers" and my AND NOT but I don't see where I am messing up. Can anyone point me in the right direction? I did look at http://knox.ac.free.fr/inty_workshop/to get a clue but didn't...

For colorCycleLoop = 0 to 5
   tilePaintColor = ColorsTanShort(colorCycleLoop)
   #BACKTAB(133) = (#BACKTAB(133) AND NOT $0007) + tilePaintColor
   Wait: Wait: Wait
  Next
ColorsTanShort:
DATA  CS_BROWN , CS_DARKGREEN , CS_BROWN , CS_DARKGREEN , CS_GREEN ,  CS_TAN

Thanks.

 

 

Link to comment
Share on other sites

Three issues as far as I can tell:

 

1. The variable tilePaintColor needs to be 16-bit, i.e. #tilePaintColor. You can avoid that by skipping the assignment of a variable at all, and address the DATA directly.

2. Use AND $0FF8 instead of AND NOT $0007 in order to clear bit 12 (FG Bit 3) as well as bit 13 (Advance CS) unless you want to maintain that bit.

3. #BACKTAB contains a GRAM character, right? The colours 8-15 are only available for GRAM, not GROM.

 

This program kind of does what you ask for:

 

 

INCLUDE "samples/constants.bas"
 
  MODE 0,CS_BLACK,CS_WHITE,CS_RED,CS_BLUE:DEFINE 0,1,graphic:WAIT
 
  FOR i=0 TO 5
    #BACKTAB(110 + i) = $0800 + 0*8 + ColorsShort(i)
  NEXT
 
  #BACKTAB(133) = $0800 + 0*8 + CS_BROWN
 
loop:
  For I = 0 to 5
     #BACKTAB(133) = (#BACKTAB(133) AND $0FF8) + ColorsShort(I)
     WAIT
     WHILE CONT.BUTTON=0:WEND
  Next
  GOTO loop
 
ColorsShort:
  DATA CS_BROWN, CS_DARKGREEN, CS_BROWN, CS_DARKGREEN, CS_GREEN, CS_TAN
 
graphic:
  BITMAP "...oo..."
  BITMAP "..oooo.."
  BITMAP "..oooo.."
  BITMAP "...oo..."
  BITMAP ".oooooo."
  BITMAP "...oo..."
  BITMAP "..o..o.."
  BITMAP ".o....o."
  • Like 2
Link to comment
Share on other sites

In Color Stack Mode, background is black on the entire stack. Attempting to change foeground color of a tile works fine if the color is from 0-7, but the higher numbered colors (for example CS_BROWN) are not working. I am pretty sure this goes back to "magic numbers" and my AND NOT but I don't see where I am messing up. Can anyone point me in the right direction? I did look at http://knox.ac.free.fr/inty_workshop/to get a clue but didn't...

For colorCycleLoop = 0 to 5
   tilePaintColor = ColorsTanShort(colorCycleLoop)
   #BACKTAB(133) = (#BACKTAB(133) AND NOT $0007) + tilePaintColor
   Wait: Wait: Wait
  Next

 

 

Two things:

  1. The foreground color bits are not contiguous. Bit 3 of the color is in bit 12 of the BACKTAB word.

    Stic_color_stack_word.png

     

  2. You cannot use the "pastel" colors (color numbers 8 and up) cards that come from GROM, as this triggers Colored Squares mode. Compare:

    Stic_color_stack_gram.png

     

    Stic_colored_squares.png

 

You can read more over here: http://wiki.intellivision.us/index.php?title=STIC

 

(And yes, I drew those images, long ago...)

 

EDIT: I meant to add, if your BACKTAB cards are indeed coming from GRAM, you can modify your loop like so:

For colorCycleLoop = 0 to 5
   tilePaintColor = ColorsTanShort(colorCycleLoop)
   #BACKTAB(133) = (#BACKTAB(133) AND NOT $1007) + tilePaintColor
   Wait: Wait: Wait
Next
Edited by intvnut
Link to comment
Share on other sites

Oh yes, if bits 14-15 are used for own content and he wants to preserve the Advance CS bit, he should use use AND $EFF8 which equals AND NOT $1007. The latter may be easier to understand, but the former I would suppose generates less code and runs a tick faster.

 

I see that in constants.bas there are two constants CS_CARD_DATA_MASK = $07F8 and FGBG_CARD_DATA_MASK = $01F8. It appears to me that both of these would clear the GROM/GRAM bit but perhaps those constants do it on purpose, for extracting the actual GROM/GRAM number without needing to know which it was?

Link to comment
Share on other sites

Oh yes, if bits 14-15 are used for own content and he wants to preserve the Advance CS bit, he should use use AND $EFF8 which equals AND NOT $1007. The latter may be easier to understand, but the former I would suppose generates less code and runs a tick faster.

 

They generate identical code due to IntyBASIC's constant folding, so I'd prefer the more readable version:

.

    ;FILE not.bas
    ;[1] #var = #var AND $EFF8
    SRCFILE "not.bas",1
    MVI V1,R0
    ANDI #61432,R0
    MVO R0,V1
    ;[2] #var = #var AND NOT $1007
    SRCFILE "not.bas",2
    ANDI #61432,R0
    MVO R0,V1
    ;ENDFILE

  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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