Assemblers for the Atari 520ST

by Matthew Jones

 

Issue 19

Jan/Feb 86

Next Article >>

<< Prev Article

 

 

A review of the Kuma K-SEKA assembler and Metacomco Macro Assembler

As someone who has written several big programs using an 8 bit macro assembler (AMAC), I was interested to see what sort of facilities the macro assemblers for the 16 bit 520ST would give me. The two I have had the opportunity to review so far are obviously meant for two different types of user.

The Kuma K-SEKA is actually a complete editor / assembler / linker / debugger program. It provides all you need to write programs in 68000 assembly language. The problem is, as with many programs that 'do everything', it doesn't do some parts very well. The first thing that any programmer uses (on the computer) is the editor. The editor of the KSEKA is a simple line editor, i.e. one line at a time, with no facility to cursor up and down. I am used to using EDLIN on the IBM PC, which is pretty poor, but in comparison I have to say that the K-SEKA editor is worse.

The most noticeable missing feature is the ability to list ten lines each side of the line you are working on (the current line), the P command being nowhere near good enough as it alters the current line.

Commands available are: Insert text; Edit current line; Target to line (change current line); Bottom of text; Up n lines; Down n lines; Print (display) n lines; Zap (delete) n lines; Locate text; Kill text; Old (unKill) text and Howbig (sic) are files. To get the best out of the K-SEKA, I would use a dedicated editor for the major typing, and only use this basic editor for small debugging changes.

The assembler itself handles all of the standard (Motorola) mnemonics (as does the Metacomco Macro Assembler). What is of relevance to the programmer is the extra facilities that the assembler gives, provided by pseudo ops. (A standard line of machine code consists of an optional label (a symbol which identifies a particular memory location), an opcode (the instruction the 68000 understands), an optional operand (the data the instruction acts upon), and an optional comment line. A pseudo op is an opcode which is not converted to an instruction for the 68000, but is an instruction to be acted on by the assembler.) The table shows a general comparison of most of the available pseudo ops in AMAC, the Atari Macro Assembler for 8 bit machines, MAC65, the OSS 8 bit macro assembler, and the 68000 processor K-SEKA and Metacomco Macro Assembler (referred to hereafter as ASSEM, as it is called on the disk).

One of the most immediate observations about K-SEKA is that it is only suitable for small programs. When I say small, I mean however much you can fit into the edit and code buffers at the same time. K-SEKAs' most noticeable missing pseudo op is INCLUDE. Without this you cannot assemble very large programs, reading through several files to produce a final big machine loadable (object code) file. Not only that, but the object file cannot be written to disk until after assembly. The advantage of this method of working is that it is very fast, and should allow a very fast edit-assemble-run-debug time.

One thing that users of the 8 bit assemblers will find new is that most 68000 programs will need 'linking' (except BASIC and LOGO). Linking is needed because the programs are assembled (or compiled) to an object code file which cannot be loaded and run as is, but must be converted first. This allows a program to be written and assembled in several smaller more manageable parts and put together (linked) later. The K-SEKA however does not need this stage (as it cannot generate code in sections), and the code produced can be run straight away. A limited linking facility is provided, but it is of little use as it only produces absolute not relocatable code. TOS, the 520ST disk operating system, generally uses relocatable code which allows it to have several programs loaded at the same time. Absolute code always loads at the same place in memory, which may cause compatibility problems later.

Kuma does not call the K-SEKA a macro assembler, just an assembler, but it does have macro facilities. A macro is a predefined piece of code that can be used as though it were a machine opcode. For instance, you may want to have the console bell ring at several places in your program. The assembler code to do this would be:

      MOVE   #7,-(SP)  ;move bell char to stack
      MOVE   #2,-(SP)  ;GEMDOS function 2
      TRAP   #1        ;call GEMDOS
      ADDQ.L #4,SP     ;restore stack

By changing this to:

BELL: MACRO            ;start of macro
      MOVE #7;-(SP)    ;move bell char to stack 

      MOVE #2,-(SP)    ;GEMDOS function 2

      TRAP #1          ;call GEMDOS 

      ADDQ.L #4,SP     ;restore stack

      ENDM             ;end of macro definition


The assembler remembers the text when it is read. The programmer can then use it at any time by simply using the command:


      BELL             ;ring bell


The macro assembler will replace this with the previously defined code. This looks similar to subroutines, but the code is copied at each use, a subroutine only exists in one place. Parameters can also be passed to the macro definition, so BELL 4 could ring the bell four times.

 

ASSEM, the Metacomco assembler, has a very full featured macro facility. In fact, most of the things that it does are done very well. For instance it can use all available program segments (a separate section for the actual code, the data and the uninitialised data), the K-SEKA only has the former two. The object files produced must be linked before they can be run, and the Digital Research LINK68 and RELMOD programs are provided for this. LINK68 is too complicated for this review, but comes with GEM libraries and various object files which the serious programmer will need for the best use of the computer. No documentation is provided for these, so it may cost extra.

 

When it comes to the problems of ASSEM, I have only relatively minor quibbles. K-SEKA, and all other assemblers I have known (IBM PC as well) start a comment at the end of a line with a semicolon (;). ASSEM will accept the semicolon start, but it also assumes that any text after the operand, starting with a space character is also a comment. This to me is a great mistake. I can imagine accidental spaces occurring during an edit which cause the loss of part of the operand to ASSEM, leaving a syntactically correct line which is actually wrong, which means I would be searching for hours (days) for a problem that most other assemblers would list as an error due to the lack of semicolon. Another quibble is that the EQU pseudo op cannot be interchanged with the equals (=) character. I so much prefer it.


