Пример #1
0
// StepLoop executes the program until an single instruction loop is encountered.
func StepLoop(d *emulator.DCPU) error {
	lastPC := d.PC
	for {
		err := d.Step()
		if d.PC == lastPC || err != nil {
			return err
		}
		lastPC = d.PC
	}
	return nil
}
Пример #2
0
// StepJmp executes the program until a "SET PC, ..." is encountered.
func StepJmp(d *emulator.DCPU) error {
	for {
		word := d.RAM[d.PC]
		if (word & 0x3ff) == 0x1c1 {
			return nil
		}
		err := d.Step()
		if err != nil {
			return err
		}
	}
	return nil
}