-
Notifications
You must be signed in to change notification settings - Fork 1
/
z80.h
123 lines (96 loc) · 3.79 KB
/
z80.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/**
* @file
* @author Miguel Vanhove / Kyuran <[email protected]>
* @author Ludovic Delplanque <[email protected]> for the original version pc-cpc v0.1z (30/03/2004)
* @version 2.0
*
* @section LICENSE
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details at
* https://www.gnu.org/copyleft/gpl.html
*
* @section DESCRIPTION
*
* Z80 emulation
*/
#include "crocods.h"
#ifndef Z80_H
#define Z80_H
#define BIT0 0x01
#define BIT1 0x02
#define BIT2 0x04
#define BIT3 0x08
#define BIT4 0x10
#define BIT5 0x20
#define BIT6 0x40
#define BIT7 0x80
// Flags Z80
#define FLAG_0 0x00
#define FLAG_C 0x01
#define FLAG_N 0x02
#define FLAG_V 0x04
#define FLAG_H 0x10
#define FLAG_Z 0x40
#define FLAG_S 0x80
/********************************************************* !NAME! **************
* Nom : Registre
********************************************************** !PATHS! *************
* !./V1!\!./V2!\!./V3!\!./V4!\Structures
********************************************************** !1! *****************
*
* Fichier : !./FPTH\/FLE!, ligne : !./LN!
*
* Description : Structure d'un registre Z80
*
********************************************************** !0! ****************/
#include "plateform.h"
//struct SRegs_s;
//typedef struct SRegs;
typedef int ( * pfct )( core_crocods_t *core );
//void ReadZ80(SRegs *z0);
//void WriteZ80(SRegs *z0);
#define RegAF core->Z80.AF.Word
#define RegBC core->Z80.BC.Word
#define RegDE core->Z80.DE.Word
#define RegHL core->Z80.HL.Word
#define Reg_AF core->Z80._AF.Word
#define Reg_BC core->Z80._BC.Word
#define Reg_DE core->Z80._DE.Word
#define Reg_HL core->Z80._HL.Word
#define RegSP core->Z80.SP.Word
#define RegPC core->Z80.PC.Word
#define RegIX core->Z80.IX.Word
#define RegIY core->Z80.IY.Word
#define RegIR core->Z80.IR.Word
#define RegA core->Z80.AF.Byte.High
#define FLAGS core->Z80.AF.Byte.Low
#define RegB core->Z80.BC.Byte.High
#define RegC core->Z80.BC.Byte.Low
#define RegD core->Z80.DE.Byte.High
#define RegE core->Z80.DE.Byte.Low
#define RegH core->Z80.HL.Byte.High
#define RegL core->Z80.HL.Byte.Low
#define RegI core->Z80.IR.Byte.High
#define RegR core->Z80.IR.Byte.Low
#define RegIXH core->Z80.IX.Byte.High
#define RegIXL core->Z80.IX.Byte.Low
#define RegIYH core->Z80.IY.Byte.High
#define RegIYL core->Z80.IY.Byte.Low
UBYTE Peek8Ext( core_crocods_t *core, USHORT adr );
void Poke8Ext( core_crocods_t *core, USHORT adr, UBYTE val );
int Z80_NMI( core_crocods_t *core );
int ___C9( core_crocods_t *core );
int ExecInstZ80_debug(core_crocods_t *core);
int ExecInstZ80_orig(core_crocods_t *core);
void ResetZ80_orig(core_crocods_t *core);
void SetIRQZ80_orig(core_crocods_t *core, int i);
void ExecZ80Code(core_crocods_t *core, char *code, int len, SRegs *result);
#endif