-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathz80.h
84 lines (69 loc) · 1.04 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
/**
* @file z80.h
* @brief Z80 specific functions.
* @author Miguel I. Garcia Lopez / FloppySoftware
*
* Functions for the Z80 cpu, for MESCC (Mike's Enhanced
* Small C Compiler for Z80 & CP/M).
*
* Revisions:
* - 13 Dec 2014 : 1st version.
* - 15 Aug 2016 : Documented. GPL v3.
*
* Copyright (c) 2014-2016 Miguel I. Garcia Lopez / FloppySoftware.
*
* Licensed under the GNU General Public License v3.
*
* http://www.floppysoftware.es
* floppysoftware@gmail.com
*/
#ifndef Z80_H
#define Z80_H
/**
* @fn int Z80in(int port)
* @brief Input a byte from a port.
* @return byte value
*/
#asm
Z80in
LD C,L
IN A,(C)
LD H,0
LD L,A
RET
#endasm
/**
* @fn void Z80out(int port, int value))
* @brief Output a byte to a port.
*/
#asm
Z80out
POP DE
POP HL
POP BC
PUSH BC
PUSH HL
PUSH DE
OUT (C),L
RET
#endasm
/**
* @fn void Z80di(void)
* @brief Disable interrupts.
*/
#asm
Z80di
DI
RET
#endasm
/**
* @fn void Z80ei(void)
* @brief Enable interrupts.
*/
#asm
Z80ei
EI
RET
#endasm
#endif