Amiga Computing - Commodore Is Awesome
Amiga Computing - Commodore Is Awesome
Amiga Computing - Commodore Is Awesome
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
1<br />
14 a 1, ,? I 1<br />
urse: v1.1<br />
CURSOR takes programs that are<br />
written for the <strong>Amiga</strong>BASIC interpreter<br />
and turns them into programs<br />
that can be run directly from<br />
al or Workbench.<br />
In doing so it compiles your<br />
BASIC programs into machine<br />
code, which means that the resultant<br />
program will run faster than<br />
the original. Not all the<br />
<strong>Amiga</strong>BASIC keywords are implemented<br />
in this version, although<br />
most are. For a full list of supported<br />
commands and functions<br />
look at the file Keywords.DOC in<br />
the Cursor drawer.<br />
The best way to use Cursor is to<br />
copy it into the C: directory of your<br />
boot-up disk. If you're still working<br />
from a bog-standard Workbench<br />
disk you'll need to make some<br />
room first by deleting some of the<br />
things you don't use very much.<br />
You must also copy the file<br />
bas_runtimelibrary (in the libs<br />
directory of the cover disk) into the<br />
LIDS: directory of your boot-up<br />
disk. All programs compiled with<br />
Cursor need this library to be present<br />
in IBS:, and so does Cursor<br />
itself. Cursor also needs the four<br />
maths libraries: mathflp.library,<br />
mathtrans,library, mathieeedoubbas.library,<br />
and mathieeedoubtranslibrarv,<br />
which must he in<br />
LIB& or in rom (mathffp.library is<br />
in rom on 500s and 2000s).<br />
Cursor is best operated from the<br />
CLI— although it is quite feasible to<br />
Icola it if you want — by supplying<br />
the name of the BASIC program as<br />
the parameter. If Cursor finds no<br />
errors it will create an executable<br />
file whose name is that of the<br />
source file without its extension.<br />
If you boot from the cover disk<br />
you will be able to play with<br />
Cursor straight away because<br />
everything is where it should be.<br />
After the cover disk has booted<br />
drag the al window up to the top<br />
of the screen and open it to its full<br />
62 AMIGA COMPUTING November 19g0<br />
height. Then type:<br />
cd cursor<br />
to get into the Cursor directory. If<br />
you're curious, use Dir to see what<br />
files are there, You'll see a few<br />
example programs with litAS<br />
extensions, The one we're going to<br />
use displays a list of prime numbers.<br />
So type:<br />
copy prises.bas ram:<br />
You can work from floppy if you<br />
want, but it's quicker from ram.<br />
Now we've got our BASIC program<br />
where we want it, type:<br />
Cursor racprines.bas<br />
Cursor will load and decrunch,<br />
then a copyright message will<br />
appear followed by the filename<br />
ramprimes•bas automatically supplying<br />
itself to the prompt. The<br />
compiler will then make two<br />
passes of the source code and create<br />
the program.<br />
It takes just a few seconds.<br />
When it's finished type:<br />
dir ran:<br />
and you'll see three things. Firstly<br />
there is a I directory. While it is<br />
working the compiler writes some<br />
temporary files into T:, so it is best<br />
to assign it to the ram disk. The<br />
cover disk startup- sequence has<br />
done this for you.<br />
Next there is the primes,bas file<br />
we copied to ram, and lastly the<br />
program Cursor has created, called<br />
primes. To rim it type:<br />
ran:primes<br />
A window will open and lots of<br />
numbers will scroll past. all the<br />
prime numbers between 2 and<br />
1,000 in fact. To finish the program<br />
at any time, click the window's<br />
close gadget.<br />
Not very impressed, are you?<br />
Well, Primes is just a simple program<br />
to prove that it works. Now<br />
you've successfully compiled<br />
something small, go ahead and<br />
compile a more complicated program,<br />
ManSing.BAS, which is a<br />
Mandelbrot Set image generator.<br />
Although the compiled ManSing<br />
may appear to take an age to draw<br />
its image (about 40 minutes), the<br />
same thing running under<br />
<strong>Amiga</strong>BASIC takes hours and<br />
hours and hourzzz...<br />
It is important to remember that<br />
you can only compile BASIC<br />
source files which have been saved<br />
in Ascii format, so make sure you<br />
use SAVE "filename", A in the<br />
<strong>Amiga</strong>BASIC interpreter else you'll<br />
be getting compiler error messages.<br />
If you run Cursor without a filename<br />
as a parameter and press<br />
Return when asked for the name of<br />
the source file, you can change<br />
some options which influence the<br />
compiled programs. Actually, you<br />
can do this either in the menu that<br />
appears when you press Return<br />
after you have started Cursor, or<br />
with the OPTION keyword in the<br />
source file. The following options<br />
are available:<br />
NO WINDOW: No window is<br />
opened automatically when the<br />
compiled program is started.<br />
TRYCLIWINDOW: The compiled<br />
program will try to use the CU<br />
window as a window with the<br />
number I.<br />
If this is not passible — for example,<br />
if the compiled program was<br />
started from Workbench — a new<br />
window is opened. You should not<br />
use graphics commands in the al<br />
window because you can inadvertently<br />
overwrite the windove's border,<br />
OPENWINDOW: A new window<br />
with the number I is always<br />
opened on the Workbench. This is<br />
the default option.<br />
ALLPCRELATIVE: Cursor assumes<br />
that all branches in the compiled<br />
machine code program do not<br />
reach further than 32k. The compiled<br />
program will be shorter if<br />
you use this option.<br />
SOMEPCRELATIVE: Cursor only<br />
assumes that all branches within<br />
subprograms do not reach further<br />
than 32k.<br />
NOPCRELATIVE: All branches can<br />
reach as far as they want. This is<br />
the default option because it is the<br />
safest assumption.<br />
WRITELINENUMBERS: The line<br />
numbers of the source file are written<br />
into the compiled programs.<br />
They will be displayed if the compiled<br />
program aborts with an error<br />
message. But the compiled program<br />
will also get bigger and run<br />
slower.<br />
All programs compiled by<br />
Cursor are pure. and Cursor sets<br />
the pure bit of the programs automatically.<br />
Compiled programs can be<br />
started from the CU or the<br />
Workbench (provide your own tool<br />
icons).<br />
Parameters passed from the al<br />
are treated as if the user typed<br />
them in using the keyboard after<br />
the program has started, separating<br />
them with the Return key, so they<br />
can be read and processed with<br />
INPUT statements.<br />
If an error occurs while a compiled<br />
program is running, an error<br />
message will be written either to<br />
standard output (if it exists) or a<br />
requester will appear.<br />
You will see additional pieces of<br />
information in the requester, like a<br />
more exact description of an I/O<br />
error or perhaps the number of the<br />
line in the source file where the<br />
error occurred.