Turbo Rascal SE Syntax

Preprocessor

Preprocessors are pre-compiler options that are handy for :

  • Including external files
  • Defining constants
  • Opting to ignore/enable parts of the code before compilation

Preprocessors in Turbo Rascal SE are recognized by the @ sign. For instance

@include “RasLib/verticalscrolling.ras” will include this file to your project. The contents of the file is basically copied and pasted into your source file before being compiled.

@define [ name ] “value” will create a preprocessor variable. This variable can be used either for other preprocessor conditionals, or as text replacement for your source. For instance, instead of typing $0400 manually as the screen memory position in your code, you might decide on using a preprocessor variable

@define screen “$0400”

In the source file, you can then apply the preprocessor by just pasting @screen. Example: poke(@screen, #0, #65);

Sometimes, defines are used for parameters in include files. In the RasLib level renderer library “Levels.ras”, you are required to specify a preprocessor directive for the zeropage pointer to be employed while rendering levels:

// Use zeropage 7 for our level rendering

@define levelpointer “zeropage7”

@include “RasLib/Levels.ras”

Variables

There are currently five kinds of variables in Turbo Rascal SE:

  1. Byte
  2. Integer
  3. Array (currently, only of byte)
  4. Strings
  5. Pointers

Pointers require some special attention, and will be covered in the section below.

Integer binary operations are not yet fully implemented. String arrays will be implemented later.

Addresses vs constants

Pointers

As pointers on the C64 are a somewhat cumbersome affair, we have handily included 9 ready-to-use built-in pointers in Turbo Rascal SE.

It is sometimes useful for your source to be able to point to a data location instead of having to copy the data itself. For instance, when rendering a level, you need to specify the location of the level data. This location is stored in a pointer, which is used while iterating the data itself.

The 9 built-in zero-page pointers in TRSE are :

  • zeropage1-7
  • screenmemory
  • print_text

Pointers are assign by just assigning them to a certain variable, such as

zeropage4 := $0400;

zeropage3 := my_data;

However, pointers act like regular arrays when they are accessed through indexing

zeropage4[#40] = #64;

c:=screenmemory[#255];

In addition, you can increment the (16-bit) pointer by using inczp

inczp(zeropage4, data_length);

Procedures

Blocks

Conditionals

IRQs