Nuclear Site (Post)

Test Block

Posit 92 Demos Block – hello from the saved content!

Posted in Uncategorized | Leave a comment

Minimal Posit-92 Example

In this page, I can show how easy it is to start programming games with Posit-92 Wasm

How it looks like (including the game loop):

You can either use Pascal or C++ to accomplish this

library Game;

{$Mode ObjFPC}
{$J-}  { Switch off assignments to typed constants }

uses
  Logger, WasmMemMgr, VGA;

procedure init;
begin
  initMemMgr;
  initBuffer;
end;

procedure afterInit;
begin
  writeLog('Hello from hello_minimal!')
end;

procedure update;
begin
end;

procedure draw;
begin
  cls($FF6495ED);
  vgaFlush
end;

exports
  init, afterInit, update, draw;

begin
{ Starting point is intentionally left empty }
end.
#include "pascal_compat.hpp"

#include "logger.hpp"
#include "vga.hpp"
#include "wasm_heap.hpp"

export void init() {
  initBuffer();
}

export void afterInit() {
  writeLog("Hello from hello_minimal!");
}

export void update() {
}

export void draw() {
  cls(0xFF6495ED);

  vgaFlush();
}

The difference here is that when exporting functions from C++, you also have to declare them in the compile script. Something like this: EXPORTED_FUNCTIONS=_init,_afterInit,_update,_draw

Both examples can be compiled with the provided compile.ts or compile_demo.ts, depending on which target you want to develop: a standalone game or a demo project for Posit-92

Posted in Posit-92 | Tagged , , , | Comments Off on Minimal Posit-92 Example

About WebAssembly games in Pascal on itch.io

At the time of writing, there’s only a single browser game that uses Pascal on itch.io, while the rest is only for desktop, which you can visit on itch.io

There’s only a handful of submissions and contributors to the Pascal tag on itch.io:

  • 4 games by Guvacode
  • 1 by Kadirov Yurij
  • 1 by DimaLink
  • 1 by Eder “Kakarotto” Dalpizzol
  • and 1 by Hevanafa (me!)

Do you know what this means?

Yes, I’m a self-proclaimed pioneer in this field

I have to thank the Free Pascal team that made all of this possible. Without them, programming in Pascal targeting WebAssembly wouldn’t be possible

I also have hopes that, someday, my game engine Posit-92 can be listed on the “Engines & tools used”, which you can find using this URL format: https://itch.io/game/tools/[your_game_id]

or by using the UI directly:

  • Edit Game –> Metadata –> Engines & tools
Posted in Indie games, Personal | Tagged , , , | Comments Off on About WebAssembly games in Pascal on itch.io

Posit-92 – Gamepad Demo

 
Posted in Uncategorized | Leave a comment

Immediate Easing Chain

This document was written in order to understand easing chains in immediate mode, i.e. without object-oriented tween systems like what Phaser JS (scene.tweens), Unity (DOTween), and Roblox (TweenService) have

This approach can be applied to any other frameworks that don’t have any built-in tweening library included, e.g. PICO-8, TIC-80, SDL2, and Raylib

If you wish to skip reading & see the demonstration right away, here’s the game in action:

 

Controls

Click Start Lerp to watch Blinky’s animation chain (move, move backwards, spin)

After the chain completes, use WASD to move him freely!

Variable Declaration

Before we start on the update & render logic, let’s declare the variables first

Prepare the state variables, which will contain the [started], [complete] and [index in the chain]

var
  isChainStarted, isChainComplete: boolean;
  chainIdx: integer;

Declare the state variables that you want to apply easing to

var
  startX, endX: integer;
  startAngle, endAngle: double;
  chainLerpTimer: TLerpTimer;

The key here is that you must have at least:

  • Start & end variable pair
  • 1 TLerpTimer

This pattern below can work too, if you only want to interpolate x:

var
  startX, endX: integer;
  chainLerpTimer: TLerpTimer;

