An open API service indexing awesome lists of open source software.

https://github.com/xnacly/register_machine

Registermachine with 7 slots and simple arithmetic operators
https://github.com/xnacly/register_machine

assembly c

Last synced: 5 months ago
JSON representation

Registermachine with 7 slots and simple arithmetic operators

Awesome Lists containing this project

README

          

REGMACH
=======
Registermachine with 7 slots and simple arithmetic operators

Specifics
---------
SLOT0 is reserved for temporary operations, therefore assigning values to this slot is not allowed:

Error: provided 'set_value' can not be assigned to 'SLOT0', assigning to SLOT0 is not allowed!. Line: 4

If an operator is used, which isn't specified below the interpreter throws the following error:

Error: selected operator invalid or unavailable. Line: 4

If no file is passed, the interpreter throws this:

Error: missing file. 32

Run
---

make all

REGMACH syntax
---------------
All operations must be between the keywords:

BEGIN

and

END

Possible Operators:
- LOADI : Set SLOT0 to VALUE
- LOAD : Load SLOT into SLOT0
- ADD : Add SLOT's value to SLOT0
- SUB : Subtract SLOT's value from SLOT0
- MULT : Multiply SLOT0 with SLOT
- DIV : Divide SLOT0 with SLOT
- STORE : STORE SLOT0 in SLOT

Simple Example:
1 BEGIN
2 LOADI 22
3 STORE 1
4 LOADI 3
5 STORE 2
6 LOAD 1
7 DIV 2
8 MULT 2
9 STORE 3
10 LOAD 1
11 SUB 3
12 STORE 3
13 END

Result:
LOADI 22: {22,0,0,0}
STORE 1: {0,22,0,0}
LOADI 3: {3,22,0,0}
STORE 2: {0,22,3,0}
LOAD 1: {22,22,3,0}
DIV 2: {7,22,3,0}
MULT 2: {21,22,3,0}
STORE 3: {0,22,3,21}
LOAD 1: {22,22,3,21}
SUB 3: {1,22,3,21}
STORE 3: {0,22,3,1}
END 0: {0,22,3,1}

Try Example locally
------------------

git clone https://github.com/xNaCly/register_machine.git regmach
cd regmach
make example