Skip to content

codeeleven0/lunarvm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LunarVM

This project is licenced under GPLv3
A simple emulated CPU.
LunarVM uses an assembly-like syntax.
If you want to build a compiler you need to follow these simple steps:

  • Create code (Make sure it's compilable with the -static flag, staticx is not allowed.)
  • Test code (I don't want to hassle with segfaults.)
  • Open an issue with the code
  • Wait... :)

If you want to extend the assembler you need to follow these simple steps:

  • Create code
  • Test code
  • Make sure it also works with LunarVM Assembly.
  • Run through clang-format (main.c -> fmain.c, see the difference.)
  • Open an issue with the code
  • Wait... :)

Arguments

FILENAME Must be argv[1]
-v Be Verbose - must be argv[2]

Instruction Set

set r1 val

Sets r1 to val.

put r1

Prints r1.

lpc r1

Sets r1 to current PC.

add r1 val

r1 = r1 + val

sub r1 val

r1 = r1 - val

mul r1 val

r1 = r1 * val

div r1 val

r1 = r1 / val

dump r1

Dumps r1.

fdump

Dump state.

mw sec r1

mem[sec] = read(r1).

mr sec r1

r1 = mem[sec].

copy r1 r2

r1 = r2.

addr r1 r2

r1 + r2 = datareg.

subr r1 r2

r1 - r2 = datareg.

divr r1 r2

r1 / r2 = datareg.

mulr r1 r2

r1 * r2 = datareg.

inp r1

r1 = userinput (needs to press enter).

Lunambly? What's that?

C library to produce LunarVM's .S files.

About

LunarVM - A simple emulated CPU.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors