Sega Genesis Dev Kit (SGDK)

SGDK only sub forum

Moderator: Stef

Shiru
Very interested
Posts: 786
Joined: Sat Apr 07, 2007 3:11 am
Location: Russia, Moscow
Contact:

Post by Shiru » Tue May 13, 2008 11:37 am

Chilly Willy wrote:Here's the problem - you apparently don't have the vblank counter set as volatile.
You right. I made this variable volatile and project now works with -O1 and higher. But, in Stef's code this variable wasn't volatile (that's reason why I made it not volatile too).

Well, thanks for help, all works now.

Stef
Very interested
Posts: 3034
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Tue May 13, 2008 5:09 pm

Haaa so nothing to do with division O_o ?
All port access have to be volatile to prevent the compiler to optimize them. Normally they are correctly declared in the devkit or it's a bug... My vsync code isn't based on vblank counter (vtimer) :

void VDP_waitVSync()
{
volatile u16 *pw;
u16 vdp_state;

vdp_state = VDP_VBLANK_FLAG;
pw = (u16 *) GFX_CTRL_PORT;

while (vdp_state & VDP_VBLANK_FLAG) vdp_state = *pw;
while (!(vdp_state & VDP_VBLANK_FLAG)) vdp_state = *pw;
}

but my FPS code is based on, maybe it can give some bugs as i didn't declared it as volatile as you mentionned.

Shiru
Very interested
Posts: 786
Joined: Sat Apr 07, 2007 3:11 am
Location: Russia, Moscow
Contact:

Post by Shiru » Tue May 13, 2008 5:33 pm

Stef wrote:Haaa so nothing to do with division O_o ?
Actually, I didn't understand it completely. When I had problem with division, it was problem exactly with division. But at the time no compilation errors occurs if libgcc.a was not linked. Now if I remove libgcc.a from project, I get compilation error.
Stef wrote: volatile u16 *pw;
u16 vdp_state;
Yes, I do that everywhere, as Fonzie said me and as I saw in your code.

EricM
Newbie
Posts: 3
Joined: Fri May 23, 2008 8:23 pm
Location: France - Lille
Contact:

Post by EricM » Fri May 23, 2008 9:34 pm

hi there (I hope I'm not in the wrong place)

I am here because I appreciate all the things you do 8) and because I want to code something on this machine héhé

In fact, I've coded some demos on amiga500/1200 and want to "port": recode, redraw my aga game on megadrive (lot of work :o )

For instance, I've installed stef kit and want to know if in C code I can insert some inline asm code and of course how ;) (I'm using stef devkit + elipse)

It'll take a long time for me to show something because of work and house and ... but I really want to do something

see you and continue your great work

Eric


ps : on amiga I always used trashmone and on mac ppc I used codewarrior both "all in one" even dams on cpc. I'm a bit confuse with the differents module like editor, compiler, ... so don't worry if I ask you some "strange" questions :)
ps1 : je suis moins pire en asm qu'en C lol

Edge-`
Interested
Posts: 39
Joined: Sun Dec 10, 2006 3:26 am

Post by Edge-` » Sat May 24, 2008 12:29 am

I'm fairly sure GCC supports the asm keyword. Another alternative is to put your assembly code into a .asm or .s file and compile and link it, and then in your C code just extern in your variables and / or functions.

Some of the other guys, especially Stef might have a better and for sure suggestion. Welcome to Genesis / Megadrive coding!
Genny Wars (Someday.. :D)

Stef
Very interested
Posts: 3034
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Sun May 25, 2008 9:14 pm

EricM wrote:hi there (I hope I'm not in the wrong place)

I am here because I appreciate all the things you do 8) and because I want to code something on this machine héhé

In fact, I've coded some demos on amiga500/1200 and want to "port": recode, redraw my aga game on megadrive (lot of work :o )

For instance, I've installed stef kit and want to know if in C code I can insert some inline asm code and of course how ;) (I'm using stef devkit + elipse)

It'll take a long time for me to show something because of work and house and ... but I really want to do something

see you and continue your great work

Eric


