zemu 0.4.1 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/zemu/instance.rb +14 -0
- data/lib/zemu.rb +9 -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: 0542a6b70d68a1ea2de55fb02802f487ec2ff06f00d824d8113dd8d0b40da40b
|
4
|
+
data.tar.gz: d806954f2a981777e57b2dcd3d8e1ba4946ce62c6ef440d63ceb2993ab1cd82c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45a3ca398596119e345dd6b146c571c7f635f5067b2ea58ecc9a2ebb6808ea3c60db327dbb0027c7d75ee1a73a79f41dc334cc9eea0e4bd7b3d634752c5047af
|
7
|
+
data.tar.gz: b580177e4823c0ecb5b54268c3820f32345560a8199054dc8754f855554ef74d38f15895d337a43fc3b7d6363e5e5ed148d479b6106db9673904765736693611
|
data/lib/zemu/instance.rb
CHANGED
@@ -61,6 +61,10 @@ module Zemu
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def initialize(configuration)
|
64
|
+
# Methods defined by IO devices that we make
|
65
|
+
# accessible to the user.
|
66
|
+
@io_methods = []
|
67
|
+
|
64
68
|
@clock = configuration.clock_speed
|
65
69
|
@serial_delay = configuration.serial_delay
|
66
70
|
|
@@ -274,12 +278,22 @@ module Zemu
|
|
274
278
|
configuration.io.each do |device|
|
275
279
|
device.functions.each do |f|
|
276
280
|
wrapper.attach_function(f["name"].to_sym, f["args"], f["return"])
|
281
|
+
@io_methods << f["name"].to_sym
|
277
282
|
end
|
278
283
|
end
|
279
284
|
|
280
285
|
return wrapper
|
281
286
|
end
|
282
287
|
|
288
|
+
# Redirects calls to I/O FFI functions.
|
289
|
+
def method_missing(method, *args)
|
290
|
+
if @io_methods.include? method
|
291
|
+
return @wrapper.send(method)
|
292
|
+
end
|
293
|
+
|
294
|
+
super
|
295
|
+
end
|
296
|
+
|
283
297
|
private :make_wrapper
|
284
298
|
end
|
285
299
|
end
|
data/lib/zemu.rb
CHANGED
@@ -62,10 +62,12 @@ module Zemu
|
|
62
62
|
SRC = File.join(__dir__, "..", "src")
|
63
63
|
|
64
64
|
# Build and start an emulator according to the given configuration.
|
65
|
+
# Returns the emulator instance.
|
65
66
|
#
|
66
67
|
# @param [Zemu::Config] configuration The configuration for which an emulator will be generated.
|
67
|
-
|
68
|
-
|
68
|
+
# @param user_defines Any user-defined preprocessor macros.
|
69
|
+
def Zemu::start(configuration, user_defines={})
|
70
|
+
build(configuration, user_defines)
|
69
71
|
|
70
72
|
return Instance.new(configuration)
|
71
73
|
end
|
@@ -81,11 +83,11 @@ module Zemu
|
|
81
83
|
end
|
82
84
|
|
83
85
|
# Builds a library according to the given configuration.
|
86
|
+
# Returns true if the build is a success, false (build failed) or nil (compiler not found) otherwise.
|
84
87
|
#
|
85
88
|
# @param [Zemu::Config] configuration The configuration for which an emulator will be generated.
|
86
|
-
#
|
87
|
-
|
88
|
-
def Zemu::build(configuration)
|
89
|
+
# @param user_defines Any user-defined preprocessor macros.
|
90
|
+
def Zemu::build(configuration, user_defines={})
|
89
91
|
# Create the output directory unless it already exists.
|
90
92
|
unless Dir.exist? configuration.output_directory
|
91
93
|
Dir.mkdir configuration.output_directory
|
@@ -116,6 +118,8 @@ module Zemu
|
|
116
118
|
"CPU_Z80_USE_LOCAL_HEADER" => 1
|
117
119
|
}
|
118
120
|
|
121
|
+
defines.merge! user_defines
|
122
|
+
|
119
123
|
defines_str = defines.map { |d, v| "-D#{d}=#{v}" }.join(" ")
|
120
124
|
|
121
125
|
includes = [
|
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.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jay Valentine
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-11-
|
11
|
+
date: 2021-11-19 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
|