This is libvm68k.info, produced by makeinfo version 4.0 from
libvm68k.texi.

INFO-DIR-SECTION Miscellaneous packages
START-INFO-DIR-ENTRY
* Libvm68k: (libvm68k).         M68000 virtual machine library.
END-INFO-DIR-ENTRY

   This file documents the usage and the internals of Libvm68k.

   Copyright 1999-2001 Hypercore Software Design, Ltd.

   Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.


File: libvm68k.info,  Node: Top,  Next: M68000 Architecture Basics,  Prev: (dir),  Up: (dir)

Libvm68k
********

   Libvm68k is an M68000 virtual machine library written in C++.

   This is Revision 1.1 of the Libvm68k Reference Manual, updated Sat,
16 Jun 2001 23:17:03 +0900.  This manual applies to Version 1.0 of
Libvm68k.

* Menu:

* M68000 Architecture Basics::  M68000 architecture in brief.
* Using Libvm68k::              How to use Libvm68k in a program.
* Function Index::              Index for functions.
* Object Index::                Index for objects.
* Type Index::                  Index for types.
* Concept Index::               Index for concepts.

 --- The Detailed Node Listing ---

M68000 Architecture Basics

* Data Size::                   Data size description.

Using Libvm68k

* Basic Types::                 Definitions of Basic Types.
* Memory Interface::            Basics of the memory subsystem.
* Processor::                   How is a processor constructed?

Memory Interface

* Memory Exceptions::           Exceptions on memory.
* Memory::                      Memory objects.
* Memory Map::                  Memory maps.

Processor

* Context::                     Context of execution.
* Execution Unit::              How instructions are decoded and executed.

Execution Unit

* Instructions::                Handling instructions.


File: libvm68k.info,  Node: M68000 Architecture Basics,  Next: Using Libvm68k,  Prev: Top,  Up: Top

M68000 Architecture Basics
**************************

   Before describing internals of Libvm68k, let's review the M68000
architecture.

   Readers who is familiar with this architecture can skip this chapter.

* Menu:

* Data Size::                   Data size description.


File: libvm68k.info,  Node: Data Size,  Prev: M68000 Architecture Basics,  Up: M68000 Architecture Basics

Data Size
=========

   In M68000 architecture, a "byte" is 8-bit long.  A "word" is two
bytes.  A "long word" is two words, or four bytes.


File: libvm68k.info,  Node: Using Libvm68k,  Next: Function Index,  Prev: M68000 Architecture Basics,  Up: Top

Using Libvm68k
**************

   This chapter describes the application program interface of Libvm68k.

   They are declared in the namespace `vm68k'.

* Menu:

* Basic Types::                 Definitions of Basic Types.
* Memory Interface::            Basics of the memory subsystem.
* Processor::                   How is a processor constructed?


File: libvm68k.info,  Node: Basic Types,  Next: Memory Interface,  Prev: Using Libvm68k,  Up: Using Libvm68k

Definitions of Basic Types.
===========================

   Libvm68k defines several basic types to keep the program portable.
These types are defined in namespace `vm68k::types' and imported in
namespace `vm68k'.

 - Typedef: uint_type
     This is a natural unsigned type that can hold an unsigned word
     number on M68000. This type is `unsigned int' on all host
     architectures.

 - Typedef: uint32_type
     This is a natural unsigned type that can hold an unsigned long
     word number on M68000. This type is `unsigned int' on host
     architectures that have `unsigned int' with at least 32-bit.

 - Typedef: sint_type
     `sint_type' is a natural signed type that can hold a signed word
     number on M68000. This type is `int' on most host architectures,
     but if the host architecture cannot represent -0x8000 in that
     type, i.e. it does not use 2's complement representation, it is
     `long int' instead.

 - Typedef: sint32_type
     `sint32_type' is a natural signed type that can hold a signed long
     word number on M68000. This type is `int' on host architectures
     that have `int' with at least 32-bit and that can represent
     -0x80000000 in that type. Otherwise, it is `long int' if the type
     can hold -0x80000000, or `long long int' if the compiler is GCC. If
     there is no type that can hold -0x80000000 on the architecture,
     Libvm68k cannot be compiled.


File: libvm68k.info,  Node: Memory Interface,  Next: Processor,  Prev: Basic Types,  Up: Using Libvm68k

Memory Interface
================

   Memory is an object that can be mapped in an address space.  The
