Skip to content

Team-Immersive-Intelligence/gasm

Repository files navigation

Gabriel's Assembly (GASM)

GASM is a variation of x86 assembly made by Gabriel (gabriel@iiteam.net) for use with ImmersiveIntelligence.

Syntax

Syntax is similar to x86 assembly with few differences:

; Function definition (comments start with ";" and can't be on the same line as instructions)
fn add:
add eax ebx
ret

; put 10 into register eax
mov eax 10
; put 5 into register ebx
mov ebx 5
; call function "add"
call add
; now eax contains 15
; every gasm code has to contain "end" at the end of the code.
end

Functions are defined as fn <function name>: while labels remain the same <label name>:.

Instruction Set

GASM has following instructions:

Instruction Description
add Add src to dst with result being stored in dst
sub Subtract src from dst with result being stored in dst
cmp Compare dst with src by subtracting src from dst. Only flags are modified
inc Increment dst by one
dec Decrement dst by one
div Divide dst by src storing result in dst
mul Multiply dst by src storing result in dst
jz Jump to label dst if zero flag is set
jnz Jump to label dst if zero flag is not set
js Jump to label dst if sign flag is not set
jns Jump to label dst if sign flag is not set
mov Move src into dst
push Push src onto top of stack
pop Pop top of stack into dst
call Call function fn
ret Return from function. Will return back to where call was called
end Used at the end of gasm code
xor Perform bitwise xor on dst using src. Store result in dst
or Perform bitwise or on dst using src. Store result in dst
shl Perform bitwise left shift by count
shr Perform bitwise right shift by count
and Perform bitwise and on dst and src keeping result in dst

About

Gabriel's Assembly Language

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors