Back in 2022, I promised I’d get back to you on the topic of macros versus subroutines. Sorry for the delay, but here it is! This posts recaps the last time I wrote about macros, then shows you how to use subroutines as an alternative.
Assembly 101
Basic concepts about coding in 6502 assembly, which transcend NESmaker and delve more into general NES development.
Assembly 101: Branch out of range
For this post, I want to zoom in a little on the “Branch out of range” error that pops up every now and then. I’ll try and explain what it means, what’s the most likely cause, how to fix it, and why that fixes it.
Assembly 101: odd or even?
Do you want to check whether a certain variable is odd or even? This is fairly easy in Assembly: simply check if the lowest bit is odd or even, and you know that the entire byte is or isn’t as well. There are a few ways to code this though. In this post, I’ll briefly go through all methods, explain why they work and tell you my favorite way to do it.
Assembly 101: The status register
The 6502 registers youre probably most familiar with, are the accumulator and the X- and Y-registers. There are three more registers though, which you may not access directly through code, but are at least as important as the former three. In this post, I’ll explain all about the Status register, and how this works with other instructions. This is a somewhat longer post, so buckle up and dive in!
Assembly 101: Dynamic subroutines
Earlier, I wrote something about subroutines, how they work, what they do and why you need them. This time, I’ll explore the somewhat more advanced concept of dynamic subroutines, i.e. calling one of a few possible subroutines based on an external value.
Assembly 101: Lookup tables
Lookup tables, or LUTs for short, are a quick and easy way to reference indexed data. This post will try to explain how to use them in your game, using a general example.
Assembly 101: Labels
Labeling memory addresses will save you a lot of hassle. It’s easier to remember and reference “Object_speed” rather than its physical memory address, which could be something like $0337. How does labeling work, when are labels applied, and what’s up with that “Label already defined” error message?
Assembly 101: Subroutines
When developing in Assembly, you will definitely have to use a subroutine or two. JSR and RTS are the two main instructions that make subroutines work. What is a subroutine, how does it work and what are the possible pitfalls? Read all about it here.
Assembly 101: Explaining addressing modes using LDA as an example
LDA is the assembly instruction to load a value into the accumulator. How does it work exactly, and which options are available with this instruction?
Assembly 101: logical operators
Some of the most essential operations in 6502 assembly are logical operations. These operations compare two variables and modify the result accordingly. In assembly, there are three basic logical operations. I’ll explain which they are and what they do here.