zemu 0.3.3 → 0.3.9
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 +3 -2
- data/lib/zemu/instance.rb +6 -0
- data/lib/zemu/interactive.rb +10 -2
- data/src/io.c.erb +15 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3278a3fa602a14489f1bfe77bee8d51781be503fac50dba4334dd400f492b5ca
|
4
|
+
data.tar.gz: 0dc3644e09613e7449bbc2dd3167f4823fca647cd0b5df94b35a0d39768a8b26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb87eef723a62c64742f06ec85bf7f5c976103c6e5b8678b5efec665b49ea3242efe59238f1ea28808c7ef3e597471ec050cda5f0152f3c74fa900f88df294ea
|
7
|
+
data.tar.gz: 29de4f2e78acae5a24a443595e3b683acb3fd3a6d00ec84991c1126e3e7b07ce35078de8721347ec84926ee99fd2bd21912b1ef768fa868c0d1cc75ae966db02
|
data/lib/zemu/config.rb
CHANGED
@@ -490,7 +490,7 @@ module Zemu
|
|
490
490
|
|
491
491
|
# Parameters accessible by this configuration object.
|
492
492
|
def params
|
493
|
-
return %w(name compiler output_directory clock_speed)
|
493
|
+
return %w(name compiler output_directory clock_speed serial_delay)
|
494
494
|
end
|
495
495
|
|
496
496
|
# Initial value for parameters of this configuration object.
|
@@ -498,7 +498,8 @@ module Zemu
|
|
498
498
|
return {
|
499
499
|
"compiler" => "clang",
|
500
500
|
"output_directory" => "bin",
|
501
|
-
"clock_speed" => 0
|
501
|
+
"clock_speed" => 0,
|
502
|
+
"serial_delay" => 0
|
502
503
|
}
|
503
504
|
end
|
504
505
|
|
data/lib/zemu/instance.rb
CHANGED
@@ -54,6 +54,7 @@ module Zemu
|
|
54
54
|
|
55
55
|
def initialize(configuration)
|
56
56
|
@clock = configuration.clock_speed
|
57
|
+
@serial_delay = configuration.serial_delay
|
57
58
|
|
58
59
|
@wrapper = make_wrapper(configuration)
|
59
60
|
|
@@ -73,6 +74,11 @@ module Zemu
|
|
73
74
|
return @clock
|
74
75
|
end
|
75
76
|
|
77
|
+
# Returns the delay between characters on the serial port for this instance in seconds.
|
78
|
+
def serial_delay
|
79
|
+
return @serial_delay
|
80
|
+
end
|
81
|
+
|
76
82
|
# Returns a hash containing current values of the emulated
|
77
83
|
# machine's registers. All names are as those given in the Z80
|
78
84
|
# reference manual.
|
data/lib/zemu/interactive.rb
CHANGED
@@ -114,13 +114,19 @@ module Zemu
|
|
114
114
|
cycles_left = cycles
|
115
115
|
actual_cycles = 0
|
116
116
|
|
117
|
+
serial_count = @instance.serial_delay
|
118
|
+
|
117
119
|
while ((cycles == -1) || (cycles_left > 0))
|
118
120
|
# Get time before execution.
|
119
121
|
start = Time.now
|
120
122
|
|
121
123
|
old_pc = r16("PC")
|
122
124
|
|
123
|
-
|
125
|
+
if (serial_count >= @instance.serial_delay)
|
126
|
+
process_serial
|
127
|
+
serial_count = 0
|
128
|
+
end
|
129
|
+
|
124
130
|
cycles_done = @instance.continue(1)
|
125
131
|
cycles_left -= cycles_done
|
126
132
|
actual_cycles += cycles_done
|
@@ -132,7 +138,9 @@ module Zemu
|
|
132
138
|
if @instance.clock_speed > 0
|
133
139
|
elapsed = ending - start
|
134
140
|
|
135
|
-
execution_time = cycles_done * (1/@instance.clock_speed)
|
141
|
+
execution_time = cycles_done * (1.0/@instance.clock_speed)
|
142
|
+
serial_count += execution_time
|
143
|
+
|
136
144
|
padding = execution_time - elapsed
|
137
145
|
sleep(padding) unless padding < 0
|
138
146
|
end
|
data/src/io.c.erb
CHANGED
@@ -4,6 +4,21 @@
|
|
4
4
|
<%= device.setup %>
|
5
5
|
<% end %>
|
6
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
|
+
|
7
22
|
zuint8 zemu_io_in(void * context, zuint16 port)
|
8
23
|
{
|
9
24
|
/* Z80 IO ports occupy the lower half of the address bus.
|
@@ -29,11 +44,6 @@ void zemu_io_out(void * context, zuint16 port, zuint8 value)
|
|
29
44
|
<% end %>
|
30
45
|
}
|
31
46
|
|
32
|
-
void zemu_io_nmi(Z80 * instance)
|
33
|
-
{
|
34
|
-
z80_nmi(instance);
|
35
|
-
}
|
36
|
-
|
37
47
|
void zemu_io_clock(Z80 * instance)
|
38
48
|
{
|
39
49
|
<% io.each do |device| %>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zemu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jay Valentine
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |2
|
14
14
|
Zemu is a gem which allows the user to configure a Z80-based system
|