Omikron BASIC for Apple Power Mac

Table of Contents Start | 2. The Editor

 

Chapter 1

Overview

 Installation
 Deinstallation
 The Demo Version
 The Lite Version
Differences Compared to Microsoft's MBASIC
 Differences Compared to the ATARI Version
 Adapting Older Programs
 New Commands
 New Control Words for the Native Compiler
 No Longer Supported Commands
 The Omikron Basic Output Window
 The Menu of the Omikron Basic Output Window
 The Demo Programs
 In the Planning Stage ...
 The Omikron Basic Internet Home Page
 Error Reports and Suggestions

Installation

If you have purchased the CD version of Omikron Basic, all you have to do for the installation is to copy the folder "OmikronBasic" from the CD to your hard drive.
Then start the Omikron Basic program by clicking at the Berkhan icon. A dialogue box opens where you have to enter your personal information and registration number. Once that has been done, the program is ready for use.

If you have downloaded the Internet version, you have to unpack the archive first. Drag the program to the StuffIt Expander icon. After the files have been unpacked, you will have a demo version on your hard drive. By running through the registration process, which is explained in the program, you can convert the demo version to the full version.

Of course, if you are not eligible for an update, then you have to first purchase the program by paying the licensing fee.

Note: A registration might not become effective until you have rebooted your computer. This depends on the type of computer you have. The folder Manual contains several HTML files, which offer instructions and notes about the use of Omikron Basic. To read the files use an HTML browser such as Netscape or MS Explorer. These programs are part of the operating system since the MacOS System 8 has been on the market; however, these programs are also available from a variety of online services, CDs in Mac magazines and via the Internet.



The Demo Version

If you have obtained a demo version, you have access to all features and there is no temporal limitation but the following restrictions apply: The editor will issue a message in intervals of 10 minutes, which will indicate that the program in use is a demo version. The compiler can only translate programs that do not contain more than 75 lines with the resulting object code not exceeding 32 kilobytes. The Library Maker can only generate Libraries, which will not exceed 8 KB. In addition, programs generated with the demo version may not be sold.
 

The Lite Version

The Lite version has the same features as the professional version, but the compiler can translate only those programs, whose object code will not exceed more than 256 kilobytes. This corresponds to approximately 5000 program lines with one command per line. The Library Maker of the Lite version can generate only Libraries, which will not exceed 8 KB.
 

Deinstallation

Omikron Basic does not create files in the system folder or other hidden places. If the use of Omikron is not desired any longer, just drag the folder 'OmikronBasic' to the trash can icon for deinstallation.


The Demo Programs

The floppy disk contains programs in the folder DEMO, which are documented in detail. Please, view these programs carefully, because they offer valuable hints and tips on how to adapt user programs to the MacOS. The example programs in the DEMO folder exhibit various aspects of programming with Omikron Basic and thus demonstrate that effective results can be achieved even with short programs. 




Differences Compared to Microsoft's MBASIC

If you still own programs written in MBASIC and you would like continue utilizing them on a modern computer, you can transfer these program to Omikron Basic just by making a few simple adjustments. The scope of commands and the possibilities for structured programming are significantly larger in Omikron Basic than in MBASIC. Thus, it is possible to transfer MBASIC programs to Omikron Basic but not the other way around.

The following differences have to be observed:

-LOG(X) calculates the natural logarithm of the number X in MBASIC. Omikron Basic calls this command LN(X).

-MKS$ and MKD$ return different strings in both languages, since the applied floating point format is different. CVS and CVD are also different due to the same reason. However, the difference is only noticeable when the strings returned by MKS$ and/or MKD$ are manipulated in some way.

-DATA lines may be not only contain constant numbers in Omikron Basic but also variables and even complete formula expressions. That is why string constants in DATA lines have to be always placed inside quotes; otherwise, they would be interpreted as variable names.

-DEFINT,DEFINTL,DEFSNG,DEFDBL, and DEFSTR are set from within the editor in Omikron Basic using the menu option 'Mode/Preferences ...'.

-RANDOMIZE is not available in Omikron Basic. Just leave out this command for those programs you want to transfer.

-RND(-X) does not return the initial starting value of the randomizer but a whole random number.

-WIDTH is not available in Omikron Basic.