Starting logic

This section should only handle chain state initialisation

procedure beginEasingChain;
begin
  isChainStarted := true;
  isChainComplete := false;
  chainIdx := 0;

  startX := 100; endX := 150;
  initLerp(chainLerpTimer, getTimer, 1.0)
end;

It has the [started], [complete] and the [index in the chain], and also the variables to interpolate later
Don’t forget to initialise the TLerpTimer

Update logic

Update logic only handles state transition

Given this example:

if isChainStarted and not isChainComplete then begin
  { Handle state transition }
  if isLerpComplete(chainLerpTimer, getTimer) then begin
    case chainIdx of
      0: begin
        { Initialise your state here }
      end;
      1: begin
        { Same pattern as index 0 }
        inc(chainIdx)
      end;
      
      2: inc(chainIdx); { Immediate transition, no setup needed }
      
      3: begin
        { Handle chain onComplete }

        isChainStarted := false;
        isChainComplete := true;
      end;
    end;
  end;
end;

This shows the transition from chainIdx 0 to 1

Your state initialisation in case chainIdx of 0 can be structured like this:

perc := getLerpPerc(chainLerpTimer, getTimer);
x := lerpEaseOutSine(startX, endX, perc);  { current X }

startX := trunc(x);
endX := endX - 50;
initLerp(chainLerpTimer, getTimer, 1.0);

inc(chainIdx)

Basically:

  • Initialise the state variables,
  • Initialise the TLerpTimer associated with it,
  • Increment chain index, or
    • Store the final state somewhere and assign complete

Movement logic

This can be handled when the easing chain is not in progress

This condition can be used to check if it’s still in progress:

if isChainStarted and not isChainComplete then

or shorter:

if not isChainStarted then

An example here is for when you want to move Blinky:

if not isChainStarted then begin
  if isKeyDown(SC_W) then blinkyY := blinkyY - Velocity * dt;
  if isKeyDown(SC_S) then blinkyY := blinkyY + Velocity * dt;

  if isKeyDown(SC_A) then blinkyX := blinkyX - Velocity * dt;
  if isKeyDown(SC_D) then blinkyX := blinkyX + Velocity * dt;
end;

Render logic

This should not have side effects, i.e. not altering the state variables

You can use the [started] variable to see if the easing chain is still going

if isChainStarted then begin
  case chainIdx of
    2: begin
      { Current state --> apply easing --> handle rendering }
      perc := getLerpPerc(chainLerpTimer, getTimer);

      x := lerpEaseOutSine(startX, endX, perc);
      angle := lerpEaseOutSine(startAngle, endAngle, perc);

      sprRotate(imgBlinky, trunc(x) + 8, trunc(blinkyY) + 8, angle);
    end;
    
    else begin
      perc := getLerpPerc(chainLerpTimer, getTimer);
      x := lerpEaseOutSine(startX, endX, perc);
      spr(imgBlinky, trunc(x), trunc(blinkyY));
    end
  end;
end else
  spr(imgBlinky, trunc(blinkyX), trunc(blinkyY));

Basically:

  • If the chain is still ongoing, move the sprite normally
  • An exception is when the chainIdx has the number 2, it’s moving and rotating at the same time
  • Otherwise, the else branch handles when the chain is not yet started or is already completed: just render the sprite normally

State Flow

(Not started)
|
v
Button press: call beginEasingChain
|
v
Running: chainIdx 0, 1, 2
|
v
Complete when chainIdx reaches 3
|
v
(Finished): isChainComplete is true, can move with WASD

Posted in Indie games, Posit-92 | Tagged , , | Leave a comment

Posit-92 – Hello World

A very basic example of Posit-92

Posted in Posit-92 | Tagged , , , , | Leave a comment

Hello Canvas – Getting Started with Pascal & WebAssembly

