Beebug


6502 Development Package

Author: Donald Morgan
Publisher: Acornsoft
Machine: BBC Model B

 
Published in Beebug #34

The long awaited 6502 Development pack from Acornsoft has at last appeared. Donald Morgan brushes the cobwebs off his second processor and reports on the package.

6502 Development Package

The long awaited 6502 Development pack from Acornsoft has at last appeared. Donald Morgan brushes the cobwebs off his second processor and reports on the package.

One of the nice features of the BBC Micro is its built-in assembler. Although quite adequate for the beginner, is this assembler really suitable for serious program development? A number of manufacturers have already given their answers to this question in the form of standalone assemblers (for example, see VASM review Vol. 3 No. 1). Now, a year and a half after the launch of the 6502 Second Processor, Acornsoft have released an assembly package, designed specifically for the 6502 Second Processor, that takes advantage of the extra speed and memory of this device. This is the 6502 Development Package, or DevPack for short.

Individual programs within this package include a truly superb text editor, a powerful macro assembler, a cryptic debugger (more on that later), a print utility and a cross referencer. To run DevPack you will require both a 6502 Second Processor (at about £200) and a disc drive (dual drives are preferable). The manual assumes that you already have a fair knowledge of 6502 assembler; although clear, it would provide hazardous reading for the absolute beginner.

The text editor supplied with the DevPack is very powerful. The reference card, for example, gives a seven keystroke sequence to reverse alternate characters within a document! Not many editors offer that degree of flexibility in their search and replace options. Control codes (if desired) are catered for, with the maximum size file being approximately 47K. This is a well thought out editor, extremely pleasant to use and difficult to fault.

MASM (Macro ASseMbler) is the main program in this package and has been written specifically for a 6502 Second Processor. It assembles code very fast thanks to efficient buffering using the extra memory available. The macros that it offers can lead, via micro libraries, to the creation of a pseudo high level language. Local and global labels, conditional assembly, looping and recursion, file linking and full macro parameter substitution all go to make MASM a very powerful assembler. MASM provides some good numeric and string manipulation operations - credit is due here, as they are comprehensive and carefully thought out. Unfortunately, MASM does have some serious flaws.

Instead of using the more normal (and BBC 'standard') MOS Technology assembler mnemonics, MASM uses the obscure Rockwell versions. This leads to LDA #4 being written as LDAIM 4, for example. The two short listings below assemble identical code (the first in BBC Basic format and the second in MASM) and should serve to indicate MASM's approach to key aspects of layout, etc. The mnemonics do have one advantage - the extra speed that results from including addressing information in the instruction code.

 10 REM Example
 20 DIM CODE 40
 30 oswrch=&FFEE
 40 FOR PASS=0 TO 2 STEP 2
 50   P%=CODE
 60   [OPT PASS
 70   .start
 80   LDX #32
 90   .loop
100   TXA
110   JSR oswrch
120   INX
130   CPX #127
140   BNE loop
150   RTS
160   ]
170 NEXT

BBC Basic Assembler Listing

; > Example
oswrch *      &FFEE
       ORG    &2000
start  LDXIM  32
loop   TXA
       JSR    oswrch
       INX
       CPXIM  127
       BNE    loop
       RTS
       END

MASM Listing

When considering whether you should use MASM, one of the main decisions will be whether or not you would use these mnemonics. Personally, I am prepared to change, but I know a couple of major BBC authors who say they would not change over to MASM to assemble their programs.

Another weak popint with MASM is the restriction on label length - six characters! If local labels were not available this would have been a pretty damning flaw.

By means of the 'CPU' directive, MASM allows the additional CMOS op-codes to be assembled as well as standard op-codes. Although this is a nice feature, there is very little available in the way of detailed documentation on these new op-codes. The otherwise excellent manual would have benefitted from the inclusion of some extra material to enlighten the newcomer to these extensions to the 6502 instruction set.

To aid the user in the inevitable debugging process, Acorn have included a program called Trace, which, to its credit, offers most of the facilities that one might expect. These include 'simulation' with range selection, breakpoints, memory protection, display, editing, etc. The problem with Trace, though, is the user interface. Commands are all two letter entries with some very cryptic derivations. Memory has been termed store and disassembly is renamed as store interpreting - hence (I think) 'IT' is the command for disassembling memory.

Numbers in Trace are entered in hexadecimal (no other base is allowed) but are illegal if not preceded by an ampersand. I couldn't find a logical reason for this and would have thought that the ampersand should not have been necessary.

Apart from the cryptic two letter commands and the insistence upon a preceding ampersand, my other criticism of Trace is that it cannot disassemble CMOS op-codes (not mentioned in the manual, incidentally!). This means that Trace is not capable of coping with everything that one might assemble with MASM. The disassembly process does not correctly adjust branches to their final destination either, but just prints the offset. Neither could I find any way to display memory in ASCII. This program is, frankly, a disappointment.

There are some additional utilities with the package. The first of these is a print program which will generate source listings with more extensive formatting than is available within the assembler. A second version of this program works without a second processor attached. There is also a cross referencer, again in two versions.

Overall, this is a very powerful package (probably the most advanced of its kind for the BBC Micro), and can be recommended if the weak points mentioned above are borne in mind. Personally, I think the good points in this package outweigh the bad ones, and suggest that all serious programmers give every consideration to this package.

Donald Morgan