Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/werdl/samik


https://github.com/werdl/samik

Last synced: about 7 hours ago
JSON representation

Awesome Lists containing this project

README

        

## Samik
- My custom architecture
- It has its own instruction set, among other things
- Currently supported via VM, but I will eventually make the computer and write an Arduino flasher program

- `` - (A,B,C,D,E,X or L)
- `` - memory address
- `` - video memory address
- `` - address of memory instruction
- `` - number

- `p1` - first param
- `p2` - second param etc

- `||` - logical or
## Registers
- Just special memory addresses
```arm
A - 000001
B - 000010
C - 000011
D - 000100
E - 000101
X - 000110
L - 000111
```
## Stage 1
- Each instruction's machine code is 17 bits long
- If the instruction doesn't have a param 2, it is just `000000`
```arm
opcode param1 param2
00001 000001 000010
00010 000100 000110
00111 000001 000000
```
```arm
Five-bit opcode | Instruction + params | Explanation
00001 mov ||,|| - Moves p1 to p2

00010 add , - X=p1+p2
00011 sub , - X=p1-p2
00100 mul , - X=p1*p2
00101 div , - X=p1/p2

00111 inc - p1++
01000 dec - p1--

01001 inv - p1=~p1

01010 and , - performs logical and on p1 and p2, stores in X
01011 or ,
01100 xor ,

01101 cmp , - examines the equality between the p1 & p2. Places result in L, for jump commands.

01111 stor , - stors p2 in p1

11000 vid || - displays p1 in the video adaptor
```
### Jumps
- Check out `L`, decides what to do based on its value
```arm
10000 je - ==
10001 jne - !=
10010 jz - L==0
10011 jg - if they were greater than
10100 jge - or equal to
10101 jl - less than
10111 jle - or equal to
```
## Examples
```arm
mov A,B
```
```arm
00001 000001 000010
```

```arm
add D,X
```
```arm
00010 000100 000110
```

```arm
inc A
```
```arm
00111 000001 000000
```
## Stage 2
```arm
push || - Pushes p1 to stack
```