MP-assembler
What is it?
MP-Assembler is an assembler to be used on the PC to assemble source code for the 6502, its compatiblessuccessors and the Z80. MP stands for "Multi-Processor". The special feature of this assembler is that you can mix 6502- and Z80-opcodes in the same file. This can come in handy when assembling programs for the C128. The MMF-9000 also contains a 6809. For this reason I want to enable this program to handle 6809 code as well in the future.The story
I know, nowadays a lot of assemblers exist for the 6502 and Z80 and each claims to be better than all the other ones. But when I started to write this one in 1988, there wasn't one available as free/shareware (AFIAK). I don't think my one is better but it has one major advantage: you get the source code with it! So if you don't like certain features, you simply change them or add ones of your own!My assembler is a multi-pass assembler. There exist two- and even one-pass assemblers but they are limited or IMHO they use one or another trick to conceal the fact that you need at least three passes to determine all labels.
Using the assembler
Usage: MP-ASSEM /Ffilename [/L] [/R$aaaa-$bbbb]/L = save labels in filename.LBL /R=$aaaa-$bbbb = range of bytes which should be saved. Only one range can be supplied.
The assemblerfiles
The only thing the assembler asks from you is a begin- and a endmark (.ba and .en). For the rest you're absolutely free to write it in the way you want. You can define more then one beginaddress but be warned: (for the moment) it is your own responsibility to take care not to overwrite previous assembled code!To help you to streamline your application you have a lot of compiler directives at your disposal:
.ap Filename = APpend a file to be assembled as well
.ba $xxxx = Begin Address of the code or data. More then one .ba may be
used.
.by [$]aa, [$]bb, [$]cc.....
.by label1, label2.....
= define a range of BYtes. You can use fixed values as well as
labels.
.co This is comment
= COmment to be displayed on screen during 3rd pass
.ei = End If conditional programming
.el = ELse conditional programming
.en = ENd of file. All text, code or data behind this mark will be
ignored.
.eq OwnLabel1 = $xx
.eq OwnLabel2 = $xxxx
.eq OwnLabel3 = OwnLabel2 + 1
= EQuals, define your own label. Values can be changed.
.fi Filename = use a binary FIle as base for your own binary. Can be used to
write patches over original binaries.
.fb [$]xx, [$]yy
.fb "c", [$]yy
.fb label, [$]yy
= Fill Byte: fill a range of length [$]yy with the same byte. A
character or a fixed value can be used as well.
.fd [$]xxxxxxxx, [$]yy
.fd "c", [$]yy
.fd label, [$]yy = Fill Doubleword.
.fw [$]xxxx, [$]yy
.fw "c", [$]yy
.fw label, [$]yy
= Fill Word.
.if label = IF start conditional programming.
.ma Name = define a MAcro.
.me = Macro End
.rb $aaaa = Re-address Begin. Following code will be assembled as if it
was situated at address $aaaa.
.re = Re-address End
.ta = translate given text to ASCII (default)
.tp = translate given text to PETSCII
.tx "This is 'TEXT'"
.tx 'This is "TEXT"'
= TeXt
.wo $aaaa, $bbbb, $cccc.....
.wo label1, label2.....
= define a range of WOrds.
; Here you can place comments
= remark
/*
here you can place
several lines
of comment
*/
= speaks for itself IMHO
I'm working on a Pascal Compiler that uses this assembler to generate the executables. This meant implementing features and directives that are not mentioned yet in this document.
The future
- warning when writing over previous assembled code
- maybe 6809 (CBM9000) and/or 8088 (CBM730)
- find a way to make them relocatable (like EXE-files on PCs)
The source code.
Having questions or comment? You want more Info?
You can email me here.