-ERASE is not available in Omikron Basic. You can re-dimension a field with the DIM command and delete the content with MAT CLEAR.

-CHAIN ...,ALL is not available in Omikron Basic.

-PRINT USING uses a somewhat different format string in Omikron Basic. A more detailed description is found in the manual.

-INPUT always enters a whole line in Omikron Basic. For example, if you want to enter three numbers separated by commas, just use INPUT A,B,C instead of INPUT A:INPUT B:INPUT C.

-STOP always terminates the program after displaying an error message. It cannot be continued after this. If all you want to do is stop program execution without closing or terminating the program, just use an INPUT command (e.g., INPUT "Continue with [Return]";Dummy).

You should also place a few compiler control words at the beginning of your program, which define an Omikron Basic output window so that your program does not output directly to the screen and thus becomes multitasking capable. Furthermore, for the first tests, it is recommended to activate the debugging mode with COMPILER "DEBUG ON" and to plan for termination at any time using COMPILER "Ctrl_C ON" so that you can still terminate your program even after it might have entered into an infinite loop. More explanations about this topic are listed in the manual under COMPILER and with the sample programs in the folder DEMO.

Differences Compared to the ATARI Version

The interpreter has been eliminated. The source code debugger will be available in the course of 1998 and undertakes the functions of the interpreter for the debugging of programs.

The string lengths is now stored in a 4-byte word so that the maximum length increases from 65536 to 2147483648 characters per string. Of course, the string heap must have sufficient available memory if one wants to work with very long strings. See also COMPILER "BAS_MEM."

The pseudo multitasking commands ON TIMER..., ON MOUSEBUT..., ON HELP..., ON KEY... only function, if the Omikron Basic output window is used. An interrupt control such as the one used with the ATARI version would have led to heavy incompatibilities with the multitasking environment of the MacOS.

If the Omikron Basic output windows are employed, it is no longer necessary to clear the screen once the program has started.
In addition, the continuous switching on and off of the mouse using MOUSEON and MOUSEOFF and/or of the BIOS cursor using PRINT CHR$(27)+"e" or +"f" is now superfluous.

BIN$, OCT$, HEX$
Write the respective postfix before the number.

BITBLT
Source and target oblongs can now have different sizes. The source image is changed in such a way as to fit it precisely into the target oblong. That means that the BITBLT command can now be used to enlarge, reduce, or distort images.
The transfer modes (last parameter of the command) have also changed. Mode=0 now means that the target picture is not modified (up to now it was Mode=3). A detailed description can be found in Chapter 5 - Command Set or in "Inside, Macintosh, Imaging with QuickDraw."
P in the syntax BITBLT Adr1 TO Adr2, COLOR P, now indicates how many color planes the target image should have. Therefore, the user can use this command to modify the pixel depth of an image.

BLOAD
A FileSpecificationRecord such as the one, for example, returned from FILESELECT must be passed in the first parameter. If this command is used to load a file previously saved with BSAVE into the screen buffer and/or the uppermost Omikron Basic output window, then the pixel depths and dimensions are automatically adjusted.

BSAVE
A FileSpecificationRecord such as the one, for example, returned from FILESELECT must be passed in the first parameter. If this command is used to write the contents of the screen buffer and/or an Omikron output window to a file, then this data will be saved in PICT format, enabling further processing by other programs.

CALL
A detailed description can be found in Chapter 5 - Command Set.

CMD
Influences only PRINT and WRITE, not, however, PRINT# and LPRINT. The commands LIST, LLIST, DUMP, and LDUMP only had validity in the interpreter anyhow and are therefore in any case obsolete.

Note: If an output routine for the screen is diverted to the printer using CMD, this generally does not lead to the desired result since the data is send directly to the printer. Instead, the command GRAF_PORT 1 should be used. This opens a page on the printer onto which the output is then diverted.

CVD
Changes a 8-byte string into a floating point number with double precision.

CVS
Changes a 4-byte string into a floating point number with single precision.

DEG/RAD
It is possible to switch between degree and radiant measure from within the program as desired.

DATE$
Instead of the usual fixed date and time display of "DD:MM:YY" (D= day, M= month, Y= year), the date string is always returned in the format that has been entered into the computer via the control field "Date & Time."

Note: Date Formats between different countries can vary.

