Skip to content

Instantly share code, notes, and snippets.

@untodesu
Last active February 4, 2021 06:35
Show Gist options
  • Save untodesu/acdf487bff8e1993e44bc98d7dead500 to your computer and use it in GitHub Desktop.
Save untodesu/acdf487bff8e1993e44bc98d7dead500 to your computer and use it in GitHub Desktop.

Error table

ID Mnemonic Alias Description
0 ENOTHING No errors
1 EMALLOC #MA Allocation failure
2 EBYTECODE #BC Invalid bytecode
3 ECALL #CL Undefined procedure
4 ETYPE #TM Type mismatch
5 EDIVZERO #DZ Division by zero

Opcode table

Byte Mnemonic Arguments Length in Bytes Description
0x00 nop 1 Do nothing
0x01 call string 3+ Function call
0x02 ret 1 Function return
0x03 ldc.8 int8 2 Push int8
0x04 ldc.16 int16 3 Push int16
0x05 ldc.32 int32 5 Push int32
0x06 ldc.64 int64 9 Push int64
0x07 ldf.32 float32 5 Push float32
0x08 ldf.64 float64 9 Push float64
0x09 ldstr string 3+ Push string
0x0A ldarg int8 2 Push argument
0x0B ldloc int16 3 Push local
0x0C stloc int16 3 Pop to local
0x0D 1 Reserved
0x0E 1 Reserved
0x0F 1 Reserved
0x10 add 1 Push (Pop + Pop)
0x11 sub 1 Push (Pop - Pop)
0x12 mul 1 Push (Pop * Pop)
0x13 div 1 Push (Pop / Pop)
0x14 mod 1 Push (Pop % Pop)
0x15 shl 1 Push (Pop << Pop)
0x16 shr 1 Push (Pop >> Pop)
0x17 and 1 Push (Pop & Pop)
0x18 or 1 Push (Pop | Pop)
0x19 xor 1 Push (Pop ^ Pop)
0x1A not 1 Push ~Pop
0x1B 1 Reserved
0x1C 1 Reserved
0x1D 1 Reserved
0x1E 1 Reserved
0x1F 1 Reserved
0x20 jmp int32 5 Jump
0x21 je int32 5 Jump if (Pop == Pop)
0x22 jne int32 5 Jump if (Pop != Pop)
0x23 jg int32 5 Jump if (Pop > Pop)
0x24 jge int32 5 Jump if (Pop >= Pop)
0x25 jl int32 5 Jump if (Pop < Pop)
0x26 jle int32 5 Jump if (Pop <= Pop)
0x27 jz int32 5 Jump if (Pop == 0)
0x28 jnz int32 5 Jump if (Pop != 0)
0x29 jn int32 5 Jump if (Pop == NaN)
0x2A jnn int32 5 Jump if (Pop != NaN)
0x2B ji int32 5 Jump if (Pop == Infinity)
0x2C jni int32 5 Jump if (Pop != Infinity)
0x2D 1 Reserved
0x2E 1 Reserved
0x2F 1 Reserved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment