mirror of
https://github.com/TomHarte/CLK.git
synced 2024-07-10 12:29:01 +00:00
67 lines
1.4 KiB
C++
67 lines
1.4 KiB
C++
|
//
|
||
|
// Z80.hpp
|
||
|
// Clock Signal
|
||
|
//
|
||
|
// Created by Thomas Harte on 14/05/2017.
|
||
|
// Copyright © 2017 Thomas Harte. All rights reserved.
|
||
|
//
|
||
|
|
||
|
#ifndef Z80_hpp
|
||
|
#define Z80_hpp
|
||
|
|
||
|
#include <cstdint>
|
||
|
|
||
|
namespace Z80 {
|
||
|
|
||
|
/*
|
||
|
The list of registers that can be accessed via @c set_value_of_register and @c set_value_of_register.
|
||
|
*/
|
||
|
enum Register {
|
||
|
ProgramCounter,
|
||
|
StackPointer,
|
||
|
|
||
|
A, Flags, AF,
|
||
|
B, C, BC,
|
||
|
D, E, DE,
|
||
|
H, L, HL,
|
||
|
|
||
|
ADash, FlagsDash, AFDash,
|
||
|
BDash, CDash, BCDash,
|
||
|
DDash, EDash, DEDash,
|
||
|
HDash, LDash, HLDash,
|
||
|
|
||
|
IXh, IXl, IX,
|
||
|
IYh, IYl, IY,
|
||
|
R, I,
|
||
|
};
|
||
|
|
||
|
/*
|
||
|
Flags as defined on the Z80; can be used to decode the result of @c get_flags or to form a value for @c set_flags.
|
||
|
*/
|
||
|
enum Flag: uint8_t {
|
||
|
Sign = 0x80,
|
||
|
Zero = 0x40,
|
||
|
Bit5 = 0x20,
|
||
|
HalfCarry = 0x10,
|
||
|
Bit3 = 0x08,
|
||
|
Parity = 0x04,
|
||
|
Overflow = 0x04,
|
||
|
Subtract = 0x02,
|
||
|
Carry = 0x01
|
||
|
};
|
||
|
|
||
|
/*!
|
||
|
Subclasses will be given the task of performing bus operations, allowing them to provide whatever interface they like
|
||
|
between a Z80 and the rest of the system. @c BusOperation lists the types of bus operation that may be requested.
|
||
|
|
||
|
@c None is reserved for internal use. It will never be requested from a subclass. It is safe always to use the
|
||
|
isReadOperation macro to make a binary choice between reading and writing.
|
||
|
*/
|
||
|
enum BusOperation {
|
||
|
Read, ReadOpcode, Write, Input, Output, Interrupt, BusRequest, None
|
||
|
};
|
||
|
|
||
|
}
|
||
|
|
||
|
#endif /* Z80_hpp */
|