





Assembled language that runs on top of Scratch.
Code examples: https://coppiq.com/cerium1.0
This technically isn't a real Assembly language since it isn't made for a low-level target, but I hope it's close enough to be relevant. It's heavily based on arm32 with a lot of high-level features from Scratch.
Some main differences:
- Registers and memory are Scratch variables, meaning they can be treated as either strings or numbers.
- No bitwise operators
- Data can be pushed directly to the stack. In any other case however, the data would need to be loaded into a register first.
- It has special branch instructions that push the stack and frame pointers automatically.
- The bytecode the project actually reads is string-based and not raw bytes. Scratch can't read raw data.
- It has special math blocks (pow, sqr, sin, cos, tan) and blocks for string manipulation (letter of, substring, make uppercase, make lowercase, length of, concatenate).
- Only branch instructions can run conditionally.
The code is assembled into a single string that gets unpacked and read as individual instructions by the OS after running execve(). (Example on image 5)
It runs on top of an OS simulator I've named Cerium, which it communicates with through syscalls. The Cerium part of it also handles virtual memory and inter-process communication. The language itself is called Spryte, with the current version being named Blueberry Spryte.
The language supports .text, .data, and .rodata segments that are always loaded into separate memory pages when starting a program.
The virtual memory has ASLR also. Program data is always accessed relatively using the stack or the "adr rx, label" psuedo-instruction, which expands into "add rx, pc, label index - instruction index".
Strings can be stored as one Scratch variable or individual characters, which is specified by using the .string or .chars directives. Individual items of memory can also be reserved with the .items directive.
Here's an example of the assembled code "echo.s":
@*--spryte-bluby0Ⓢ1.0.0Ⓢ0Ⓢ0=0Ⓢ!074Ⓢ!001Ⓢ!021Ⓢ"48d"39d1Ⓢ!0a1Ⓢ(1a8%0414Ⓢ)119a'?0 Ⓢ!11d')0dd1Ⓢ)0aa1Ⓢ%06-13Ⓢ?0Ⓢ!11d')0dd1Ⓢ!071Ⓢ!000Ⓢ'
"ex_fork.s":
@*--spryte-bluby0Ⓢ1.0.0Ⓢ0Ⓢ0=0;1=86Ⓢ!072Ⓢ'(000Ⓢ!074Ⓢ!001Ⓢ!021Ⓢ%0243Ⓢ!0735Ⓢ!00-1Ⓢ!01-1Ⓢ'!07500Ⓢ!001Ⓢ'!074Ⓢ!001Ⓢ)01f100Ⓢ'!0720Ⓢ'#30f96Ⓢ!074Ⓢ!001Ⓢ)01f90Ⓢ')01f86Ⓢ'!07500Ⓢ!001Ⓢ'%0629Ⓢ!07500Ⓢ!002Ⓢ'!074Ⓢ!001Ⓢ)01f65Ⓢ'!0720Ⓢ'#30f62Ⓢ!074Ⓢ!001Ⓢ)01f56Ⓢ')01f52Ⓢ'!071Ⓢ!000Ⓢ'ⓈHello from child ␛[30m␛[47mpid ⓈⓈHello from parent ␛[30m␛[42mpid ⓈⓈ␛[39m␛[49mⓈ
The outputted file is structured as follows:
- Magic Number
@*--spryte-bluby - Internal Version Number
0Ⓢ - Readable Version Number
1.0.0Ⓢ - Entry Point
0Ⓢ - Segment Table
0=0;1=86Ⓢ - .text
!072Ⓢ'(000Ⓢ!074Ⓢ!001Ⓢ... - .data (optional)
Hello from child ␛[30m␛[47m...
This is actually the second version of this project. The original (Strawberry Spryte) was completely different and based on the 6502 architecture with syscalls weirdly mixed in. The last image is a screenshot of the joke program "sl" written in it. (original file is at https://pastebin.com/T6vJiR85)
The Scratch project is very unfinished so I won't be sharing it yet, sorry.
This is a project made partially to teach myself so I apologise if the code is a bit amateurish or messy. I can promise that nothing here was written with AI though.