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.
subroutine
Deep Dive: VBlank and NMI
Sometimes, you’ll want to stop code execution until the screen is done drawing. For instance, if you need to update more tiles on screen than the vBlank period is capable of, when you want to turn off the screen to do additional updates, or simply because you want a few frames of idle time in your game. There are two ways to do this, which NESmaker both applies. Let’s go into the details.
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: 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.
Deep Dive: Bankswitching
So, earlier on, I explained that NESmaker projects use Mapper 30, which has 32 banks of 16KB data. The NES console itself can only handle up to 32KB – or 2 NESmaker banks – of program data though. So how can we get access to all the data we have available on the cartridge? Well, this is where bankswitching comes in handy.