zemu 0.4.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/zemu/config.rb +424 -384
- data/lib/zemu/debug.rb +39 -6
- data/lib/zemu/instance.rb +145 -8
- data/lib/zemu/interactive.rb +13 -12
- data/lib/zemu.rb +8 -27
- data/src/bus.c.erb +119 -0
- data/src/bus.h.erb +53 -0
- data/src/debug.c +1 -1
- data/src/debug.h +1 -2
- data/src/main.c +1 -2
- metadata +4 -6
- data/src/io.c.erb +0 -52
- data/src/io.h.erb +0 -25
- data/src/memory.c.erb +0 -59
- data/src/memory.h.erb +0 -11
data/src/io.c.erb
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
#include "io.h"
|
2
|
-
|
3
|
-
<% io.each do |device| %>
|
4
|
-
<%= device.setup %>
|
5
|
-
<% end %>
|
6
|
-
|
7
|
-
void zemu_io_nmi(Z80 * instance)
|
8
|
-
{
|
9
|
-
z80_nmi(instance);
|
10
|
-
}
|
11
|
-
|
12
|
-
void zemu_io_int_on(Z80 * instance)
|
13
|
-
{
|
14
|
-
z80_int(instance, TRUE);
|
15
|
-
}
|
16
|
-
|
17
|
-
void zemu_io_int_off(Z80 * instance)
|
18
|
-
{
|
19
|
-
z80_int(instance, FALSE);
|
20
|
-
}
|
21
|
-
|
22
|
-
zuint8 zemu_io_in(void * context, zuint16 port)
|
23
|
-
{
|
24
|
-
/* Z80 IO ports occupy the lower half of the address bus.
|
25
|
-
* We cannot assume that the top half is valid.
|
26
|
-
*/
|
27
|
-
port &= 0x00FF;
|
28
|
-
|
29
|
-
<% io.each do |device| %>
|
30
|
-
<%= device.read %>
|
31
|
-
<% end %>
|
32
|
-
return 0;
|
33
|
-
}
|
34
|
-
|
35
|
-
void zemu_io_out(void * context, zuint16 port, zuint8 value)
|
36
|
-
{
|
37
|
-
/* Z80 IO ports occupy the lower half of the address bus.
|
38
|
-
* We cannot assume that the top half is valid.
|
39
|
-
*/
|
40
|
-
port &= 0x00FF;
|
41
|
-
|
42
|
-
<% io.each do |device| %>
|
43
|
-
<%= device.write %>
|
44
|
-
<% end %>
|
45
|
-
}
|
46
|
-
|
47
|
-
void zemu_io_clock(Z80 * instance)
|
48
|
-
{
|
49
|
-
<% io.each do |device| %>
|
50
|
-
<%= device.clock %>
|
51
|
-
<% end %>
|
52
|
-
}
|
data/src/io.h.erb
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
#ifndef _ZEMU_IO_H
|
2
|
-
#define _ZEMU_IO_H
|
3
|
-
|
4
|
-
#include "emulation/CPU/Z80.h"
|
5
|
-
|
6
|
-
#ifndef ZEMU_IO_SERIAL_BUFFER_SIZE
|
7
|
-
#define ZEMU_IO_SERIAL_BUFFER_SIZE 256
|
8
|
-
#endif
|
9
|
-
|
10
|
-
typedef struct {
|
11
|
-
zuint8 buffer[ZEMU_IO_SERIAL_BUFFER_SIZE];
|
12
|
-
unsigned int head;
|
13
|
-
unsigned int tail;
|
14
|
-
} SerialBuffer;
|
15
|
-
|
16
|
-
void zemu_io_serial_master_puts(zuint8 val);
|
17
|
-
zuint8 zemu_io_serial_master_gets(void);
|
18
|
-
zusize zemu_io_serial_buffer_size(void);
|
19
|
-
|
20
|
-
zuint8 zemu_io_in(void * context, zuint16 port);
|
21
|
-
void zemu_io_out(void * context, zuint16 port, zuint8 value);
|
22
|
-
void zemu_io_nmi(Z80 * instance);
|
23
|
-
void zemu_io_clock(Z80 * instance);
|
24
|
-
|
25
|
-
#endif
|
data/src/memory.c.erb
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
#include "memory.h"
|
2
|
-
|
3
|
-
<% memory.each do |mem| %>
|
4
|
-
/* Initialization memory block "<%= mem.name %>" */
|
5
|
-
<%= mem.readonly? ? "const " : "" %>zuint8 zemu_memory_block_<%= mem.name %>[0x<%= mem.size.to_s(16) %>] =
|
6
|
-
{<% mem.contents.each_with_index do |b, i| %><%= (i % 16 == 0) ? "\n " : "" %><%= ("0x%02x, " % b) %><% end %>
|
7
|
-
};
|
8
|
-
<% end %>
|
9
|
-
|
10
|
-
zuint8 zemu_memory_read(void * context, zuint16 address)
|
11
|
-
{
|
12
|
-
zuint32 address_32 = address;
|
13
|
-
<% memory.each do |mem| %>
|
14
|
-
if (address_32 >= 0x<%= mem.address.to_s(16) %> && address_32 < 0x<%= (mem.address + mem.size).to_s(16) %>)
|
15
|
-
{
|
16
|
-
return zemu_memory_block_<%= mem.name %>[address_32 - 0x<%= mem.address.to_s(16) %>];
|
17
|
-
}
|
18
|
-
<% end %>
|
19
|
-
/* Unmapped memory has a value of 0. */
|
20
|
-
return 0;
|
21
|
-
}
|
22
|
-
|
23
|
-
void zemu_memory_write(void * context, zuint16 address, zuint8 value)
|
24
|
-
{
|
25
|
-
zuint32 address_32 = address;
|
26
|
-
<% memory.each do |mem| %>
|
27
|
-
<% next if mem.readonly? %>
|
28
|
-
if (address_32 >= 0x<%= mem.address.to_s(16) %> && address_32 < 0x<%= (mem.address + mem.size).to_s(16) %>)
|
29
|
-
{
|
30
|
-
zemu_memory_block_<%= mem.name %>[address_32 - 0x<%= mem.address.to_s(16) %>] = value;
|
31
|
-
}
|
32
|
-
<% end %>
|
33
|
-
}
|
34
|
-
|
35
|
-
zuint8 zemu_memory_peek(zuint16 address)
|
36
|
-
{
|
37
|
-
zuint32 address_32 = address;
|
38
|
-
<% memory.each do |mem| %>
|
39
|
-
if (address_32 >= 0x<%= mem.address.to_s(16) %> && address_32 < 0x<%= (mem.address + mem.size).to_s(16) %>)
|
40
|
-
{
|
41
|
-
return zemu_memory_block_<%= mem.name %>[address_32 - 0x<%= mem.address.to_s(16) %>];
|
42
|
-
}
|
43
|
-
<% end %>
|
44
|
-
/* Unmapped memory has a value of 0. */
|
45
|
-
return 0;
|
46
|
-
}
|
47
|
-
|
48
|
-
void zemu_memory_poke(zuint16 address, zuint8 value)
|
49
|
-
{
|
50
|
-
zuint32 address_32 = address;
|
51
|
-
<% memory.each do |mem| %>
|
52
|
-
<% next if mem.readonly? %>
|
53
|
-
if (address_32 >= 0x<%= mem.address.to_s(16) %> && address_32 < 0x<%= (mem.address + mem.size).to_s(16) %>)
|
54
|
-
{
|
55
|
-
zemu_memory_block_<%= mem.name %>[address_32 - 0x<%= mem.address.to_s(16) %>] = value;
|
56
|
-
return;
|
57
|
-
}
|
58
|
-
<% end %>
|
59
|
-
}
|
data/src/memory.h.erb
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
#include "emulation/CPU/Z80.h"
|
2
|
-
|
3
|
-
#include <stdio.h>
|
4
|
-
|
5
|
-
zuint8 zemu_memory_read(void * context, zuint16 address);
|
6
|
-
|
7
|
-
void zemu_memory_write(void * context, zuint16 address, zuint8 value);
|
8
|
-
|
9
|
-
zuint8 zemu_memory_peek(zuint16 address);
|
10
|
-
|
11
|
-
void zemu_memory_poke(zuint16 address, zuint8 value);
|