Help ASM80

CPU selection

CPU type is determined by file suffix. ".a80" means 8080 or 8085, ".z80" means Z80 and "a65" means 6502.

Basic operations

Write your code. Don't forget to save it with some name. F9 or Compile compiles this code and makes filename.hex and filename.lst files.

Source code format.

Line can begin with a label. Label should be followed by ":", but it can be omitted.

Everything after a ; in a line is a comment (unlees the ; is part of a string literal, of course). There are no multiline comments.

String literals are written to the object file without any character set translation. In case you use punctuated character, the lower byte of its unicode representation will be used.

Blanks are significative only in string literals and when they separate lexical elements. Any number of blanks has the same meaning as one. A blank between operators and operands is allowed but no required except when the same character has other meaning as prefix ('$' and '%', for example).


Numeric literals can be written in decimal, binary, octal and hexadecimal formats. Several formats are accepted to obtain compatibility with the source format of several assemblers.

A literal that begins with $ is a hexadecimal constant, except if the literal is only the $ symbol.

A literal that begins with % is a binary constant, except if the literal is only the % symbol, in that case is an operator.

A literal that begins with a decimal digit can be a decimal, binary, octal or hexadecimal. If the digit is 0 and the following character is an X, the number is hexadecimal. If not, the suffix of the literal is examined: D means decimal, B binary, H hexadcimal and O or Q octal, in any other case is taken as decimal. Take care, FFFFh for example is not an hexadecimal constant, is an identifier, to write it with the suffix notation you must do it as 0FFFFh.

String literals.

There is one format of string literals. They should be single or double quote delimited. Both of these forms are equivalent.

A string literal of length 1 can be used as a numeric constant with the numeric value of the character contained. This allows expressions such as 'A' + 80h to be evaluated as expected.

Identifiers are the names used for labels, EQU symbols and macro names and parameters. The names of the CPU mnemonics, registers and flag names, and of assemble directives are reserved and can not be used as names of identifiers. Reserved names are case insensitive, even if case sensitive mode is used.

Identifiers are not case sensitive.


Directive Meanings
db (alias: defb) Define Byte. The argument is a comma separated list of string literals or numeric expressions. The string literals are inserted in the object code, and the result of the numeric expression is inserted as a single byte, truncating it if needed. You can use DUP for entering N same values: DB 10 DUP (123) means "10 times value 123"
dw (alias: defw) Define Word. The argument is a comma separated list of numeric expressions. Each numeric expression is evaluated as a two byte word and the result inserted in the proper "endianity". You can use DUP for entering N same values: DW 10 DUP (123) means "10 times value 123"
ds (aliases: defm,defs) Define Space. Take one argument, which is the amount of space to define, in bytes.
org addr ORiGin. Establishes the origin position where to place generated code. Several ORG directives can be used in the same program, but if the result is that code generated overwrites previous, the result is undefined.
.ent addr ENTer point for debugging. I.e. .ent $
equ (alias: =) EQUate. Must be preceded by a label. The argument must be a numeric expression, the result is assigned to the label. I.e. VIDRAM equ $4000
.if cond Contional assembly. The argument must be a numeric expression, a result of 0 is considered as false, any other as true. If the argument is true the following code is assembled until the end of the IF section is encountered, else is ignored. The IF section is ended with a ENDIF directive. IF can't be nested.
.ifn cond IF NOT
.endif End of the IF block
.include filename Include a file. The file is readed and the result is the same as if the file were copied in the current file instead of the INCLUDE line. The file included may contain INCLUDE directives, and so on. INCLUDE directives are processed before the assembly phases, so the use of IF directives to conditionally include different files is not allowed.
.macro macro_name Defines a macro, see the chapter about macros.
.rept počet Repeat a block of code substituing arguments. See the chapter about macros.
.endm End of MACRO definition or REPT cycle.