class `memory' is the abstract base class for all memory.

   Libvm68k uses a single address space to access memory and peripheral
devices.

* Menu:

* Memory Exceptions::           Exceptions on memory.
* Memory::                      Memory objects.
* Memory Map::                  Memory maps.


File: libvm68k.info,  Node: Memory Exceptions,  Next: Memory,  Prev: Memory Interface,  Up: Memory Interface

Memory Exceptions
-----------------

 - Abstract Class: memory_exception

 - Class: bus_error_exception

 - Class: address_error_exception


File: libvm68k.info,  Node: Memory,  Next: Memory Map,  Prev: Memory Exceptions,  Up: Memory Interface

Memory
------

 - Abstract Class: memory
     Abstract base class for memory components.

 - Enumeration in `memory': function_code
     Classifies memory references.  These values are defined:

    `USER_DATA'
          User data reference.  The processor uses this value in the
          user state for reading and writing data.

    `USER_PROGRAM'
          User program reference.  The processor uses this value in the
          user state for reading instructions.

    `SUPER_DATA'
          Supervisor data reference.  The processor uses this value in
          the supervisor state for reading and writing data.

    `SUPER_PROGRAM'
          Supervisor program reference.  The processor uses this value
          in the supervisor state for reading instructions.

 - Abstract Method on memory: int get_8 (uint32_type ADDRESS,
          function_code FC) const
     Reads an 8-bit data from this memory.  The return value is
     unsigned.

 - Abstract Method on memory: uint16_type get_16 (uint32_type ADDRESS,
          function_code FC) const
     Reads a 16-bit data from this memory.  ADDRESS must be a multiple
     of 2.  The return value is unsigned.

 - Method on memory: uint32_type get_32 (uint32_type ADDRESS,
          function_code FC) const
     Reads a 32-bit data from this memory.  ADDRESS must be a multiple
     of 4.  The return value is unsigned.

     This method is just implemented using two `get_16' calls for
     convenience, but can be overridden by a derived class for a
     slightly better performance.

 - Abstract Method on memory: void put_8 (uint32_type ADDRESS, int
          VALUE, function_code FC)
     Writes an 8-bit value to this memory.  VALUE may be signed or
     unsigned.  FC must be one of the data references.

 - Abstract Method on memory: void put_16 (uint32_type ADDRESS,
          uint16_type VALUE, function_code FC)
     Writes a 16-bit value to this memory.  ADDRESS must be a multiple
     of 2.  VALUE may be signed or unsigned.  FC must be one of the
     data references.

 - Method on memory: void put_32 (uint32_type ADDRESS, uint32_type
          VALUE, function_code FC)
     Writes a 32-bit value to this memory.  ADDRESS must be a multiple
     of 4.  VALUE may be signed or unsigned.  FC must be one of the
     data references.

     This method is just implemented using two `put_16' calls for
     convenience, but can be overridden by a derived class for a
     slightly better performance.


File: libvm68k.info,  Node: Memory Map,  Prev: Memory,  Up: Memory Interface

Memory Map
----------

 - Class: memory_map
     This is a class of address spaces for memory.

 - Typedef in `memory_map': function_code
     Alias of `memory::function_code'.

 - Method on memory_map: int get_8 (uint32_type ADDRESS, function_code
          FC) const

 - Method on memory_map: uint16_type get_16 (uint32_type ADDRESS,
          function_code FC) const

 - Method on memory_map: uint16_type get_16_unchecked (uint32_type
          ADDRESS, function_code FC) const

 - Method on memory_map: uint32_type get_32 (uint32_type ADDRESS,
          function_code FC) const

 - Method on memory_map: void put_8 (uint32_type ADDRESS, int VALUE,
          function_code FC)

 - Method on memory_map: void put_16 (uint32_type ADDRESS, uint16_type
          VALUE, function_code FC)

 - Method on memory_map: void put_16_unchecked (uint32_type ADDRESS,
          uint16_type VALUE, function_code FC)

 - Method on memory_map: void put_32 (uint32_type ADDRESS, uint32_type
          VALUE, function_code FC)


File: libvm68k.info,  Node: Processor,  Prev: Memory Interface,  Up: Using Libvm68k

Processor
=========

   A processor is made of a pair of a context and an execution unit. A
context represents the dynamic state, which is updated by program
execution. An execution unit represents the static setting that is not
changed while program execution.

* Menu:

* Context::                     Context of execution.
* Execution Unit::              How instructions are decoded and executed.


File: libvm68k.info,  Node: Context,  Next: Execution Unit,  Prev: Processor,  Up: Processor

