ScuzzBlog: Diaries December 2020
Entry 17th December 2020: Post 1: Amiga BASIC - Stack Overload.
Amiga BASIC - Stack Overload.
I started this little adventure a few days ago trying to help a
guy with running a large program in Amiga BASIC. Seems he had once
written a program that was very large and now couldn't run it cus
of memory issues. Having delved even deeper into my library of
BASIC books for the Amiga I am about done. I am not sure I have
solved the issue but I really cannot find any suitable solution.
I did discuss this the other day but I will again summarise what
I believe are the controlling factors to consider.
Before I begin can I be clear about what I call the Amiga BASIC
program and the actual writers own program. Both are a program
and I need to define which I am talking about. For the benefit of
clarity I will refer to the Amiga BASIC program as ABPROG and the
actual program written as the PROPROG.
ToolType Stack:
I call the Icon 'info' for ABPROG the 'Tooltype', probably the
wrong definition but I assume you know what I am talking about.
If you check the 'info' for a specific Tool for ABPROG you will
get the window showing the icons information. On that opening
'info' is a small box where you can change the 'STACK' size. I
have yet to find one reference in anything I have read where the
PROPROG requires a change in the ABPROG stack size from the Tooltype.
It would appear that the characteristics of the ABPROG are a
matter for the developer and they ensure that the number specified
is sufficient to carry out the functions of the ABPROG.
CLI STACK:
You can change the value of the stack in the CLI but again that
is an increase in memory for the actual CLI and nothing more.
Program or PROPROG stack.
This is controlled by the CLEAR command and I have discussed this
at length recently. I am convinced now that to control the parameters
of the PROPROG you need to use the BASIC commands and attributes
associated with 'CLEAR'.
MERGE and CHAIN:
A better management method is to break the program down into sub-
sections and then use the CHAIN and MERGE functions to flush out
text and simply move data to the next portion of the program. In
addition to this the PROPROG can be allocated space on a special
BOOT disk, specific for the project, to better use the resources
and memory on the disk, and ultimately the program [ EITHER ].
[QUOTE]
Opening a Program File
There are three main ways to open a program file. The most common
is to use the LOAD command. When you load a program file, all open
data files are closed, the contents of memory are cleared, and the
loaded program is put into memory.
A second way to load a program file is to attach it to the end of
a program already in memory. Do this with the MERGE command. MERGE
is useful when you are developing a large program and want to test
the parts of it separately. After testing and debugging the parts,
you can merge them together. Note: You must save all files with
the A option of the SAVE command before you can MERGE them with a
program currently in memory.
A third way to open a program file is to transfer control to it
during the execution of another program. Do this with the CHAIN
statement. When you use CHAIN, the program in memory opens another
program and brings it into memory. The first program is no longer
in memory. Options to the CHAIN statement include preserving some
or all variable values and merging the program already in memory
with the program to which control is being transferred.
[END QUOTE: The words of Commodore ]
Like I say I am just about done. Sadly BASIC doesn't feature very
much in magazines given that by WB2.x it was removed. It is a
feature of the Amiga history line that was cut short in favour
of other scripting techniques. Most would have moved over to one
of the more commercial products.
And so I didn't answer the question. I couldn't find an answer.
What I did find was an application that started life as ABasiC
cus of a failure of Commodore to develop its own language. Which
then was supplanted with a Microsoft product that was removed
in favour of other scripting methods by 2.0x. You can make your
own mind up whether Amiga BASIC was ever successful. For me it
doesn't look that way. I also find its implementation as dull
as soup. It never dragged itself out off the mire that was the
original language for 8BiT machines and I was truly glad to
see the back of it.
For my part I spent a lot of time programming in Mallard BASIC
and probably wasted too much of my life entering lines into some
very dull lifeless content. Had I had some of the more modern
methods available to me I would have dumped BASIC much earlier.
Anyhoo ... I finished that little exercise. I did find the books
quite amusing at times. I also found it interesting what folk
used as bookmarks in them. I do enjoy reading books. Sadly they
are a pig to photograph and I rarely squish them flat into a
scanner. So sorry for that.
I'm done.
Amiga BASIC - Stack Overload.
|