as504 - an alternative assembler for the Siemens SAB-C504
View this page in Dutch.
Jump to the download section.
Features
- Open source (using C and yacc), so
- Cross platform (win32 binary available, others on request)
- Simple interface
- Error messages on stdout (not via a listfile)
- Support for long filenames and identifiers
- Almost completely compatible with ASM504 and standard assembly (e.g. a period in front of an assemler directive), we thus provide support for:
- USING, AR0..7, INCL, IF, ELSE, ENDIF, EQU, BYTE, DS (=SKIP), etc.
Usage
You can assemble a file called test.asm
using
as504 test.asm
In windows you can just drop the .asm-file on the as504 executable to assemle it. Error messages, if any, will be shown in the DOS-box that pops up. In order to prevent it from closing immediately, you will have to press enter to close it (this can be disabled by recompiling as504 and removing "-D WIN32
" from the Makefile).
The options -l
and -d
may be added as commandline arguments and do, respectively, generate a listfile (like the one from ASM504) and print extra debug information.
as31
as504 is an extension of as31, an 8031/8051 assembler by Ken Stauffer. Apart from a few bugfixes, we added some extra compiler directives and aliases for them as to make it more compatible with ASM504. Retrospectively, I found a second version of as31 which also incorporated a few bugfixes, see also the download section below.
Problems in ASM504
I started writing as504 because there was no assembler running on Linux for the SAB-C504. Apparently it is a 8051 variant, such that the open source as31 assembler can be used, although it is not source-compatible with ASM504. Furthermore, we found a few problems with ASM504 while testing (mostly in the handling of assembly-errors), being:
- Lines with exactly one unknown identifier on it are being accepted, although this is syntactically incorrect. This way, a bug like
ORG 20h
H0: DS 1
H1: DS 1
H2: DS 1
H3; DS 1
could remain unspotted (notice the ;
after H3).
- The lines
ORG 80h
MOV A, #0
ORG 80h
NOP
are being accepted. Although this is not really wrong, code will be overwritten, which is of course not really desirable.
label: ORG 80h
is interpreted, such that the label is defined first (to the previous memory location) and the ORG directive is applied afterwards. This is also quite a useless operation, so most assemblers apply the ORG first and then set the label to have value 80h.
These problems were all discovered accidentally and do not rule out the possibility of more problems in ASM504 that can lead to some nasty debugging.
Differences between as504 and ASM504
Advantages:
- Open source, so it is extensible and modifiable
- Cross platform (tested in Windows and Linux)
- Simple interface (drag&drop in Windows)
- Error messages on stdout (not via a listfile)
- Support for long filenames and identifiers
- Better error handling and warnings
Most important implementation differences:
- Compiler directives SET, SEG and OFFS are not implemented
- END, FOLD, LIST, LMARG, NOFLD, NOLST, PAGE, PGLEN and TABS are ignored.
- $IDEF, $PASS and $USR1..9 are not implemented ($ is, such that
SJMP $
works)
- String constants are like the ones in C:
- Strings start and end with " (double)
- Escaping characters is done using a backslash: \n, \r, \t, \b, \", \' and \\
- A single character can be treated as a number by placing it between single quotes (e.g. 'a' == 61h).
- If
-D WINDOWS_QUOTING
is used for compiling as504, strings can start with a ', but the single-character function is not usable then. This define was used for compiling the Win32 binary below.
Download
See the ChangeLog (mostly Dutch) for a list of changes per version-date.
Compiling
Using a standard UNIX system with a C compiler, make and yacc, you should be able to compile as504 as follows (provided that the as504 archive is in the current working directory):
tar -xvjf as504*.tar.bz2
cd as504*/
make
make man
Now as504
is the assembler and as504.cat
is the manpage.
Compiletime options can be changed in the Makefile:
-D OS_linux
, replace with -D WIN32
to build for windows.
-D WINDOWS_QUOTING
, remove this to return to the standard C syntax for using single characters.
License
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
See http://www.gnu.org/copyleft/gpl.html
Bugs/Contact
Known bug: included files should always end with a newline (will be fixed if the assembler is being used, so report that please).
Please send any other bugs you may find to me: freek -at- vanwal -dot- nl.