FACT (X)
Floating point numbers can now be substituted for X, because the factorial is calculated via the gamma function.

FILESELECT (P$,F$,R)
In contrast to the Atari operating system, the MacOS makes available different file select boxes for loading and saving. For this reason, the parameter R must first be set to 0 or 1 in order to determine which file select box is desired.
A detailed description of this command can be found in Chapter 5 - Command Set.

FILL X,Y,C: New Variations of this command have been implemented. Now, negative values can be indicated for X and Y. Then it will be filled from the outside and where appropriate, inverted. A detailed description can be found in Chapter 5 - Command Set.

FILL PATTERN= A,B
Long integer numbers must now be passed in A and B. An 8 x 8 bit pattern is created from the combined 64 bit of both numbers, which serves as a fill pattern, if FILL STYLE is set to = 0,0 (FILL STYLE = 0,0).

FRE (Volume$)
The volume name must be followed by a colon.

HCOPY
If the OUTPUT_WINDOW is activated, a hard copy of the buffer for the uppermost window is made - otherwise from the whole screen.

INKEY$
The SHIFT keys, which are now modifier keys, are assigned slightly differently. In the third byte, the value of a second key pressed simultaneously is now reported. A detailed description can be found in Chapter 5 - Command Set.

KILL, CHDIR, MKDIR, RMDIR, OPEN
These instructions must be given a FileSpecificationRecord as well, such as the one, for example, returned from FILESELECT. The function 'Get_Fsspec$' from the ExtensionLibrary also provides such a record.

LINE PATTERN= A,B
Long integer numbers must now be passed in A and B. An 8 x 8 bit pattern is created from the combined 64 bit of both numbers, which serves as a fill pattern for lines if LINE STYLE is set to = 0 (LINE STYLE = 0).

LPRINT
The text is first written to a printer port. With the command LPRINT CHR$(12); it is possible to close a page and with LPRINT CHR$(26); to close the whole port and thereby force a printer printout.

MEMORY
Provides a nonrelocateable memory block from the application heap of the program. The size of the program's application heap to be reached can be adjusted either with the compiler control word COMPILER "PRE_SIZE ..." or using the finder via the menu option 'Get Info'.

MEMORY_BLOCK
It is not possible to write to a MEMORY_BLOCK, since it exists in the code fragment, which is write-protected.

MEMORY_MOVE
This command is automatically transposed into MEMORY_MOVEB if the source or destination address is uneven. The copying rate is highest if source and destination addresses are on an 8-byte boundary.

MKD$
Returns a string 8 bytes long instead of the up to now usual 10 bytes.

MKS$
Returns a string 4 bytes long instead of the up to now usual 6 bytes.

MODE M$
Only influences the transformation of lower case letters to upper case and the other way around (with the two commands UPPER$ and LOWER$); however, not the date or time format. This will always be displayed the same way it was indicated in the control field 'Date & Time' of the Macintosh.

MOUSEBUT
Also considers the state of the modifier keys and accordingly reports values between 0 and 32.

NAME F1$ AS F2$
F1$ must contain a FileSpecificationRecord. F2$ may only contain the new name. If a directory should be renamed, the names must be followed by a colon.

PALETTE
Writes the listed RGB values to the internal CLUT of Omikron Basic. The first parameter indicates from which index writing should commence.

POINT (X, Y)
Does not return a color index but a pointer to a RGB record instead. This is a 6-byte structure with the red, green and blue components of the pixel.

RESUME
Jumps to the beginning of the line in which the error occurred, not to the command itself.

SCREEN
This command allows the opening of further Omikron Basic output windows. A detailed description can be found in Chapter 5 - Command Set.

SEGPTR (20|28)
Always results in zero. This was already a feature with the Atari version compiler but not with the interpreter.

SORT
This command was extended in such a way as to allow for the simultaneous sorting of as many fields as desired.  A detailed description can be found in Chapter 5 - Command Set.

TEXT STYLE
Now, a total of 7 attributes exist. The meaning of each flag is changed.

TUNE T,F...
Omikron Basic 6 supports up to 16 sound channels so that T can now take values of 0 to 15. Only numbers between 0 and 127 may be used for F, which corresponds to the MIDI notes. See MIDI table in the appendix.

