Assembly Language Basics

Anyone that is visiting this site probably knows how to program in BASIC or another simplistic programming language. If you don't, I would recommend learning BASIC first, since many of the techniques used in assembly language come from BASIC. Like me, your interest in assembly language probably started when you saw how much faster assembly programs in ION or MirageOS could run on your calculator. Assembly language is not easy, however, and there are many limitations that you must think around for seemingly simple tasks. In this tutorial, I will try to explain the basics of what assembly language exactly is and why it can be difficult.

Let's assume that you know nothing about assembly language. Assembly language is code that you write that gets sent directly to the processor. It is the lowest level of programming possible, so you have total control over what happens. The reason that BASIC is so much slower is that BASIC must be first translated into unoptimized assembly code,compiled into hexidecimal, and then sent to the processor. Assembly code that you write, however, is compiled into hexidecimal beforehand and sent directly to the processor. This allows you create programs that run at least 10 to 20 times faster. An example of the differences between ASM and BASIC is shown in the table below:

BASIC Code -->Assembly Code -->Hexidecimal
Disp "Hello World"ld hl,str1
call _vputs
str1:
.db "Hello World",0
0A4F2621
318DE8FF