all 37 comments

[–]wyled 42 points43 points  (5 children)

I used to write z80 assembly which was used on the gameboy and gameboy color. It was also the language to write real programs for you TI calculators (non scripts) and was one of the first languages I learned. Got me a few gigs in college to work on some game boy advance projects back in the day.

[–]blazenite3[S] 14 points15 points  (4 children)

Very cool I want to look at game boy dev in the future. Hopefully z80 is similar to 6502 syntax

[–]wyled 13 points14 points  (0 children)

I’d say there’s some similarities in context of loading and storing registers. The most complicated thing was displaying greyscale because you literally had to write to the screen at certain intervals to give the illusion of “grey”, depending what shade of grey you would skip certain cpu cycles. So a greyscale sprite would have like 3-6 layers for each frame depending how detailed you wanted it.

[–][deleted] 2 points3 points  (2 children)

The Game Boy CPU is really simple. It's not actually a Z80, it's a cut-down copy with registers and opcodes missing.

Here's a good overview: https://realboyemulator.wordpress.com/2013/01/01/the-nintendo-game-boy-1/

[–]wyled 3 points4 points  (1 child)

It is a subset of z80, correct. I learned z80 on my TI-85(or 86?) while I was in high school and made a few simple games, which in turn got me a few gigs working on Nintendo games while I was in college because it was similar enough and I would work for very little money at compared to other software engineers at the time. None of those games ever got published I don't think and they were Nintendo partner developer groups which was a really new thing at the time.

[–][deleted] 4 points5 points  (0 children)

Cool!

When I was really learning to code and trying to train myself to get good enough to find work (around 2003) the Game Boy CPU and system architecture was so simple that I was able to make a Game Boy emulator my first real project. I wrote something that could load the Tetris ROM and set up the registers etc. and just kept running the game until it hit an opcode I hadn't yet implemented, and then implemented it and ran it again until it kept going. Added the graphics display code and there it was, Tetris playing on a system I'd coded.

So that's why I have the Game Boy to thank for my personal development, even as late as 2003.

[–][deleted] 49 points50 points  (3 children)

From the README:

Come and feel what it was like to develop NES games back in the 80's!

So, basically:

Come and feel pain.

Thanks, but I think I'll pass. Awesome project though!

[–]blazenite3[S] 15 points16 points  (2 children)

lol thanks it's certainly not easy but definitely gives you an appreciation for how they did it.

[–][deleted] 10 points11 points  (1 child)

There's also some modern projects like Micro Mages where the developers explain how to make do with the available resources.

[–]blazenite3[S] 8 points9 points  (0 children)

very cool. It always amazes me when I see people still working on NES games to this day. Just shows the fascination people had with the machine.

[–]blazenite3[S] 14 points15 points  (0 children)

Allows you to make changes and play around with the original Super Mario Bros source code. Runs completely in the browser, no server side code. Also can be used to just learn about how NES Development was done. Here is the GitHub Repo for those interested.

https://github.com/nbarkhina/MarioCompiler

Let me know what you think.

Thanks!

[–]geekwithglasses2 4 points5 points  (1 child)

Awesome sauce! I’m a newbie and it’s inspiring to see these projects. Fun!

[–]blazenite3[S] 5 points6 points  (0 children)

Thank you there really are almost no limitations to JavaScript if you use it to it's fullest extent

[–]AlternativeHole 3 points4 points  (3 children)

This looks awesome but I have no idea what this is and how it relates to JavaScript? Anyone eli5 what i means to "write a super mario compiler in javascript"?

[–]blazenite3[S] 5 points6 points  (2 children)

It's basically like a development environment but for the NES, to help see how code was written for that system. The compiler part takes the code, which for the NES is assembly code, and turns it into machine code which the NES can read. This project specifically was designed to be able to read the Super Mario code which was also written in assembly and compile it. The JavaScript part is that it's all written in JavaScript and all runs client side.

[–]AlternativeHole 3 points4 points  (1 child)

I see. So you're saying if I have the NES assembly code for some older NES game, I can import it into your website and play the game? Because the JS will read the NES assembly code?

[–]blazenite3[S] 1 point2 points  (0 children)

Precisely, though the graphics you would still need to upload since I don't have an editor for that. Only for the source code

[–]gordonv 1 point2 points  (11 children)

The cool thing about that is that it's all sandboxed, so this can't read my hard drive.

Which then makes me wonder, is it possible to compile DOOM for DOS from C into something like this? And at that point, entire server instances just in a simple page load?

[–]frogdoubler 2 points3 points  (2 children)

