NESMaker 6502
ASM Challenges

Back to Index

Challenge 1 (From Tutorial Episode 2)

Challenge: As a coding challenge, I want you to write a piece of ASM code that increases the variable myMagic by 3 every time it’s run, but if the number goes higher than the number 25 (#$19) it sets the myMagic value to 25.

Hint: For this challenge you’ll need to use the JMP (Jump) command to skip to the end of the script! The syntax is very similar to a branch. We’ll cover it next tutorial.
Syntax: JMP [label]
Label is the label you wish to jump to. This is an unconditional jump. When it is encountered in the code the program will jump to the destination label.

Commands used in this challenge:
LDA, STA, ADC, CLC, CMP, BCS, JMP

Check the “Monitor” checkbox. In the “Start $” textbox enter the number 0, and in the “Length $” textbox enter the number 1. Click Assemble then Run to assemble and run your result, then keep clicking Run until you confirm this challenge is complete! The Monitor should show the number after 0000: increase by $03 until it stops at $19 and increases no further with subsequent Run presses.