Show HN: NES Contra (1987) port (ASM –> C and then C –> WebAssembly)
Based on vermiceli's annotated disassembly of Contra: https://github.com/vermiceli/nes-contra-us. Thanks for the great work.I ported it in two steps. First to C: the game logic is translated routine by routine from the 6502 assembly, and checked frame by frame against the original in the Mesen emulator. Then the C code to WebAssembly so it runs in the browser.The cherry on top: online multiplayer, so two players can play co-op over the internet.Source: https://github.com/epoyraz/nes-contra-us
83 points by tevlon - 57 comments
The whole thing (all banks) is more than 10,000 lines of assembly code. When I wrote assembly code for a university computer science course, it was hard to manage even 200 lines. I cannot imagine writing and managing 10,000 lines!
But I agree, that using an "AI" tool may be a serious temptation and thus way less new porting projects will be done with such care.
When someone commissions a painting, or a sculpture, they might cut the ribbon that holds the curtain on the opening day, that is all.
I hadn’t heard about that - any details?
I used it to get games written in Lua running on SNES and in my own language/engine running on Dreamcast, Wii, Web and more.
Are there any emulators out there that let you swap in higher resolution assets so a game can be freshened without a complete port?
https://store.steampowered.com/app/1147940/3dSen_PC
The NES supports PCM audio. It was notably implemented wrong in the title screen of Double Dribble and fixed with a patch that produces clearer audio after bit reversal into the correct encoding for the hardware:
https://www.youtube.com/watch?v=Jli0RGpuZDg
Edit: For SNES, not NES, my bad.
For AI usage: It was all done by Claude/Codex, but it wasn't that straight forward. First: i started in April and the models weren't good enough and would make errors. You could see those immediately in glitches. Then, i spent some time in building a harness and collect telemetry data in Mesen. Once, i had that: i just played the game in the emulator and asked Claude Opus 5.5 to use this as verification. The rest was smooth.
You sure you're a gamer? I've been at it since about 1986.
I do think you're objectively correct in your post, but I think what the grandparent meant was that "The author isn't actually interested in playing Contra on his website" which is why QoL stuff like that wasn't added and it "smells" like it should be there if you cared about playing on the thing you actually shared to HN. I know the first thing I would do would be to add wasd + mouse support to Contra, since the control scheme is the reason I don't try to play it. But at the same time I have never been interested in games that deliberately limit your controls as a form of difficulty (feels like a Japanese gamedev thing, from Resident Evil to Dark Souls)
edit: figured out why that nostalgia happened. I was revisiting an old flash game I liked [0] and people were complaining to the dev about this exact key ghosting issue to him when it wasn't his fault but a fault of their keyboards, and in the Newgrounds description he links to a forum post [1] elaborating on the issue
[0] https://www.newgrounds.com/portal/view/547881
[1] https://board.flashkit.com/board/showthread.php?789015-wont-...