Setup and introduction

Turbo Rascal Syntax error, “;” expected but “BEGIN” runs as a stand-alone application on windows, linux and OS X.

You need to go through four hard-core tasks before being able to compile programs for TRSE :

  1. Procure your favorite emulator, such as vice(C64/C128/PET/PLUS4/VIC20), mednafen(NES) or fs-uae (Amiga)
  2. Open the Settings page of TRSE and select the location of the emulators  (like, x64.exe for VICE)
  3. Select a project directory, like the one with all the tutorials. There are several kinds of tutorials, ranging from general-introduction to games to demos and disk access tutorials etc.
    1. C64
    2. Vic20
    3. NES
    4. Amiga 500
    5. C128
    6. Fjong ray-tracer (C64 examples)
  4. Lots and lots of intoxicating beverages

How to compile

The TRSE editor will display all valid files in the current project directory, which includes the following file types

  • .RAS :  Turbo Rascal source files
  • .ASM : Compiled DASM-style MOS6502 assembler files
  • .PRG : Compiled C64 programs
  • .PAW : TRSE Packing & disk file
  • .FLF : TRSE image format (sprites, charsets, images, amiga, C64, VIC-20)
  • .FJO : Ray tracer source files.

To open a file, double click it.

To compile a RAS file, press ctrl+B to build and ctrl+R to run (which will also build first). The compile step first produces Dasm .ASM files, before compiling the PRG to a PRG file.

Errors in the RAS file will shift the focus to the line where the error occurred. Perhaps. Does’t always work yet.

ctrl-U generates a complete memory map of the current project. Here’s an example from the tutorial game Rogue Burger One:

A note on the language itself:

The Turbo Rascal SE compiler is very much in its infancy, and is filled with bugs and errors. While an advanced binary operation might compile fine, it could crash on something far less conspicous (such as an open paranthesis, bracket or whatnot). Until I have encountered and tackled most of the severe bugs, the code is considered unstable, just like myself on a monday morning.

Program structure & variable declarations

program MyProgramName;
var
    a,b: byte=0;
    // allocates array of 8 bytes
    array1: array[8] of byte;
    // allocates array of 8 bytes with intialization
    array2: array[8] of byte = (0,1,2,3,4,5,6,7);
    // allocates array of 8 bytes at given memory address
    array3: array[] of byte = (0,1,2,3,4,5,6,7) at $8000;
 
    // include (compressed) binary file at $6000
    myImage: incbin("images/myImage_compressed.bin", $6000);
 
    myText: string = ("THIS IS A STRING", " ANOTHER PART THAT IS ADDED TO THE PREVIOUS STRING", 5,3 ,$44, "YOU CAN ALSO ADD NUMBERS,0);
 
    myPointer: pointer; // Zeropage pointer

Procedures are declared as such:

procedure MyProcedure();
begin
   // Let pointer point to text
   myPointer:=myText;
   moveto(0,5, $04); // Move screen pointer to x=0, y=5 on screen bank 0 ($0400)
   // Loop through text until a zero is found and print to screen
   while (myPointer[0]<>0) do begin
      screenmemory[a]:=myPointer[0]; // draw text
      myPointer:=myPointer+1; // increase pointer value
   end;
end;

The main code block:

begin
   // set black background & border
   SCREEN_BG_COL:=BLACK;
   SCREEN_FG_COL:=BLACK;
   // clear screen with space ($20);
   clearscreen($20,$0400);
   // call procedure
   MyProcedure();
   // .. do some more stuff
   decrunch(myImage); // decrunch and display binary image
   Loop(); // infinite loop 
end.