Omikron BASIC for Apple Power Mac

Table of Contents Start | 2. The Editor

 

Chapter 1

Overview



Installation

The Demo Version
The Lite Version
Deinstallation
The Demo Programs
Application Scope of Omikron Basic

Differences with other BASIC Dialects

Omikron Basic for Atari
GFA-Basic
MBASIC from Microsoft
Quick Basic from Microsof

Topicals

Switching to Mac OS X
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, if not executed automatically. If you like the program, click on [Order] to buy a full version. More information in our online shop on the internet.

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.
By paying a licence fee, the demo version can be converted into a lite or prfessional version.


 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 folder 'DEMO' contains several programs, which are documented in detail. Please, view these programs carefully, because they offer valuable hints and tips on how to adapt your own programs to the Mac OS. 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. Please, also have a look at the 'PleaseRead' file in the 'DEMO' folder.
Other demo programs, which engage in programming user interfaces, are located in the 'EasyGem' folder.


Application Scope of Omikron Basic

Basically, Omikron Basic is suitable for a variety of programming tasks. For example, you can use the Omikron Basic output windows to quickly and easily write small programs without having to deal with programming cumbersome and complicated user interfaces but you can also use it together with the EasyGemLibrary to create professional user interfaces (Omikron Basic itself was programmed with Omikron Basic).
Furthermore, you can call many of the Macintosh operating system functions using the MAC_OS command and pass pointers to files and functions just like with the C programming language. Yes, even programming shared libraries and plugins and with that the import and export of data and functions is not a problem with Omikron Basic.



Differences with Other Basic Dialects

Unfortunately, the programming language BASIC is not as standardized as FORTRAN or C. This means a variety of BASIC dialects developed over the years, which are sometimes quire different from one another. Omikron Basic thus differs from other BASIC variations as well. A few relatively closely related BASIC implementations are listed and described in this chapter as well as the differences. If you do not want to work with old programs written in other BASIC dialects you may skip this chapter.


Omikron Basic for Atari

This chapter addresses programmers who used to work with Omikron Basic and Atari computers. Due to the many differences between the two systems and a few needed improvements it was unfortunately not possible to change the Macintosh version into a completely Atari compatible version. The following are the individual differences:

The interpreter has been eliminated. The function of the interpreter used to debug programs is assumed by the Source Code Debugger.

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 X."

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 Basic 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= 0,0 is used.

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 Extension Library 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=0 is used.

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 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' located in the menu 'Search'.
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. Open the dialog box 'Mode/Settings>General-Display' and then select the checkbox 'Display all postfixes' from the subdialog 'Display'. Then click on 'Execute'.
2. Deactivate the declaration monitoring in the subdialog "General' and again click on "Execute'.
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 or 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 for Mac 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 PowerPC Compiler

The PowerPC 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

Some commands are no longer supported because they are either Atari-specific, only have meaning for an interpreter, or are no longer sensible or realizable on a Mac computer.

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


GFA-Basic

This is also a programing language developed especially for Atari computers. There was a later PC version, which was not very popular, however.

At first glance, GFA-Basic and Omikron Basic seem to be quite similar. For example, GFA-Basic also uses postfixes to classify the different variable types and the command and function names are frequently similar. However, the devil is in the detail... This means that the GFA-Basic postfix significance is different than the Omikron Basic postfix and the meaning of the parameters is switched for many similar commands.

But it is possible to transfer a GFA-Basic program into Omikron Basic without too much trouble. Use the rather powerful search and replace functions of the Editor to transfer a GFA-Basic program to Omikron Basic (e.g., to adapt the postfixes). GFA-Basic also features a few commands that serve the GEM programming (e.g., to define menus). The EasyGem Library of Omikron Basic serves the same purpose.

MBASIC from Microsoft

If you still own programs written in MBASIC and you would like continue utilizing them on a modern computer, you can transfer these programs 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/Settings>Program ...'.

-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. We also recommend starting the program with 'Debug' for the first few tests because you are then notified of most of the errors and can also terminate the program with [Ctrl]+[C] at any time in case it should be caught in an endless loop. More information about this topic is listed in the chapter Source Code Debugger.

Quick Basic

This BASIC is also by Microsoft and was available for the Mac up to System 6. The differences compared with Omikron Basic are significantly higher than with MBASIC. But it is possible to transfer your old Quick Basic programs into Omikron Basic, as some of our customers have reported.





Topicals


Switching to Mac OS X

The following is important when using your Omikron Basic programs native under Mac OS X:

1. You have to use the control word COMPILER "Carbon" to instruct the compiler to generate a Carbon program or the program is started in the Classic environment of Mac OS X.

2. Each program has 4 GB of virtual memory. The MEMORY(-1) function thus serves no purpose. Memory addresses such the ones returned by MEMORY can also take negative values. Memory addresses are always only valid within the same program and cannot be transferred to other programs.

3. If your program does not contain any direct operating system calls, i.e., the program uses only pure BASIC commands, you do not have to make any additional changes.

4. The Extension Library has to be version 2.0 or later if used in your program.

5. The EasyGem Library has to be version 4.5 or later if used in your program.

6. You have to check all calls for Carbon-compatibility yourself if your program itself calls operating system functions via the MAC_OS command. Many functions of the operating system are no longer supported by Carbon or were modified. Please visit the Apple website and consult the 'Carbon Porting Guide' for an overview of the changes:

http://developer.apple.com/techpubs/macosx/Carbon/CarbonPortingTools/Carbonportingtools.html

7. Generic functions to generate Universal Procedure Pointers (UPP) are no longer available under Carbon. Under Carbon, the address operator (&) thus does not return an UPP for a function defined with FNEX but a transition vector instead. To change this into an UPP, Carbon features special routines for every purpose to which a transition vector has to be passed and which then return an UPP (e.g., for a callback routine).


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.berkhan.com/basic/start_e.htm



Error Reports and Suggestions

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

E-mail: support@berkhan.de

Fax: ++ 05832 6160 (from USA 011 49 5832 6160)
Hotline: ++ 5832 979895

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

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


© 1997-2009 Berkhan-Software