Improved assembler

This commit is contained in:
2024-06-26 14:14:11 +02:00
parent e23c1ece80
commit 68ec1467ef
7 changed files with 85 additions and 46 deletions

View File

@ -20,8 +20,8 @@ func (c *CPU) IsFree(reg Register) bool {
return c.usage&(1<<reg) == 0
}
func (c *CPU) FindFree() (Register, bool) {
for _, reg := range c.General {
func (c *CPU) FindFree(registers []Register) (Register, bool) {
for _, reg := range registers {
if c.IsFree(reg) {
return reg, true
}