Skip to content

PASTA/80 Version 0.97

Pre-release
Pre-release

Choose a tag to compare

@pleumann pleumann released this 17 Mar 16:40
· 311 commits to master since this release

Still no version 1.0, but we're getting closer. This version brings a couple of new features including an additional target, lots of bugfixes, and improvements to existing functionality.

There are binaries available for Mac (Arm and Intel), Windows (Intel), Linux (Intel) and Raspberry Pi (Arm).

New features

Agon target

PASTA/80 now has an Agon target, courtesy of Shawn Sijnstra. It supports all the core features plus files (all three types of) and command line parameters. There are also a few graphics primitives that would allow you to run or port some of the graphics examples (like the 3D hat or the Mandelbrot set). It is fully integrated into the mini IDE and supports the Fab Agon Emulator including debugging (see below).

Note that the Agon has an eZ80 processor that is actually much more powerful than an ordinary Z80 and can address lots more of memory. The code generated for the Agon target (currently) only uses a single 64K block of memory (running from physical address 0x40000) because right now neither PASTA/80 nor sjasmplus can handle the 24 bit address space. We're looking at how to make more of the additional memory usable, either via overlays or by moving the heap or stack.

Debugging support

You can now use Debug and Debug(Condition) to have the compiler add normal and conditional breakpoints, respectively, into the assembly code. For the ZX Spectrum 48K/128K and the Agon, this generates a command line snippet that can be passed to FUSE and the fab-agon-emulator, respectively, on startup. In the case of the ZX Spectrum Next, special Z80 opcodes are inserted into the binary. In --ide mode, the D key will launch the emulator in debugging mode, whereas R launches normally.

Release mode

You can now build in --release mode, which will compile both Debug and Assert as no-op, resulting in smaller binaries.

Functions results

Functions can now use Exit(Value) to immediately return a value and leave the function body, analogous to modern versions of Free Pascal and Delphi:

function Max(A, B: Integer): Integer;
begin
  if A > B then Exit(A);
  Exit(B);
end;

Exit code for scripts

The compiler now exits with a non-zero status code on errors (#46), making it usable in shell scripts and Makefiles:

pasta myfile.pas && echo "OK" || echo "FAILED"

The actual codes reported are:

Code Meaning
0 Success
1  Error in command line parameters
2  Error during compilation phase
3 Error during assembly phase

Improvements and fixes

Better error reporting when converting values to strings

The error reporting for Val has been improved (#45). It's now actually closer to Turbo Pascal 5.5 than to 3.0 because that version had a better behavior. Any error will now be flagged properly. In case of empty string or an incomplete number (such as 1.23E+) the error position will be Length(Str)+1.

Partial support for enum types when reading text files

Read and ReadLn now accept enum-typed variables when reading from a text file. A word is read from the input and matched against the enum's constant names (case-sensitive). There is currently no error handling. Write and WriteLn have been supporting enum types for a while already.

Stack corruption fix for short String parameters and return values

A long-standing stack corruption bug affecting String[N] with N < 255 used as value parameters or function return types has been fixed (#47). In addition, the actual length of strings passed as parameters is capped to what the formal parameter allows.

Several subrange type fixes

Subrange type definitions of the form Red..Green (enum bounds belonging to an existing enum type) now parse and type-check correctly. In addition, arithmetic on subrange types in expressions has been corrected (#48).

Miscellaneous

  • A bug in the type checker (#31) that could accept mismatched types in certain contexts has been fixed.
  • SeekEof and SeekEoln are now proper Boolean functions, not procedures, with the correct behavior (#49).
  • Rename(F, NewName) previously failed when called with two arguments. This has been corrected; the function now works as expected (#50).
  • ReadLn for text files is significantly faster and now correctly accepts all characters, including those previously filtered out (#40).
  • A bug in the binary floating-point encoder that caused range checks to fail for certain values has been fixed (#36).
  • ZX Spectrum Next Layer 2 RAM now paged at the correct address to avoid a crash in hat256 when compiled without optimisations (#39).
  • Invalid peephole optimisation removed that produced wrong code in certain conditional branches (#32); regression test added.
  • The three separate file test suites have been combined into a single suite files.pas, improved and extended.
  • Windows: single quotes in generated shell commands replaced with double quotes for compatibility.

New Examples

File Description
examples/anagrams.pas Anagram generator
examples/animals.pas Classic Pangolins (aka "guess the animal") game
examples/breakpoints.pas Demonstrates Debug / Debug(Cond) breakpoints
examples/hat.pas 3D hat surface, ZX Spectrum 48K/128K version
examples/hat256.pas 3D hat surface, ZX Spectrum Next L2 version
examples/hexdump.pas A simple file hexdump tool for the command line
examples/mandelbrot.pas Mandelbrot set renderer, ZX Spectrum 48K/128K version
examples/mandelbrot256.pas Mandelbrot set renderer, ZX Spectrum Next L2 version
examples/zxattrs.pas ZX Spectrum attribute demo beyond basic colors