akarsh-shrivastava / avm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

avm

Installing

git clone https://github.com/akarsh-shrivastava/avm.git
cd avm/assembler
make install
cd ../runtime
make install

Syntax

  • all the data is one byte typeless and unsigned

  • addresses are enclosed in brackets
    eg [231]

  • Instructions with 2 arguments
    mov, add, sub, mul, div, mod, and, or, xor, cmp
    syntax:

    <instruction> <address1> <address2/constant>
  • Instructions with 1 argument
    not, neg, read, write, push, pop
    syntax:

    <instruction> <address>
  • arithmetic and bitwise operations store the result in the first address
    hence the original value is lost

  • cmp instruction compares 2 arguments and sets last 3 bits of flag accordingly
    1 if second argument is greater
    2 if both are equal
    4 if first argument is greater

  • read reads one byte to the address
    write prints one byte from the address as character

  • push pushes value from address to stack
    pop pops the top of stack to the address

  • labels can be any non-reserve words
    syntax:

    <label_name>:
    ...
  • jmp instruction jumps to the lable depending on the condition
    syntax:

    jmp <condition> <label_name>

    conditions are:
    eq, neq, less, lesseq, grt, grteq, always


Running

Save the assembly code with .lsm extention
To assemble:

lasm filename.lsm

filename.ahl will be created
To run:

avm filename.ahl

To see status of memory after each instruction run with --de option

About


Languages

Language:C++ 68.9%Language:C 26.2%Language:Makefile 4.9%