Topspeed assembler docs

Skip to first unread message


Mar 24, 2003, 2:44:41 AM3/24/03
Does anyone have some documentation on Topspeed assembler syntax.

After the last response from this group things are going well. The problem
is I can't seem to call a label.

shl ebp,cl
jc mylabel:
** some code **

** more code **


QuantumX admin

Mar 24, 2003, 6:54:37 AM3/24/03
I recall there being docs for the assembler section back in the Clarion for
DOS days, although I can't recall it being printed since then. I have a
funny feeling it might be on the enterprise CDs ?

Anyway, labels in clarion need to be in column 1. I'm guessing they'd keep
this restriction for the other compiled languages ...

Tony Bowes

"TonyM" <tonym110@hotmail._com> wrote in message


Mar 24, 2003, 11:26:54 AM3/24/03
Hi Tony,

> Does anyone have some documentation on Topspeed assembler syntax.

I posted what was the only doc for it for the windows assembler a couple of
years back on the NG's. Not sure I even have a copy anymore. It was not

> After the last response from this group things are going well. The problem
> is I can't seem to call a label.
> eg.
> shl ebp,cl
> jc mylabel:
> ** some code **
> mylabel:
> ** more code **

jc will be your problem. The label syntax is correct. Not all instructions
are supported and as such any that are not need to be macro'd using the
appropriate machine code or instruction equivalent as follows....

macro scasd "scas dword es:[edi]"


Plugware Ltd, taking the puzzle out of I.T
Tel : +44 1249 813335
Fax : +44 1249 813462


Mar 24, 2003, 6:00:51 PM3/24/03
Could you have a look to see if you still have a copy?
It's like trying to program blind folded. Without being able to do a
conditional jump this small task will become impossible.

I really don't want to have to mess around with other assemblers and linkers
for such a small task.