ps : on amiga I always used trashmone and on mac ppc I used codewarrior both "all in one" even dams on cpc. I'm a bit confuse with the differents module like editor, compiler, ... so don't worry if I ask you some "strange" questions :)
ps1 : je suis moins pire en asm qu'en C lol
Welcome to the board, i'm always pleased to see new member =)

You can interleave ASM and C code with the 'asm("<asm_code>")' stuff :

Code: Select all

  {
     ..
     asm("nop");
     ..
  }
You can have an idea by looking into the joy.c file from the devkit.
Another possibility is to use your own asm file with .s extension as the sega.s header file.

Port amiga demos won't be an easy task, megadrive video hardware doesn't have bitmap mode, you'll have to deal with tiles ;)
Good luck !

EricM
Newbie
Posts: 3
Joined: Fri May 23, 2008 8:23 pm
Location: France - Lille
Contact:

Post by EricM » Mon May 26, 2008 9:32 am

thanks a lot guys

@stef > I just want to convert my aga game ;). I know the work I'll have to do and I'm reading all the docs I can

thanks for your work

tails92
Interested
Posts: 41
Joined: Sun May 04, 2008 10:16 pm

Post by tails92 » Tue May 27, 2008 3:47 pm

how new is it? are people still developing for the amiga?
The AGA chipset does 256-color in non-HAM mode as far as I know, while the genesis has only 64, so you either need to use raster effects and highlight and shadow to give the impression of more than 64 colors, or you convert the graphics to the less colorful 64 colors.
The colors you can choose for the palette are also much less on the genesis, 512.
I'm converting a game from PC to Megadrive and it's being a bit difficult as I have to fake some layers and I've to fake more colours.

EricM
Newbie
Posts: 3
Joined: Fri May 23, 2008 8:23 pm
Location: France - Lille
Contact:

Post by EricM » Wed May 28, 2008 8:35 am

hi

It will not be a port but an adaptation ;)

for instance, I want to learn coding on this machine. Then, I think I make a version 2 of my game with specific graphics for genesis

Once the game will be playable, maybe someone here could help me with graphics :wink:

see you

ps : warning I am very slowwww :wink:

TmEE co.(TM)
Very interested
Posts: 2392
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Wed May 28, 2008 12:50 pm

I'm certainly looking forward to it, and if you need a sound engine, don't hesitate to ask me (I've made a pretty nice one for MD) :)
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

TotOOntHeMooN
Interested
Posts: 38
Joined: Sun Jun 01, 2008 1:12 pm
Location: Lyon, France
Contact:

Post by TotOOntHeMooN » Sun Jun 01, 2008 1:25 pm

Hello everybody ! :)

I'm new and beginer on Genesis.
I would like to understand how programming work.
I love to hack hardware. Here my little blog about Megadrive : (french)
http://www.gamekult.com/blog/totoonthem ... l?cat=9406

tails92 wrote:The AGA chipset does 256-color in non-HAM mode as far as I know, while the genesis has only 64 [...] The colors you can choose for the palette are also much less on the genesis, 512.
Why not using the 32X video capacity ? :idea:

TmEE co.(TM)
Very interested
Posts: 2392
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Sun Jun 01, 2008 3:50 pm

Because 32X is not too easy to manage at decent speed ?
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

Chilly Willy
Very interested
Posts: 2844
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Sun Jun 01, 2008 3:56 pm

You can use the 32X video without using the 32X CPUs. Devster does that with his BASIC compiler. You'll find an example of using the 32X video from the Genny-side over at his site.

TotOOntHeMooN
Interested
Posts: 38
Joined: Sun Jun 01, 2008 1:12 pm
Location: Lyon, France
Contact:

Post by TotOOntHeMooN » Sun Jun 01, 2008 4:21 pm

Thank you for this information.
I hope that 32X RAM, Video and Sound cababilities will be added to a next version of GenesisDev. :D

EDIT :
I have just finish to read all posts about "Super VDP".
THE project ! 8)

TmEE co.(TM)
Very interested
Posts: 2392
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Sun Jun 01, 2008 8:45 pm

You have some pretty nice HW stuff in your blog !!! Too bad I don't understand French...
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

Post Reply