libcrisc 1.0.1

A virtual CPU and assembler library.


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

CRISC

Clipsey's Reduced Instruction Set Computing virtual toy processor and assembler.

What does CRISC do?

CRISC is a single-file virtual CPU and assembler for a small toy architecture I made because i was bored.

Please don't make any serious applications with this, (neither can you, really.)

Building

To build CRISC, you need to have the DMD compiler installed.

Run

make
sudo make install

To build and install CRISC.

Usage

To assemble an crisc assembly file, use criscasm, for running a crisc binary criscexec.

Notes

How do you get addresses from labels?

To get the address of an label suffix it with #, for example: jmpc #myJumpoint

How do you declare variables and create strings?

You can't yet.

Conditional execution

In CRISC, to do conditional execution you first have to move the value you want to test to the status buffer (0xFF) then, you can compared values, const values and register values are the current supported options.

Instruction Set

DO NOTE criscasm will automatically infer which mode you are going to use. So if you are working with registers, remember to suffix arguments with @ for registers/addresses.

InstructionInput AInput B Description
HALTHalts the execution of the program
MOVREG AREG BMoves register A to register B
MOVCCONST AREG BMoves const A to register B
ADDREG AREG BAdds register A to register B
ADDCCONST AREG BAdds const A to register B
SUBREG AREG BSubtracts register A to register B
SUBCCONST AREG BSubtracts const A to register B
MULREG AREG BMultiplies register A to register B
MULCCONST AREG BMultiplies const A to register B
DIVREG AREG BDivides register A to register B
DIVCCONST AREG BDivides const A to register B
JMPADDRESS AJumps to address A
JMPEQADDRESS AREG BJumps to address A if B is equal to value in status register
JMPNEQADDRESS AREG BJumps to address A if B is not equal to value in status register
JMPLEQADDRESS AREG BJumps to address A if B is larger than or equal to value in status register
JMPSEQADDRESS AREG BJumps to address A if B is smallerthan or equal to value in status register
JMPCCONST ADDRESS AJumps to address A
JMPEQCADDRESS ACONST BJumps to address A if B is equal to value in status register
JMPNEQCADDRESS ACONST BJumps to address A if B is not equal to value in status register
JMPLEQCADDRESS ACONST BJumps to address A if B is larger than or equal to value in status register
JMPSEQCADDRESS ACONST BJumps to address A if B is smallerthan or equal to value in status register
LDRREG AADDRESS BLoad memory from address B in to register A
LDRCCONST AADDRESS BLoad memory from const B in to register A
STRREG AADDRESS BStore memory from register A in to address B (in memory)
STRCCONST AADDRESS BStore memory from const A in to address B (in memory)
CALLADDRESS ACall address A
PUSHREG APush value from register A to stack
PUSHCCONST APush constant value to stack
POPREG APop value from stack to register A
RETReturn from subroutine
DBGDBG OPTION ACONST BSet debugging options
Dependencies:
none
Versions:
1.0.1 2018-Aug-24
1.0.0 2018-Aug-24
~master 2018-Oct-10
~v2 2019-Jul-22
Show all 4 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 11 downloads total

Score:
0.4
Short URL:
libcrisc.dub.pm