You wouldn't believe it, but we throw out the old Clarion 3 books just 2
months ago. So much for house keeping :-(


"Plugware" <> wrote in message


Mar 25, 2003, 5:58:05 AM3/25/03
Hi Tony,

> Could you have a look to see if you still have a copy?
> It's like trying to program blind folded. Without being able to do a
> conditional jump this small task will become impossible.

Trust me, it would not help you. It would be in one of my email archives
somewhere which is not something that is quick to search for.

As I mentioned, you merely need to macro the relevant machine code or
equivalent instructions. Your best bet is to use masm61(1/2) to either
create an example in that and copy the machine code or use the Intel
instructions manual available on thier site. This is a 10 minute job.
Quicker than wading through docs that really won't help you because of the
limited opcodes the TS Asm supports. Remember it only supported upto 486.
this is a very doable exercise as I did this to support MMX for faster
encryption / decryption and for my alpha blending code.

Carl W. Sumner

May 10, 2003, 3:37:25 PM5/10/03
On Mon, 24 Mar 2003 17:44:41 +1000, "TonyM" <tonym110@hotmail._com>

I found this in the old TopSpeed Docs, FWIW. It was about the dos
version, but the syntax is still mostly the same.


· The lexical structure is derived from Modula-2. In particular, the
Assembler is case sensitive, comments are marked with (* and *) and
hexadecimal constants must be in upper case.

· A semi-colon (;) is used to separate multiple statements on a line.
In fact, a newline and a semi-colon are regarded as identical by the

· There is only one kind of label and there are no data types. Instead
of data types, TopSpeed Assembler uses specifiers. Thus, the
specifiers near, far, byte and word can be used to define the data
type of the operands of an instruction.

· Memory operands and segment overrides must always be explicitly

Program Layout

A TopSpeed Assembler program has the following general layout:

module <name> (* Names the module *)
segment <name>.....(* Define segments *)
<code and data>....
section (* Another section - Optional *)
....<and so on>
end (* Marks the end of the module *)


The TopSpeed Assembler uses a number of keywords:

byte db dd dw dword
end extrn far fixup group
include log2 module near org
power2 public qword section select
seg segment st tbyte word


The following operators are defined in TopSpeed Assembler. The
operators are listed in order of precedence (highest precedence
power2 power of two
log2 log base 2 (truncated to integer)
/ % * division, modulus, multiplication
+ - addition, subtraction
: segment reference
~ bitwise not
& bitwise and
| bitwise or
seg segment of address

Operators of equal precedence associate with the expression to their

Assembly Language Considerations

This section groups together a number of points regarding the use of
the TopSpeed Assembler. This section should be used in conjunction
with Appendix D, which contains full details of the 8086 and 8087
instruction sets. This chapter describes a number points of interest
for the assembly level programmer, who is used to using other
assemblers. You may find it useful to use the TopSpeed Disassembler
TSDA to generate examples of TopSpeed Assembler from high-level
language object files.

The Symbol Table

The TopSpeed Assembler discards the current symbol table every time a
new section is started, except for any global equates which occur
before the module keyword in the source file. This means that symbols
may be redefined. If you redefine a public symbol, the linker issues a
warning message. If you wish to reference external objects, the extrn
keyword should be used, for example:
extrn ReturnOne
call far ReturnOne

To make an object accessible from another module, the name must be
preceded by the public keyword.

Operand Sizes

In most cases, the operands to an instruction have an implied size
(byte, word, etc). This size can be calculated by the Assembler and
requires no intervention on your part. However, when there is a chance
of ambiguity, you must use a specifier to indicate the size of the
inc word [bp] [-6]
mov byte es:[bx], 1
mov es:[bx], ax (* no specifier needed *)
(* - ax implies word *)
push es:[bx] (* push always uses a word *)

Jumps and Calls

Jumps and calls default to the smallest possible case. Thus, unless a
label has been defined before use, the Assembler assumes that it is a
label in the same segment as the statement referencing it. Labels
should result in a jump of between -128 bytes and +127 bytes in the
output object code. If a jump exceeds this range, a specifier must be
For example:
jmp near _loop


Single character string constants are treated as numbers by the
TopSpeed Assembler. The Assembler syntax does not provide a segment
override for string instructions. If you wish to do this, it must be
done using the db keyword.
For example:
db 2EH; (*cs:*) stosb


Within TopSpeed Assembler, forward references are assumed for labels
that have not yet been defined. The TopSpeed Assembler assumes that
such labels are in the currently selected segment within the current
section. Within a single section, equated symbols may be redefined;
labels, on the other hand, may not be redefined.

Non-8086 Instructions

The TopSpeed Assembler supports only 8086, 8088, 8087 and 80287
instructions. If you need to use the opcodes specific to the 80286,
80386 or 80387, they must be simulated with the db directive, as
described in Strings above.

Floating-point Options

The foption mnemonic is used to control floating point emulation and
carries a single argument, as follows:
foption 0 causes floating point emulation.
foption 1 suppresses the generation of emulation fixups.
foption 2 suppresses the generation of fixups and wait instructions.
Unless foption 2 is used, the Assembler generates a wait instruction
between successive floating-point instructions in order to synchronize
the 8086 with the 8087.

Variables and Data

Variables can be defined, and uninitialized data areas reserved, using
the following directives:
db initialize storage as bytes (expects byte or string oper-ands).
dw initialize storage as words (expects word operands).
org reserve some uninitialized memory of a size equal to the value of
the operand.

File Inclusion

The TopSpeed Assembler has an include directive which allows a header
file to be included. This is used in the library to define commonly
used identifiers:
include ""

Conditional Assembly

The TopSpeed Assembler has the ability to conditionally assemble
sections of code based on the value of an identifier. There are three
special directives that mark which blocks to include/exclude. These
(*%T <identifier> *)
means process this section only when <identifier>=1
(*%F <identifier> *)
means process this section only when <identifier>=0
(*%E *) means end of conditional section
These directors are commonly used with the return code for a procedure
that is memory model independent:
(*%T _fcall *)
ret 0
(*%E *)
(*%F _fcall *)
ret far 0
(*%E *)

Conditional sections can be nested.
For further examples of using conditional assembly, please refer to
the file COREGRAP.A in the \TS\SRC directory. This file is also an
excellent example of assembly language procedures providing memory
model and register passed parameter support.

Predefined Identifiers

The assembler pre-defines a symbol for each #pragma
define(<symbol>=><value>) which is active in the project file at the
point where the #compile occurs. This allows conditional assembly
according to which model has been selected. The value is 1 if the
project value is on, otherwise the value is 0.

Calling Conventions

Your assembly language functions need to follow the TopSpeed calling
conventions if they are to successfully be called from a high-level
language. In particular the bp register must be preserved. Which other
registers need to be preserved will depend on the calling convention
being used, which can be modified with pragmas. In the JPI calling
convention, all registers except those used to pass parameters and
return function results must be preserved.

Miscellaneous Points

Other assemblers allow instruction formats such as:
mov ax, es:[bx+6]
In TopSpeed Assembler, these must be expressed as:
mov ax, es:[bx] [6]
The instructions rep, repne and lock are regarded by the Assembler
as separate instructions. They must be followed by a semi-colon, for
rep; movsb (* NOTE the semi-colon *)


Reply all
Reply to author
0 new messages