First Program

"The first blow is half the battle." - Oliver Goldsmith, 'She Stoops to Conquer'

by Ciaran McCreesh
Created: 12th September 1999
Last Modified: 27th November 1999

This page will show you how to enter, assemble and run a program using Assembly Studio.

The Program

The program listed below is a very simple assembly program that will display 'Hello World' on the screen five times.

Source: hello5.asm
Compiled: hello5.86p

#include "ti86asm.inc"

.org _asm_exec_ram

  call _clrScrn      ; Clear screen, cursor to top left
  call _homeup
  ld b,5             ; Loop counter becomes five
LoopStart:
  ld hl,StartOfText  ; hl points to text
  call _puts         ; Display text pointed to by hl
  call _newline      ; New line
  djnz LoopStart     ; Loop back to LoopStart, decrease counter

  call _pause        ; Wait for [ENTER] to be pressed
  call _clrScrn      ; Clear screen, cursor to top left
  call _homeup
  ret                ; Return from program

StartOfText:
.db "Hello World",0

.end

You don't need to understand this program - it will be explained later.

Running the Program

To run this program, follow these steps:

  1. Run Assembly Studio
  2. From the File menu, select New.
  3. Delete anything that's already there.
  4. Use the clipboard to copy the above program and paste it into Assembly Studio.
  5. Check that some different colours appear in the window (they probably won't be the same as the ones that I've used above). Select Save from the File menu and enter 'hello5' as the filename.
  6. Plug your calculator in, turn it on and make sure you are on the home screen (not the Receive screen!).
  7. From the Assembly menu, select Build and Send to Calculator.
  8. If a box appears asking you what kind of link you use select the appropriate option and click OK.
  9. Assuming you get no error messages, type in asm(hello5) and press enter. (The asm command can be found in the CATLG/VARS - CATLG menu.)
  10. Press enter to exit the program when the calculator pauses.
Screenshot showing how to run program Screenshot showing program being run
How to run the program Program being run