Page 1 of 1

Problems with running a .bin with MESS

Posted: Sun Sep 01, 2013 2:57 pm
by MihajelPetrovic
Hello everyone,
I am new here and recently I decided to start learning Sega Genesis programming as a hobby since it's my favorite console since childhood. I study programming and I use C and Java, we did some asm but we never really got that into it.

I've been following the guides from this blog: http://bigevilcorp.wordpress.com and I downloaded the files of part 5 but I can't get it to run on an emulator.

The assembler I got is SN 68k version 2.53 and I am running Windows 7, 64 bit. When I download and extract MD_TextTest.zip from http://bigevilcorp.wordpress.com/2012/04/ there's 6 .asm files and 1 folder that has one of the .asm's, I place them all in a folder where's asm68k.exe and run the .exe. Of those 6 .asm files, the one named "hello.asm" has the following lines on top:

Code: Select all

include 'init.asm'
include 'globals.asm'
include 'text.asm'
So I expect that after I run in cmd: >asm68k.exe hello.asm,hello.bin to all of the rest of the .asm's that it needs, as the hello.bin will be the rom that should be played by an emulator, right? It's kinda new to me so it confuses me. It does says: Assembly completed. 1021 lines, which is more than what hello.asm alone has.

When I try to run that .bin with MESS, I get:
Image

What am I doing wrong here?

Posted: Sun Sep 01, 2013 9:03 pm
by notaz
Looks like a MESS bug to me, have you tried a different emulator?

Posted: Sun Sep 01, 2013 11:55 pm
by MihajelPetrovic
Yes, I tried Fusion but it says "Genesis Shutdown. Warning: Checksum incorrect!"

Posted: Sun Sep 01, 2013 11:58 pm
by TascoDLX
By default, ASM68K tacks on a small header that throws everything out of whack.

Try this instead:

Code: Select all

asm68k.exe /p hello.asm,hello.bin

Posted: Mon Sep 02, 2013 12:30 am
by MihajelPetrovic
Just tried it and it gives same result.
Can somebody try to compile and run the file please?

I am also interested in what the include instruction does. If you put 'include abc.asm' on top of some .asm, will the content of abc.asm be the one that is first executed when you compile and run .bin?

Edit: I just ran it through Fusion and it worked. It gives the same error though, but it may be the thing with initialization.
Image
Thank you.

Posted: Mon Sep 02, 2013 2:01 am
by frederic
MihajelPetrovic wrote:I am also interested in what the include instruction does. If you put 'include abc.asm' on top of some .asm, will the content of abc.asm be the one that is first executed when you compile and run .bin?
"include" is a directive that is interpreted by the assembler (ie by asm68k), not by the Megadrive. It's not an instruction that is part of the 68000's instruction set. You can replace 'include abc.asm' by the lines contained in the abc.asm file, and you will end up with the exact same binary code (ie the .bin file that will be executed by the Megadrive). A basic assembler may not provide such a directive, though most (if not all) do provide it. It's there to make the job of the programmer easier. This directive is described in the documentation of asm68k, see http://birg.cs.wright.edu/ceg320/simula ... page.shtml. See also http://en.wikipedia.org/wiki/Assembly_l ... directives about assembly directives in general.

The process of transforming assembly code into binary code is rather called "assembling" than "compiling", even though it is common to use the term "compiling".
MihajelPetrovic wrote:Edit: I just ran it through Fusion and it worked. It gives the same error though, but it may be the thing with initialization.
That's just Fusion warning you that the checksum of your ROM is not correct. See http://en.wikibooks.org/wiki/Genesis_Pr ... g#Checksum. You can ignore this warning.

Posted: Mon Sep 02, 2013 2:32 am
by TascoDLX
Looks like something got changed in MESS v0.149. It works fine in v0.148u1, but the new version expects the ROM to be at least 8KB. Just pad it out with zeroes and it'll work fine.

Posted: Mon Sep 02, 2013 5:27 am
by MihajelPetrovic
Thanks for all of the info guys.