This tutorial will guide you through how to setup Pascal targeting WebAssembly without using Pas2JS — pure Pascal code directly compiled to WASM

Why does this guide exist? It’s because I find so many outdated documentations — many of them are from 2021, and also they mentioned wasi instead of wasm32

What we’ll have for the compilation target in this series is wasm32-embedded, not wasi. The difference is that wasi is mainly for desktop & offline systems that has direct file I/O operations and is some sort of bootstrapped framework, while wasm32 is for HTML5 games on the web and has the “close to metal” feeling

What you’ll achieve by the end of the tutorial:

  • FPC compiler setup for wasm32-embedded
  • Compile your first Pascal –> Wasm binary
  • See a coloured rectangle on an HTML canvas
  • Understand the JS glue code

Prerequisites

I’m using a Windows 10 (64-bit) machine to build this. It’s possible to use Mac OS or Linux, but this guide is focused on Windows

Other than that:

  • Basic Pascal knowledge (knowing some other languages can help too)
  • Text editor (I recommend VSCode)

Compiler Setup

We’ll use fpcupdeluxe because it handles the cross-compilation setup automatically. Manual FPC setup for WebAssembly is painful, trust me

Step 1: Download fpcupdeluxe

Step 2: Install

  • Run the installer
  • Choose an easy-to-reach folder like C:\fpc-wasm or E:\fpc-wasm
  • (This matters for later when you need to reference the compiler path)

Step 3: Install FPC trunk

  • Under the Basic tab, select trunk version from the list
  • Click the Only FPC button
  • Wait for it to compile (this takes a few minutes)

Step 4: Add the WebAssembly cross-compiler

  • Go to the Cross tab
  • CPU: wasm32
  • OS: embedded
  • Click Install compiler
  • (Note: This might need a retry or two – it’s finicky)

Step 5: Verify it worked

This is the last step, verify if the installation works

I’m using E:\fpc-wasm as the installation directory, you can change it depending on the previous steps

You can choose either one of these options:

Option 1: Use the -iV switch

E:\fpc-wasm\fpc\bin\x86_64-win64\ppcrosswasm32.exe -iV

It should output the version number, something like 3.3.1

Option 2: Use test-path

Test-Path "E:\fpc-wasm\fpc\bin\x86_64-win64\ppcrosswasm32.exe"

If it outputs True, then you’re good to go

What’s Next?

Part 2 – Your first WASM program (coming soon)

Posted in Pascal + WebAssembly | Tagged , , , | Leave a comment

Posit-92 DOS Display Demo

A MS-DOS-like terminal interface built with my custom Pascal game framework (Posit-92 Wasm), showcasing CRT effects and retro computing aesthetics

Using the features from 26th Dec 2025

Features:

  • 8×8 CGA font rendering
  • Scrolling terminal with 40×25 char buffer
  • 16-colour text support
  • Animated scanline background
  • Snow particle system
  • Chiptune audio playback

Available commands:
Type HELP to see all commands, including DATE, TIME, DIR, MEM, SNOW and JINGLE

Technical details:

  • 100% software rendering (no GPU)
  • Written in Turbo Pascal dialect, compiled to WebAssembly
  • 640 KB simulated heap, like the classic DOS memory limit

Credits:

Posted in Indie games, Posit-92 | Tagged , | Leave a comment

Posit-92 Demo – CRT Effects

This demonstrates how Posit-92 Wasm handles 4 layers of filters, fully using software rendering (100% CPU, no GPU used)

The filter layers are as follows:

  • Phosphor glow filter
  • Chromatic aberration
  • Scanlines (25% darker)
  • Vignette

How to play

Simply click Play to start

Posted in Posit-92 | Tagged , , | Leave a comment

JMBlue Catch Game

I made this with QBJS (v0.10.1)

The image assets are made by @jmblue7827 on TikTok


Changelog

06-10-2025: Increased maximum fish to 30

Posted in Indie games | Leave a comment