-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnes-homebrew-source-code.html
More file actions
12 lines (12 loc) · 11 KB
/
nes-homebrew-source-code.html
File metadata and controls
12 lines (12 loc) · 11 KB
1
2
3
4
5
6
7
8
9
10
11
12
<!DOCTYPE html><html lang="en-gb"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>NES Homebrew Source Code - Nesrocks</title><meta name="description" content="As I'm making my PC game Super Hiking League, sometimes I need a break. Recently, it's been in the form of translating some of its elements into a NES homebrew program. I can't call it a game yet, as there's very little going on gameplay-wise."><meta name="generator" content="Publii Open-Source CMS for Static Site"><link rel="canonical" href="https://nesrocks.github.io/nes-homebrew-source-code.html"><link rel="alternate" type="application/atom+xml" href="https://nesrocks.github.io/feed.xml" title="Nesrocks - RSS"><link rel="alternate" type="application/json" href="https://nesrocks.github.io/feed.json" title="Nesrocks - JSON"><meta property="og:title" content="NES Homebrew Source Code"><meta property="og:image" content="https://nesrocks.github.io/media/website/main_admin_avatar.png"><meta property="og:image:width" content="184"><meta property="og:image:height" content="184"><meta property="og:site_name" content="Nesrocks"><meta property="og:description" content="As I'm making my PC game Super Hiking League, sometimes I need a break. Recently, it's been in the form of translating some of its elements into a NES homebrew program. I can't call it a game yet, as there's very little going on gameplay-wise."><meta property="og:url" content="https://nesrocks.github.io/nes-homebrew-source-code.html"><meta property="og:type" content="article"><link rel="stylesheet" href="https://nesrocks.github.io/assets/css/style.css?v=b9c13d70183586570330f9e09da4155b"><script type="application/ld+json">{"@context":"http://schema.org","@type":"Article","mainEntityOfPage":{"@type":"WebPage","@id":"https://nesrocks.github.io/nes-homebrew-source-code.html"},"headline":"NES Homebrew Source Code","datePublished":"2025-09-17T09:19-03:00","dateModified":"2025-09-17T09:19-03:00","image":{"@type":"ImageObject","url":"https://nesrocks.github.io/media/website/main_admin_avatar.png","height":184,"width":184},"description":"As I'm making my PC game Super Hiking League, sometimes I need a break. Recently, it's been in the form of translating some of its elements into a NES homebrew program. I can't call it a game yet, as there's very little going on gameplay-wise.","author":{"@type":"Person","name":"Nesrocks","url":"https://nesrocks.github.io/authors/nesrocks/"},"publisher":{"@type":"Organization","name":"Nesrocks","logo":{"@type":"ImageObject","url":"https://nesrocks.github.io/media/website/main_admin_avatar.png","height":184,"width":184}}}</script><noscript><style>img[loading] {
opacity: 1;
}</style></noscript></head><body class="post-template"><header class="top js-header"><a class="logo" href="https://nesrocks.github.io/"><img src="https://nesrocks.github.io/media/website/main_admin_avatar.png" alt="Nesrocks" width="184" height="184"></a><nav class="navbar js-navbar"><button class="navbar__toggle js-toggle" aria-label="Menu" aria-haspopup="true" aria-expanded="false"><span class="navbar__toggle-box"><span class="navbar__toggle-inner">Menu</span></span></button><ul class="navbar__menu"><li><a href="https://nesrocks.itch.io/naw" target="_self">NAW (itch.io)</a></li><li><a href="https://store.steampowered.com/app/915850/Super_Hiking_League_DX/" target="_self">Super Hiking League (Steam)</a></li><li><a href="https://nesrocks.github.io/tutorial-series-for-simulating-nes-graphics.html" target="_self">NES Graphics Tutorials</a></li><li><a href="https://nesrocks.github.io/about.html" target="_self">About</a></li></ul></nav></header><main class="post"><article class="content"><div class="hero hero--noimage"><header class="hero__content"><div class="wrapper"><h1>NES Homebrew Source Code</h1><div class="feed__meta content__meta"><a href="https://nesrocks.github.io/authors/nesrocks/" class="feed__author">Nesrocks</a> <time datetime="2025-09-17T09:19" class="feed__date">September 17, 2025</time></div></div></header></div><div class="entry-wrapper content__entry"><p>As I'm making my PC game Super Hiking League, sometimes I need a break. Recently, it's been in the form of translating some of its elements into a NES homebrew program. I can't call it a game yet, as there's very little going on gameplay-wise.</p><p>Still, it was quite an achievement for myself to get something not only being displayed on screen, but with interactivity resembling a videogame! So I decided to share this as an out-of-the-box, 100% portable, working project that compiles a NES ROM with graphics, screen transitions, music and interactivity. It is for Windows only, and since it uses the graphics from Super Hiking League, it is for educational purposes only, unless stated otherwise. Look in the license.txt file for more info on this.</p><figure class="aligncenter size-full wp-image-413"><img loading="lazy" src="http://nesrocks.com/blog/wp-content/uploads/2018/05/gamename-1.gif" alt="" width="512" height="480" data-is-external-image="true"></figure><p>By running the batch file, it generates a NES Mapper 3 ROM with 2 16k PRG banks and 8 8k CHR banks, with vertical mirroring. You can edit these settings on the nes.cfg and header.asm files in the system folder, provided you know what you are doing. Included in the zip are the ca65.exe and ld65.exe programs required by the batch file. So hopefully, absolutely no configuration is required. Just unzip the folder and run the batch!</p><p>I feel like not many working projects such as this are available out there, so here it is! The code is all in assembly language. Use any text editor for the files. The main file is "main.asm" in the src folder. Disclaimer: the code comes from an unexperienced NES developer who's just really happy that it works, so you may use it to try things out, but do not take it as an example of good coding practices, as I'm pretty sure it's far from that!</p><p></p><h5>List of features:</h5><p>- It works! yay!<br>- It displays graphics!<br>- Graphics are in CHR format (compatible with yy-chr and Nes Screen Tool). In the case of NST, save the 8k file.<br>- Palettes! (compatible with yy-chr). NST palettes will not work as is, but it should be easy to convert the palette reading section for that format.<br>- Uncompressed nametables! (compatible with yy-chr and NST). Nametables must contain attributes at the end of the file.<br>- Chr switching!<br>- Controller works! The player reacts. You can jump (height is controllable), and you can move left/right.<br>- Rudimentary Scrolling! The screen will scroll showing nametable 2 and it will wrap around seamlessly to nametable 1.<br>- No tile collision! The ground is hardcoded.<br>- Metasprites!<br>- Game states!<br>- Sprite flickering!<br>- Probably horrible coding! But it works out of the package, so that is a plus. I'm still a terrible asm programmer, so do not learn from my code, please!</p><h5>Recommended tools:</h5><p>- <a href="https://www.sublimetext.com/3" target="_blank" rel="noopener noreferrer">Sublime Text 3</a><br>- <a href="https://www.romhacking.net/utilities/119/" target="_blank" rel="noopener noreferrer">YY-CHR</a><br>- <a href="https://shiru.untergrund.net/software.shtml" target="_blank" rel="noopener noreferrer">Shiru's Nes Screen Tool</a><br>- <a href="http://hertzdevil.info/programs/" target="_blank" rel="noopener noreferrer">Famitracker</a></p><h5>Sublime Text 3</h5><p>A Sublime Text 3 project is provided, but not necessary. If you use it though, there are some advantages:<br>I have provided a syntax highlight file, modified from a nice one I found online called "ASM 6502 (xkas-plus)".<br>This helps writing code in ASM by highlighting code, data, etc.<br>Copy both ASM and USER folders to ST3's package folder. You can find it going to preferences, browser packages.<br>Then it will not only show the new syntax, but also compile the code directly from ST3 and run the game in the end<br>just by pressing F5!</p><p>[download id="1025"]</p><p>I hope you enjoy this example and that it helps you get started on writing assembly for the NES.</p><p>- Nesrocks<br>2018</p></div><footer class="content__footer"><div class="entry-wrapper"><p class="content__updated">This article was updated on September 17, 2025</p><div class="content__actions"><div class="content__share"><button class="btn--icon content__share-button js-content__share-button"><svg width="20" height="20" aria-hidden="true"><use xlink:href="https://nesrocks.github.io/assets/svg/svg-map.svg#share"></use></svg> <span>Share It</span></button><div class="content__share-popup js-content__share-popup"><a href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fnesrocks.github.io%2Fnes-homebrew-source-code.html" class="js-share facebook" rel="nofollow noopener noreferrer"><svg class="icon" aria-hidden="true" focusable="false"><use xlink:href="https://nesrocks.github.io/assets/svg/svg-map.svg#facebook"/></svg> <span>Facebook</span> </a><a href="https://twitter.com/intent/tweet?url=https%3A%2F%2Fnesrocks.github.io%2Fnes-homebrew-source-code.html&via=%40bitinkstudios&text=NES%20Homebrew%20Source%20Code" class="js-share twitter" rel="nofollow noopener noreferrer"><svg class="icon" aria-hidden="true" focusable="false"><use xlink:href="https://nesrocks.github.io/assets/svg/svg-map.svg#twitter"/></svg> <span>Twitter</span></a></div></div></div><div class="content__bio bio"><div><h3 class="h4 bio__name"><a href="https://nesrocks.github.io/authors/nesrocks/" rel="author">Nesrocks</a></h3></div></div></div><nav class="content__nav"><div class="wrapper"><div class="content__nav-inner"><div class="content__nav-prev"><a href="https://nesrocks.github.io/adventure-island-hack.html" class="content__nav-link" rel="prev"><div><span>Previous</span> Adventure Island Hack</div></a></div><div class="content__nav-next"><a href="https://nesrocks.github.io/freebie-nes-tileset.html" class="content__nav-link" rel="next"><div><span>Next</span> Freebie NES tileset</div></a></div></div></div></nav></footer></article></main><footer class="footer footer--glued"><div class="wrapper"><div class="footer__copyright"><p>Powered by Publii</p></div><button id="backToTop" class="footer__bttop" aria-label="Back to top" title="Back to top"><svg width="20" height="20"><use xlink:href="https://nesrocks.github.io/assets/svg/svg-map.svg#toparrow"/></svg></button></div></footer><script defer="defer" src="https://nesrocks.github.io/assets/js/scripts.min.js?v=700105c316933a8202041b6415abb233"></script><script>window.publiiThemeMenuConfig={mobileMenuMode:'sidebar',animationSpeed:300,submenuWidth: 'auto',doubleClickTime:500,mobileMenuExpandableSubmenus:true,relatedContainerForOverlayMenuSelector:'.top'};</script><script>var images = document.querySelectorAll('img[loading]');
for (var i = 0; i < images.length; i++) {
if (images[i].complete) {
images[i].classList.add('is-loaded');
} else {
images[i].addEventListener('load', function () {
this.classList.add('is-loaded');
}, false);
}
}</script></body></html>