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.
--- The Detailed Node Listing ---
Command Reference
M68000 Architecture
Virtual X68000 Coding Conventions
General Purpose Components
Memory and I/O
Processor
Execution Unit
X68000 Emulation
Memory Components
Disk I/O
Human68k Emulation
Document Type Definitions
Virtual X68000 is a virtual machine that emulates a Sharp X68000 system.
Virtual X68000 is written in C++ and uses many templates.
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.
vx68kvx68k executes X68000 programs.
vx68k
[option]...
[-]
command
[argument]...
-M n
--memory-size=n
Before describing internals of Virtual X68000, let's review the M68000 architecture.
Readers who is familiar with this architecture can skip this chapter.
In M68000 architecture, a byte is an octet. A word is two octets. A long word is four octets.
This chapter describes the coding conventions used in the Virtual X68000 programs.
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.
|
General purpose components are provided by the library libvm68k. These components are declared in the namespace vm68k.
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.
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 |
|
| 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 |
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 |
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.
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. |
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. |
An instruction is defined by a function. This function is called instruction handler.
This chapter describes UI-independent part of Virtual X68000.
They are available in library libvx68k.
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. |
| main_memory | Class |
| Memory component for the main memory. |
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 |
| 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.
|
| graphic_video_memory | Class |
X68000 uses a Zilog Z8530 SCC, or serial communication controller, for a COM port and a mouse port.
| 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 |
| floppy_disk_unit | Class |
Virtual X68000 is unique as it also offers functions of the basic operating system, Human68k.
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. |
This chapter describes the implementation of the sample application
vx68k.
[Insert DTD here.]
[Insert DTD here.]
attach on system_rom: IOCS and System ROM
call_iocs on system_rom: IOCS and System ROM
check on disk_unit: Disk I/O
configure on machine: Machine
connect on machine: Machine
data_fc on context: Context
detach on system_rom: IOCS and System ROM
exec_unit on machine: Machine
fill_plane on text_video_memory: Text Video Memory
get_16 on memory: Class memory
get_16 on memory_map: Class memory_map
get_16 on system_rom: IOCS and System ROM
get_16 on text_video_memory: Text Video Memory
get_16_unchecked on memory_map: Class memory_map
get_32 on memory: Class memory
get_32 on memory_map: Class memory_map
get_8 on memory: Class memory
get_8 on memory_map: Class memory_map
get_8 on system_rom: IOCS and System ROM
get_8 on text_video_memory: Text Video Memory
initialize on system_rom: IOCS and System ROM
install_iocs_calls on text_video_memory: Text Video Memory
machine on machine: Machine
master_context on machine: Machine
memory::SUPER_DATA: Class memory
memory::SUPER_PROGRAM: Class memory
memory::USER_DATA: Class memory
memory::USER_PROGRAM: Class memory
memory_size on machine: Machine
program_fc on context: Context
put_16 on memory: Class memory
put_16 on memory_map: Class memory_map
put_16 on system_rom: IOCS and System ROM
put_16 on text_video_memory: Text Video Memory
put_16_unchecked on memory_map: Class memory_map
put_32 on memory: Class memory
put_32 on memory_map: Class memory_map
put_8 on memory: Class memory
put_8 on memory_map: Class memory_map
put_8 on system_rom: IOCS and System ROM
put_8 on text_video_memory: Text Video Memory
read on disk_unit: Disk I/O
recalibrate on disk_unit: Disk I/O
regs of context: Context
run on exec_unit: Execution Unit
seek on disk_unit: Disk I/O
set_instruction on exec_unit: Execution Unit
set_iocs_call on system_rom: IOCS and System ROM
set_supervisor_state on context: Context
step on exec_unit: Execution Unit
SUPER_DATA of memory: Class memory
SUPER_PROGRAM of memory: Class memory
supervisor_state on context: Context
USER_DATA of memory: Class memory
USER_PROGRAM of memory: Class memory
verify on disk_unit: Disk I/O
write on disk_unit: Disk I/O
console: Machine
context: Context
default_memory: Class memory
disk_unit: Disk I/O
exec_unit: Execution Unit
floppy_disk_unit: Floppy Disk
function_code of memory: Class memory
graphic_video_memory: Graphic Video Memory
gtk_console: GTK+ User Interface
machine: Machine
main_memory: Main Memory
memory: Class memory
memory::function_code: Class memory
memory_map: Class memory_map
memory_map::function_code: Class memory_map
sint32_type: Basic Types
sint_type: Basic Types
system_rom: IOCS and System ROM
system_rom::iocs_call_type: IOCS and System ROM
text_video_memory: Text Video Memory
uint32_type: Basic Types
uint_type: Basic Types