-
Notifications
You must be signed in to change notification settings - Fork 6
/
Z80IO.h
79 lines (68 loc) · 4.32 KB
/
Z80IO.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
/****************************************************************************/
/*** ***/
/*** Z80IO.h ***/
/*** ***/
/*** This file contains the prototypes for the functions accessing memory ***/
/*** and I/O ***/
/*** ***/
/*** Original code is Copyright (C) Marcel de Kogel 1996,1997 ***/
/*** You are not allowed to distribute this software commercially ***/
/*** Please, notify me, if you make any changes to this file ***/
/*** ***/
/*** Modifications to the original code are ***/
/*** Copyright (C) 2014 David Ryan (pcryan) ***/
/****************************************************************************/
#ifndef Z80IO_H_
#define Z80IO_H_
#include "Z80em.h"
#include "Z80.h"
/****************************************************************************/
/* Input a byte from given I/O port */
/****************************************************************************/
byte Z80_In(byte Port);
/****************************************************************************/
/* Output a byte to given I/O port */
/****************************************************************************/
void Z80_Out(byte Port, byte Value);
/****************************************************************************/
/* Read a byte from given memory location */
/****************************************************************************/
unsigned Z80_RDMEM(dword A);
/****************************************************************************/
/* Write a byte to given memory location */
/****************************************************************************/
void Z80_WRMEM(dword A, byte V);
/****************************************************************************/
/* Just to show you can actually use macros as well */
/****************************************************************************/
/*
extern byte *ReadPage[256];
extern byte *WritePage[256];
#define Z80_RDMEM(a) ReadPage[(a)>>8][(a)&0xFF]
#define Z80_WRMEM(a,v) WritePage[(a)>>8][(a)&0xFF]=v
*/
/****************************************************************************/
/* Z80_RDOP() is identical to Z80_RDMEM() except it is used for reading */
/* opcodes. In case of system with memory mapped I/O, this function can be */
/* used to greatly speed up emulation */
/****************************************************************************/
#define Z80_RDOP(A) Z80_RDMEM(A)
/****************************************************************************/
/* Z80_RDOP_ARG() is identical to Z80_RDOP() except it is used for reading */
/* opcode arguments. This difference can be used to support systems that */
/* use different encoding mechanisms for opcodes and opcode arguments */
/****************************************************************************/
#define Z80_RDOP_ARG(A) Z80_RDOP(A)
/****************************************************************************/
/* Z80_RDSTACK() is identical to Z80_RDMEM() except it is used for reading */
/* stack variables. In case of system with memory mapped I/O, this function */
/* can be used to slightly speed up emulation */
/****************************************************************************/
#define Z80_RDSTACK(A) Z80_RDMEM(A)
/****************************************************************************/
/* Z80_WRSTACK() is identical to Z80_WRMEM() except it is used for writing */
/* stack variables. In case of system with memory mapped I/O, this function */
/* can be used to slightly speed up emulation */
/****************************************************************************/
#define Z80_WRSTACK(A, V) Z80_WRMEM(A, V)
#endif // Z80IO_H_