TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: NESFab – Programming language for making NES games

298 点作者 pubby大约 2 年前
This is a long-running personal project I&#x27;ve had to write an optimizing compiler from scratch. Everything was done by me, including the lexer&#x2F;parser, SSA-based IR, high-performance data structures, and code generator.<p>Originally I wasn&#x27;t targeting the NES. It started as a scripting language, then it morphed into a C++ replacement, and then finally I turned it into what it is today. The large scope of the project and colorful history means it&#x27;s still a little rough around the edges, but it&#x27;s now working well enough to post.

24 条评论

bmitc大约 2 年前
As someone trying to undertake some personal projects like this, I have a question. How do you keep motivated enough to work on this for so long and dedicatedly? As a solo developer, how did you manage things like getting stuck on technical issues that were either bugs out of your control or something you didn&#x27;t have the knowledge to know how to fix?
评论 #35059014 未加载
评论 #35058926 未加载
评论 #35064783 未加载
评论 #35058590 未加载
Taikonerd大约 2 年前
This is a really interesting approach. One thing that surprised me from the code snippet:<p><pre><code> fn play_sound() {$4015}(%100) {$4008}($FF) </code></pre> Are these hard-coded memory addresses meaningful to NES devs? I&#x27;m surprised that they don&#x27;t have more readable aliases, like $SOUND_ROM_BASE_ADDR or whatever.
评论 #35057676 未加载
评论 #35057571 未加载
mungoman2大约 2 年前
I have long dreamed of a language for 8-bit computers&#x2F;consoles with a compiler that helps scheduling routines.<p>For example, let&#x27;s say I have a short snippet of code that needs to run every H blanking period. I should just declare something like<p>@every_hblank Blabla_code()<p>Or scheduling some code for X pixels into a line.<p>Actual scheduling can be done however the compiler wants to, using interrupts or inserting dummy instructions for delays.<p>I guess in the end it&#x27;s a constraint problem to solve where all these snippets fit in.<p>I imagine this makes it easier to write games&#x2F;special effects as you remove the tricky cycle counting. Easier, but maybe less fun...
评论 #35062598 未加载
russellsprouts大约 2 年前
Just read through the documentation. There are so many great ideas for generating efficient code. `goto mode` in particular is an awesome idea. Generalizing the program to have multiple &quot;entry&quot; points and overlapping their global variables to save RAM, I&#x27;ve never heard of that technique before.<p>The inline assembly integration looks nice too -- accessing the arguments and return address as fields on the function makes a lot of sense.
leroy-is-here大约 2 年前
I didn’t take a deep dive, but I’m interested in how you keep the binary size small. Is it simply that LLVM, etc., all have too much function overhead and don’t take advantage of routines over subroutines (function calls)? Or is your back-end just specialized enough to take advantage of architecture-specific features the larger compiler suites don’t have the time to care about?<p>Anyway, this looks dope. Truthfully, we could use more hyper-specific languages like this in all sorts of areas.
评论 #35060805 未加载
pkaye大约 2 年前
You should make a link to the examples directory prominent on the webpage so others get an quick idea of the language features.
lastdong大约 2 年前
Congrats on the release! Website and code look super clean, and looks like super useful for anyone getting into NES game development.<p>- What languages did you use as inspiration?<p>- Is it possible to write a game to a physical cartridge and play it on a real snes?<p>Thanks for sharing your amazing work!
Timwi大约 2 年前
Out of curiosity, why did you disallow tabs for indentation, and &#x2F;<i>...</i>&#x2F;-style comments in the middle of a line?
评论 #35067098 未加载
foldor大约 2 年前
Really cool stuff! Is there an syntax highlighter available on any IDE&#x27;s like VSCode available? I&#x27;m having a hard time following the documentation without it as it&#x27;s hard for me to know what is a keyword and what is a variable for example. Single letter types can be hard for me to follow, but I can definitely appreciate their style.<p>Nice work.
terrycody大约 2 年前
Hey I think a lot of nostalgic people sometimes want to hack the game ROMs instead of making a new one. For example, they may want to add more characters, use enemy roles, add more skills and fun things, does your programming language can also provide such purposes?
hunta2097大约 2 年前
I got a Windows Defender alert when downloading the Windows binary:<p>Detected: Trojan:Script&#x2F;Wacatac.H!ml<p>Status: Removed<p>Details: This program is dangerous and executes commands from an attacker.
评论 #35060875 未加载
apple4ever大约 2 年前
This is awesome! I&#x27;m currently learning programming NES in assembler with FamicomParty[0], and this look like a great next step!!<p>0. <a href="https:&#x2F;&#x2F;famicom.party" rel="nofollow">https:&#x2F;&#x2F;famicom.party</a>
jonny_eh大约 2 年前
&gt; Handling banks is normally a tedious affair for programmers, but NESFab handles it for you. The compiler smartly allocates code and data into banks, with the gritty details abstracted away.<p>Killer feature, but is there a cost to bank switching? Could abstracting it result in a lot of performance cost?
评论 #35062268 未加载
a_e_k大约 2 年前
Nice work! Pubby, it looks like the markdown for the documentation goes off the rails in 12.3.
warpspin大约 2 年前
Pretty cool project. While I never did NES games, I did assembler on the C64 for a while. The language alone minus the NES parts would already have been super useful back then at least for the high level parts of the programs I wrote.
agentultra大约 2 年前
This is very cool. I had wanted to do a project like this once. Nice work!
nubinetwork大约 2 年前
Its nice that people are still writing code for the NES, but I have to ask what makes this better than using ca65... assembly isn&#x27;t hard to learn.
评论 #35057902 未加载
AdmiralAsshat大约 2 年前
Does this language have support for being able to save the game&#x27;s state into a simulated battery a la Legend of Zelda&#x2F;Metroid?
评论 #35059184 未加载
评论 #35062877 未加载
stehtisch123大约 2 年前
Awesome! Is it hard&#x2F;possible to put the finished game on a cartridge or do you play it with an emulator?
tibbon大约 2 年前
Not to increase your scope, but have you considered making it work across other 6502 systems?
评论 #35057170 未加载
评论 #35059388 未加载
nunobrito大约 2 年前
It is looking fantastic. Great work!
dom96大约 2 年前
Really cool but shouldn&#x27;t this actually be a library rather than a programming language?
评论 #35064194 未加载
评论 #35059453 未加载
algem大约 2 年前
this is really cool, thanks for sharing.
benj111大约 2 年前
Why spaces and not tabs for indents?<p>I know this conversation has probably been had many times before. But if I prefer a 2 space tab, and you prefer a 4 space tab, we both get them how we want them with tabs.<p>With spaces, I have to put up with your stupidly wide indents, and try not to scratch my eyes out from the pain.
评论 #35057462 未加载
评论 #35057475 未加载
评论 #35057296 未加载
评论 #35057310 未加载
评论 #35062019 未加载
评论 #35057692 未加载