[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Basic compiler



John B. Matthews wrote:

IIRC, when branching forward, Applesoft has to walk the pointers from one line to the next until the target line is located. I seem to recall some effort devoted to optimization by moving oft-used routines to the beginning of the program. Might this effect produce the (presumed) speedup for small modules?

Still, I have to wonder if the long disk-swap times wouldn't swamp the effect, at least when running from floppy.

--- From the manual:

ProBASIC enhances the Applesoft BASIC that is built into your Apple II series computer. It allows you to add new commands and functions called modules in your programs. This capability is called 'extensibility' because the language actually grows.

These modules may be written in either BASIC or machine language. Machine language modules may be written to greatly increase the speed of your programs. Those programmers not familiar with machine language can still easily use machine language modules written by others. BASIC modules add modularity and structure that make it much easier to edit, debug and maintain your programs. Additionally, the modules may be saved on disk and easily integrated into other programs.

Proper use of ProBASIC modules will make your programs run faster and will make them much easier to understand for making changes. Variable conflicts are also much easier to avoid since each BASIC modules module has it's own set of variables (local variables). Programs should be broken down into modules of not more than 30 or 40 lines that can be easily understood and quickly edited. Each modules can be independently tested and re-used in other programs.

--- A little further in the manual

A program in ProBASIC consists of the main program and zero or more modules. The main program itself is a BASIC module called 'MAIN'. When you run a ProBASIC program, the main program (MAIN) is run. It may then call other modules.

Once a module has been created or loaded from disk, it is called just like a standard BASIC statement or function and for all practical purposes the module has become a part of the BASIC language just as much as FOR or NEXT or any of the others. All modules are both statements and functions. They may be executed without returning a value like the statements HGR or GOTO. Every module may also be called as a function that returns a value such as SINE or PEEK. Modules may be called from the main program or from BASIC modules.

Like BASIC commands, a module may require one or more parameters. Parameters are values that are passed to the statement or module. For example, the statement POKE 36,20 has 2 parameters: 36 and 20.The first parameter is an address and the second parameter is the value to poke into that address.

--- Even further.

The ProBASIC program resides at $0c00 (3072) to $1fff (8191). The area $0800 to $0bff (2048 to 3071) is free and you may use it for text page 2 or lo-res graphics page 2 or for extra memory for your modules. The module VIRTUAL uses it for a 1k ProDOS buffer so do not use it if you are using VIRTUAL. Page 3 ($0300) is not used by ProBASIC. HIMEM has been lowered to make room for the new commands MODLOAD and MODSAVE.

--- End of manual quotes.

I found my printed copy of the help file provided with ProBASIC. I hope this is enough to give some idea of the system. There is more help for using and programming in the environment which seems to be a modified BASIC.SYSTEM program.

I'm not sure what the speed trade off is. It's been a few years since I used it and even then, not much. I see a limit of 255 modules. Likewise, there is a limit on the keyword table size but no mention of how big it is. It should only be a problem if you have close to the maximum number of modules and the module names are over 8 characters. It also allows recursion although it doesn't say how deep you can recurse to.

Disk based modules are available but they aren't required. Mostly useful for large programs or when extra variable space is needed.

Looking a some notes I had scribbled, you can use Program Writer. My only complaint is the inability to work with Beagle's Extra Variables. That would make a powerful combination.

Cheers,
Mike T.