Restrict global and function references to memory size

This commit is contained in:
Ian Gulliver
2021-11-20 18:12:17 -10:00
parent bdb6b17187
commit bd84a5b969
6 changed files with 35 additions and 11 deletions

View File

@@ -2,6 +2,8 @@ package vm
import "fmt"
const GlobalMemorySize = 16
type State struct {
running bool
err error
@@ -18,7 +20,7 @@ type State struct {
func NewState(prog *Program) (*State, error) {
return &State{
program: prog,
globalMemory: NewMemory(16),
globalMemory: NewMemory(GlobalMemorySize),
}, nil
}