Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/werdl/samik
https://github.com/werdl/samik
Last synced: about 7 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/werdl/samik
- Owner: werdl
- Created: 2023-07-24T08:46:13.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-07-24T10:32:53.000Z (over 1 year ago)
- Last Synced: 2023-07-24T11:48:29.612Z (over 1 year ago)
- Language: Python
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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 p200010 add , - X=p1+p2
00011 sub , - X=p1-p2
00100 mul , - X=p1*p2
00101 div , - X=p1/p200111 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
```