|
|
@ -109,7 +109,7 @@ var InstructionLoad = &Instruction{ |
|
|
|
if len(module.register) <= index { |
|
|
|
if len(module.register) <= index { |
|
|
|
return fmt.Errorf("index %d exceeds register size of %d", index, len(module.IO)) |
|
|
|
return fmt.Errorf("index %d exceeds register size of %d", index, len(module.IO)) |
|
|
|
} |
|
|
|
} |
|
|
|
module.accumulator = module.register[index] |
|
|
|
module.accumulator = module.mmu.Read(Address(operand)) |
|
|
|
return nil |
|
|
|
return nil |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
@ -129,7 +129,7 @@ var InstructionStore = &Instruction{ |
|
|
|
if len(module.register) <= index { |
|
|
|
if len(module.register) <= index { |
|
|
|
return fmt.Errorf("index %d exceeds register size of %d", index, len(module.IO)) |
|
|
|
return fmt.Errorf("index %d exceeds register size of %d", index, len(module.IO)) |
|
|
|
} |
|
|
|
} |
|
|
|
module.register[index] = module.accumulator |
|
|
|
module.mmu.Write(Address(operand), module.accumulator) |
|
|
|
return nil |
|
|
|
return nil |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
@ -209,7 +209,8 @@ func newMathInstruction(name string, operation func(accumulator, register float6 |
|
|
|
return fmt.Errorf("index %d does not exist in register", index) |
|
|
|
return fmt.Errorf("index %d does not exist in register", index) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
module.accumulator = operation(module.accumulator, module.register[index]) |
|
|
|
param := module.mmu.Read(Address(index)) |
|
|
|
|
|
|
|
module.accumulator = operation(module.accumulator, param) |
|
|
|
return nil |
|
|
|
return nil |
|
|
|
}, |
|
|
|
}, |
|
|
|
} |
|
|
|
} |
|
|
|