DASM
Classes
DExec.pm File Reference

Execution system for the DCPU-16 processor. More...

#include "DCPU.pm"
#include "DExecHWAdapter.pm"

Go to the source code of this file.

Classes

class  DExec
 Execution system for the DCPU-16 processor. More...

Detailed Description

Execution system for the DCPU-16 processor.

This is a pretty simple interpreter for the core data.

We work on the principle that all operands are references. If an operand is read, we use the 'readref', and if the operand is written to we use the 'writeref'. The references may be to registers, or to core memory locations. They may also be objects which implement hardware, in which case their 'read' or 'write' functions are called.

Consequently some of the opcodes are implemented oddly. Where possible we try to keep to the same semantics such that any memory accesses will obey hardware mappings that might be present.

Actual hardware regions will be implemented by separate objects, and will be registered as part of hardware profiles. However, the hardware devices registered with the core will be copied from the DASM object if it is used to initialise the execution object. These hardware devices may provide poll() methods in order to provide regular updates of the devices, if necessary.

Typical use of this class might be:

   $dasm->readfile($infile);  # Assemble some code (or load a dump)

   # Resolve all the relocations
   die "Unresolved relocations" if (!$dasm->resolve($infile));

   $dexec = new DExec($dasm);
   $dexec->start(1);
   while (1)
   {
       $dexec->runone();
   }
   $dexec->stop();
Author:
Justin Fletcher

Definition in file DExec.pm.