Context
-------

   The state of the processor is stored in a context. Major components
of a context are a set of registers and a reference to an address space.

 - Class: context
     This class represents the dynamic part of a processor.

 - Instance Variable of context: registers regs
     This variable keeps values of the processor registers.

 - Method on context: bool supervisor_state () const
     This method returns true if this context is in the supervisor
     state.

 - Method on context: void set_supervisor_state (bool STATE)
     This method sets the supervisor state to STATE.

 - Method on context: memory::function_code data_fc () const
     This method returns the function code for data.

 - Method on context: memory::function_code program_fc () const
     This method returns the function code for programs.


File: libvm68k.info,  Node: Execution Unit,  Prev: Context,  Up: Processor

Execution Unit
--------------

   Libvm68k encapsulates non-dynamic aspects of a M68000 processor into
an execution unit.

 - Class: exec_unit
     This class represents the static part of a processor.

 - Method on exec_unit: instruction_type set_instruction (uint16_type
          OP, const instruction_type &I)
     This method sets an instruction for operation word OP to I and
     returns the previous value.

 - Method on exec_unit: void step (context &C) const
     This method executes a single instruction in context C.

 - Method on exec_unit: void run (context &C) const
     This method executes instructions in context C.

* Menu:

* Instructions::                Handling instructions.


File: libvm68k.info,  Node: Instructions,  Prev: Execution Unit,  Up: Execution Unit

Instructions
............

   An instruction is defined by a function.  This function is called
"instruction handler".


File: libvm68k.info,  Node: Function Index,  Next: Object Index,  Prev: Using Libvm68k,  Up: Top

Function Index
**************

* Menu:

* data_fc on context:                    Context.
* get_16 on memory:                      Memory.
* get_16 on memory_map:                  Memory Map.
* get_16_unchecked on memory_map:        Memory Map.
* get_32 on memory:                      Memory.
* get_32 on memory_map:                  Memory Map.
* get_8 on memory:                       Memory.
* get_8 on memory_map:                   Memory Map.
* program_fc on context:                 Context.
* put_16 on memory:                      Memory.
* put_16 on memory_map:                  Memory Map.
* put_16_unchecked on memory_map:        Memory Map.
* put_32 on memory:                      Memory.
* put_32 on memory_map:                  Memory Map.
* put_8 on memory:                       Memory.
* put_8 on memory_map:                   Memory Map.
* run on exec_unit:                      Execution Unit.
* set_instruction on exec_unit:          Execution Unit.
* set_supervisor_state on context:       Context.
* step on exec_unit:                     Execution Unit.
* supervisor_state on context:           Context.


File: libvm68k.info,  Node: Object Index,  Next: Type Index,  Prev: Function Index,  Up: Top

Object Index
************

* Menu:

* regs of context:                       Context.
* SUPER_DATA:                            Memory.
* SUPER_PROGRAM:                         Memory.
* USER_DATA:                             Memory.
* USER_PROGRAM:                          Memory.


File: libvm68k.info,  Node: Type Index,  Next: Concept Index,  Prev: Object Index,  Up: Top

Type Index
**********

* Menu:

* address_error_exception:               Memory Exceptions.
* bus_error_exception:                   Memory Exceptions.
* context:                               Context.
* exec_unit:                             Execution Unit.
* function_code <1>:                     Memory Map.
* function_code:                         Memory.
* memory:                                Memory.
* memory_exception:                      Memory Exceptions.
* memory_map:                            Memory Map.
* sint32_type:                           Basic Types.
* sint_type:                             Basic Types.
* uint32_type:                           Basic Types.
* uint_type:                             Basic Types.


File: libvm68k.info,  Node: Concept Index,  Prev: Type Index,  Up: Top

Concept Index
*************

* Menu:

* coding convention:                     Using Libvm68k.
* context:                               Context.
* execution unit:                        Execution Unit.
* instruction handler:                   Instructions.
* memory:                                Memory Interface.
* processor:                             Processor.



Tag Table:
Node: Top509
Node: M68000 Architecture Basics1886
Node: Data Size2266
Node: Using Libvm68k2516
Node: Basic Types2981
Node: Memory Interface4507
Node: Memory Exceptions5015
Node: Memory5267
Node: Memory Map7845
Node: Processor8937
Node: Context9426
Node: Execution Unit10357
Node: Instructions11137
Node: Function Index11345
Node: Object Index12575
Node: Type Index12954
Node: Concept Index13789

End Tag Table
