Mikroone - Online
Help
Here you find a description
on how to write Assembler - Files:
The Assembler - Files can
be written with any Text - Editor you want to use.
But for Simulating them with
MikroOne - Simulator you should watch some Rules:
An ASM-File contains of:
· Commands
· Comments
· Labels
· Equations
Commands
To compile an ASM-File
without errors all containing commands must be with right syntax.
If not the Compiler will
tell you where he found errors.
If you need information on
the Commands please see the Command Overview.
Comments
Comments always have to
start with an Semicolon (;).
You can place them alone in
a row or behind a Command.
Labels
Label are used to tell jump
- Commands where to go.
They can be placed alone in
a row, or in front of a Command.
They have to end with a
You are able to load the address
value of a Label with the Command LDL to a register.
This is very useful for
example when using Interrupt Service Routines,
because you do not need to
calculate the addresses by yourself.
As you only can use LDL,
the addresses can not be larger than 255.
If they are larger, only
the Low-Byte is used.
So keep in mind that your
Labels are placed in the range from 0 to 255.
Values
You can write
values in your ASM-File in two different ways:
· Decimal
· Hexadecimal
· Binary
If you use
decimal Values you just write the number you want to have.
Example:
LDH R[2], 20
When using
Hexadecimal Values you have to write a "$" in front of the number.
Example:
LDH R[2], $10
If you want to
use Binary Values you have to use the “%” prefix.
Example:
LDL R[2],%0100
;This loads the Value 4 into Register 2.
Equations
You are also
able to use Equations in your ASM-File.
Equations are
Preprocessor Directives and have to be at the beginning of an ASM-File.
Only Comments
can occure before them.
Equations can be
Values, like described above or even entire Commands.
To create
Equations you have to write:
Name EQU Value
Example of an ASM-File
containing Equations:
;This is a comment
EQU1 EQU $FF
COM1 EQU ADD R[2],R[3],R[4]
LDH R[3],EQU1
COM1
Note
If you click the Open-File Button while writing an ASM-File, you get
asked if you want to save the current File.
If you cancel and after that do not open a File, the code you already
have written is lost.