Page 1 of 2

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

Posted: Tue May 22, 2012 10:23 am
by Ricky
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

Posted: Tue May 22, 2012 12:39 pm
by Stef
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).

Posted: Tue May 22, 2012 12:46 pm
by Ricky
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?

Posted: Tue May 22, 2012 3:41 pm
by Shiru
This is a must read, this and this will help too.

Posted: Tue May 22, 2012 5:03 pm
by Stef
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).

Posted: Tue May 22, 2012 6:11 pm
by Ricky
Stef wrote: You don't need XGCC is you use SGDK (as you already have the compiler).
*facepalm* Thanks :)

Posted: Tue May 22, 2012 9:33 pm
by sega16
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.

Posted: Tue May 22, 2012 10:54 pm
by Ricky
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?

Posted: Tue May 22, 2012 10:54 pm
by Chilly Willy
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.

Posted: Tue May 22, 2012 10:56 pm
by Ricky
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.

Posted: Tue May 22, 2012 11:06 pm
by Chilly Willy
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/

Posted: Wed May 23, 2012 2:09 am
by Ricky
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?

Posted: Wed May 23, 2012 6:18 am
by Nemesis
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.

Posted: Wed May 23, 2012 7:20 am
by Chilly Willy
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.

Posted: Wed May 23, 2012 8:23 am
by Gigasoft
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.