What programming language was Super Mario Bros. written in?

  • Super Mario Bros. is definitely the most famous videogame created yet, selling a scorching 40.23 million copies. http://en.wikipedia.org/wiki/List_of_best-selling_video_games

    What programming language was it written in? Does anyone have some original code reference?

    I get the feeling a lot of the old NES games were written in machine-specific assembly.

    Not a duplicate, as this one asks for specific code samples from a specific game.

    I don't see the value in having many "What language was X written in?" questions, no matter how notable X is, unless it was notable because of the development platform. Also, it's asking for specific code samples of a game still under copyright (and still being sold) with no intentional source availability.

    @joe wreschnig: as far as i know one has every right to disassemble a bought game. Just as having the right to break your ferrari down to every last bolt. I think this whole process of figuring the code out might be very educational.

    @Toad: Yes, but you generally don't have the right to post it online, or to download a copy (even if you own the game yourself), or to make derivative works based off your own reading of the code.

    @Toad: disassemble it as you wish, but this doesn't mean you have the *original* code, only a disassembled version of the compiled code.

    @lo'oris: In this case, probably it was created in assembly anyway. So the dissasembled code and the original macro assembler should not be that off.

    Voting to close, as questions about what technology a particular game used are now off topic.

    @user744: you are assuming that "the game" sources hasn't been released. While it might be true in one specific instance (this), it would still be a valid question. Open source games exist, so asking about the sources of a specific game makes sense. The answer might be "it's closed source".

    "definitely the most famous" [citation needed]

  • 6502 Assembler

    Here is a forum page about hacking the ROM. http://forums.selectbutton.net/viewtopic.php?t=26956&sid=1a883209e1ba63877bcd58c007bb63ae

    It should contain any code references you need as well.

    A few posts down there is a link to a zip file that contains these items needed to edit/hack the game.

    • ca65 - a 6502 assembly compiler from http://www.cc65.org/
    • ld65 - a 6502 linker from http://www.cc65.org/
    • smbdis.asm - a comprehensive Super Mario Bros. disassembly
    • smb.chr - Super Mario Bros. graphics (character ROM data)
    • smb.hdr - Super Mario Bros. ROM header (iNES header)
    • MAKESMB.BAT - a batch file I made that automates the compilation process.
    • 6502jsm.doc - a summary of 6502 instructions.

    Wow, perfect answer! Kudos

    I'm confused by this answer myself. You're basically pointing to an executable (the ROM) and claiming that it was written in assembly... because it was disassembled. It's an executable; *of course it can be disassembled*. By this logic, every C/C++ program ever written was actually written in assembly. To prove that this was written in assembly, you need to actually show that *Nintendo wrote it* in assembly, not that you can disassemble the executable binary.

  • Almost all NES games were hand-written in 6502 assembly, the same as used in the Commodore 64, the Apple ][e, etc. The very few which were written in C had a reputation for being terribly slow because the NES is only 2Mhz and has 2Kb of onboard RAM (with an 8Kb window for the cartridge to patch more in). Careful assembly designed to take full advantage of the NES's peculiar architecture was much more effective.

    Stop and think about that... games like Super Mario Bros 3 and Kirby's Adventure ran on 2Mhz. Compare how rich they are to today's games which swallow gigahertz and hundreds of megabytes of RAM...

    @Lohoris I just logged in to up-vote that comment. And to my surprise, I already did

    What's an example of a licensed NES game that was written in C?

    [citation needed]

License under CC-BY-SA with attribution

Content dated before 6/26/2020 9:53 AM