The TI-86 Assembly Guide: Lesson 1
by Ahmed El-Helw
What is ASM? ASM is Assembly Language. Assembly Language is for
many formats, not just the TI-86. The Assembly on this calculator is programming the z80 processor, which is the Ti-86's processor. One can for example program x86 ASM on his computer. Yet we are now worried about z80 assembly. What is the benifit of
using assembly over basic? First of all, assembly programs are a LOT faster. Secondly, you can use advanced graphics, better than the best basic graphics you've seen before. Third, you can make an awesome program that takes up very little space on your
calculator. Unfortunatly, the Ti-86 does not allow programs over 10k, but Ti's ASM Modules allow you to call one program from another. Besides this "problem" which has a cost-free solution, ASM is all good, except maybe learning it... but once you star
t, you'll be awesome!
- An IBM Compatible PC w/DOS & Windows on it.
- A TI-GraphLink or a homemade link, w/software.
- Asm86 III from the TICalc.org Dos/Assembly Archives.
- A good text editor, NotePad or MSDos Edit will do, you don't need Word. I usually use EditPad or Super NoteTab.
At this point, you should have Asm86 unzipped to a directory of your choice. You should also have the computer on at this point, and you should be able to "Alt-Tab" between your Editing Program, Dos, and your graphlink software. Now, you should open
a new doecument. You need to put the header files before you put anything else. These header files include the basic commands in your program. Therefore, you will not have to define every command.
What does this do? This tells the compiler that you are going to include those files in your program. This is to make your job a LOT easier. You MUST have asm86.h and ti86asm.inc. YOu can remove the other 3 TI files if you would like to. Again you
do need the ".org _asm_exec_ram", for that loads the program in the place it will run in. Next, we need to put the commands in to allow the program to display text. This is done here... notice that some lines are indented [..], these MUST be indented i
n the program to compile correctly.
String: .db "Made in @sm!",0
The first command clears the screen, clrLCD. ld stands for "Load"... so ld a,0 loads 0 into a. Next, you are loading a into curRow, which is the cursor row, and you are loading a into curCol, which is the cursor column. Load hl,String points to the nam
e of the string to display. Call _puts displays it on the screen. GetKey waits for a key press. And finally, ret returns from the assembly program. The String Label is followed by a ".db", which means define byte. Then the string of text is put in qu
otes, followed by a ,0 which means you are at the end of the line. Finally, .end and END tell the compiler that this is the end of the assembly program file.
Next, you can compile your program. Save the program in the same directory as your Asm86 III files. It should be saved with the extension "*.asm". Next, in the DOS window, type "make86p progname" where progname is the name of your program. If you
get any errors regarding the program, make sure you didn't mispell, and that you indented the lines w/[..] in them. Of course, don't put a [..] before each line. This of course will cause you problems in compiling. Also, make sure that you didn't forge
t and that ALL the files are in the same directory. When you get it to work, put it on your calculator and run it with the "Asm()" command. That's all! You just made your first program!
Now try this.. change the "_curRow" to "_penRow", and the "_curCol" to "_penCol", and change the _puts to _vputs. Now compile it and try to rerun it. You will see that the text now appears smaller. Therefore, the Ti-86 has two fonts, the standard,
and the small font. If you change the values of the numbers loaded into A, you can change the location on the screen as well.
These are some basic assembly commands and their explanations.
- label: - This is a label, kinda like the "Lbl A" in Basic. This is used to make jumps and calls, just like you do in basic.
- call - This calls a label, and when that label reaches a ret, it returns to where it was called.
- ret - Returns either 1. From the place called, or 2. From the ASM Program.
- jp and jr - These two commands jump to another label. Jr jumps a smaller distance, and saves some memory, yet it doesn't work over large distances, use jp instead.
- call _clrLCD - Clears the Screen
- call _runindicoff - Turns off the RunIndicator
- call _getkey - Wait for a keypress
These are some basic commands. In the next lesson, these will be discussed in detail. This lesson is basically an introduction to ASM, and helps you create your first ASM Program!
This is the ASM Guide Lesson 1, Copyright (C) 1998 By: Ahmed El-Helw. This document was completed on January 11, 1998. If anyone
finds any mistakes, please EMail me. You will always find the latest ASM Guide lessons on ticalc.org. Again, if anyone has any questions, comments, etc., please feel free to email me. My ICQ UIN is 3350394, you can ask me questions there too, and I am known as Ahmed or Ahmed_ on IRC on #ti sometimes.