Steril707 Posted September 4, 2007 Share Posted September 4, 2007 I am using Skipdraw for my sprites, and everything seems to work fine, and i guess i understood now how skipdraw works in terms of the pointer subtraction it does inside a page. Now i want one of my sprites to have a new color each line... I tried to do the same thing that Skipdraw does with a colortable + appropriate pointer, and wanted to use a simple lda (colortable), y sta COLUP0 inside my kernal, , but didnt get far with this. So, can somebody tell me something about this, or point me to some threads with info about how to get coloured sprites working? I havent found anything here using the Atariage-search yet... thanks a lot, Michael Quote Link to comment Share on other sites More sharing options...
SeaGtGruff Posted September 4, 2007 Share Posted September 4, 2007 I am using Skipdraw for my sprites, and everything seems to work fine, and i guess i understood now how skipdraw works in terms of the pointer subtraction it does inside a page. Now i want one of my sprites to have a new color each line... I tried to do the same thing that Skipdraw does with a colortable + appropriate pointer, and wanted to use a simple lda (colortable), y sta COLUP0 inside my kernal, , but didnt get far with this. So, can somebody tell me something about this, or point me to some threads with info about how to get coloured sprites working? I havent found anything here using the Atariage-search yet... thanks a lot, Michael These may be dumb questions, but did you define the lo-byte/hi-byte pointers for colortable, did you set them to the correct lo-byte/hi-byte values, and did you create a table of color values at the address pointed to by those pointers? Michael Quote Link to comment Share on other sites More sharing options...
Steril707 Posted September 4, 2007 Author Share Posted September 4, 2007 Hey Michael, i am currently in the weird situation that i cannot post any code, for the pc where i code at is not connected to the internet. This will change over the next days though... I think i did all the things you mentioned, but i am not completely sure if i did everything the right way... Hmm, i guess i have to wait until i can post some code, once more anyway, thanks... Michael Quote Link to comment Share on other sites More sharing options...
LS_Dracon Posted September 6, 2007 Share Posted September 6, 2007 Don't need pointer or var. Just : ... tay lda colortable,y sta COLUP0 lda (spritepointer),y ... After tay. Quote Link to comment Share on other sites More sharing options...
DEBRO Posted September 6, 2007 Share Posted September 6, 2007 Hi there, I think i did all the things you mentioned, but i am not completely sure if i did everything the right way... Hmm, i guess i have to wait until i can post some code, once more Have a look my Climber 5 source. Unfortunately I can't find it right now. You should be able to find it if you do a search in the forums or [stella]. I did the same thing you're trying to do with the climber. Make sure you set up your indirect pointer for your colors the same way you set up your indirect pointer to the graphics data. This is how I set mine up... sec lda #KERNEL_HEIGHT tay ; used for the kernel sbc verPosP1 ; subtract the climber vertical position adc #CLIMBER_HEIGHT-1 ; add back in the climber height to get the ; offset sta climberOffset ; this is decremented in the kernel to ; determine when the y-register is in range ; to draw the climber clc adc playerGraphicLSB ; add the value to the graphic pointer LSB sta playerPointer ; so the indirect read doesn't cross a page ; boundary lda climberOffset clc adc playerColorsLSB ; now calculate the color pointer LSB the sta playerColorPointer ; same way Then in the kernel I would do the typical... lda #CLIMBER_HEIGHT-1 ; 2 dcp climberOffset ; 5 bcs .colorClimber ; 2 SLEEP_9 ; 9 lda #0 ; 2 beq .drawClimber ; -10 .colorClimber lda (playerColorPointer),y ; 5 sta COLUP1 ; 3 lda (playerPointer),y ; 5 .drawClimber sta GRP1 ; 3 Also, your colors would have the same page restrictions as your graphic data. I hope this helps. Quote Link to comment Share on other sites More sharing options...
Steril707 Posted September 9, 2007 Author Share Posted September 9, 2007 Hello Dennis, thanks for your advice and code samples... Just one question: Can't i just change the Player color all the time...I guess it doesnt make any difference, if i do a playercolor-write and the player isnt being drawn this scanline anyway, isnt it? greets, Mike Quote Link to comment Share on other sites More sharing options...
SeaGtGruff Posted September 9, 2007 Share Posted September 9, 2007 Can't i just change the Player color all the time...I guess it doesnt make any difference, if i do a playercolor-write and the player isnt being drawn this scanline anyway, isnt it? If by "change the Player color all the time" you mean on each scan line-- or pair of scan lines, if you're using a 2-line kernel-- then I don't think that would work unless you're also drawing the player on each line (i.e., a 192-line or 96-line tall player). Otherwise, the index to the playercolor table won't match up with the index to the playershape table, see? Also, it would take up more ROM. On the other hand, if ROM isn't an issue, but cycles *are* an issue, then playershape and playercolor tables that span the height of the screen might be useful, since you could just load and store the playershape and playercolor data on each line, without having to spend cycles on testing any variables and then taking the appropriate branches. But since your player will presumably need to move in the vertical direction, you'll need to pad the beginning and end of the tables with enough "blank" lines to let you move the player vertically by changing the point at which you start reading from the tables. Michael Quote Link to comment Share on other sites More sharing options...
DEBRO Posted September 10, 2007 Share Posted September 10, 2007 Hi there, Just one question: Can't i just change the Player color all the time...I guess it doesnt make any difference, if i do a playercolor-write and the player isnt being drawn this scanline anyway, isnt it?You could but if you're using skipDraw and indirect indexing for the colors then your cycle counts wouldn't be constant it you did a read outside the table. Quote Link to comment Share on other sites More sharing options...
Steril707 Posted September 11, 2007 Author Share Posted September 11, 2007 @ Dennis: Hmm, somehow i don't get this whole thing together..I concentrated on other things though on my game. I still hope i can tackle this subject not too far in the future.. @Michael: I am using a 2lk, but i still have y being in the "true" scanline count, not the halfed one. just doing dey after every STA WSYNC. Else i couldn't update the background and foreground colors each row on Bombjack. Quote Link to comment Share on other sites More sharing options...
Nukey Shay Posted September 11, 2007 Share Posted September 11, 2007 If there's not enough leftover cycles in either portion of your 2lk, you could try unrolling the loop where the player character is drawn. 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.