Skip to content

Documentation

ItsGraphax edited this page Nov 23, 2025 · 1 revision

Azure Documentation

Foreword

Troughout the documentation, you'll find different annotations for many things. Ill try to clarify anything here.

What is :any?

This is my way of adding type annotation to the documentation!

  • any: Any value representable in a scratch variable
  • str: Exclusively a text
  • int: Exclusively a number
  • reg: An index pointing to a register

What is base referring to in lists?

When I say base 0, that means that indexes start at 0. When I say base 1 the indexes work like in scratch.

What are registers?

Registers are the temporary variables of a program. Every program gets 16 Registers for themselves, indexed from 1 to 16

What is Memory?

Memory is the RAM of Azure. It is indexed base 0

Program Memory

Program Memory, happens when the program is running in user mode, which limits the readeable and writeable range to the program memory and offsets it to make index 0 be the start of program memory

What is the Heap?

The heap is literally just a long list where you can write into with base 1

What is the main tick?

The program runs in two easy steps every tick:

  • Get OPCODE: This fetches the next instruction OPCODE and Arguments
  • Run Command: This runs the selected OPCODE. Writing and Reading is handled then by internal functions

Documentation

OPCODES

NOOP

NOOP

Does nothing

EXIT

EXIT

Exits the program

JMP

JMP pc:int

Jumps to instruction pc in program memory

CALL

CALL pc:int

Pushes current pc to stack and jumps to pc can be returned to using #OPCODES#RET

RET

RET

Pops the top pc from stack and jumps to it. Needs #OPCODES#CALL to be used first

SYSCALL

SYSCALL key:str

Raises a syscall trap to key

MOV

MOV des:reg val:any

Sets the registry des to val (Not required to be int)

COPY

COPY orig:reg des:reg

Copies the value in registry orig into registry des

ADD/SUB/MULT/DIV/MOD

ADD/SUB/MULT/DIV/MOD des:reg val:reg

Runs the specific operation on the registry des with the registry val

  • ADD: Addition (+)
  • SUB: Subtraction (-)
  • MULT: Multiplication (*)
  • DIV: Division (/)
  • MOD: Modulo (%)

CMP

CMP reg1:reg reg2:reg

Compares reg1 to reg2 and sets the corresponding flags (EQ, LT, GT, ZF)

JEQ/JLT/JGT/JZ/JNZ

JEQ/JLT/JGT/JZ/JNZ pc:int

Jumps to instruction pc if the corresponding condition is true

  • JEQ: Equal (EQ) flag is true
  • JLT: Less than (LT) flag is true
  • JGT: Greater than (GT) flag is true
  • JZ: Zero (ZF) flag is true
  • JNZ: Zero (ZF) flag is false

ALLOC

ALLOC amount:int reg:reg

Allocates amount spaces in heap and returns index to registry reg

READMEM

READMEM addr.int reg:reg

Returns the value at program memory addrinto registry reg

WRITEMEM

WRITEMEM addr:int reg:reg

Writes the value at register reg to program memory addr

READHEAP

READHEAP pointer_reg:reg des_reg:reg

Returns the value at heap index of registry pointer_reginto registry des_reg

WRITEHEAP

WRITEHEAP pointer_reg:reg val_reg:reg

Writes the value at registry val_reg into heap index of registry pointer_reg

Kernel Instructions

EXTERNAL

EXTERNAL key:str

Calls an external function (key)

SYSRET

SYSRET

Just like #OPCODES#RET, but also sets trap status and mode

Syscall Functions

Here you'll see every every Syscall function indexed by register:type

Log

1:str

Logs the value at 1 to the Scratch Addons/Turbowarp Debugger