Files
CAR/README.md

2.1 KiB

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:

  • few to none.
  • 32 general purpose registers
  • 32-bit addresses

Needed features:

  • conditional jmps

Instuctions (arithmetic):

  • add
  • sub (subtract)
  • mul (multiply)
  • div (divide)
  • mod (modulus, division remainder)
  • shl (logical shift left)
  • shr (logical shift right)
  • ahr (arithmetic shift right)
  • ror (logical rotate right)
  • and (logical AND)
  • or (logical OR)
  • 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):

  • 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)
  • ldi (load register with and immediate value, only low 21 bits)
  • str (store register at memory, using the program counter as the base)
  • sts (store register at memory, using the stack pointer as the base)
  • stb (store register at memory, using the specified register as the base)
  • 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):

  • nop (do nothing)
  • call (call subroutine/function)
  • ret (return from subroutine/function)
  • jmp (jump to memory address)