1 Commits

Author SHA1 Message Date
e342d9b254 Fixed poking segfault
Machine would segfault when poking address 0 on an uninitialized
block. this has been fixed.
2022-08-29 12:01:08 -04:00

View File

@@ -263,7 +263,7 @@ func (machine *Machine[WORD]) Peek(address WORD) (word WORD) {
// Poke sets the value at address in the block to word.
func (machine *Machine[WORD]) Poke(address WORD, word WORD) {
if int(address) >= len(machine.block) {
reallocatedBlock := make([]WORD, address*3/2)
reallocatedBlock := make([]WORD, address*3/2+1)
copy(reallocatedBlock, machine.block)
machine.block = reallocatedBlock
}