The syntax used in the inline assembler is inspired by the Intel assembly language. This means that
each statement has the form:
<op> <dest>, <src>;. Some statements only take one operand.
Each of the two operands can be one of:
- A register
- A literal
- A variable
- A label
Three different registers are available:
c. These come in four sizes,
cl for byte-sized registers,
ecx for Int-sized registers,
for Long-sized registers and
ptrC for pointer-sized registers. These are
referred to by their names.
Literals are numeric constants with a prefix telling their type. Size prefixes are supported:
The literal 'sPtr', optionally followed by an asterisk and an integer, can be used as a pointer-sized literal representing multiples of the pointer-size of the current plaform (4 or 8 bytes).
To refer to variables in Basic Storm, simply refer to them by name. A variable will return its
representation in Basic Storm. A variable holding an
Int can be accessed as an
Int in assembler
and modified. Variables of object-types are pointers.
Memory is accessed using square braces preceeded by a size specifier. The braces may contain a
pointer-sized register, optionally followed by a
+ sign and an integer literal to indicate an
offset. The size specifier for the memory access is the same as for numeric literals described
i[ptrA] reads an integer (
i) from the address in
l[ptrA + 8] reads a long (
l) from the address 8 bytes after
p[ptrA + sPtr] reads a pointer (
ptrA plus the size of one pointer (4 or 8 bytes depending on the platform).
p[ptrA + sPtr*2] reads a pointer (
ptrA plus the size of two pointers (4 or 8 bytes eac depending on the platform).
Labels can be placed before or after any statement, and are formed by a name followed by a colon
:). Labels are referred to as
Some op-codes take a conditional as one of their parameters. A conditional represents the result of
cmp operation. These conditionals can be one of the following:
ifEqual- a equals b
ifNotEqual- a does not equal b
ifAbove- a is above b (unsigned)
ifAboveEqual- a is above or equal to b (unsigned)
ifBelow- a is below b (unsigned)
ifBelowEqual- a is below or equal to b (unsigned)
ifGreater- a is greater than b (signed)
ifGreaterEqual- a is greater than or equal to b (signed)
ifLess- a is less than b (signed)
ifLessEqual- a is less than or equal to b (signed)