# TI 83 Plus Assembly/Hello World

In this section you will make a program to display "Hello, World" on the screen.

## Writing the Program

Make a new text file on NotePad and type the following text:
The tabbed lines need to be tabbed! Save this file as myprog.z80 into your "Programs" subfolder. Also, note that the command B_CALL may need to be changed to bcall depending on the contents of the includes file used during compiling. The compiler will record one error if the command (B_CALL or bcall) is different than the one defined in ti83plus.inc, though in the most popular editions of ti83plus.inc it is bcall - simply swapping one for the other may fix this.

## Compiling the Program

Compiling essentially means translating text code into code that a machine can read.
To compile your program myprog.z80 first open a Command Prompt (it should be in Accessories). You should be faced with a black window with some white text saying what folder you are in. The first step is to change the folder to your programs folder. To do this use the following commands:
* cd subfoldername (This will go to the subfolder that you tell it to.)
* cd .. (This will instantly go to the folder that holds the folder you are in.)
Afterwards, you need to type in:
* compile myprog
This should automatically compile myprog.z80 if you have followed all instructions correctly.
The finished program should be located in your "Programs" folder as myprog.8xp.

## Testing the Program

On your computer, open up the TI 83 Plus Flash Debugger to make a fake calculator for testing purposes. Click on the white paper icon to make a new fake calculator and choose the 83+ calculator. Then click on Load... RAM File and open your compiled program (myprog.8xp). Finally, click on the triangle-shaped play button to begin emulation. On the fake calculator, press [2nd]+[Catalog] to bring up the catalog and arrow down to Asm(. Press enter to insert the command into the screen and then select your program ([PRGM],[ENTER]). The screen on the calc should say Asm(prgmMYPROG). Now press enter, and "Hello World" should be displayed on the screen.
Always test your programs on the Flash Debugger before you use them on your real calculator because there is a large chance of your real calculator crashing.

## Commands of the Program

The only lines of importance now are the middle ones:
When the calculator executes a program, it follows the commands line by line. The first line (ld a,0) loads zero into a, which is a commonly used register. So now register a = 0. The next two lines load that number into the cursor row and column sectors in the RAM. So now the cursor is located at 0,0 and the next text will be displayed at that location. The fourth line (ld hl,text), loads the location of .db "Hello... into hl, another register. B_Call(_PutS) takes the text that hl has specified and displays it at the current cursor location. Finally, ret tells the calculator to exit out of the program. You should now have a vague understanding of the functions of most of the lines in your first program.
This little program, however small, is far from optimal. ld a,0 can be replaced by xor a as long as you don't need to preserve the flags. XOR A (see ) inverts any bit that is 1, so basically it sets A to zero. This is not all, one can load CurCol and CurRow at once with ld (CurRow),hl , L will go into CurRow and H into CurCol.
Previous: What you need Next: Jumps Table of Contents: TI 83 Plus Assembly