Node:Top, Next:, Previous:(dir), Up:(dir)

Virtual X68000

Virtual X68000 is a host-architecture independent emulator of Sharp X68000 written in C++.

This is Revision 1.21 of the Virtual X68000 Reference Manual, updated Sat, 16 Dec 2000 00:54:31 +0900. This manual applies to Version 1.1 of Virtual X68000.


Node:Introduction, Next:, Previous:Top, Up:Top

Introduction

Virtual X68000 is a virtual machine that emulates a Sharp X68000 system.

Virtual X68000 is written in C++ and uses many templates.


Node:Command Reference, Next:, Previous:Introduction, Up:Top

Command Reference

While Virtual X68000 is written primarily as a set of reusable class libraries, a sample program is also provided for demonstration.

This chapter describes the usage of the sample program.


Node:Invoking vx68k, Previous:Command Reference, Up:Command Reference

Invoking vx68k

vx68k executes X68000 programs.

vx68k [option]... [-] command [argument]...

Options

-M n
--memory-size=n
Allocate n megabytes.


Node:M68000 Architecture, Next:, Previous:Command Reference, Up:Top

M68000 Architecture

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

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


Node:Data Size, Previous:M68000 Architecture, Up:M68000 Architecture

Data Size

In M68000 architecture, a byte is an octet. A word is two octets. A long word is four octets.


Node:Coding Conventions, Next:, Previous:M68000 Architecture, Up:Top

Virtual X68000 Coding Conventions

This chapter describes the coding conventions used in the Virtual X68000 programs.


Node:Basic Types, Previous:Coding Conventions, Up:Coding Conventions

Basic Types

Virtual X68000 defines several basic types to keep the program portable. These types are defined in namespace vm68k::types and imported in namespace vm68k.

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

uint32_type Typedef
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.

sint_type Typedef
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.

sint32_type Typedef
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 no type can hold -0x80000000 on the architecture, Virtual X68000 cannot be compiled.


Node:General Purpose Components, Next:, Previous:Coding Conventions, Up:Top

General Purpose Components

General purpose components are provided by the library libvm68k. These components are declared in the namespace vm68k.


Node:Memory and I/O, Next:, Previous:General Purpose Components, Up:General Purpose Components

Memory and I/O

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

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


Node:Class memory, Next:, Previous:Memory and I/O, Up:Memory and I/O

Class memory

memory Abstract Class
This class has methods get_16, get_8, get_32, put_16, put_8, and put_32. The methods get_16, get_8, put_16, and put_8 are pure virtual and must be overridden in derived classes. Default implementations for get_32 and put_32 are provided but a derived class can override those for better performance.

memory::function_code Enumeration
memory::SUPER_PROGRAM

memory::SUPER_DATA

memory::USER_PROGRAM

memory::USER_DATA

uint_type get_16 (function_code fc, uint32_type address) const Abstract Method on memory
This method reads a word data from the memory. address must be aligned to a word boundary.

unsigned int get_8 (function_code fc, uint32_type address) const Abstract Method on memory
This method reads a byte data from the memory.

uint32_type get_32 (function_code fc, uint32_type address) const Method on memory

void put_16 (function_code fc, uint32_type address, uint_type value) Abstract Method on memory

void put_8 (function_code fc, uint32_type address, unsigned int value) Abstract Method on memory

void put_32 (function_code fc, uint32_type address, uint32_type value) Method on memory

default_memory Class


Node:Class memory_map, Previous:Class memory, Up:Memory and I/O

Class memory_map

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

memory_map::function_code Typedef
Alias of memory::function_code.

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) Method on memory_map


Node:Processor, Previous:Memory and I/O, Up:General Purpose Components

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.


Node:Context, Next:, Previous: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.

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

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

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

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

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

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


Node:Execution Unit, Previous:Context, Up:Processor

Execution Unit

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

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

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

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

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


Node:Instructions, Previous:Execution Unit, Up:Execution Unit

Instructions

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


Node:X68000 Emulation, Next:, Previous:General Purpose Components, Up:Top

X68000 Emulation

This chapter describes UI-independent part of Virtual X68000.

They are available in library libvx68k.


Node:Machine, Next:, Previous:X68000 Emulation, Up:X68000 Emulation

Machine

In Virtual X68000, a machine is an abstraction of X68000 hardware and firmware BIOS.

These definitions are available in <vx68k/machine.h>.

machine Class
This class represents the user-interface independent part of an X68000 hardware and firmware.

machine (size_t memory_size) Constructor on machine
This method constructs a machine.

size_t memory_size () const Method on machine
Returns the size of main memory.

class exec_unit * exec_unit () const Method on machine
Returns the pointer to the execution unit of this object.

context * master_context () const Method on machine
Returns the master context.

void connect (console *c) Method on machine
Sets a console for this object. A console is an abstract interface to the host system.

void configure (memory_map &mm) Method on machine
Configures address space mm for this object.

console Abstract Class
This class is an abstract interface to the host system.


Node:Memory Components, Next:, Previous:Machine, Up:X68000 Emulation

Memory Components


Node:Main Memory, Next:, Previous:Memory Components, Up:Memory Components

Main Memory

main_memory Class
Memory component for the main memory.


