Пример #1
0
from __future__ import print_function
from amitools.vamos.machine import Machine, CPUState
from amitools.vamos.machine.opcodes import *
from amitools.vamos.error import *
from amitools.vamos.log import log_machine
from amitools.vamos.cfgcore import ConfigDict
import logging

log_machine.setLevel(logging.DEBUG)


def create_machine(cpu_type=Machine.CPU_TYPE_68000):
    m = Machine(cpu_type, raise_on_main_run=False)
    cpu = m.get_cpu()
    mem = m.get_mem()
    code = m.get_ram_begin()
    stack = m.get_scratch_top()
    return m, cpu, mem, code, stack


def machine_machine_run_rts_test():
    m, cpu, mem, code, stack = create_machine()
    # single RTS to immediately return from run
    mem.w16(code, op_rts)
    rs = m.run(code, stack)
    assert rs.done
    assert rs.error is None
    m.cleanup()


def machine_machine_instr_hook_test():
Пример #2
0
from __future__ import print_function
from amitools.vamos.machine import Machine, CPUState
from amitools.vamos.machine.opcodes import *
from amitools.vamos.error import *
from amitools.vamos.log import log_machine
from amitools.vamos.cfgcore import ConfigDict
import logging


log_machine.setLevel(logging.DEBUG)


def create_machine(cpu_type=Machine.CPU_TYPE_68000):
  m = Machine(cpu_type, raise_on_main_run=False)
  cpu = m.get_cpu()
  mem = m.get_mem()
  code = m.get_ram_begin()
  stack = m.get_scratch_top()
  return m, cpu, mem, code, stack


def machine_machine_run_rts_test():
  m, cpu, mem, code, stack = create_machine()
  # single RTS to immediately return from run
  mem.w16(code, op_rts)
  rs = m.run(code, stack)
  assert rs.done
  assert rs.error is None
  m.cleanup()