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
Registers

In assembly code, registers are like variables. They are used to store both values (numbers) and memory addresses. Do not use registers to store options or data, because usually they will not last for 20 lines in a program (other commands use the registers and the data previously in them gets destroyed). These are the registers that are available for you to use:

a,b,c,d,e,f,h,l

Each register can hold 1 byte of data. However, since this is a 16 bit (2 byte) processor, each register can be paired up to make a 16-bit register pair. The following pairs are below:

af,bc,de,hl,ix,iy

Now let's try loading numbers into a register.

Header removed

StartProg:
      ld a,10
      ld hl,Data2
      ret
Data2:
      .db 0Ch,22h,F5h,00h,00h

end

This loads the value of 10 into A, and the Memory Address (Location) of Data2 into HL (A 2-byte register must be used because each address is 2 bytes). You can also load a register into another register, such as "ld a,b" loads b into a.

Another command dealing with registers is "ex". This exchanges the values of two registers. For example:

Header removed

StartProg:
      ld bc,1020
      ld de,0CE8
      ex de,bc
      ret

end

The values of bc and de would now be switched.

Putting parentheses around a register loads a value into the literal location, as opposed to just the register. What!? Well, think of it this way. You want to load the value of 25 into memory address 8025h. How would you do this? Well, read on.

Header removed

StartProg:
      ld hl,8025h ;Load memory address into hl
      ld (hl),10 ;Load 10 into literal location
      ret

end

As much as you think you'll have to use this, it rarely comes in handy until we start working with AppVars. Now using our new knowledge, we can display text on the screen.

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.