VARPTR, &
In the case of numerical individual variables, the address operator points toward the value of the variable, in the case of strings to a string pointer, and in the case of fields to a field pointer.

VOLUME, NOISE
These two commands now have the same syntax as TUNE, except that the volume and/or the audio purity are modified instead of the frequency.

WAIT
The system is no longer blocked. Other processes can continue during the waiting time. Consequently, the actual waiting time can be increased.

W_CHAR
Returns a number indicating how many zeros fit on one line. For the proportional fonts usually found on the Apple that actually depends on the used alphabetic characters.

Adapting Older Programs

Programs that were developed with Omikron Basic versions before version 6.0 can be loaded into the editor without problems. However, in this case, the German umlauts and other special characters are represented incorrectly since - in the case of the Apple - they are located on different ASCII codes. However, they can easily be replaced with the correct umlauts with the function 'Replace Text' located in the menu 'Find'.

On the Atari, the German umlauts have the following ASCII codes: Ä=142, ä=132, Ö=153, ö=148, Ü=154, ü=129, ß=158. These characters are produced best by entering the ASCII code via the numeric keypad while pressing the ALT key.

What also has to be considered is that the PowerPC processor uses floating point formats with a smaller value range and lesser precision. If floating point numbers with single precision are used in the program, followed by extensive calculations, errors might accumulate, which in turn could lead to completely incorrect results.
Therefore, we recommend using only floating point numbers with double precision. If the user wants to convert an old program from working with single precision to double precision, it is best to proceed as follows:

1. From the menu 'Mode' choose the entry 'Display All Postfixes.'
2. In the menu 'Mode' choose 'Preferences' and deactivate the declaration monitor.
3. Replace all "!" with "#" using the 'Replace Text' function of the editor.
4. Reset declaration monitor to on.

In addition, functional compiled products are only achieved if a few adjustments are effected. In order to simplify these adjustments for the user, a migration help was installed in the editor. If the menu option 'Atari -> Mac' in the Program Menu is chosen, a window will open, in which all program locations that have to be adapted as well are listed. It is possible to jump directly to the components to be modified by clicking on them in the list and making any corrections necessary according to the references in the chapter 'Differences Compared to the Atari Version.'

Furthermore, use should be made of the new compiler control words, since otherwise only unspecified default values are used. In many cases the use of the Extension Library is nessessary of helpful at least. E.g. if you want to use OPEN or modify the text attributes for PRINT and LPRINT.

See also the demo program 'Mandelbrot.BAS'.


 

New Commands

Omikron Basic 6 contains a few new commands; others have an expanded scope of functionality. A detailed description can be found in Chapter 5 - Command Set. 

GRAF_PORT
Ptr

MAC_OS [R0,R1...] [;F];{P$+N$+M$|N},F$,[P0,P1,P2...]

SCREEN Nr[,X,Y[,W,H]]

SORT [ASC] A() [TO B(),C(),D()...]

DEF FNEX A(B,C,D...)

EXPORT A,B,C... 

EXPORT_EXIT FNEX A

EXPORT_INIT FNEX A

EXPORT_MAIN A$


New Control Words for the Native Compiler

The native compiler contains some new control words, which are listed subsequently. A detailed description can be found in Chapter 5 - Command Set, keyword 'Compiler.'

COMPILER "DEBUG ON|OFF"

COMPILER "EVENT"

COMPILER "FILE_TYPE XXXX"

COMPILER "FPU_EXCEPTIONS ON|OFF" or COMPILER "FPUEXON|OFF"

COMPILER "IU_EXCEPTIONS ON|OFF" or COMPILER "IUEXON|OFF"

COMPILERS "MIN_SIZE X"

COMPILER "OUTPUT_WINDOW X*Y" or COMPILER "OPW X*Y"

COMPILERS "PRE_SIZE X"

COMPILER "RANGE_CONTROL ON|OFF" or COMPILER "RCON|OFF"

COMPILER "SHARED_LIBRARY" or COMPILER "SHLB"

COMPILERS "SIGNATURE SIGN"

COMPILER "STACK_CONTROL ON|OFF" or COMPILER "SCON|OFF"

COMPILER "STRING +|*X"



No Longer Supported Commands:

