Refactored code structure

This commit is contained in:
2024-07-03 11:39:24 +02:00
parent ed03f6a802
commit feebfe65bb
54 changed files with 583 additions and 450 deletions

View File

@ -30,3 +30,14 @@ func (c *CPU) FindFree(registers []Register) (Register, bool) {
return 0, false
}
func (c *CPU) MustUseFree(registers []Register) Register {
register, exists := c.FindFree(registers)
if !exists {
panic("no free registers")
}
c.Use(register)
return register
}