Electron User


Addcomm
By Vine Micros
Acorn Electron

 
Published in Electron User 2.09

As the name indicates, this is a utility program which adds commands to your Electron, giving you, in effect, an even more extended Basic. It is stored on a ROM chip and to be able to use it you must have a ROM card or box such as the Slogger Rombox or Rombox+.

The added commands fall into four categories:

  • Graphics
  • Logo graphics
  • Toolkit Commands
  • Miscellaneous

Electron graphics are already superb, but the Addcomm commands make them even better. There are, for example, commands for creating circles and ellipses. They are really easy to use. For instance:

10 MODE5
20 CIRCLE 640,512,400

will draw a circle of radius 400 screen units with its centre at the centre of the screen. If you don't like your screen being 1280 units across and 1024 units up, you can scale it.

SCALE 0,10,0,10

will make the screen 10 units across and 10 units down. To get a similar circle you need:

CIRCLE 5,5,4

On the scaled screen you cannot use MOVE, DRAW or PLOT but you can use SMOVE, SDRAW and SPLOT. Any line in a program can mix Basic and Addcomm statements or variables. So:

CIRCLE X,Y,RND(500)

is quite acceptable. Extra parameters give arcs.

If you've ever envied the colour fill routines you see in commercial programs it's easy with Addcomm. The statement FILL with X and Y co-ordinates will fill from the point specified to the edge of the screen or to a non-background colour.

This will fill any shape, however complex, even through text. If you fancy patterned filling, CFILL allows you to specify a mix of colours for individual pixels.

It's even possible to have a non-upright screen by using ROTATE, or to shift the whole thing up or to the side with the TRANS command. Logo graphics give you the chance to create displays with minimal use of co-ordinates. It's rather more like using a pen.

First you decide where to start on the screen (LOMOVE). This sets the position of the Logo cursor. You choose your PEN (dots, lines or fills) and then the ANGLE to draw and the distance to ADVANCE.

If you prefer relative rather than absolute angles, TURN can be used to rotate a specified number of degrees. LCIRCLE and LELLIPSE draw circles/ellipses or arcs around the Logo cursor.

The Toolkit commands offer a mix of useful and informative commands. MEM displays in decimal and hex how much memory your program takes and what is spare. This is based on your current mode, so put yourself into the correct mode when using it.

CHAR is a superb command enabling you to design/edit VDU 23 characters. There are dozens of programs which do this, but this one can be used while you're actually writing your program.

GOODPROG attempts to mend a Bad Program, while FKEYS displays on screen the contents of your function keys. Both work well, and, because Addcomm becomes a part of your computer they sit there waiting to be used in crisis situations.

The same applies to LVAR, which lists all the variable names you've used. This can really help to avoid a muddle.

VERIFY is a facility that was missed out on the Electron. It checks that what has been saved on tape exactly matches the same program in memory.

LLIST is a line listing command. Unlike ordinary LIST, LLIST can be included in a program. Silly? Not at all. My error routine, when debugging programs is now:

ON ERROR MODE6:REPORT:PRINT" at line ";ERL:LLIST ERL:END

This tells me the error and displays the problem line. Using FIND it is possible to list the whole program, including the possibility of different list formats such as multi-statement lines broken up.

Whenever I program I like to use meaningful variable names. It makes life easier for me, but the computer can handle the resident integer variables (A% - Z%) more quickly and efficiently.

Using the Addcomm command GREPL I can ask for a variable such as pos_of_prog and change it right through the program to F%. SREPL finds each variable you might want to change and then gives you the option of whether to change it or not.

I can now use variables that I understand and when the program is fully debugged, change to short fast variables. Not only that, I can use KILLREM to remove all REM statements and then superb COMPACT to combine lines, thus saving more memory and processing time.

Programs of mine that I have put through the processes save about one third of the original memory - and run more quickly into the bargain. For example, programs I and II are identical in what they do (selecting football pool numbers) but Program II has had its variables changed and its REMs removed. It has then been compacted and renumbered. Table I shows the differences. Imagine the effects on long programs.

Program I: Long pools selector

      10REM POOLS PREDICTOR
      20REM By Rog Frost
      30REM 
      40REM
      50MODE1
      60rnd=RND(-TIME)
      70VDU19;4;0;
      80PRINTTAB(1,10)"Auto selection of twenty four numbers"TAB(10,13)"for   
   football pools"TAB(4,20)"Press space to get numbers"
      90REPEATUNTILGET=32:CLS
     100DIM choice%(55)
     110FORselection%=1TO24
     120number%=RND(55)
     130IFchoice%(number%)<>0THEN120
     140choice%(number%)=number%
     150NEXT
     160PRINT'
     170FORprintout%=1TO55
     180IF choice%(printout%)<> 0 PRINT printout%
     190NEXT

Program II: Compacted

      10MODE1:R%=RND(-TIME):VDU19;4;0;:PRINTTAB(1,10)"Auto selection of twenty 
   four numbers"TAB(10,13)"for football pools"TAB(4,20)"Press space bar to get 
   numbers":REPEATUNTILGET=32:CLS
      20DIM C%(55):FORS%=1TO24
      30N%=RND(55):IFC%(N%)<>0 THEN30
      40C%(N%)=N%:NEXT:PRINT':FORP%=1TO55:IF C%(P%)<>0 PRINT P%
      50NEXT

Table I: ADDCOMM advantages

 Program IProgram II
Time taken 2.1 seconds1.9 seconds
Program length 394 bytes246 bytes
Variable storage 291 bytes232 bytes
Spare memory 7763 bytes7970 bytes

So far all has been very good, but three of the miscellaneous commands are dreadful. POPGOS, POPREP and POPFOR allows you to jump out of subroutines, REPEAT/UNTIL loops and FOR/NEXT loops. All of these make for very bad programming and should be avoided.

Another command, LGOTO is like GOTO but instead of jumping to a specified line number, you jump to a label.

It works fine, but so far I've had no particular use for it. SETWIN allows you to predefine seven text windows which can then be edited with the WIN command. It's easier than VDU28.

The last miscellaneous command is SORT. This can be used to sort string arrays into alphabetical order. In truth, it actually produces ASCII order with upper case before lower case. It's a very fast sort taking just 0.75 seconds to sort 100 words into order.

To sum up, Addcomm is brilliant, particularly the graphics and the toolkit, but there is a small price to pay in terms of memory. It requires 256 bytes of RAM for its own use and so it pushes PAGE up to &F00. If you are going to load a long commercial program it's as well to turn Addcomm off. To do this type Addcomm and hit the BREAK key. *FX 163 will turn it on again.

Firmware like Addcomm requires good documentation, and Vine Micros has achieved a winner here. The 72 page manual is clear, concise and simple giving full syntax and examples for each of the forty commands. Addcomm is the most valuable piece of software I've got. Every Electron owner who does some programming should consider getting it. It's easily worth the £28.

Rog Frost

Other Acorn Electron Game Reviews By Rog Frost


  • Inertia Front Cover
    Inertia
  • Dominoes Front Cover
    Dominoes
  • US Drag Racing Front Cover
    US Drag Racing
  • Clogger Front Cover
    Clogger
  • TV Director Front Cover
    TV Director
  • Serpent's Lair Front Cover
    Serpent's Lair
  • Vindaloo Front Cover
    Vindaloo
  • Primary Time Front Cover
    Primary Time
  • Gyroscope Front Cover
    Gyroscope
  • Subway Vigilante Front Cover
    Subway Vigilante