News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Mode 13h color cycling

Started by wossname, November 21, 2005, 07:33:46 PM

Previous topic - Next topic

wossname

I'm beginning to write a VERY simple shoot-em-up game based on the old game "Eliminator" from the 1980's.

Basically you are flying down a road and I think I can animate this road effect by rotating the video adaptor's palette.

I have sucessfully tried randomizing palette colors before but this time I want to know what is the best way to go about rotating part of the video palette...


Method 1:
Keep an array of RGB values in a normal array and edit those THEN upload those to the video adaptor (basically updating the entire palette each time, this would be easy to code I think).

Method 2:
Only use the RGB array once at startup and then read and write directly to the video adaptor's palette (on ports 3c8h and 3c9h).  This would be harder to code I think but it would be more efficient I think.

Method 3:
???




Any ideas guys?


ps, what is the easiest way to rotate a large number of bytes in memory?  I already have a bit of code for rotating an array by 24 bits but its a bit unweildy and not very efficient.

daydreamer

Quote from: wossname on November 21, 2005, 07:33:46 PM
I'm beginning to write a VERY simple shoot-em-up game based on the old game "Eliminator" from the 1980's.

Basically you are flying down a road and I think I can animate this road effect by rotating the video adaptor's palette.

I have sucessfully tried randomizing palette colors before but this time I want to know what is the best way to go about rotating part of the video palette...


Method 1:
Keep an array of RGB values in a normal array and edit those THEN upload those to the video adaptor (basically updating the entire palette each time, this would be easy to code I think).

Method 2:
Only use the RGB array once at startup and then read and write directly to the video adaptor's palette (on ports 3c8h and 3c9h).  This would be harder to code I think but it would be more efficient I think.

Method 3:
???




Any ideas guys?


ps, what is the easiest way to rotate a large number of bytes in memory?  I already have a bit of code for rotating an array by 24 bits but its a bit unweildy and not very efficient.
rotate large number of bytes in memory?, easiest way is dont do rotate the bytes, just emulate it
have a variable that keeps incremented/decremented by how much you move in the game
in the top of the loop read that variable as offset to memoryreads into your RGB array you output all to palette and let the pointer wraparound  so it is kept inside your RGB array completely
for easier code, arrange it as 32bit ARGB aligned, a dummy byte, so all you need is *4 scaler on your variable