Hey guys I'm new and I got a couple of questions

Ask anything your want about Megadrive/Genesis programming.

Moderator: BigEvilCorporation

Ricky
Interested
Posts: 23
Joined: Tue May 22, 2012 10:09 am

Hey guys I'm new and I got a couple of questions

Post by Ricky » Tue May 22, 2012 10:23 am

Hi all, I just finished setting up SGDK with codeblocks and compiling my first hello world.

I'm pretty seasoned when it comes to C but I wanted to know how I could program for the genesis in ASM because I'd really love to learn.

Also, any reason why the gensmodk takes up 100% cpu when I run my programs? o_o

Thanks

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

Post by Stef » Tue May 22, 2012 12:39 pm

Hi Ricky,

Nice to see new guys there :)
You can use ASM as C with SGDK, the makefile handle them :) you just need .s extension to your file.
Have a look in the library source files to see the syntax, you have some assembly ones as this one :

http://code.google.com/p/sgdk/source/br ... bmp_ff_a.s

I think you have first to learn about the megadrive hardware itself (if you are not already familiar with).

Ricky
Interested
Posts: 23
Joined: Tue May 22, 2012 10:09 am

Post by Ricky » Tue May 22, 2012 12:46 pm

Stef wrote:Hi Ricky,

Nice to see new guys there :)
You can use ASM as C with SGDK, the makefile handle them :) you just need .s extension to your file.
Have a look in the library source files to see the syntax, you have some assembly ones as this one :

http://code.google.com/p/sgdk/source/br ... bmp_ff_a.s

I think you have first to learn about the megadrive hardware itself (if you are not already familiar with).
How do I learn MD hardware? I can't find good papers, but I've been reading the forum and I get little pieces here and there. You got any good sources to share? :)

I was reading about XGCC, what to do with that? Can it work with your devkit?

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

Post by Shiru » Tue May 22, 2012 3:41 pm

This is a must read, this and this will help too.

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

Post by Stef » Tue May 22, 2012 5:03 pm

Ricky wrote: How do I learn MD hardware? I can't find good papers, but I've been reading the forum and I get little pieces here and there. You got any good sources to share? :)

I was reading about XGCC, what to do with that? Can it work with your devkit?
Shiru gave you the best sources to learn MD hardware :)
Sega2F is a complete documentation leaked from official megadrive devkit.
gen-hw and genvdp are very good summary of the above document.

You don't need XGCC is you use SGDK (as you already have the compiler).

Ricky
Interested
Posts: 23
Joined: Tue May 22, 2012 10:09 am

Post by Ricky » Tue May 22, 2012 6:11 pm

Stef wrote: You don't need XGCC is you use SGDK (as you already have the compiler).
*facepalm* Thanks :)

sega16
Very interested
Posts: 251
Joined: Sat Jan 29, 2011 3:16 pm
Location: U.S.A.

Post by sega16 » Tue May 22, 2012 9:33 pm

Is is possible to use asm68k or something other than that awful gcc syntax for compiling an asm file I just do not like the gcc syntax.

Ricky
Interested
Posts: 23
Joined: Tue May 22, 2012 10:09 am

Post by Ricky » Tue May 22, 2012 10:54 pm

sega16 wrote:Is is possible to use asm68k or something other than that awful gcc syntax for compiling an asm file I just do not like the gcc syntax.
Ah yeah, what is that eh? At&T? I don't remember :? haven't touched ASM in so long. It's the one with the $ right?

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

Post by Chilly Willy » Tue May 22, 2012 10:54 pm

sega16 wrote:Is is possible to use asm68k or something other than that awful gcc syntax for compiling an asm file I just do not like the gcc syntax.
You would need an assembler that could produce files gcc is capable of dealing with. My own thought was to use vasm68k to make COFF files, then use OBJCOPY to convert COFF to ELF, and then you could link it into your project like normal.

Your other choice is to assemble the code to binary at a specific location, then use something like .incbin in gcc. That makes variables much harder to deal with, along with needing to assemble to a set address.

Ricky
Interested
Posts: 23
Joined: Tue May 22, 2012 10:09 am

Post by Ricky » Tue May 22, 2012 10:56 pm

Chilly Willy wrote:
sega16 wrote:Is is possible to use asm68k or something other than that awful gcc syntax for compiling an asm file I just do not like the gcc syntax.
You would need an assembler that could produce files gcc is capable of dealing with. My own thought was to use vasm68k to make COFF files, then use OBJCOPY to convert COFF to ELF, and then you could link it into your project like normal.

Your other choice is to assemble the code to binary at a specific location, then use something like .incbin in gcc. That makes variables much harder to deal with, along with needing to assemble to a set address.
Seems like a lot to deal with just to change syntax. I personally don't really mind, as long as I'm as low level as I can get.

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

Post by Chilly Willy » Tue May 22, 2012 11:06 pm

Hmm - actually, looking at the current vasm info, it DOES support ELF, so you should be able to assemble to ELF for direct linking in your project.

http://sun.hasenbraten.de/vasm/

Ricky
Interested
Posts: 23
Joined: Tue May 22, 2012 10:09 am

Post by Ricky » Wed May 23, 2012 2:09 am

Chilly Willy wrote:Hmm - actually, looking at the current vasm info, it DOES support ELF, so you should be able to assemble to ELF for direct linking in your project.

http://sun.hasenbraten.de/vasm/
Damn.. no Win binary :(
You guys recommend snASM68k?

Nemesis
Very interested
Posts: 791
Joined: Wed Nov 07, 2007 1:09 am
Location: Sydney, Australia

Post by Nemesis » Wed May 23, 2012 6:18 am

I'd strongly recommend, rather than reading the sega2f html or doc version, that you go with the proper scanned version we now have available:
http://nemesis.hacking-cult.org/MegaDri ... Manual.pdf

This is the exact same manual, just with a few pages that were missing from the old sega2f document, minus a lot of transcription errors and the woeful formatting.

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

Post by Chilly Willy » Wed May 23, 2012 7:20 am

Ricky wrote:
Chilly Willy wrote:Hmm - actually, looking at the current vasm info, it DOES support ELF, so you should be able to assemble to ELF for direct linking in your project.

http://sun.hasenbraten.de/vasm/
Damn.. no Win binary :(
You guys recommend snASM68k?
No, it's old and won't let you do anything but a 100% assembly binary. Look, your choices are limited: use gcc and it's odd syntax, build vbcc yourself, or use one of the standalone assemblers and put up with binary only.

Gigasoft
Very interested
Posts: 95
Joined: Fri Jan 01, 2010 2:24 am

Post by Gigasoft » Wed May 23, 2012 8:23 am

No, it's old and won't let you do anything but a 100% assembly binary.
No, that's incorrect. It supports COFF. Use the -l option.

Post Reply