AES
BIOS
CHAIN
COMMON
CLEAR with parameters
FILES
GEMDOS
IPL
JOYSTICK
KEY
MODE LPRINT
NDC
OPEN "K", "M"
RUN
SPRITE
VDI
WVBL
XBIOS



The Omikron Basic Output Windows

Upon request, Omikron Basic makes so-called output windows available. These windows can be used to hold all output, which would otherwise be rerouted directly to the screen. The management of these windows is performed automatically by Omikron Basic. Consequently, programs that have no window management and use PRINT and INPUT for input and output run neatly in a multitasking environment as well. The Omikron Basic output window can be activated with the command COMPILER "OUTPUT_WINDOW X*Y" - the maximum values for X (width) and Y (height) to be applied to the first window have to be in pixels. The contents of the output windows are buffered in the application heap of the program. Therefore, depending on size and pixel depth, memory must be sufficiently available. Where appropriate, more memory has to be reserved for the program using the finder or COMPILER PRE_SIZE X."
If the output windows are active, a menu bar is also added, which allows easy access to the desk accessories as well as the help and program menu. In order to make sure that Omikron Basic receives the event messages concerning the output windows or the menu bar, the command COMPILER "EVENT" should be used to cause a WaitNextEvent call is compiled into the program at the appropriate location. See also the demo program 'Mandelbrot.BAS.'

If a program is located in an INPUT or INPUT$ instruction, WaitNextEvent calls are always made to the MacOS, because key pressings are constantly observed. The same applies to the FORM_ALERT command.

The output windows also have scroll bars so that they can be designed larger than the physical screen. However, please consider that the window contents must be buffered in the application heap. A window with 1280 x 960 image pixels requires in the case of, e.g., 256 colors, 1.2 MB of storage.
The increments used to scroll the window content if clicking on the arrows on the slider bar can be adjusted with the procedure Set_Scroll_Parameter from the Extension Library.

Note: With the command SCREEN, additional Omikron Basic output windows can be opened.


 

The Menu of the Omikron Basic Output Windows

If the Omikron Basic output windows are activated, an additional menu bar is created. A few basic functions can now be called using the menu 'File.'

Open ... : The uppermost Omikron Basic output window is loaded with a file previously created with 'Save as ... ' If the picture to be loaded has other dimensions or another pixel depth, it is adapted automatically to the Omikron Basic output window. The file must be available in the 'PICT' format. Thus, it can also be modified by other programs.

Save as ... : The content of the buffer for the uppermost Omikron Basic output window is stored in the 'PICT' format. Consequently, it is possible to load and further process the stored image by other programs.

Page Setup ... : The 'PrStlDialog' dialog box opens. The printer settings can be adjusted in this dialog box.

Print ... : The 'PrJobDialog' dialog box opens. Further adjustments can be effected in this dialog box. The buffer for Omikron Basic is displayed in the output window after 'OK' has been clicked on.

Quit : The program is terminated. If only one window is left open, clicking on the closer in the Omikron Basic output window has the same effect. First, however, a security query is issued.

 



In the Planning Stage ...

A new float type with a 128-bit width will be created (corresponds to a precision of up to 32 places after the decimal point). Later, we intend to implement the use of complex numbers for all mathematical operations. Since implementation will occur in the PowerPC assembler, these commands can be carried out very fast. We are also considering the use of "structures", as they are known from the programming language C.

The Omikron Basic Internet Home Page

A current demo version of the program can be downloaded from the Omikron Basic home page. Point the browser toward
http://www.OmikronBasic.com

Error Reports and Suggestions

If an Omikron Basic error has been detected or to submit suggestions, please send an email to the following electronic addresses:

E-mail: info@berkhan.de

Fax: ++ 05832 6160 (from USA 011 49 5832 6160)
Hotline: ++ 5832 979895 (from USA 011 49 5832 979895)
(Monday - Saturday 11.00 to 11.30, Sunday 13.00 to 14.00 UTC (former GMT))

Or via postal mail to:

Berkhan-Software
Entwicklung & Vertrieb
Alt-Isenhagen 21
29386 Hankensbuettel
Germany
The Omikron Basic Team 


Table of Contents Start | 2. The Editor

Tech-Support | Order | Start | Home: http://www.berkhan.com


© 1997-2001 Berkhan-Software