Xemu [doxygen]
hyppo 0a42be3a057156924bc1b626a687bd6e27349c45 @ Sat 19 Mar 02:15:11 CET 2022
targets
ep128
zxemu.c
Go to the documentation of this file.
1
/* Minimalistic Enterprise-128 emulator with focus on "exotic" hardware
2
Part of the Xemu project, please visit: https://github.com/lgblgblgb/xemu
3
Copyright (C)2015-2016,2020 LGB (Gábor Lénárt) <lgblgblgb@gmail.com>
4
5
This program is free software; you can redistribute it and/or modify
6
it under the terms of the GNU General Public License as published by
7
the Free Software Foundation; either version 2 of the License, or
8
(at your option) any later version.
9
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
GNU General Public License for more details.
14
15
You should have received a copy of the GNU General Public License
16
along with this program; if not, write to the Free Software
17
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
18
19
#include "
xemu/emutools.h
"
20
#include "
enterprise128.h
"
21
#include "
zxemu.h
"
22
#include "
cpu.h
"
23
#include "
primoemu.h
"
24
25
26
27
int
zxemu_on
= 0;
28
29
30
31
32
void
zxemu_switch
(
Uint8
data
)
33
{
34
data
&= 128;
35
if
(
data
==
zxemu_on
)
36
return
;
37
zxemu_on
=
data
;
38
DEBUG
(
"ZXEMU: emulation is turned %s."
NL
,
zxemu_on
?
"ON"
:
"OFF"
);
39
if
(
zxemu_on
)
40
primo_switch
(0);
41
nmi_pending
= 0;
42
}
43
44
45
static
int
zxemu_nmi (
void
)
46
{
47
nmi_pending
=
zxemu_on
;
48
return
nmi_pending
;
49
}
50
51
52
void
zxemu_write_ula
(
Uint8
hiaddr,
Uint8
data
)
53
{
54
ports[0x40] = hiaddr;
// high I/O address
55
ports[0x41] = 0xFE;
// low I/O address, the ULA port
56
ports[0x42] =
data
;
// data on the bus
57
ports[0x43] = 0;
// ?? 0 = I/O kind of op
58
if
(!zxemu_nmi())
59
DEBUG
(
"ZXEMU: ULA write: no NMI (switched off)"
NL
);
60
DEBUG
(
"ZXEMU: writing ULA at %04Xh (data: %02Xh)"
NL
,
Z80_PC
,
data
);
61
}
62
63
64
Uint8
zxemu_read_ula
(
Uint8
hiaddr )
65
{
66
ports[0x40] = hiaddr;
67
ports[0x41] = 0xFE;
68
ports[0x42] = 0xFF;
// ???????
69
ports[0x43] = 0;
70
if
(!zxemu_nmi())
71
DEBUG
(
"ZXEMU: ULA read: no NMI (switched off)"
NL
);
72
DEBUG
(
"ZXEMU: reading ULA at %04Xh"
NL
,
Z80_PC
);
73
return
zxemu_on
? 0xBF : 0xFF;
74
}
75
76
77
/* This function is only allowed to be called, if zxemu_on is non-zero, and attribute area is written! */
78
void
zxemu_attribute_memory_write
(
Uint16
address,
Uint8
data
)
79
{
80
ports[0x40] = address >> 8;
81
ports[0x41] = address & 0xFF;
82
ports[0x42] =
data
;
83
ports[0x43] = 0x80;
84
zxemu_nmi();
85
DEBUG
(
"ZXEMU: attrib-mem trap at %04Xh"
NL
, address);
86
}
zxemu.h
zxemu_write_ula
void zxemu_write_ula(Uint8 hiaddr, Uint8 data)
Definition:
zxemu.c:52
primoemu.h
zxemu_attribute_memory_write
void zxemu_attribute_memory_write(Uint16 address, Uint8 data)
Definition:
zxemu.c:78
emutools.h
zxemu_read_ula
Uint8 zxemu_read_ula(Uint8 hiaddr)
Definition:
zxemu.c:64
zxemu_on
int zxemu_on
Definition:
zxemu.c:27
m65-memcontent-generator.data
data
Definition:
m65-memcontent-generator.py:119
Uint8
uint8_t Uint8
Definition:
fat32.c:51
cpu.h
NL
#define NL
Definition:
fat32.c:37
Z80_PC
#define Z80_PC
Definition:
z80ex.h:121
primo_switch
void primo_switch(Uint8 data)
Definition:
primoemu.c:110
zxemu_switch
void zxemu_switch(Uint8 data)
Definition:
zxemu.c:32
Uint16
uint16_t Uint16
Definition:
fat32.c:50
enterprise128.h
DEBUG
#define DEBUG(...)
Definition:
emutools_basicdefs.h:167
nmi_pending
int nmi_pending
Definition:
cpu.c:47
Generated by
1.8.17