Added a function to load in a block of memory
This commit is contained in:
parent
3b8f87212f
commit
eb3f581b00
@ -53,7 +53,7 @@ func (machine *Machine) Reset () {
|
||||
func (machine *Machine) Execute (offset int) {
|
||||
machine.counter = offset
|
||||
|
||||
for {
|
||||
for machine.counter < len(machine.Program) {
|
||||
switch machine.instruction() {
|
||||
case 0x0:
|
||||
// PUSH
|
||||
@ -244,5 +244,11 @@ func (machine *Machine) Unregister (id int) {
|
||||
delete(machine.functions, id)
|
||||
}
|
||||
|
||||
// LoadMemory loads the contents of block into the machine's memory.
|
||||
func (machine *Machine) LoadMemory (block []int) {
|
||||
machine.block = make([]int, len(block))
|
||||
copy(machine.block, block)
|
||||
}
|
||||
|
||||
// Milk milks the stack machine
|
||||
func (machine *Machine) Milk () {}
|
||||
|
Loading…
Reference in New Issue
Block a user