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 five hard-core tasks before being able to compile programs for TRSE :

  1. Download the DASM compiler (found here)
  2. Procure a c64 emulator, such as vice
  3. Open the Settings page of TRSE and select the location of the DASM executable and the emulator  (like, x64.exe for VICE)
  4. Select a project directory, like the one with all the tutorials
  5. 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 file
  • .FLF (TRSE image format)

To open a file, double click it. When clicking on C64 .PRG files, the emulator will automatically run the program.

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[8] 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
      inczp(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.