Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/grdsdev/tisa
tisa is an emulator for the Tiny ISA
https://github.com/grdsdev/tisa
c emulator interpreter
Last synced: 28 days ago
JSON representation
tisa is an emulator for the Tiny ISA
- Host: GitHub
- URL: https://github.com/grdsdev/tisa
- Owner: grdsdev
- Created: 2018-09-15T13:16:56.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-29T10:05:13.000Z (over 4 years ago)
- Last Synced: 2023-10-19T04:15:40.889Z (about 1 year ago)
- Topics: c, emulator, interpreter
- Language: C
- Homepage:
- Size: 10.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# TISA
TISA stands for Tiny ISA.## Bulding and executing
For building the project we're using cmake.
```
mkdir build
cd build
cmake ..
make
```Then run with:
`./tisa ../input.s --dump`## Supported instructions
- ADD rx, ry // rx = rx + ry
- SUB rx, ry
- DIV rx, ry
- MUL rx, ry
- BRZ rx, DES // PC += DES se rx = 0
- BRNZ rx, DES // PC += DES se rx != 0
- BRLZ rx, DES // PC += DES se rx < 0
- BRGZ rx, DES // PC += DES se rx > 0
- IBRZ rx, ADR // PC = MEM(ADR) se rx = 0
- MOV rx, ry // rx = ry
- LOADM rx, ADR // rx = MEM(ADR)
- STOREM rx, ADR // MEM(ADR) = rx
- LOADI rx, VAL // rx = VAL
- WRITE rx // printf(“%d\n”, rx)
- READ rx // scanf(“%d”, rx)
- EXIT // exit(0)## Example
```c
int x = 0;
for (int i = 100; i > 0; i--) {
for (int k = i; k > 0; k--) {
x += k;
}
}
printf("%d\n", x);
```The `C` code above is translated to:
```assembly
LOADI r1, 0
LOADI r3, 1
LOADI r2, 100
MOV r4, r2
ADD r1, r4
SUB r4, r3
BRNZ r4, -2
SUB r2, r3
BRNZ r2, -5
WRITE r1
EXIT
```