E-mail Address
Password

Register
arasian > support > education > tutorial

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
For Loops (djnz)

With your knowledge as of now, it is possible to create a forloop in ASM. However, there is another command that aids with this, the djnz command. This means "Decrement and Jump While not Zero". It uses the b register. You load a value into b, and it checks to see if it equals 0. If not, it decrements it and then jumps back to the top of the loop. Don't forget, it goes from most to least, as opposed to a normal for loop which goes from least to most. Since commands in the method could destroy the registers, it is essential to push them and pop them as shown below. Below is a sample code that will display text progressively up the screen.
     ld b,4
TextLoop:
     push bc
     ld a,0
     ld (CURCOL),a
     ld a,b
     ld (CURROW),a
     pop bc
     djnz TextLoop

So with this it should be easy to do forloops.

Creative Commons License
The text in this tutorial is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License.

Privacy Policy | Contact Us
(c) 1999-2010 Arasian. All rights reserved.