[][src]Module z80emu::host

This module contains traits that should be implemented by the builder of the host computer.

To complete the emulation of the Z80-based computer the following trait interfaces need to be implemented:

  • Clock - to determine how the CPU cycles are being counted and when certain events take place.
  • Io - to establish a communication with the I/O devices.
  • Memory - to build a bridge between the CPU and the host's memory.

When the Cpu is executing instructions, it calls Clock's methods to increase the cycle counter, only hinting which cycle the currently executed instruction is at. It is however up to the Clock implementation to actually increase the counter. Some of the Clock's methods return timestamps which in turn are being used when accessing peripherals or memory to mark certain actions on the time axis.

Please see crate::host::cycles module for the description of each emulated cycle.

Modules

cycles

This module defines constants indicating the number of T-states of each of the emulated Cpu cycle, to help Clock implementations count those cycles.

Structs

TsCounter

A simple T-states counter wrapping at 2^bitsize of T. You may refer to it as a template for implementing Clock trait methods.

Enums

BreakCause

An enum representing the execution break cause returned by various methods of the Cpu trait.

Traits

Clock

This trait defines an interface to the system clock from the Cpu emulation perspective.

Io

This trait defines an interface for handling data provided to IN or from OUT instruction families and maskable interrupts.

Memory

This trait defines an interface for accessing the host's memory.

Type Definitions

Result

The type returned from some of the Cpu trait methods.