Node:IOCS and System ROM, Next:, Previous:Main Memory, Up:Memory Components

The IOCS and the System ROM

X68000 uses the IOCS for input/output and other primitive services. The name IOCS stands for input/output control subsystem. It is stored in the System ROM.

system_rom Class
Memory component for the System ROM. This class derives vm68k::memory.

This class manages a table of IOCS call handlers, and dispatches IOCS calls to them.

uint16_type get_16 (function_code fc, uint32_type address) const Method on system_rom
Returns the 16-bit value at address address using function code fc.

int get_8 (function_code fc, uint32_type address) const Method on system_rom
Returns the 8-bit value at address address using function code fc.

void put_16 (function_code fc, uint32_type address, uint16_type value) Method on system_rom
Stores 16-bit value value at address address using function code fc.

void put_8 (function_code fc, uint32_type address, int value) Method on system_rom
Stores 8-bit value value at address address using function code fc.

void attach (exec_unit *eu) Method on system_rom

void detach (exec_unit *eu) Method on system_rom

void initialize (memory_map &mm) Method on system_rom

system_rom::iocs_call_type Typedef
Type for IOCS call handlers.

void set_iocs_call (int number, const iocs_call_type &handler) Method on system_rom
Sets the handler for IOCS call number to handler.

void call_iocs (int number, context &c) Method on system_rom


Node:Text Video Memory, Next:, Previous:IOCS and System ROM, Up:Memory Components

Text Video Memory

text_video_memory Class
Memory component for text video frame buffer.

uint16_type get_16 (function_code fc, uint32_type address) const Method on text_video_memory
Returns the 16-bit value at address address using function code fc.

int get_8 (function_code fc, uint32_type address) const Method on text_video_memory
Returns the 8-bit value at address address using function code fc.

void put_16 (function_code fc, uint32_type address, uint16_type value) Method on text_video_memory
Stores 16-bit value value at address address using function code fc.

void put_8 (function_code fc, uint32_type address, int value) Method on text_video_memory
Stores 8-bit value value at address address using function code fc.

void install_iocs_calls (system_rom &rom) Method on text_video_memory

void fill_plane (int left, int top, int right, int bottom, int plane, uint16_type pattern) Method on text_video_memory
Fills a rectangular area in a plane. This method implements the function of an IOCS call _TXFILL.


Node:Graphic Video Memory, Next:, Previous:Text Video Memory, Up:Memory Components

Graphic Video Memory

graphic_video_memory Class


Node:SCC, Previous:Graphic Video Memory, Up:Memory Components

Z8530 SCC

X68000 uses a Zilog Z8530 SCC, or serial communication controller, for a COM port and a mouse port.


Node:Disk I/O, Previous:Memory Components, Up:X68000 Emulation

Disk I/O

disk_unit Abstrace Class
Base class for disk units.

uint32_type recalibrate (uint16_type mode) Abstrace Method on disk_unit

uint32_type seek (uint16_type mode, uint32_type pos) Abstract Method on disk_unit

uint32_type read (uint16_type mode, uint32_type pos, memory_map &mm, uint32_type buf, uint32_type nbytes) Abstract Method on disk_unit

uint32_type write (uint16_type mode, uint32_type pos, const memory_map &mm, uint32_type buf, uint32_type nbytes) Abstract Method on disk_unit

uint32_type verify (uint16_type mode, uint32_type pos, const memory_map &mm, uint32_type buf, uint32_type nbytes) Abstract Method on disk_unit

uint32_type check (uint16_type mode, int op) Abstract Method on disk_unit


Node:Floppy Disk, Previous:Disk I/O, Up:Disk I/O

Floppy Disk

floppy_disk_unit Class


Node:Human68k Emulation, Next:, Previous:X68000 Emulation, Up:Top

Human68k Emulation

Virtual X68000 is unique as it also offers functions of the basic operating system, Human68k.


Node:Memory Management, Next:, Previous:Human68k Emulation, Up:Human68k Emulation

Memory Management


Node:Filesystem, Previous:Memory Management, Up:Human68k Emulation

Filesystem


Node:GTK+ User Interface, Next:, Previous:Human68k Emulation, Up:Top

GTK+ User Interface

This chapter describes the GTK+ implementation of user interface components.

All components described in this chapter is declared in namespace vx68k::gtk.

gtk_console Class
Implements a console using the GTK+ user interface toolkit.


Node:Sample Application, Next:, Previous:GTK+ User Interface, Up:Top

Sample Application

This chapter describes the implementation of the sample application vx68k.


Node:Document Type Definitions, Next:, Previous:Sample Application, Up:Top

Document Type Definitions


Node:Disk Set Descriptors, Next:, Previous:Document Type Definitions, Up:Document Type Definitions

Disk Set Descriptors

[Insert DTD here.]


Node:Options Settings, Previous:Disk Set Descriptors, Up:Document Type Definitions

Options Setting

[Insert DTD here.]


Node:Function and Variable Index, Next:, Previous:Document Type Definitions, Up:Top

Function and Variable Index


Node:Data Type Index, Next:, Previous:Function and Variable Index, Up:Top

Data Type Index


Node:Concept Index, Previous:Data Type Index, Up:Top

Concept Index