Metacomco provide all you need to write programs on their disk. Their screen editor, ED, is provided. I have been using this
for some months now, and I find it very irritating. It has all the usual facilities of a screen editor (a screen editor means you can use the cursor to scroll up and down, like Atariwriter), though some need a combination of commands. For instance to do a block move, you must do an insert block then a delete block. Each command can be repeated until an error occurs, so a global search and replace is possible. However this is very slow as ED spends a lot of time showing you how it removes each character of the old word, and then inserts each character of the new. Very pretty I'm sure, but a big waste of time. What has to be my biggest frustration is that the block markers are not visible and they disappear very easily. This means that you cannot mark a block at one end of the text buffer, go to the other end doing a bit of editing on the way and expect the block to still be marked when you get to where you want to move it. Still, it is far more useable than the K-SEKA editor.

 

What ASSEM does not provide but K-SEKA does is a debugging facility. K-SEKA allows you to set breakpoints, single step, and all the usual debugger functions, as well as a disassembler. Digital Research can provide a debugger for the LINK68 program.

Conclusion

To sum up, K-SEKA is most useful to the programmer interested in learning 68000 assembler. It provides everything you will need (except perhaps a better editor) and whilst it does have a size limitation, on a 512K machine, I can't imagine it being reached too early.

The Metacomco Macro Assembler (ASSEM) is obviously aimed at the more professional programmer. It provides all the pseudoops you would expect and more, comes with libraries, a linker and an editor. The edit-assemble-run-debug time will be a lot longer, but the program could be a much bigger one. The KSEKA will have uses for the ASSEM user as an experimentation tool.

Though I don't know the Atari Assembler-Editor cartridge very well, I would say that it is to AMAC, what K-SEKA is to ASSEM. K-SEKA is ideal for the beginner, and masterpieces can be written, but they are easier with ASSEM.

Finally, it is worth saying that neither of these assemblers come with more than a reference manual. Certainly they are not going to teach you 68000 assembler, you must buy a separate book for that.

I hope to review other assemblers and languages for the ST as soon as I get them.

Footnote: Metacomco will be making their assembler compatible with both the Digital Research LINK68 and the GST linker. At the time of writing it had not been decided who's linker and libraries will actually be supplied on the disk. The DRI libraries are the 'official' GEM libraries, but I daresay that the GST libraries, if they are good, will be used by more people. Contact Metacomco for more details.

Metacomco Macro Assembler - £49.95
METACOMCO, 26 Portland Square, Bristol, Avon, BS2 8RZ. 

Tel. (0272) 428781

 

Kuma K-SEKA - £49.95
KUMA, 12 Horseshoe Park, Pangbourne, Berks, RG8 7JW. 

Tel. 0735 74335

____________________

Table 1. This table lists all the major pseudo ops available to each assembler. The 68K assemblers are listed alongside those of the 6502 assemblers to aid owners of those assemblers in a comparison.

The pseudo ops are listed in the following assembler order: 

AMAC  MAC65 K-SEKA  ASSEM 

GENERAL PSEUDO OPS

Set origin (RORG=relative origin)
ORG  *= ORG,LOAD  RORG
Set location counter (for overlays)
LOC  none n/a n/a
Assemble to different parts of program file (segments). 

USE

none

CODE,DATA 

SECTION, 

BSS, DATA

TEXT, OFFSET

End of program.
END  .END END END
Conditional assembly features, e.g. extra code to be assembled in a debug version.
IF .IF IF IF
ELSE .ELSE ELSE  none
ENDIF .ENDIF ENDIF ENDC
Check condition, and generate assembly error if false. Used for checking if memory requirements are too big etc. 
ASSERT ERR  .ERROR  none  FAIL
Local labels. These can only be used in the same 'local' section of code. The Metacomco locals only exist between normal global labels, the 'global' labels are only global in the file though, and not known by the linker unless told about them.
: none $

PROC

EPROC

.LOCAL none (major labels)
Align to a boundary. Forces the program counter to an even (odd) boundary, needed for some 68000 instructions. 
n/a n/a EVEN/ODD CNOP
Generate illegal opcode for debugger.
none none ILLEGAL none
Define a label as global for linker. (Permits label use in another file.)
n/a n/a  GLOBL XDEF XREFa
Include a file for assembly. Useful for defining symbols across files, e.g. EOF,EOL etc.
INCLUDE .INCLUDE none(!) INCLUDE

SYMBOL DEFINITION PSEUDO OPS

Define a symbol.
= .= =

EQU

.EQU

EQU

EQUR,REG

Define an alterable symbol.
SET none none  SET
Allocate space in memory. Code is written to file.

DB

DC 

DW 

.BYTE 

.SBYTE

.WORD

 DC.size

(.size=.B,

.W,.L)

DC.size

(.size=.B, 

.W,.L)

Special format field lengths.
REAL6,VFD  none  none none
Allocate large spaces in memory (for tables etc.), but don't initialise.
DS  none BLK  DS
As above but initialise (fill) the space defined.  

ECHO

DB

ENDM

none

BLK

DCB

MACRO PSEUDO OPS

Start a macro definition.
MACRO  .MACRO  MACRO MACRO
Stop macro assembly (for use with conditional tests)
none none none  MEXIT
Ability to define unique labels within macros.
%K  none  ?0
Stop macro definition.
ENDM .ENDM ENDM ENDM
Ability to assemble direct to memory for immediate running?
NO YES YES  NO

OTHER FUNCTIONS

All of the assemblers have the ability to turn the generation opcode and/or listings on and off. Listings can be with or without conditionals, macros, paging, title (except KSEKA), and some have a page eject feature. MAC65 is the only one that needs line numbers in the source, something that would cause the others to splutter.

top