EUG PD


Addcomm ROM And Its Features

 
Author: Tony Boarer
Published in EUG #27

Addcomm 1.30

My version of this ROM is 1.30, which is switched on when the computer is powered up. Version 1.31 is the "off" version on power up and is switched on by *FX163,0 then BREAK. As I have said before, a ROM image of version 1.30 has to switched on after *RLOAD ADDCOMM and rid by CTRL-BREAK, *FX163,0 (RETURN) then BREAK. But another thing that I have found since having the Addcomm ROM image put into my last ROM128 is that it crashes the computer on power up. So I suspected that this was because the latest ROM128 is in Page 13 and therefore above BASIC. I confirmed this by placing my own ROM image in the battery-backed RAM in Page 15, both write and non-write protected, and in both cases the computer crashed on power up. Previously I had always LOADed the image into my 16K module in Page 7 and switched on with the above procedure. I should really have twigged this would happen, for Addcomm allows its commands to be used in BASIC programs without any * prefix.

Addcomm Features

It is an interesting ROM with four groups of commands:

  1. Enhanced graphics
  2. LOGO/Turtle Graphics
  3. Toolkit commands
  4. Miscellaneous statements

The enhanced graphics are a big advantage in making up pretty pictures. For example, the screen can be scaled to any dimension positive or negative, and choosing a scale like x(0,10),y(0,10) makes later selection of co-ordinates much easier for colouring in one's creation which, in my case, can then be printed out in colour.

CFILL And FILL

Mode 2 obviously gives a wide scope with the CFILL and FILL commands. This is because the CFILL command can take two forms, viz:-

      CFILLa,b,c,d or
      CFILLa,b,c,d,e,f,g,h
         where the first is a block of 2x2 pixels and the second a block
         of 2x4 pixels.

Quite clearly, complex colouring can be produced by permutating the selection of individual pixels. The following simple program gives some idea on what can be done:

       10INPUT"MODE required M%";M%
       20MODEM%
       30IF M%=2 GOTO40ELSE20
       40GCOL0,132:CLG
       50SCALE-10,10,-10,10
       60FOR angle=0 TO 180 STEP45
       70ROTATE0,0,angle
       80ELLIPSE0,0,3,6
       90NEXT angle
      100CFILL1,1,1,1
      110FILL0,0
      120CFILL1,3,3,1
      130FILL0,5
      140CFILL1,3,3,1
      150FILL0,-5
      160CFILL1,3,3,1
      170FILL5,0
      180CFILL1,3,3,1
      190FILL-5,0
      200CFILL1,2,2,1
      210FILL4,4
      220CFILL1,2,2,1
      230FILL-4,4
      240CFILL1,2,2,1
      250FILL4,-4
      260CF1,2,2,1
      270FILL-4,-4
      280CFILL3,3,3,3
      290FILL0,3.2
      300CFILL3,3,3,3
      310FILL0,-3.2
      320CFILL3,3,3,3
      330FILL3.2,0
      340CFILL3,3,3,3
      350FILL-3.2
      360CFILL1,2,1,2,2,3,3,2
      370FILL3.2,1.2
      380CFILL1,2,1,2,2,3,3,2
      390FILL-3.2,1.2
      400CFILL1,2,1,2,2,3,3,2
      410FILL-3.2,-1.2
      420CFILL1,2,1,2,2,3,3,2
      430FILL3.2,-1.2
      440CFILL3,3,1,1,2,2,1,1
      450FILL1,4
      460CFILL3,3,1,1,2,2,1,1
      470FILL-1,4
      480CFILL3,3,1,1,2,2,1,1
      490FILL-1,-4
      500CFILL3,3,1,1,2,2,1,1
      510FILL1,-4
      520CFILL3,3,3,2,1,1,1,2
      530FILL2.5,2.5
      540CFILL3,3,3,2,1,1,1,2
      550FILL-2.5,2.5
      560CFILL3,3,3,2,1,1,1,2
      570FILL-2.5,-2.5
      580CFILL3,3,3,2,1,1,1,2
      590FILL2.5,-2.5
      600VDU19,4,4;0;
      610VDU23,1,0;0;0;0

This program will draw ellipses on the vertical and horizontal axes and 45 degrees in between and come back to the original axes which is critical for the FILL(x,y) command. The FILL command is a co-ordinate within a bounded space that is to be filled by the colours demanded by the CFILL pixel selection. Therefore, in the above example all the bounded spaces created by the overlapping ellipses will be filled in the colours selected and symmetrically about the X and Y axes.

Obviously this could be constructed with far less lines.

