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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0be58ea6333733b1c2b6467ecc9e0ec1ebebc16cd1e3ba5f6b34454d22941313
4
- data.tar.gz: 373889194e89aec21f878ef44dfe28b5432b9893d311532e83c460904bd1e292
3
+ metadata.gz: 3278a3fa602a14489f1bfe77bee8d51781be503fac50dba4334dd400f492b5ca
4
+ data.tar.gz: 0dc3644e09613e7449bbc2dd3167f4823fca647cd0b5df94b35a0d39768a8b26
5
5
  SHA512:
6
- metadata.gz: ccb11a107eb8aa7f39634ecdfd0d1765583655c1c33c0d87c3ae01f9b6634ffc965e2234b8fe3460b2f8de3b8848a0387488bd401d588a47e69967b87afda864
7
- data.tar.gz: 6d727da2887d8bf9d3e94f376d8659b29f03d3bb32865a2b66f3c61772bbeb300a347994c4341b494ed50649f0fe8cddf51d6c4b991c34b0955313d67907e932
6
+ metadata.gz: bb87eef723a62c64742f06ec85bf7f5c976103c6e5b8678b5efec665b49ea3242efe59238f1ea28808c7ef3e597471ec050cda5f0152f3c74fa900f88df294ea
7
+ data.tar.gz: 29de4f2e78acae5a24a443595e3b683acb3fd3a6d00ec84991c1126e3e7b07ce35078de8721347ec84926ee99fd2bd21912b1ef768fa868c0d1cc75ae966db02
@@ -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
 
@@ -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.
@@ -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
- process_serial
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
@@ -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.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-03-30 00:00:00.000000000 Z
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