Development Notes :WIP:

Concept

One of the main concepts I have been focused on is building a CPU that offers the most convenient programming experience at an assembly level.

This is one of the branches I have been exploring the idea is to build a CPU that directly evaluates expressions.

Effectively providing only 2 core instructions Eval and Branch(If)

Binary Encoding

A simple method for encoding this instruction would be to start with the opcode(1 byte) then the destination register(1 byte) followed by the count of terms(1 byte).

This is then followed by the Terms 1 byte each 0-127 for registers and 128-512 for operators

Instructions

Opcode Eval: e r1 + r2

eval will set the flags register for if

Opcode set: s r1 + r2

this would set the register to the resualt this could replace e if the dst is the flag register

Opcode If: if true_lbl fase_lbl

uses the flags register

Opcode Loop: loop r1 > r2

The loop can continue or be in a scope and use scope names

Opcode Continue: continue lbl

Assembler Open { and close } have pre defined names like It in loop

This should apply to parent scope and root scope

Native call frames the cpu should have the stack built into its register file

Register file banks should be mappable to ram for fat or perhaps boxed/framed structs in memmory

Doing this would simplify the eval operator and make it more powerfull

Tasks

TODO write assemblers Lexer

SCHEDULED: <2025-08-30 Sat>