NESMaker 6502
ASM Challenges

Back to Index

Challenge 3 (From Tutorial Episode 4)

Challenge: For this challenge, you will receive random numbers in the baseDamage variable and playerFlags variable. If the 3rd bit (########) in playerFlags is set, set damage to baseDamage divided by 2. If baseDamage is odd, add 1 to the result of the division to round the number up. If the 3rd bit in playerFlags is not set, simply store baseDamage in the damage variable. This challenge will utilize information from all three ASM Basics tutorials: Branching, Conditions/Binary Operations and Simple Division.

Commands used in this challenge:
LDA,STA,AND,BNE,BEQ,JMP,CLC,ADC,LSR

Check the “Monitor” checkbox. In the “Start $” textbox enter the number 0, and in the “Length $” textbox enter the number 3. Click Assemble then Run multiple times to see if your code works. Use the Debugger on the right to step through and watch your code in action if you want to see it operating.