CreativeASM

From Esolang
Jump to navigation Jump to search

CreativeASM is a esolang made by Mihai Popa. It's the succesor of CreativeScript. It's a high-level assembly-like language. It assembles (transpiles) to Batch, not to machine code.

Syntax

Syntax is borrowed from x86, M68K and ARM assembly, but it's modified to be easy to learn and program.

Registers

In early versions, there are 8 or 12 registers, but now is 16. The registers can be of any size, up to "unlimited", not in x86 assembly, which is 32 bits. More formally, these are variables.

Difference between versions

In early versions, the language is implemented. Now, the language is compiled (assembled/transpiled) to Batch.

Note

There are exactly 37 instructions! WOW!

Instruction list

Instruction list
Instruction Meaning
put [register] [text] Puts [text] in the register specified
int [register] 00h Calls user input and puts the value in the register specified
int [register] 01h Outputs the value in the register specified
add [register] [register2] [register3] Adds the 2 values from the 2 specified registers and puts the value in the register specified
sub [register] [register2] [register3] Subtracts the 2 values from the 2 specified registers and puts the value in the register specified
mul [register] [register2] [register3] Multiplies the 2 values from the 2 specified registers and puts the value in the register specified
div [register] [register2] [register3] Divides the 2 values from the 2 specified registers and puts the value in the register specified
mod [register] [register2] [register3] Does a modulo on 2 values from the 2 specified registers and puts the value in the register specified
bl Prints a CR+LF combo (a newline)
beqrax [value] [label] Jumps to the label specified if RAX is equal to the value specified
beqrbx [value] [label] Jumps to the label specified if RBX is equal to the value specified
beqrcx [value] [label] Jumps to the label specified if RCX is equal to the value specified
beqrdx [value] [label] Jumps to the label specified if RDX is equal to the value specified
beqeax [value] [label] Jumps to the label specified if EAX is equal to the value specified
beqebx [value] [label] Jumps to the label specified if EBX is equal to the value specified
beqecx [value] [label] Jumps to the label specified if ECX is equal to the value specified
beqedx [value] [label] Jumps to the label specified if EDX is equal to the value specified
lbl [label] / start [label] Defines a label
slp Waits for a keypress
slt Waits for a tick (~33 ms). Use a for loop to wait for longer
sls Waits for a second. Use a for loop to wait for longer
jmp [label] Jumps directly to the label specified
hal Halts the execution
clr Clears the screen
for [register] [start] [end] [step] Defines a for loop
endfor End of for loop
tit [title] Sets the CMD title to how you want to be
cpy [register1] [register2] Copies the value from the first register in the second register
mov [register1] [register2] Moves the value from the first register in the second register
or [register1] [register2] [register3] Does a OR on 2 values and puts the value in the third register
xor [register1] [register2] [register3] Does a XOR on 2 values and puts the value in the third register
rnd [register] [start] [end] Generates a random integer (number) and puts in the register
col [color] Changes the CMD color to how you want to be
dat Prints the system date (as a updateable variable)
tim Prints the system time (as a updateable variable)

Comments

Comments can be done with @ (a at symbol) or with mrk (from mark)

Examples

See the examples at CreativeASM/Examples

Assembler to Batch

See the assembler at CreativeASM/Assembler