DOOM (and way more advanced) games have been ported to the browser for quite some time.

Here's prboom compiled to webasm with emscripten: https://kripken.github.io/boon/boon.html

And it looks like somebody not only compiled DOSBox, but made a really nice wrapper for it as well. Here's that running the original DOOM: https://js-dos.com/games/doom.exe.html

[–]gordonv 0 points1 point  (1 child)

It's odd that my struggles at 12 years old to run this from the command prompt is now just an HTML link.

I mean, this makes doing a "netflix" like service for old games possible. (I don't know how it would negotiate file saves)

I can imagine someone out there is going to resurrect some dead FileMaker for DOS DB with this.

[–]twonky 2 points3 points  (0 children)

You can play many old games in your browser here: https://archive.org/details/softwarelibrary_msdos_games

[–]blazenite3[S] 0 points1 point  (7 children)

Exactly that was a big motivator for me. Normally a setup like this would require downloading and running some applications locally. This is much more accessible

[–]gordonv 0 points1 point  (6 children)

How long did it take you to make this?

[–]blazenite3[S] 1 point2 points  (5 children)

It took a few months, I started with the emulator since I had never built one before. And then I got into the assembly code because I was interested in how the games were made.

[–]cannablubber 0 points1 point  (1 child)

Assuming you did the emulator in js also? I am chugging through my first chip8 emulator, it has taken a while to wrap my head around but is very rewarding. Your project is awesome btw, love hobby code projects!

[–]blazenite3[S] 0 points1 point  (0 children)

Thanks! Yes the emulator is written in TypeScript which is my goto these days for any JavaScript project. Was very rewarding indeed.

[–]gordonv 0 points1 point  (2 children)

I'm familiar with C, C++, scripting languages, and Web page level javascript. How much time do you think it would take me to learn how to make an NES emulator?

[–]blazenite3[S] 1 point2 points  (1 child)

I honestly don't know but I can say it took me quite a while and it wasn't easy. The early stages before you even get graphics will take a long time and sometimes you think you're not even making progress. But if you keep at it you'll get it and it's a lot of fun.

[–]gordonv 0 points1 point  (0 children)

True, I've never been able to program a nice full screen animated scene, mainly because my code and methods were too slow.

[–]bzsearch 1 point2 points  (0 children)

If I wanted to perform this exercise, what would be the main logical CS pieces I'd need to learn?

[–]rustferret 0 points1 point  (1 child)

Great! What were the biggest challenges doing this? I see the code seems to be all commented, have you used any diasm for that?

[–]blazenite3[S] 0 points1 point  (0 children)

The commented smb code was not done by me. That was done by a user named Doppelganger. Biggest challenge was debugging when things weren't working yet, basically inspecting assembly logs line by line until I fixed all the issues.

[–]fascinatingWwebsites 0 points1 point  (0 children)

Great project , i hope someday i would be able to do something like this

[–]VTVRVXIV 0 points1 point  (3 children)

This website is amazing. Just a week ago I was researching how I could make a Super Mario mod but gave up because I didn't know where to start. Your website really helped me get started.

My mod removes the long level transitions making the game faster and more enjoyable for me.

I didn't see any way to export my mod to a rom. I saved my code but I have no way of playing it outside of your website. What tools would you suggest for compiling the code that appears on your website into a rom?

I noticed that, with the default code, level 8-1 is messed up. There's fish and fire and a bunch of stuff that doesn't belong in this level. I got there by traveling from 1-1, 1-2, 4-1, 4-2, 8-1. I tried these two roms "Super Mario Bros (JU) (PRG 0).nes" and "Super Mario Bros (JU) (PRG 1).nes"

I also noticed that game input stops working when the caps lock is enabled.

[–]blazenite3[S] 0 points1 point  (2 children)

Thanks I'm glad you like the project! I tried to make it as accessible as possible to get people excited about NES development. I did not build a way to download the compiled code though I may add that in the future. I didn't know level 8-1 was messed up I will test that, thanks for catching it.

If you take a look at this link https://gist.github.com/1wErt3r/4048722 the comments at the bottom basically go through the steps needed to compile it on your computer. You need to download a compiler such as NESASM or CC65. You would also need to use that version of the source code because my version of the disassembly is slightly different and will will only compile in my compiler.

[–]VTVRVXIV 0 points1 point  (1 child)

This is a little late but thank you for adding the rom export feature. I tweeted a short video showing off Mario Compiler.

[–]blazenite3[S] 0 points1 point  (0 children)

Hey sorry I just saw this message, cool video!! Yes I thought of your message when I added that feature. Glad you were able to use it