Turbo Rascal Syntax error, “;” expected but “BEGIN”

“Turbo Rascal Syntax error, “;” expected but “BEGIN”” (Turbo Rascal SE, TRSE) is an upcoming project with release date spring 2018. TRSE will support both Windows and OS X (and perhaps linux). Development begain on feb 24th 2018.



What is Turbo Rascal Syntax error, “;” expected but “BEGIN”?

In a nutshell, Turbo Rascal Syntax error, “;” expected but “BEGIN” is a complete suite for developing for the Commodore 64. It is written in Qt C++, and runs as a stand-alone application that contains various tools for developing and deploying projects for the MOS6502♥ processor. The TRSE suite includes the following stuff:

  • A semi-fully functional Pascal-like compiler that compiles to DASM assembler files.
  • A substantial amount of handy built-in assembler functions optimized for easy-to-use and fast C64 operations (typically memory operations, zero paging, copying, sprite handling, IRQs)
  • RasLib, the Turbo Rascal C64 library  (Level rendering, scrolling, high-level stuff)
  • Multicolor/hires image editor with image importer
  • Level editor
  • ???

But.. why?

The author had a C64 as a kid, but never got the hang of understand proper programming until the x86-era of the 90’s. This is his way of mending the hole in is soul. In addition, he hopes that he’ll get filthy rich & famous off this project.


Free of charge. How the “rich” part will be achieved is still up for debate.

Turbo Rascal SE features

Image processing, creation and editing.

Just like photoshop – or, like a very stunted retarded younger offspring of photoshop.

Using the C64 palette (or any other user-defined indexed palette), you can create/import either fake C64 images or stick to the real thing: C64 MultiColor+HiRes format. Don’t let the limitations limit yourself! Export as regular image, binary formats or direct-to-assembler.

Example of a C64 Multicolor (imported) image that is modified using various brushes. Currently supports Pen Brush, Dithered brush, spray, fill, lines and copy. Color parameters can be tweaked at import, with parameters such as blur, color restrictions, HSV, gamma, brightness and saturation.

When the image is done, it can be exported directly to C64 assembler and executed as such:

Rascal Editor & compiler

Always wanted to develop stuff for the C64? Perhaps porting PUBG to MOS6502 assembler? But tired of trying to figure out what you actually implemented in assembler last night while you were drunk? No fear – TSRE contains a fully semi-working version of our powerful Rascal compiler. Here’s the workflow:

  1. Write programs in Rascal using our built-in syntax-highlighted editor
  2. Compile directly to DASM assembler by pressing CTRL+B, and watch as DASM ferociously tries to squeeze some C64 binary code from the generated assembly output.
  3. Press CTRL+R to run the code in your grandmother’s favorite emulator, such as VICE
  4. Bewilder in astonishment as you encounter horrible bugs that will crash your emulator to new heights

The TRSE Project Editor

Turbo Rascal SE contains a modern, syntax-highlighted editor that lets you edit, search, and compile files in a specified project folder. Did we mention that syntax highlightning?

The screenshots below displays various effects from the tutorials written in Turbo Rascal SE.


The Turbo Rascal Programming Language

At LemonSpawn, we truly believe that the world needs yet another programming language. Turbo Rascal is a strongly typed language that mimics Pascal, but follows standards like your mom. It was developed, mostly while intoxicated, because the author was fascinated by MOS6502 assembly language but tired of trying to maintain a consistent overview of assembler source files and rewriting tedious routines. While interested in learning about MOS6502 assembly language, the author was not keen on re-implementing routines over and over again.

Why not use another high-level programming language for the C64, such as CC65? Well, this would defy the initial goal of the author: to fulfill a childhood dream of finally understanding how the C64 works. What better way than to actually write a compiler on your own? So the author sat down one weekend with a couple of sixpacks, and here we are.

Turbo Rascal is developed to produce as fast and optimized assembly code as possible. The code is both high and low level, and continuously has new features added as the codebase is expanded. Our initial goal is to produce a small game that will be included as an example project.

Current features:

  • Pascal-like syntax
  • Conditionals: While, For, If, Else, And, Or
  • Branched binary and logical conditions: if (a=b and (c<>d or (e>b and g<k) ) ) then ….
  • Global variables: Byte, Integer, String, Binary inclusion
  • Arrays: Byte [Integer arrays soon]
  • Recursive binary operations for 8-bit operands, such as siny[x]:= ((sine[c2x*#2] + sine[c2y+b])/#2) &7;
  • Procedure definition and calls with parameters, but not yet return values.
  • Tons of built-in functions for SID handling, memory management, fast screen poking & number writing, sine functions etc
  • Sprite handling (enabling you to draw sprites on x>255)
  • SID file support. Include SID files directly: load, init and play addresses extracted from header, so just init and call play!
  • Raster IRQ support. Hook procedures/interrupts to the raster baby!
  • Preprocessor directives : @Include files, @define, @ifdef, @ifndef, @endif
  • Integrated image support (multicolor)
  • Character set generation from images (work in progress)
  • Joystick & keyboard input methods
  • Inline assembler
  • Error handling with line numbers etc
  • Simple optimizer
  • Ultra-fast Abstract Syntax Tree (AST) compiler written in C++
  • Tutorials (work in progress)
  • Unit Test Program
  • Handy built-in lever designer
  • Zeropage addressing pointers

To-do list before release:

  • Integer binary operations (ugh, rewrite parts of binop nodes)
  • Integer arrays
  • String arrays
  • For step
  • Editor Cycle Counter (automatically counts the number of cycles in a block. Handy for optimizations!)
  • Loop unroll macro
  • Graphics libraries (75% done)
  • Type structures? Hm
  • Better optimizer
  • Support for other assemblers (kick etc)

For more detailed info on the programming language, check out the tutorials section.