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
Displaying Text

Here is the complete code for displaying text on the screen.

.NOLIST
#define END .end
#define end .end
#define equ .equ
#include "ti83plus.inc"
.LIST

      .org 9D93h
      .db $BB,$6D
StartProg:
      ld a,0
      ld (CURCOL),a
      ld a,0
      ld (CURROW),a
      ld hl,txtHello
      B_CALL(_PutS)
      ret
txtHello:
      .db "Hello World",0

.end

Copy this code into DOS Edit and compile. It should display "Hello World" on the screen. Below is a breakdown and explanation of the program.

      .org 9D93h
      .db $BB,$6D

This is part of the program included in every assembly program. It sets the program counter to 9D93h, and has the required AsmPrgm Token.

StartProg:
      ld a,0
      ld (CURCOL),a
      ld a,0
      ld (CURROW),a

This loads 0 into the row and column of the cursor. You cannot load zero directly, though. You must load it first into a and then into the cursor column and row. There are parentheses because we are loading the value into the literal location.

      ld hl,txtHello
      B_CALL(_PutS)
      ret

We load the address of the text into hl, then B_CALL a routine called PutS. This puts the text in hl on the screen at normal size at curcol and currow. The return, as you know, exits the program.

txtHello:
      .db "Hello World",0

This is the text label and the text data. This data is called txtHello. The "txt" prefix on the label is not required, but we recommend it to keep images, text, and routine labels seperate. ".db" stands for data byte. More about data will be discussed in the next section. The Zero at the end terminates the string. PutS and other text commands stop displaying text when they reach a zero, so it's important for this 0 to be there.
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.