DDR like demo
Moderator: Mask of Destiny
DDR like demo
J've just coded a DDR-like with SGDK and i wanted to have your impressions and comments about it.
For the moment there is only one level playable.
The thème is emerald hill from Sonic 2. (but my cam recorder don't recognized my sound card )
I know this BGM is under copyright but this is for the moment only a demo and i'm too bad at music to make my own ^^
If i continue the game i maybe will need help from music mens (or womans )
I almost forgot the most important : no rom for the moment but just a video : http://youtu.be/fnkgEfY-Yyg
now i have a question : is there any way to save score (in order to use it with a original pcb then) with SGDK?
For the moment there is only one level playable.
The thème is emerald hill from Sonic 2. (but my cam recorder don't recognized my sound card )
I know this BGM is under copyright but this is for the moment only a demo and i'm too bad at music to make my own ^^
If i continue the game i maybe will need help from music mens (or womans )
I almost forgot the most important : no rom for the moment but just a video : http://youtu.be/fnkgEfY-Yyg
now i have a question : is there any way to save score (in order to use it with a original pcb then) with SGDK?
In fact, Joypad is mapped as this :
Left : Left
Down : B
Up : Up
Right : C
So it's playable with a standard controller
With a keyboard this take a little time to be good but it's really playable.
I will maybe add an option menu where we could choose between several joypad config...
I would like to use a dance pad but it doesn't exist for Genesis so i had to hack a standard paddle to integrate it in a dansce pad. No problem, easier than coding this game
Left : Left
Down : B
Up : Up
Right : C
So it's playable with a standard controller
With a keyboard this take a little time to be good but it's really playable.
I will maybe add an option menu where we could choose between several joypad config...
I would like to use a dance pad but it doesn't exist for Genesis so i had to hack a standard paddle to integrate it in a dansce pad. No problem, easier than coding this game
Re: DDR like demo
Yes you could make a pcb with sram and cr2032 battery but if you just want to save the score it would make the pcb cost less to come up with a password system. An idea I had was to xor encrypt the score and have a simple hash as part of the password that is xor encrypted with another value. This will prevent players from trying to get a higher score by entering a false password.oofwill wrote: now i have a question : is there any way to save score (in order to use it with a original pcb then) with SGDK?
-
- Very interested
- Posts: 2984
- Joined: Fri Aug 17, 2007 9:33 pm
Re: DDR like demo
I think he means how do you read/write sram using SGDK. There's no built in support - you have to edit the header in rom_head.c, then use pointers to access the sram.sega16 wrote:Yes you could make a pcb with sram and cr2032 battery but if you just want to save the score it would make the pcb cost less to come up with a password system. An idea I had was to xor encrypt the score and have a simple hash as part of the password that is xor encrypted with another value. This will prevent players from trying to get a higher score by entering a false password.oofwill wrote: now i have a question : is there any way to save score (in order to use it with a original pcb then) with SGDK?
The rom header is normally this (from rom_head.c)
Code: Select all
char console[16]; /* Console Name (16) */
char copyright[16]; /* Copyright Information (16) */
char title_local[48]; /* Domestic Name (48) */
char title_int[48]; /* Overseas Name (48) */
char serial[16]; /* Serial Number (2, 14) */
u16 checksum; /* Checksum (2) */
char IOSupport[16]; /* I/O Support (16) */
u32 rom_start; /* ROM Start Address (4) */
u32 rom_end; /* ROM End Address (4) */
u32 ram_start; /* Start of Backup RAM (4) */
u32 ram_end; /* End of Backup RAM (4) */
char modem_support[24]; /* Modem Support (24) */
char notes[40]; /* Memo (40) */
char region[16]; /* Country Support (16) */
Code: Select all
char console[16]; /* Console Name (16) */
char copyright[16]; /* Copyright Information (16) */
char title_local[48]; /* Domestic Name (48) */
char title_int[48]; /* Overseas Name (48) */
char serial[16]; /* Serial Number (2, 14) */
u16 checksum; /* Checksum (2) */
char IOSupport[16]; /* I/O Support (16) */
u32 rom_start; /* ROM Start Address (4) */
u32 rom_end; /* ROM End Address (4) */
u32 ram_start; /* Start of Backup RAM (4) */
u32 ram_end; /* End of Backup RAM (4) */
char sram_sig[2]; /* "RA" for save ram (2) */
u16 sram_type; /* 0xF820 for save ram on odd bytes (2) */
u32 sram_start; /* SRAM start address - normally 0x200001 (4) */
u32 sram_end; /* SRAM end address - start + 2*sram_size (4) */
char modem_support[12]; /* Modem Support (12) */
char notes[40]; /* Memo (40) */
char region[16]; /* Country Support (16) */
turn on sram
Code: Select all
*(vu8*)0xA130F1 = 1; /* enable sram */
turn off sram
Code: Select all
*(vu8*)0xA130F1 = 0; /* disable sram */
Code: Select all
*(vu8*)0xA130F1 = 3; /* enable sram, write-protected */
To read/write the sram, read/write bytes at odd positions.
read
Code: Select all
u8 read_sram(int offset)
{
return *(vu8*)(0x200001 + offset*2);
}
Code: Select all
void write_sram(int offset, u8 val)
{
*(vu8*)(0x200001 + offset*2) = val;
}
Wow! many thanks for those usefull infos!
Indeed, i've already realized cartmods on pcb with Sram.
My question, as you noticed Chilly Willy, is how to use this Sram with SGDK.
- for rom header, this will be easy, ok.
- my rom will surely be heavier than 2MB, so i would have to turn on and off sram when i want to use it : ok
To read & write i'm not sure now.
Example : i want to store the score for sonic level : wich offset range can i use?
how many bytes will take an integer?
I will do test this evening, thanks again for your help
Indeed, i've already realized cartmods on pcb with Sram.
My question, as you noticed Chilly Willy, is how to use this Sram with SGDK.
- for rom header, this will be easy, ok.
- my rom will surely be heavier than 2MB, so i would have to turn on and off sram when i want to use it : ok
To read & write i'm not sure now.
Example : i want to store the score for sonic level : wich offset range can i use?
how many bytes will take an integer?
I will do test this evening, thanks again for your help
I'm doing test now.
What means "0xF820 for save ram on odd bytes"?
What is "odd bytes"?
So. I'm testing the save but my code is surely bad.
score is int and equal to 400
VDP_drawText give me 00012 on screen.
Maybe a problem with my adress? (i don't really know what offset is )
or with my variables? (int shouldn't work?)
my rom_head.c:
EDIT : ok, it's certainly variable type.
I don't really know difference between int & u8...
What means "0xF820 for save ram on odd bytes"?
What is "odd bytes"?
So. I'm testing the save but my code is surely bad.
Code: Select all
write_sram(0, score);
i = read_sram(0);
intToStr(i, varichar, 5);
VDP_drawText(varichar, 2, 25);
VDP_drawText give me 00012 on screen.
Maybe a problem with my adress? (i don't really know what offset is )
or with my variables? (int shouldn't work?)
my rom_head.c:
Code: Select all
const struct
{
char console[16]; /* Console Name (16) */
char copyright[16]; /* Copyright Information (16) */
char title_local[48]; /* Domestic Name (48) */
char title_int[48]; /* Overseas Name (48) */
char serial[16]; /* Serial Number (2, 14) */
u16 checksum; /* Checksum (2) */
char IOSupport[16]; /* I/O Support (16) */
u32 rom_start; /* ROM Start Address (4) */
u32 rom_end; /* ROM End Address (4) */
u32 ram_start; /* Start of Backup RAM (4) */
u32 ram_end; /* End of Backup RAM (4) */
char sram_sig[2]; /* "RA" for save ram (2) */
u16 sram_type; /* 0xF820 for save ram on odd bytes (2) */
u32 sram_start; /* SRAM start address - normally 0x200001 (4) */
u32 sram_end; /* SRAM end address - start + 2*sram_size (4) */
char modem_support[24]; /* Modem Support (24) */
char notes[40]; /* Memo (40) */
char region[16]; /* Country Support (16) */
} rom_header = {
"SEGA MEGA DRIVE ",
"(C)FLEMTEAM 2011",
"SAMPLE PROGRAM ",
"SAMPLE PROGRAM ",
"GM 00000000-00",
0x0000,
"JD ",
0x00000000,
0x00020000,
0x00FF0000,
0x00FFFFFF,
"RA",
0xF820,
0x00200001,
0x00200100,
" ",
"DEMONSTRATION PROGRAM ",
"JUE "
};
I don't really know difference between int & u8...
Last edited by oofwill on Thu Aug 16, 2012 8:06 pm, edited 2 times in total.
-
- Very interested
- Posts: 2984
- Joined: Fri Aug 17, 2007 9:33 pm
Bytes on ONLY odd addresses... notice the read function (for example)oofwill wrote:I'm doing test now.
What means "0xF820 for save ram on odd bytes"?
What is "odd bytes"?
Code: Select all
u8 read_sram(int offset)
{
return *(vu8*)(0x200001 + offset*2);
}
reading a word in assembly
Code: Select all
movep.w 0(a0),d0
reading a word in C
Code: Select all
u16 val;
val = read_sram(ptr)<<8 | read_sram(ptr+2);
The offset is whatever the programmer decides. Make a list of variables you need to save and how big they are. That will tell you how much sram each save slot will need. If you allow (for example) four different saves, you would need four slots, or at least four time the space needed to save the variables, plus a description of the save (if you use one).
-
- Very interested
- Posts: 2984
- Joined: Fri Aug 17, 2007 9:33 pm
Ok.
After several hours of reading, it finally works!
First, i've learned interesting things about variables types
Then, i saw that i forgot to enable sram, that's why it didn't work!
I'm sorry for disturbing you with stupid questions, i know that it could be really annoying, so forgive me if sometimes my questions seems to be senseless, it's just i'm starting from 0...
After several hours of reading, it finally works!
First, i've learned interesting things about variables types
Then, i saw that i forgot to enable sram, that's why it didn't work!
I'm sorry for disturbing you with stupid questions, i know that it could be really annoying, so forgive me if sometimes my questions seems to be senseless, it's just i'm starting from 0...
I've another problem with save:
I use those command lines
It works perfectly with Gens, but Regen gave me the following message : "ADDRESS ERROR !"
On real Hardware, after the message "produced by or under...", i've a black screen.
What could be the problem?
I use those command lines
Code: Select all
*(vu8*)0xA130F1 = 1; /* enable sram */
if (*(vu8*)(0x200001) != 250)
{
j=15;
VDP_drawText("First time running Dance Impact", 3, 3);
VDP_drawText("Reset memory", 3, 7);
for(i=0; i<5000; i++)
{
VDP_drawText(".", j, 7);
if (i==4990 && j<20) {j++; i=0;}
}
*(vu8*)(0x200001) = 250; //indique qu'une sauvegarde existe
*(vu16*)(0x200003) = 500; //best score stage 1 réglé à 500
*(vu16*)(0x200007) = 500; //best score stage 2 réglé à 500
*(vu16*)(0x200011) = 500; //best score stage 3 réglé à 500
}
*(vu8*)0xA130F1 = 0; /* disable sram */
On real Hardware, after the message "produced by or under...", i've a black screen.
What could be the problem?
-
- Very interested
- Posts: 2443
- Joined: Tue Dec 05, 2006 1:37 pm
- Location: Estonia, Rapla City
- Contact:
You cannot read words or longs from an odd address
Mida sa loed ? Nagunii aru ei saa
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen