| Ti-83 and Ti-84 Assembly Programming | ||
| Getting Started 1.1: About This Tutorial 1.2: About TI-ASM 1.3: Writing Your First Program 1.4: Compiling 1.5: Debugging ASM Basics 2.1: Calls and Jumps 2.2: Registers 2.3: Displaying Text System Controls and Calls 3.1: Data 3.2: Register Stack 3.3: If Statements (Comparing) 3.4: GetKey and GetCSC 3.5: System Flags 3.6: Menus 3.7: Displaying Pictures 3.8: For Loops (djnz) 3.9: White Loops 3.10: OP Registers Applications 4.1: Apps vs ASM 4.5: KeyHooks | If Statements (Comparing) There is no official If-Then statement in assembly. Conditionals must be accomplished through comparing. "cp" takes whatever value is stored in a and compares it to a given value. If they are the same, then a zero flag is set. If they are different, then a non-zero flag is set. Let's take a look at some sample code.
This will load the value of 3 into a, and then check to see if the value loaded into a is 7 or 3 or neither. If the value is 7, it will jump to the label IsSeven, if it is 3, it will jump to IsThree, and if it is neither of those, it will jump to IsNoneOfThese. "jp" is not the only one that can take the z and nz conditionals. "jr" and "call" also can use these. | |
![]() The text in this tutorial is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. | ||

