Sirc

From Esolang
Jump to navigation Jump to search

Sirc

Sirc (single register computer) as in name it only has a single register, also it doesnt allow any immediate values

Architecture

  • The CPU has a single register (acc).
  • RAM stores both the program and data.
  • No immediate values are allowed; all operations depend on values in `acc` or RAM.
  • Programs begin execution at RAM address `0`.

Memory

  • RAM contains both instructions and data.
  • RAM is limited to 65536 adresses
  • Each RAM adress can hold 2^16 (unsigned)

Instruction Set

Sirc has a minimal set of instructions,

  • `hlt` halts the program
  • `lac` load given ram adress into acc
  • `sac` load acc into given ram adress
  • `jgz` jmp to given adress or label (in assembler) if acc > 0
  • `jez` jmp to given adress or label (in assembler) if acc == 0
  • `jmp` jmp to given adress or label (in assembler) no condition
  • `add` adds given ram adress value into acc
  • `sub` subtract given ram adress value from acc

Example Programs

Increment a acc

This program increments the value of acc.

lac 0x01 ; load ram adress 0x01 value into acc (this does nothing other than setting ram adress 0x01 value to 1)
add 0x01 ; 0x01 is now 1 so we add it into acc

implementations

 sadly there is no implementation right now but i am developing in python