Subversion Repositories NedoOS

Rev

Rev 2247 | Details | Compare with Previous | Last modification | View Log

Rev Author Line No. Line
2241 lvd 1
// Z80 ciphers test framework
2
// (c) 2019 lvd^mhm
3
 
4
/*
5
    This file is part of Z80 ciphers test framework.
6
 
7
    Z80 ciphers test framework is free software:
8
    you can redistribute it and/or modify it under the terms of
9
    the GNU General Public License as published by
10
    the Free Software Foundation, either version 3 of the License, or
11
    (at your option) any later version.
12
 
13
    Z80 ciphers test framework is distributed in the hope that
14
    it will be useful, but WITHOUT ANY WARRANTY; without even
15
    the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
    See the GNU General Public License for more details.
17
 
18
    You should have received a copy of the GNU General Public License
19
    along with Z80 ciphers test framework.
20
    If not, see <http://www.gnu.org/licenses/>.
21
*/
22
 
23
#ifndef _Z80_WRAP_H_
24
#define _Z80_WRAP_H_
25
 
2254 lvd 26
#define SYS_CPM    (1)
27
#define SYS_NEDOOS (2)
28
#define SYS_ZX     (3)
2241 lvd 29
 
2254 lvd 30
struct type_detect
31
{
32
        const char * const argument_name;
33
        const int sys_type;
34
};
35
 
2241 lvd 36
enum z80_max_clocks
37
{
38
        Z80_MAX_CLOCKS = 10000000
39
};
40
 
41
 
42
struct z80_context
43
{
44
        Z80 z80;
2254 lvd 45
        uint16_t start_address;
46
        uint16_t start_sp;
2241 lvd 47
 
2247 lvd 48
        int was_ed;
2254 lvd 49
        int was_23;
2247 lvd 50
 
2241 lvd 51
        uint8_t z80_mem[65536];
52
};
53
 
54
 
2254 lvd 55
struct z80_context * z80_init(char * filename, int sys_type);
2241 lvd 56
 
2254 lvd 57
size_t z80_exec(struct z80_context * z80, size_t max_clocks);
2241 lvd 58
 
59
 
60
uint8_t  z80_rdbyte(struct z80_context * z80, uint16_t addr);
61
uint16_t z80_rdword_le(struct z80_context * z80, uint16_t addr);
62
uint32_t z80_rdlong_le(struct z80_context * z80, uint16_t addr);
63
uint64_t z80_rdocta_le(struct z80_context * z80, uint16_t addr);
64
 
65
void z80_wrbyte(struct z80_context * z80, uint16_t addr, uint8_t  data);
66
void z80_wrword_le(struct z80_context * z80, uint16_t addr, uint16_t data);
67
void z80_wrlong_le(struct z80_context * z80, uint16_t addr, uint32_t data);
68
void z80_wrocta_le(struct z80_context * z80, uint16_t addr, uint64_t data);
69
 
70
 
71
 
72
 
73
 
74
#endif // _Z80_WRAP_H_
75