BASIC-BOSS

From C64-Wiki
Jump to navigationJump to search
Stub This article is very short and not very detailed. Please help to improve it.
GEOS
Start screen.
Developer Thilo Herrmann
Company
Publisher Markt & Technik Verlag
Release 1988
Licence Full version
Platform C64
Genre BASIC-Compiler
Operation Keyboard
Media Diskette
Language(s) Language German Language:english
Information 64'er Extra Nr.11

BASIC-BOSS is a 2-pass BASIC compiler, which was programmed by Thilo Herrmann in 1988. The compilation is real 6502 machine language code, not a compressed programming language code. The compiled BASIC programs run faster on average than the original BASIC code. The total speed increase of the compiled code is dependent on how well the program is coded.

BASIC-BOSS used the syntax of BASIC V2. The standard compilation speeds up a BASIC program slightly, because it allows some BASIC commands to bypass the built-in BASIC interpreter of the C64. However, the real power of BASIC-BOSS lies in its special compiler syntaxes, which further optimize BASIC programs.

New Variables[edit | edit source]

64'er Extra Nr.11: BASIC-BOSS.

One of the advantages of BASIC-BOSS are the new variables:

  • Boolean
  • Byte (unsigned 8 bit integer)
  • Integer (signed 16 bit integer)
  • Word (unsigned 16 bit integer)
  • Real (Same as the normal float)
  • String (Same as the normal string)

Every calculation in CBM BASIC is done using floating point arithmetic. For many calculations, this method causes unnecessary CPU time to be wasted. BASIC-BOSS's new variables allows easy additions with byte, integer or word by using a few assembler commands. This new method speeds up many calculations. For example, a variable counting from 0 to 100 should be declared as a byte with BASIC-BOSS syntax. This allows BASIC-BOSS's optimized arithmetic routines to perform the incrementation more quickly.

This code example can be used in BASIC V2 (slowly) or as BASIC-BOSS compilation (faster machine code):

 10 REM@ £BYTE I=FAST:£FASTFOR
 20 FOR I=0 TO 255:POKE 1024+I,I:NEXT I

