CAR: added stack operations, call, ret, jmp and some other random stuff

This commit is contained in:
2026-07-18 19:28:11 -05:00
parent 5902eae153
commit 1f11242762
10 changed files with 294 additions and 20 deletions

View File

@ -1,22 +1,19 @@
#Cool ARM Ripoff
# Cool ARM Ripoff
*A simple (and ridiculous) virtual machine/CPU made for no real reason/purpose.*
***Written in C, made by David Goeke.***
###Current features:
### Current features:
- few to none.
- 32 general purpose registers
- 32-bit addresses
###Needed features:
- push/pop
- call/ret
- jmp/conditional jmps
- store high 11 bits of an immediate in memory
### Needed features:
- conditional jmps
###instuctions (arithmetic):
### Instuctions (arithmetic):
- add
- sub (subtract)
- mul (multiply)
@ -31,8 +28,13 @@
- xor (logical XOR)
- not (logical NOT/invertion)
- xchg (exchange registers)
- fp_add (add floating point values in registers)
- fp_sub (subtract floating point values in registers)
- fp_mul (multiply floating point values in registers)
- fp_div (divide floating point values in registers)
- fp_mod (modulus (division remainder) floating point values in registers)
###Insutrctions (load/store):
### Insutrctions (load/store):
- ldr (load register with value from memory, using the program counter as the base)
- lds (load register with value from memory, using the stack pointer as the base)
- ldb (load register with value from memory, using a specified register as the base)
@ -43,6 +45,14 @@
- ldh (load high 11 bits of register with immediate)
- sti (store a 21-bit immediate at memory, using the program counter as the base)
- stj (store a 21-bit immediate at memory, using the stack pointer as the base)
- push (push register onto stack)
- pushi (push 21-bit immediate onto stack)
- pop (pop value from stack into register)
- sth (stroe high 11 bits of register to memory, using pc as the base)
- stk (stroe high 11 bits of register to memory, using sp as the base)
###Instructions (misc):
### Instructions (misc):
- nop (do nothing)
- call (call subroutine/function)
- ret (return from subroutine/function)
- jmp (jump to memory address)