News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Help with ASM6  (Read 1174 times)

szemigi

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
Help with ASM6
« on: March 07, 2019, 06:50:43 pm »
Hello!
As a test, I typed "asm6 smbdis.asm", then the programme spitted out a SMBDIS.BIN file.

What to do with it? Because I'm fed up that I'm unlucky in this NES compiling thing. :banghead:


Somebody write me down how exactly this works!

Disch

  • Hero Member
  • *****
  • Posts: 2814
  • NES Junkie
    • View Profile
Re: Help with ASM6
« Reply #1 on: March 07, 2019, 07:37:16 pm »
Quote
What to do with it?

Depends what was in the asm file you had.

Assuming this is the same version of the doppleganger SMB disassembly that I have a copy of, this looks to be just the PRG for the game.  Meaning it's not QUITE a full ROM, but it is most of the ROM.

You'll need both the header and the CHR (graphics), slap those together with this BIN file, and then you'll have a ROM you can run in an emu.

Quote
Somebody write me down how exactly this works!

asm files have human-readable code.  Assemblers (like asm6) take that code and transform it into a "binary".  "Binaries" are not really human readable, but machines (and emulators) can read them quite easily when you format them properly.

NES ROMs consist of 3 basic parts:
1)  A 16 byte header    (offset 0x00000 to 0x0000F in SMB)
2)  A bunch of PRG data  (offset 0x00010 to 0x0800F in SMB)
3)  A bunch of CHR data  (offset 0x08010 to 0x0A00F in SMB)

"PRG" data is game code and data and stuff.  CHR is typically just graphics but VERY OCCASIONALLY also has some data in it.

If you assembled the doppleganger SMB disassembly, you have the PRG (#2).  If you want to turn this into a ROM, one way would be to open both your .bin file and a ROM in a hex editor, and copy/paste the entire bin file into the ROM (not at the end of the ROM, but paste it so it replaces the ROM's existing PRG).

A better way is to extract the header and CHR from a ROM and have them as separate bin files.  Then create a batch file to both assemble the .asm file and tie together the ROM from the various parts.

An example batch file might look like this:
Code: [Select]
asm6 smbdis.asm
copy /B header.bin+smbdis.bin+chr.bin myhack.nes

(write this up in your text editor of choice, then rename it to "build.bat" or something)

The "copy" command here will tie all the pieces together for you.  And the asm6 line will run the assembler to produce your PRG binary.  This means that whenever you make any changes to the assembly, all you have to do is run this batch file and it'll produce a full ROM that you can use.

szemigi

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
Re: Help with ASM6
« Reply #2 on: March 07, 2019, 08:33:09 pm »
So once I get the bin file, I must paste the entire bin file into an original ROM file? That's all?

Disch

  • Hero Member
  • *****
  • Posts: 2814
  • NES Junkie
    • View Profile
Re: Help with ASM6
« Reply #3 on: March 07, 2019, 10:35:09 pm »
Yes.  Or build the ROM with that "copy" command by plugging together the 3 individual pieces.  Either one will work.