This BASIC program is the same program example after compiling:

 10 REM@ £BYTE I=FAST,SC(=1024:£FASTFOR
 15 DIM SC(1000)
 20 FOR I=0 TO 255:SC(I)=I:NEXT I


BASIC-BOSS syntaxes[edit | edit source]

The BASIC-BOSS commands contain the characters "£", "" or "@". This shows the programmer and the compiler which lines contain a BASIC-BOSS command.

BASIC-BOSS commands[edit | edit source]

  • £ALLRAM / £BASICRAM
First you must declare, if the whole RAM is used or only the BASIC-RAM ($0801-$9FFF, the famous 38911 bytes).
  • £ROUTSTART
Start adress in hexadecimal of the compilation, which is executed with SYS or JSR/JMP - example: '£ROUTSTART $2000'.
  • £HEAPEND
Declaration for the RAM area (end) of the string heap in hexadecimal. If the RAM area is too small or BASIC-BOSS detects a conflict, the error message "HEAPSTART OVER HEAPEND" is shown when compiling.
- Example: £HEAPEND $7FFF
  • £FASTFOR
Activate a faster compilation of FOR NEXT loops. Attention: Every FOR must be directly followed by a NEXT command when using this compiler command.
  • £FASTARRAY
Switched off the area check for arrays. This means, that no error message appears if an array index is outside the dimensions.
  • REM@
For compiling REM remarks.
  • £IGNORE / £USE
The BASIC code between £IGNORE and £USE is ignored by compiling. Examples:
- REM@ £IGNORE - ignored REM lines
- REM@ £USE
  • ←LOAD
For loading program data like music, graphics or sprites with a KERNAL-LOAD.
Syntax: ←LOAD,"<File-Name>",<Device Address>,<Start Address>
Example: ←LOAD,"MUSIC",8,4096 - The file "MUSIC" is loaded at RAM address $1000 by using device address 8 for a disk drive.
Under Construction Site / Sign
Language German TO Language:english
This article has recently been imported from the German C64-Wiki and not been translated yet. Please come back at a later time to read the English version of this article or help us.


Changing against BASIC 2.0[edit | edit source]

Man möchte in der Regel das sich ein kompiliertes Programm, außer das es schneller ausgeführt wird, genau wie die unkompilierte Version verhält. Es gibt allerdings ein paar Kleinigkeiten, die sich anders Verhalten. Da gibt es zum einen Erweiterungen, wie die Möglichkeit ganzzahlige Werte mit einem vorangestellten Dollarzeichen auch hexadezimal anzugeben (z.B. $1337) und zum anderen zusätzliche Befehle und Funktionen. Ebenfalls verändert ist die interne Zeichenkettenverwaltung, was sich in einer deutlich schnelleren „Garbage Collection“ niederschlägt, also wenn der Speicher aufgeräumt wird, um Platz zu schaffen und alte, nicht mehr benutzte String-Daten zu entsorgen.

Die zusätzlichen Möglichkeiten kann man einfach ignorieren/nicht verwenden, um die Kompatibilität mit BASIC 2.0 zu wahren. Allerdings verhält sich das Kompilat an einigen Stellen auch anders als der interpretierte Code. Beispiele:

  • Arrays müssen in Zeilen, bevor sie verwendet werden, mit DIM angelegt werden und die Dimensionen müssen zur Übersetzungszeit feststehen, dürfen also keine Variablen sein, außer sie wurden mit £CONSTANT als Konstanten deklariert (womit sie dann keine Variablen mehr sind, aber man kann auf diese Weise symbolische Namen vergeben und die Dimension(en) von mehreren zusammengehörenden Arrays an einer Stelle anpassen).
  • Die Funktion ASC() liefert bei einer leeren Zeichenkette 0 statt einen ?ILLEGAL QUANTITY ERROR auszulösen.
  • FRE(X) liefert auch bei einem Wert größer 32767 den korrekten Wert und keine negative Zahl die man erst umrechnen muss.
  • LIST, NEW, und STOP verhalten sich im Kompilat wie der END-Befehl.
  • GOSUBRETURN und FORNEXT können in einer bestimmten Kombination zum Absturz des Kompilats führen, weil RETURN in den Maschinenbefehl RTS übersetzt wird, der die Rücksprungadresse auf dem Stack erwartet, FOR-Schleifen dort aber auch Informationen ablegen. Das bedeutet eine FOR-Schleife muss komplett abgearbeitet sein, bevor ein RETURN erfolgen darf, denn sonst interpretiert RTS die FOR-Daten als Rücksprungadresse. Diese ”gefährliche” Befehlsabfolge sollte in sauber programmierten BASIC-Programmen aber sowieso nicht vorkommen. Verlassen kann man sich darauf jedoch nicht, da der BASIC-Interpreter sehr gutmütig mit offenen FOR-NEXT- sowie GOSUB-RETURN-Strukturen umgeht und implizit mit einem RETURN oder FOR für eine bestimmte Schleifenvariable alle inneren FOR-NEXT-Schleifen still und ohne Nebenwirkung (hinsichtlich Stapelüberlauf) beseitigt. Im folgenden Beispiel würde der Interpreter mit dem RETURN alle offenen FOR-NEXT des Unterprogramm einfach implizit schließen. Das Programm springt aus der Schleife, bevor sie vollständig abgearbeitet ist und kehrt zum aufrufenden Programmteil "vorzeitig" zurück. Ein Beispiel mit einer logisch ”offen” gelassen Schleife zeigt die Situation, die für den Compiler vermieden werden sollte:
  10 GOSUB 20:END
  20 FOR I=1 TO 10
  30 GOTO 50
  40 NEXT I
  50 RETURN

Versions[edit | edit source]

  • In Germany was the last official version of BASIC-BOSS V2.4 published by Markt & Technik in 64'er Extra Nr.11 vertrieben. [1]
  • It exists also an inoffical version 2.42 of BASIC-BOSS compiler from the year 2011.

Links[edit | edit source]

References[edit | edit source]

  1. : BASIC-BOSS Handbuch (Manual), Markt & Technik Verlag (1988) Language German