Hi,
I am trying to learn the SGDK and am stuck on literately the 3rd tutorial which is drawing a background using tiles. Here is a link to the source code. When i compile it it compiles fine, however when I run it it crashes my emulator. Any assistance in this matter would be greatly appreciated.
Sincerely,
Scorpion Illuminati
Code Crashes Emulator
Moderator: Stef
-
- Interested
- Posts: 28
- Joined: Fri Oct 02, 2015 4:58 pm
Code Crashes Emulator
Scorpion Illuminati - An open source rhythm game for the Sega Genesis
http://www.scorpionilluminati.tk
http://www.scorpionilluminati.tk
Re: Code Crashes Emulator
Works at home. Test with blastem, kfusion and genskmod.
I also tried to change tile number with TILE_USERINDEX and also works.
same source with my binary file.
https://www.dropbox.com/s/o1u9wz5ef9d6w ... t.zip?dl=0
Does your batch launch binary in good directory : c:\blastem\blastem.exe -d c:\segadevc\out\rom.bin
I also tried to change tile number with TILE_USERINDEX and also works.
same source with my binary file.
https://www.dropbox.com/s/o1u9wz5ef9d6w ... t.zip?dl=0
Code: Select all
//we load our unique tile data at position 1 on VRAM
VDP_loadTileData( (const u32 *)titleScreen_Tiles, TILE_USERINDEX, 1, 0);
//write our tile 1 on plane B at (5,5) with pal 0
VDP_setTileMapXY(PLAN_B, TILE_USERINDEX, 5, 5);
Does your batch launch binary in good directory : c:\blastem\blastem.exe -d c:\segadevc\out\rom.bin
-
- Interested
- Posts: 28
- Joined: Fri Oct 02, 2015 4:58 pm
Re: Code Crashes Emulator
Thanks, your code made it work for me. Not sure what TILE_USERINDEX s but it fixed it for me. So now the question is how do I setup the palette so I can show more then different shades of black? There aren't any tutorials that I could find for setting up the palette manually without going through the trouble of drawing an image just to convert it. Any assistance in this matter would be greatly appreciated.dub wrote: ↑Sat Oct 07, 2017 7:33 amWorks at home. Test with blastem, kfusion and genskmod.
I also tried to change tile number with TILE_USERINDEX and also works.
same source with my binary file.
https://www.dropbox.com/s/o1u9wz5ef9d6w ... t.zip?dl=0
Code: Select all
//we load our unique tile data at position 1 on VRAM VDP_loadTileData( (const u32 *)titleScreen_Tiles, TILE_USERINDEX, 1, 0); //write our tile 1 on plane B at (5,5) with pal 0 VDP_setTileMapXY(PLAN_B, TILE_USERINDEX, 5, 5);
Does your batch launch binary in good directory : c:\blastem\blastem.exe -d c:\segadevc\out\rom.bin
Sincerely,
Scorpion Illuminati
Scorpion Illuminati - An open source rhythm game for the Sega Genesis
http://www.scorpionilluminati.tk
http://www.scorpionilluminati.tk
Re: Code Crashes Emulator
You can read the tuto here : https://github.com/Stephane-D/SGDK/wiki/Tuto-Intro
TILE_USERINDEX is the beginning of the vram for the user and who not used by the system.
For the palette, I always use Image but in the source code and the doc, you must fnd a way with "VDP_setPalette (u16 num, const u16 * pal );"
If you change the first 16 colors :: num = 0 to 15 => PAL0
For the palette color :
Color is defined with 3 bits for each component : xxxxBBBxGGGxRRRx
https://github.com/Stephane-D/SGDK/blob ... /vdp_pal.c
So red = 000R, blue = 0B00 and red+blue = 0B0R
VDP_setPalette(0, 0x0002);
VDP_setPalette(1, 0x0200);
Not tested
TILE_USERINDEX is the beginning of the vram for the user and who not used by the system.
For the palette, I always use Image but in the source code and the doc, you must fnd a way with "VDP_setPalette (u16 num, const u16 * pal );"
If you change the first 16 colors :: num = 0 to 15 => PAL0
For the palette color :
Color is defined with 3 bits for each component : xxxxBBBxGGGxRRRx
https://github.com/Stephane-D/SGDK/blob ... /vdp_pal.c
So red = 000R, blue = 0B00 and red+blue = 0B0R
VDP_setPalette(0, 0x0002);
VDP_setPalette(1, 0x0200);
Code: Select all
const u16 palette_red[16] =
{
0x0000,
0x0002,
0x0004,
0x0006,
0x0008,
0x000A,
0x000C,
0x000E,
0x000E,
0x000E,
0x000E,
0x000E,
0x000E,
0x000E,
0x000E,
0x000E
};
Re: Code Crashes Emulator
Read through the include files. They describe every available function in detail.