libcrisc ~master

A virtual CPU and assembler library.


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

CRISC

Clipsey's Reduced Instruction Set Computing virtual toy CPU and assembler. CRISC is a single-file virtual CPU and assembler for a small toy architecture I made because i was bored.

Building

Makefile

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

Then run the following in the CRISC root folder.

make
sudo make install

DUB Usage

You can add libcrisc as a package on dub to your project if you want to utilize this virtual CPU. http://code.dlang.org/packages/libcrisc

Usage

To assemble an crisc assembly file, use casm.

To run a crisc binary, use criscexec.

Instruction Set

DO NOTE casm 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

  • 0 downloads total

Score:
0.4
Short URL:
libcrisc.dub.pm