Other Enhanced Graphics Commands

Other commands that can be used in the enhanced graphics are SMOVE, SDRAW, SPLOT, CIRCLE, TRANS, UNSCALE and PRINT. The first three are similar to BASIC except that they use the scaled screen. TRANS(x,y) is used to translate a scaled screen by a vector displacement. UNSCALE will convert scaled co-ordinates to non-scaled co-ordinates to provide greater compatibility between the standard graphic scale and the user-defined scale. PRINT x,y will display the value of unscaled co-ordinates corresponding to the scaled co-ordinates after UNSCALE.

A simple Logo/Turtle Graphics program with Addcomm will take the form:

       10SCALE0,10,0,10
       20ROTATE0,0,0
       30TRANS0,0
       40MODE4
       50ANGLE 90
       60LMOVE 5,5
       70PEN 13
       80FOR loop=1 TO 6
       90ADVANCE 1
      100TURN 60
      110NEXT loop

This will draw a hexagon. Other "Logo" commands are LCIRCLE, LELLIPSE and LPOS. LPOS returns the current position of the logo-cursor. PEN can be used as "PEN p", where p is PEN 4 - nothing seen on screen, PEN 13 - draw a line, PEN 29 - draw dotted lines, or PEN 85 - draw triangles (used with OPT 7,1 - see later). A whole series of overlapping hexagons could be drawn, for example, and then bounded areas coloured in using FILL and CFILL.

Toolkit Commands

Toolkit commands are CHAR, COMPACT, FIND, FKEYS, GOODPROG, GREPL, KILLREM, LGOTO, LLIST, LVAR, MEM, OPT, SORT, SREPL and VERIFY. The CHAR command provides a simple way of designing user-defined characters using an 8x8 grid. COMPACT is an intelligent line compacter that will add lines together in a program in such a way that program execution is not affected - e.g. COMPACT |100,500 will compact lines 100 to 500 inclusive.

FIND|x(|(")s,e) will find all 'x's between lines s and e inclusive and in quotes if " is used. FKEYS returns the function keys set. GOODPROG will attempt to mend a "bad" program. GREPL will replace globally and set of characters with any other set of characters and takes the form GREPL|x|y(|(")s,e).

KILLREM (|s,e) will kill all REM statements between lines s and e inclusive. LGOTO x provides a structured jump where x is a label in lower case and must be at the start of a line. LLIST x will list a line whose number is x, and can be used in conjunction with FIND and certain OPT commands but is too complex to explain now.

LVARSg will list variables whose names begin with S onwards to those beginning with g, and LVARtt will list all variables beginning with t. MEM will give the spare memory.

OPT Commands

There are also many OPT commands (again too complex to explain now!) which can be used in Turtle Graphics, and with foreground and background effects with CFILL. SORT is used with string arrays and SORT A$(1),A$(5) will sort into alphabetical order elements 1 to 5 of array A$. SREPL will replace selectively any set of characters with any other set of characters within part or all of a program, with all matches being highlighted, and the user specifying whether to replace or not by keying in "Y" or "N" - it takes the form SREPL|x|y(|(")s,e).

VERIFY will check that the program on cassette or disk is as in memory and takes the form VERIFY f(,a) where f is the filename and a the start address if not PAGE.

Miscellaneous Commands

The miscellaneous commands are POPFOR, POPGOS, POPREP, SETWIN and WIN. POPFOR allows the jumping out of a FOR...NEXT loop, e.g.:

       10FOR X=1 to 30
       20IF X*X>100 THEN POPFOR:GOTO 50
       30NEXT X
       40END
       50......

POPGOS will delete the current subroutine return address so that a GOSUB subroutine can be jumped out of cleanly. POPREP is similar to POPFOR for use in the REPEAT...UNTIL loop. SETWIN is used to set up multiple windows to a maximum of seven, and takes the form SETWIN w,x1,y1,x2,y2 where w is the window number 1 to 7. The windows are then selected by the command WIN w. Again, a lot can be done with this arrangement using CFILL and FILL commands and normal BASIC.

Addcomm allows command syntax to be obtained quickly such as *H.SCALE and is compatible with both the BBC and the Electron, although on the latter it can only be used in 32K mode. It's wise however to keep a separate disk for files that use it. It wouldn't do to use Addcomm commands in professional software, of course! Too few people would be able to take advantage of it.

Verdict

I hope that readers without this ROM still find the above feature interesting (and they might then get one if one becomes available). There is a lot more to the Addcomm's "Super Extended BASIC" than I can possibly explain!

Tony Boarer, EUG #27

Tony Boarer