First Spear Posted April 25, 2018 Share Posted April 25, 2018 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. Quote Link to comment Share on other sites More sharing options...
carlsson Posted April 25, 2018 Share Posted April 25, 2018 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." 2 Quote Link to comment Share on other sites More sharing options...
intvnut Posted April 25, 2018 Share Posted April 25, 2018 (edited) 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: The foreground color bits are not contiguous. Bit 3 of the color is in bit 12 of the BACKTAB word. You cannot use the "pastel" colors (color numbers 8 and up) cards that come from GROM, as this triggers Colored Squares mode. Compare: 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 April 25, 2018 by intvnut Quote Link to comment Share on other sites More sharing options...
intvnut Posted April 25, 2018 Share Posted April 25, 2018 Heh... looks like I missed carlsson's post, which made similar points to mine. I just clicked the link from email and started typing, and then finished over the course of time. :-P Quote Link to comment Share on other sites More sharing options...
carlsson Posted April 25, 2018 Share Posted April 25, 2018 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? Quote Link to comment Share on other sites More sharing options...
intvnut Posted April 25, 2018 Share Posted April 25, 2018 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 2 Quote Link to comment Share on other sites More sharing options...
carlsson Posted April 25, 2018 Share Posted April 25, 2018 Cool! It didn't occur to me to test before I commented. That is good to know. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.