z80 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build-and-test-extension.yml +57 -0
- data/.github/workflows/publish-gem.yml +40 -0
- data/.gitignore +3 -1
- data/CHANGELOG.md +18 -0
- data/CITATION.cff +24 -0
- data/Gemfile +2 -0
- data/README.md +86 -38
- data/Rakefile +7 -0
- data/ext/z80/extconf.rb +34 -80
- data/ext/z80/z80.c +90 -90
- data/lib/z80/version.rb +1 -1
- data/lib/z80.rb +1 -1
- data/z80.gemspec +49 -0
- metadata +36 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4105cc740b5ab5ec51d21e3a26e9a05966c44ce7e6557c7fc3f37efa831a5ac9
|
4
|
+
data.tar.gz: 3647f4f6f121f54963b7f09794a0a5aef3fa94204cbbd96cc904ee64eecdbb65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1e1a6097cc49a5efe595675e4b63fb8027e9e6cc9ba152fd1c1aa1b7ba7519562f079dc68d86e00d5119fc22d1db6895639e71f4fdf28a237d0bc9682f8ba4c
|
7
|
+
data.tar.gz: c3da2a05c7860e59e82827f0b2cf0a3ce70cbae64e6de4d8d3fc2f55850797fca015d24a357714b60fd14c11177336cafede3da347ed445aedff86162974e311
|
@@ -0,0 +1,57 @@
|
|
1
|
+
name: Build and test extension
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
paths:
|
6
|
+
- '.github/workflows/build-and-test-extension.yml'
|
7
|
+
- 'ext/**'
|
8
|
+
- 'lib/**'
|
9
|
+
- 'z80.gemspec'
|
10
|
+
pull_request:
|
11
|
+
paths:
|
12
|
+
- '.github/workflows/build-and-test-extension.yml'
|
13
|
+
- 'ext/**'
|
14
|
+
- 'lib/**'
|
15
|
+
- 'z80.gemspec'
|
16
|
+
|
17
|
+
jobs:
|
18
|
+
build-and-test-extension:
|
19
|
+
runs-on: ${{matrix.os}}
|
20
|
+
|
21
|
+
strategy:
|
22
|
+
matrix:
|
23
|
+
os: [macos-latest, ubuntu-latest]
|
24
|
+
ruby-version: ['3.2', '3.1', '3.0', '2.7']
|
25
|
+
|
26
|
+
steps:
|
27
|
+
- uses: actions/checkout@v3
|
28
|
+
|
29
|
+
- name: Set up Ruby
|
30
|
+
uses: ruby/setup-ruby@v1
|
31
|
+
with:
|
32
|
+
ruby-version: ${{matrix.ruby-version}}
|
33
|
+
|
34
|
+
- name: Install dependencies (macOS)
|
35
|
+
if: startsWith(matrix.os, 'macos')
|
36
|
+
run: brew install redcode/zxe/z80
|
37
|
+
|
38
|
+
- name: Install dependencies (Ubuntu)
|
39
|
+
if: startsWith(matrix.os, 'ubuntu')
|
40
|
+
run: |
|
41
|
+
sudo mkdir -pm700 /root/.gnupg
|
42
|
+
sudo mkdir -pm755 /etc/apt/keyrings
|
43
|
+
sudo gpg --no-default-keyring --keyring /etc/apt/keyrings/zxe-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys FE214A38D6A0C01D9AF514EE841EA3BD3A7E1487
|
44
|
+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/zxe-archive-keyring.gpg] https://zxe.io/repos/apt stable main" | sudo tee /etc/apt/sources.list.d/zxe.list
|
45
|
+
sudo apt-get update
|
46
|
+
sudo apt-get -y install libz80-dev
|
47
|
+
|
48
|
+
- name: Build gem
|
49
|
+
run: gem build z80.gemspec
|
50
|
+
|
51
|
+
- name: Install gem (macOS)
|
52
|
+
if: startsWith(matrix.os, 'macos')
|
53
|
+
run: gem install z80*.gem -- --with-Z80-dir=$(brew --prefix)
|
54
|
+
|
55
|
+
- name: Install gem (Ubuntu)
|
56
|
+
if: startsWith(matrix.os, 'ubuntu')
|
57
|
+
run: gem install z80*.gem
|
@@ -0,0 +1,40 @@
|
|
1
|
+
name: Publish gem
|
2
|
+
|
3
|
+
on:
|
4
|
+
release:
|
5
|
+
types: [published]
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
publish-gem:
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
|
11
|
+
steps:
|
12
|
+
- uses: actions/checkout@v3
|
13
|
+
|
14
|
+
- name: Set up Ruby
|
15
|
+
uses: ruby/setup-ruby@v1
|
16
|
+
with:
|
17
|
+
ruby-version: "${{vars.PUBLISH_GEM_RUBY_VERSION}}"
|
18
|
+
|
19
|
+
- name: Publish to GPR
|
20
|
+
env:
|
21
|
+
GEM_HOST_API_KEY: "Bearer ${{secrets.GPR_PAT}}"
|
22
|
+
OWNER: ${{github.repository_owner}}
|
23
|
+
run: |
|
24
|
+
mkdir -p $HOME/.gem
|
25
|
+
touch $HOME/.gem/credentials
|
26
|
+
chmod 0600 $HOME/.gem/credentials
|
27
|
+
printf -- "---\n:github: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
28
|
+
gem build *.gemspec
|
29
|
+
gem push --key github --host https://rubygems.pkg.github.com/${OWNER} *.gem
|
30
|
+
|
31
|
+
- name: Publish to RubyGems
|
32
|
+
env:
|
33
|
+
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_API_KEY}}"
|
34
|
+
run: |
|
35
|
+
mkdir -p $HOME/.gem
|
36
|
+
touch $HOME/.gem/credentials
|
37
|
+
chmod 0600 $HOME/.gem/credentials
|
38
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
39
|
+
gem build *.gemspec
|
40
|
+
gem push *.gem
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,23 @@
|
|
1
1
|
# Z80-Ruby ChangeLog
|
2
2
|
|
3
|
+
## 0.2.0 / 2024-01-02
|
4
|
+
|
5
|
+
### Enhancements
|
6
|
+
|
7
|
+
* Added [`Z80::MINIMUM_CYCLES_PER_STEP`](https://zxe.io/software/Z80/documentation/latest/APIReference.html#c.Z80_MINIMUM_CYCLES_PER_STEP).
|
8
|
+
* Minor code improvements.
|
9
|
+
|
10
|
+
### Bugfixes
|
11
|
+
|
12
|
+
* Changed the order in which the files are required so that the extension is loaded before `'z80/version'`.
|
13
|
+
* Fixed typos in the names of `#xyl`, `#xyl=`, `#wzh`, `#wzh=`, `#wzl` and `#wzl=`.
|
14
|
+
|
15
|
+
### Project
|
16
|
+
|
17
|
+
* Added CI.
|
18
|
+
* Added `Gemfile`, `CITATION.cff`.
|
19
|
+
* Added [rake-compiler](https://rubygems.org/gems/rake-compiler) as a development dependency.
|
20
|
+
|
3
21
|
## 0.1.0 / 2023-12-24
|
4
22
|
|
5
23
|
Initial public release.
|
data/CITATION.cff
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
abstract: Ruby interface for the Z80 library.
|
2
|
+
authors:
|
3
|
+
- family-names: "Sainz de Baranda y Goñi"
|
4
|
+
given-names: Manuel
|
5
|
+
orcid: https://orcid.org/0000-0001-6326-3519
|
6
|
+
email: manuel@zxe.io
|
7
|
+
website: https://zxe.io
|
8
|
+
cff-version: 1.2.0
|
9
|
+
date-released: 2023-01-02
|
10
|
+
keywords:
|
11
|
+
- binding
|
12
|
+
- CPU
|
13
|
+
- emulator
|
14
|
+
- LLE
|
15
|
+
- Ruby
|
16
|
+
- Z80
|
17
|
+
- Zilog
|
18
|
+
license: MIT
|
19
|
+
message: If you use this software, please cite it using these metadata.
|
20
|
+
repository-code: https://github.com/redcode/Z80-Ruby
|
21
|
+
title: Z80-Ruby
|
22
|
+
type: software
|
23
|
+
version: 0.2.0
|
24
|
+
url: https://zxe.io/software/Z80-Ruby
|
data/Gemfile
ADDED
data/README.md
CHANGED
@@ -1,33 +1,57 @@
|
|
1
|
-
# Z80-Ruby
|
1
|
+
# Z80-Ruby <img src="https://zxe.io/software/Z80-Ruby/assets/images/Z80-Ruby.svg" width="128" align="right">
|
2
|
+
|
3
|
+
[![](https://zxe.io/software/Z80-Ruby/assets/images/gem-badge)](https://zxe.io/software/Z80-Ruby/gem)
|
4
|
+
[![](https://github.com/redcode/Z80-Ruby/actions/workflows/build-and-test-extension.yml/badge.svg)](https://github.com/redcode/Z80-Ruby/actions/workflows/build-and-test-extension.yml)
|
5
|
+
[![](https://zxe.io/software/Z80/assets/images/chat-badge)](https://zxe.io/software/Z80/chat)
|
2
6
|
|
3
7
|
Ruby binding for the [Z80](https://github.com/redcode/Z80) library.
|
4
8
|
|
5
9
|
## Installation
|
6
10
|
|
7
|
-
First make sure that you have the Z80 library [installed](https://github.com/redcode/Z80#installation) on your system.
|
11
|
+
First, make sure that you have the Z80 library [installed](https://github.com/redcode/Z80#installation) on your system.
|
8
12
|
|
9
|
-
Then add `z80` to the `Gemfile` of your project and run `bundle`:
|
13
|
+
Then add the `z80` gem to the `Gemfile` of your project and run `bundle`:
|
10
14
|
|
11
15
|
```ruby
|
12
16
|
gem 'z80'
|
13
17
|
```
|
14
18
|
|
15
|
-
Or install the gem directly
|
19
|
+
Or install the gem directly:
|
16
20
|
|
17
21
|
```shell
|
18
22
|
gem install z80
|
19
23
|
```
|
20
24
|
|
25
|
+
### Troubleshooting
|
26
|
+
|
27
|
+
#### "I installed the Z80 library through Homebrew, but `bundle` does not find it."
|
28
|
+
|
29
|
+
Configure the environment variables [`C_INCLUDE_PATH`](https://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html#index-C_005fINCLUDE_005fPATH) and [`LIBRARY_PATH`](https://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html#index-LIBRARY_005fPATH) by adding the installation prefix of the library:
|
30
|
+
|
31
|
+
```shell
|
32
|
+
export C_INCLUDE_PATH="$C_INCLUDE_PATH:$(brew --prefix)/include"
|
33
|
+
export LIBRARY_PATH="$LIBRARY_PATH:$(brew --prefix)/lib"
|
34
|
+
```
|
35
|
+
|
36
|
+
#### "I installed the Z80 library through Homebrew, but `gem` does not find it."
|
37
|
+
|
38
|
+
Tell `gem` the installation prefix of the library:
|
39
|
+
|
40
|
+
```shell
|
41
|
+
gem install z80 -- --with-Z80-dir=$(brew --prefix)
|
42
|
+
```
|
43
|
+
|
21
44
|
## Examples
|
22
45
|
|
23
|
-
|
46
|
+
### Z80 Instruction Set Exerciser
|
47
|
+
|
48
|
+
This small script demonstrates how to run the [CP/M versions of `zexall` and `zexdoc`](https://github.com/redcode/Z80/wiki/Z80-Instruction-Set-Exerciser) with a few lines of code:
|
24
49
|
|
25
50
|
```ruby
|
26
51
|
require 'z80'
|
27
52
|
|
28
|
-
quit
|
29
|
-
|
30
|
-
cpu = Z80.new
|
53
|
+
memory = quit = nil
|
54
|
+
cpu = Z80.new
|
31
55
|
|
32
56
|
cpu.fetch_opcode = cpu.fetch = cpu.read do |context, address|
|
33
57
|
memory[address]
|
@@ -55,16 +79,30 @@ cpu.hook do |context, address|
|
|
55
79
|
end
|
56
80
|
end
|
57
81
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
82
|
+
ARGV.each do |file_path|
|
83
|
+
program = file_path == '-' ? $stdin.read : File.read(file_path)
|
84
|
+
puts "#{file_path}:"
|
85
|
+
quit = false
|
86
|
+
memory = Array.new(65536, 0)
|
87
|
+
memory[0x0100, program.size] = program.bytes
|
88
|
+
memory[0] = memory[5] = Z80::HOOK
|
89
|
+
cpu.power true
|
90
|
+
cpu.pc = 0x0100
|
91
|
+
cpu.run(Z80::MAXIMUM_CYCLES) until quit
|
92
|
+
puts
|
93
|
+
break if file_path == '-'
|
94
|
+
end
|
95
|
+
```
|
96
|
+
|
97
|
+
<sup>**[<sub><img src="https://zxe.io/software/Z80-Ruby/assets/images/rb.svg" height="14"></sub> run-yaze-zex.rb](https://zxe.io/software/Z80-Ruby/scripts/run-yaze-zex.rb)**</sup>
|
98
|
+
|
99
|
+
Want to try it? Use this:
|
100
|
+
|
101
|
+
```shell
|
102
|
+
curl ftp://ftp.ping.de/pub/misc/emulators/yaze-1.14.tar.gz | tar -xOzf- yaze-1.14/test/zexall.com | ruby -e'eval `curl https://zxe.io/software/Z80-Ruby/scripts/run-yaze-zex.rb`' -
|
65
103
|
```
|
66
104
|
|
67
|
-
|
105
|
+
### Zilog Z80 CPU Test Suite
|
68
106
|
|
69
107
|
This runs any tape from Patrik Rak's [Zilog Z80 CPU Test Suite](https://github.com/raxoft/z80test) (except `z80ccfscr.tap`):
|
70
108
|
|
@@ -77,11 +115,8 @@ module Opcode
|
|
77
115
|
CALL = 0xCD
|
78
116
|
end
|
79
117
|
|
80
|
-
quit
|
81
|
-
|
82
|
-
cursor_x = 0
|
83
|
-
memory = Array.new(65536, 0)
|
84
|
-
cpu = Z80.new
|
118
|
+
quit = cursor_x = tab = memory = nil
|
119
|
+
cpu = Z80.new
|
85
120
|
|
86
121
|
cpu.fetch_opcode = cpu.fetch = cpu.read do |context, address|
|
87
122
|
memory[address]
|
@@ -135,29 +170,42 @@ cpu.hook do |context, address|
|
|
135
170
|
end
|
136
171
|
end
|
137
172
|
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
memory
|
144
|
-
memory[
|
145
|
-
memory[
|
146
|
-
memory[
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
173
|
+
ARGV.each do |file_path|
|
174
|
+
program = file_path == '-' ? $stdin.read : File.read(file_path)
|
175
|
+
puts "#{file_path}:"
|
176
|
+
quit = false
|
177
|
+
cursor_x = tab = 0
|
178
|
+
memory = Array.new(65536, 0)
|
179
|
+
memory[0x8000, program.size - 91] = program.bytes[91..-1]
|
180
|
+
memory[0x0010] = Z80::HOOK # THE 'PRINT A CHARACTER' RESTART
|
181
|
+
memory[0x0D6B] = Opcode::RET # THE 'CLS' COMMAND ROUTINE
|
182
|
+
memory[0x1601] = Opcode::RET # THE 'CHAN_OPEN' SUBROUTINE
|
183
|
+
memory[0x7000] = Opcode::CALL # -.
|
184
|
+
memory[0x7001] = 0x00 # |- call 8000h
|
185
|
+
memory[0x7002] = 0x80 # -'
|
186
|
+
memory[0x7003] = Z80::HOOK
|
187
|
+
cpu.power true
|
188
|
+
cpu.im = 1
|
189
|
+
cpu.i = 0x3F
|
190
|
+
cpu.pc = 0x7000
|
191
|
+
cpu.run(Z80::MAXIMUM_CYCLES) until quit
|
192
|
+
break if file_path == '-'
|
193
|
+
end
|
152
194
|
```
|
153
195
|
|
154
|
-
<sup>**[<sub><img src="https://zxe.io/software/Z80/assets/images/
|
196
|
+
<sup>**[<sub><img src="https://zxe.io/software/Z80-Ruby/assets/images/rb.svg" height="14"></sub> run-raxoft-z80test.rb](https://zxe.io/software/Z80-Ruby/scripts/run-raxoft-z80test.rb)**</sup>
|
197
|
+
|
198
|
+
Want to try it? Use this:
|
199
|
+
|
200
|
+
```shell
|
201
|
+
curl http://zxds.raxoft.cz/taps/misc/z80test-1.2a.zip | bsdtar -xOf- z80test-1.2a/z80full.tap | ruby -e'eval `curl https://zxe.io/software/Z80-Ruby/scripts/run-raxoft-z80test.rb`' -
|
202
|
+
```
|
155
203
|
|
156
204
|
## License
|
157
205
|
|
158
|
-
<img src="https://zxe.io/software/Z80/assets/images/0bsd.svg" width="160" align="right">
|
206
|
+
<img src="https://zxe.io/software/Z80-Ruby/assets/images/0bsd.svg" width="160" align="right">
|
159
207
|
|
160
|
-
Copyright © 2023 Manuel Sainz de Baranda y Goñi.
|
208
|
+
Copyright © 2023-2024 Manuel Sainz de Baranda y Goñi.
|
161
209
|
|
162
210
|
Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.
|
163
211
|
|
data/Rakefile
CHANGED
data/ext/z80/extconf.rb
CHANGED
@@ -4,94 +4,48 @@ dir_config 'Z80'
|
|
4
4
|
abort "missing header Z80.h" unless have_header 'Z80.h'
|
5
5
|
abort "missing library Z80" unless have_library 'Z80'
|
6
6
|
|
7
|
-
%w(
|
8
|
-
|
9
|
-
z80_instant_reset
|
10
|
-
z80_int
|
11
|
-
z80_nmi
|
12
|
-
z80_execute
|
13
|
-
z80_run
|
14
|
-
).each do |function|
|
15
|
-
abort "missing #{function}()" unless have_func function
|
7
|
+
%w(power instant_reset int nmi execute run).each do |function|
|
8
|
+
abort "missing z80_#{function}()" unless have_func "z80_#{function}"
|
16
9
|
end
|
17
10
|
|
18
11
|
have_func 'z80_special_reset'
|
19
12
|
|
20
|
-
%w(
|
21
|
-
|
22
|
-
z80_r
|
23
|
-
z80_refresh_address
|
24
|
-
z80_in_cycle
|
25
|
-
z80_out_cycle
|
26
|
-
).each do |function|
|
27
|
-
abort "missing #{function}()" unless have_func(function, 'Z80.h')
|
13
|
+
%w(break r refresh_address in_cycle out_cycle).each do |function|
|
14
|
+
abort "missing z80_#{function}()" unless have_func("z80_#{function}", 'Z80.h')
|
28
15
|
end
|
29
16
|
|
30
17
|
%w(
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
Z80_HL
|
61
|
-
Z80_AF_
|
62
|
-
Z80_BC_
|
63
|
-
Z80_DE_
|
64
|
-
Z80_HL_
|
65
|
-
Z80_MEMPTRH
|
66
|
-
Z80_MEMPTRL
|
67
|
-
Z80_PCH
|
68
|
-
Z80_PCL
|
69
|
-
Z80_SPH
|
70
|
-
Z80_SPL
|
71
|
-
Z80_XYH
|
72
|
-
Z80_XYL
|
73
|
-
Z80_IXH
|
74
|
-
Z80_IXL
|
75
|
-
Z80_IYH
|
76
|
-
Z80_IYL
|
77
|
-
Z80_A
|
78
|
-
Z80_F
|
79
|
-
Z80_B
|
80
|
-
Z80_C
|
81
|
-
Z80_D
|
82
|
-
Z80_E
|
83
|
-
Z80_H
|
84
|
-
Z80_L
|
85
|
-
Z80_A_
|
86
|
-
Z80_F_
|
87
|
-
Z80_B_
|
88
|
-
Z80_C_
|
89
|
-
Z80_D_
|
90
|
-
Z80_E_
|
91
|
-
Z80_H_
|
92
|
-
Z80_L_
|
18
|
+
MAXIMUM_CYCLES
|
19
|
+
MAXIMUM_CYCLES_PER_STEP
|
20
|
+
MINIMUM_CYCLES_PER_STEP
|
21
|
+
|
22
|
+
HOOK
|
23
|
+
|
24
|
+
OPTION_OUT_VC_255
|
25
|
+
OPTION_LD_A_IR_BUG
|
26
|
+
OPTION_HALT_SKIP
|
27
|
+
OPTION_XQ
|
28
|
+
OPTION_IM0_RETX_NOTIFICATIONS
|
29
|
+
OPTION_YQ
|
30
|
+
|
31
|
+
MODEL_ZILOG_NMOS
|
32
|
+
MODEL_ZILOG_CMOS
|
33
|
+
MODEL_NEC_NMOS
|
34
|
+
MODEL_ST_CMOS
|
35
|
+
|
36
|
+
REQUEST_REJECT_NMI
|
37
|
+
REQUEST_NMI
|
38
|
+
REQUEST_INT
|
39
|
+
|
40
|
+
RESUME_HALT
|
41
|
+
RESUME_XY
|
42
|
+
RESUME_IM0_XY
|
43
|
+
|
44
|
+
MEMPTR PC SP XY IX IY AF BC DE HL AF_ BC_ DE_ HL_
|
45
|
+
MEMPTRH MEMPTRL PCH PCL SPH SPL XYH XYL IXH IXL IYH IYL
|
46
|
+
A F B C D E H L A_ F_ B_ C_ D_ E_ H_ L_
|
93
47
|
).each do |macro|
|
94
|
-
abort "missing #{macro}" unless have_macro(macro, 'Z80.h')
|
48
|
+
abort "missing Z80_#{macro}" unless have_macro("Z80_#{macro}", 'Z80.h')
|
95
49
|
end
|
96
50
|
|
97
51
|
create_makefile "z80/z80"
|
data/ext/z80/z80.c
CHANGED
@@ -290,7 +290,7 @@ ACCESSOR(zuint8, pcl, MACRO, Z80_PCL, UINT2NUM, NUM2UINT )
|
|
290
290
|
ACCESSOR(zuint8, sph, MACRO, Z80_SPH, UINT2NUM, NUM2UINT )
|
291
291
|
ACCESSOR(zuint8, spl, MACRO, Z80_SPL, UINT2NUM, NUM2UINT )
|
292
292
|
ACCESSOR(zuint8, xyh, MACRO, Z80_XYH, UINT2NUM, NUM2UINT )
|
293
|
-
ACCESSOR(zuint8,
|
293
|
+
ACCESSOR(zuint8, xyl, MACRO, Z80_XYL, UINT2NUM, NUM2UINT )
|
294
294
|
ACCESSOR(zuint8, ixh, MACRO, Z80_IXH, UINT2NUM, NUM2UINT )
|
295
295
|
ACCESSOR(zuint8, ixl, MACRO, Z80_IXL, UINT2NUM, NUM2UINT )
|
296
296
|
ACCESSOR(zuint8, iyh, MACRO, Z80_IYH, UINT2NUM, NUM2UINT )
|
@@ -624,7 +624,7 @@ static VALUE Z80__alloc(VALUE klass)
|
|
624
624
|
|
625
625
|
void Init_z80(void)
|
626
626
|
{
|
627
|
-
VALUE module, klass =
|
627
|
+
VALUE module, klass = rb_define_class("Z80", rb_cObject);
|
628
628
|
|
629
629
|
rb_define_alloc_func(klass, Z80__alloc);
|
630
630
|
|
@@ -670,92 +670,92 @@ void Init_z80(void)
|
|
670
670
|
rb_define_const(module, "XY", UINT2NUM(Z80_RESUME_XY ));
|
671
671
|
rb_define_const(module, "IM0_XY", UINT2NUM(Z80_RESUME_IM0_XY));
|
672
672
|
|
673
|
-
# define DEFINE_ACCESSOR(name
|
674
|
-
rb_define_method(klass, #name,
|
673
|
+
# define DEFINE_ACCESSOR(name) \
|
674
|
+
rb_define_method(klass, #name, Z80__##name, 0); \
|
675
675
|
rb_define_method(klass, #name "=", Z80__set_##name, 1);
|
676
676
|
|
677
|
-
DEFINE_ACCESSOR(fetch_opcode
|
678
|
-
DEFINE_ACCESSOR(fetch
|
679
|
-
DEFINE_ACCESSOR(read
|
680
|
-
DEFINE_ACCESSOR(write
|
681
|
-
DEFINE_ACCESSOR(in
|
682
|
-
DEFINE_ACCESSOR(out
|
683
|
-
DEFINE_ACCESSOR(halt
|
684
|
-
DEFINE_ACCESSOR(nop
|
685
|
-
DEFINE_ACCESSOR(nmia
|
686
|
-
DEFINE_ACCESSOR(inta
|
687
|
-
DEFINE_ACCESSOR(int_fetch
|
688
|
-
DEFINE_ACCESSOR(ld_i_a
|
689
|
-
DEFINE_ACCESSOR(ld_r_a
|
690
|
-
DEFINE_ACCESSOR(reti
|
691
|
-
DEFINE_ACCESSOR(retn
|
692
|
-
DEFINE_ACCESSOR(hook
|
693
|
-
DEFINE_ACCESSOR(illegal
|
694
|
-
DEFINE_ACCESSOR(context
|
695
|
-
DEFINE_ACCESSOR(cycles
|
696
|
-
DEFINE_ACCESSOR(cycle_limit
|
697
|
-
DEFINE_ACCESSOR(memptr
|
698
|
-
DEFINE_ACCESSOR(pc
|
699
|
-
DEFINE_ACCESSOR(sp
|
700
|
-
DEFINE_ACCESSOR(xy
|
701
|
-
DEFINE_ACCESSOR(ix
|
702
|
-
DEFINE_ACCESSOR(iy
|
703
|
-
DEFINE_ACCESSOR(af
|
704
|
-
DEFINE_ACCESSOR(bc
|
705
|
-
DEFINE_ACCESSOR(de
|
706
|
-
DEFINE_ACCESSOR(hl
|
707
|
-
DEFINE_ACCESSOR(af_
|
708
|
-
DEFINE_ACCESSOR(bc_
|
709
|
-
DEFINE_ACCESSOR(de_
|
710
|
-
DEFINE_ACCESSOR(hl_
|
711
|
-
DEFINE_ACCESSOR(memptrh
|
712
|
-
DEFINE_ACCESSOR(memptrl
|
713
|
-
DEFINE_ACCESSOR(pch
|
714
|
-
DEFINE_ACCESSOR(pcl
|
715
|
-
DEFINE_ACCESSOR(sph
|
716
|
-
DEFINE_ACCESSOR(spl
|
717
|
-
DEFINE_ACCESSOR(xyh
|
718
|
-
DEFINE_ACCESSOR(
|
719
|
-
DEFINE_ACCESSOR(ixh
|
720
|
-
DEFINE_ACCESSOR(ixl
|
721
|
-
DEFINE_ACCESSOR(iyh
|
722
|
-
DEFINE_ACCESSOR(iyl
|
723
|
-
DEFINE_ACCESSOR(a
|
724
|
-
DEFINE_ACCESSOR(f
|
725
|
-
DEFINE_ACCESSOR(b
|
726
|
-
DEFINE_ACCESSOR(c
|
727
|
-
DEFINE_ACCESSOR(d
|
728
|
-
DEFINE_ACCESSOR(e
|
729
|
-
DEFINE_ACCESSOR(h
|
730
|
-
DEFINE_ACCESSOR(l
|
731
|
-
DEFINE_ACCESSOR(a_
|
732
|
-
DEFINE_ACCESSOR(f_
|
733
|
-
DEFINE_ACCESSOR(b_
|
734
|
-
DEFINE_ACCESSOR(c_
|
735
|
-
DEFINE_ACCESSOR(d_
|
736
|
-
DEFINE_ACCESSOR(e_
|
737
|
-
DEFINE_ACCESSOR(h_
|
738
|
-
DEFINE_ACCESSOR(l_
|
739
|
-
DEFINE_ACCESSOR(r
|
740
|
-
DEFINE_ACCESSOR(i
|
741
|
-
DEFINE_ACCESSOR(r7
|
742
|
-
DEFINE_ACCESSOR(im
|
743
|
-
DEFINE_ACCESSOR(request
|
744
|
-
DEFINE_ACCESSOR(resume
|
745
|
-
DEFINE_ACCESSOR(iff1
|
746
|
-
DEFINE_ACCESSOR(iff2
|
747
|
-
DEFINE_ACCESSOR(q
|
748
|
-
DEFINE_ACCESSOR(options
|
749
|
-
DEFINE_ACCESSOR(int_line
|
750
|
-
DEFINE_ACCESSOR(halt_line
|
751
|
-
DEFINE_ACCESSOR(sf
|
752
|
-
DEFINE_ACCESSOR(zf
|
753
|
-
DEFINE_ACCESSOR(yf
|
754
|
-
DEFINE_ACCESSOR(hf
|
755
|
-
DEFINE_ACCESSOR(xf
|
756
|
-
DEFINE_ACCESSOR(pf
|
757
|
-
DEFINE_ACCESSOR(nf
|
758
|
-
DEFINE_ACCESSOR(cf
|
677
|
+
DEFINE_ACCESSOR(fetch_opcode)
|
678
|
+
DEFINE_ACCESSOR(fetch )
|
679
|
+
DEFINE_ACCESSOR(read )
|
680
|
+
DEFINE_ACCESSOR(write )
|
681
|
+
DEFINE_ACCESSOR(in )
|
682
|
+
DEFINE_ACCESSOR(out )
|
683
|
+
DEFINE_ACCESSOR(halt )
|
684
|
+
DEFINE_ACCESSOR(nop )
|
685
|
+
DEFINE_ACCESSOR(nmia )
|
686
|
+
DEFINE_ACCESSOR(inta )
|
687
|
+
DEFINE_ACCESSOR(int_fetch )
|
688
|
+
DEFINE_ACCESSOR(ld_i_a )
|
689
|
+
DEFINE_ACCESSOR(ld_r_a )
|
690
|
+
DEFINE_ACCESSOR(reti )
|
691
|
+
DEFINE_ACCESSOR(retn )
|
692
|
+
DEFINE_ACCESSOR(hook )
|
693
|
+
DEFINE_ACCESSOR(illegal )
|
694
|
+
DEFINE_ACCESSOR(context )
|
695
|
+
DEFINE_ACCESSOR(cycles )
|
696
|
+
DEFINE_ACCESSOR(cycle_limit )
|
697
|
+
DEFINE_ACCESSOR(memptr )
|
698
|
+
DEFINE_ACCESSOR(pc )
|
699
|
+
DEFINE_ACCESSOR(sp )
|
700
|
+
DEFINE_ACCESSOR(xy )
|
701
|
+
DEFINE_ACCESSOR(ix )
|
702
|
+
DEFINE_ACCESSOR(iy )
|
703
|
+
DEFINE_ACCESSOR(af )
|
704
|
+
DEFINE_ACCESSOR(bc )
|
705
|
+
DEFINE_ACCESSOR(de )
|
706
|
+
DEFINE_ACCESSOR(hl )
|
707
|
+
DEFINE_ACCESSOR(af_ )
|
708
|
+
DEFINE_ACCESSOR(bc_ )
|
709
|
+
DEFINE_ACCESSOR(de_ )
|
710
|
+
DEFINE_ACCESSOR(hl_ )
|
711
|
+
DEFINE_ACCESSOR(memptrh )
|
712
|
+
DEFINE_ACCESSOR(memptrl )
|
713
|
+
DEFINE_ACCESSOR(pch )
|
714
|
+
DEFINE_ACCESSOR(pcl )
|
715
|
+
DEFINE_ACCESSOR(sph )
|
716
|
+
DEFINE_ACCESSOR(spl )
|
717
|
+
DEFINE_ACCESSOR(xyh )
|
718
|
+
DEFINE_ACCESSOR(xyl )
|
719
|
+
DEFINE_ACCESSOR(ixh )
|
720
|
+
DEFINE_ACCESSOR(ixl )
|
721
|
+
DEFINE_ACCESSOR(iyh )
|
722
|
+
DEFINE_ACCESSOR(iyl )
|
723
|
+
DEFINE_ACCESSOR(a )
|
724
|
+
DEFINE_ACCESSOR(f )
|
725
|
+
DEFINE_ACCESSOR(b )
|
726
|
+
DEFINE_ACCESSOR(c )
|
727
|
+
DEFINE_ACCESSOR(d )
|
728
|
+
DEFINE_ACCESSOR(e )
|
729
|
+
DEFINE_ACCESSOR(h )
|
730
|
+
DEFINE_ACCESSOR(l )
|
731
|
+
DEFINE_ACCESSOR(a_ )
|
732
|
+
DEFINE_ACCESSOR(f_ )
|
733
|
+
DEFINE_ACCESSOR(b_ )
|
734
|
+
DEFINE_ACCESSOR(c_ )
|
735
|
+
DEFINE_ACCESSOR(d_ )
|
736
|
+
DEFINE_ACCESSOR(e_ )
|
737
|
+
DEFINE_ACCESSOR(h_ )
|
738
|
+
DEFINE_ACCESSOR(l_ )
|
739
|
+
DEFINE_ACCESSOR(r )
|
740
|
+
DEFINE_ACCESSOR(i )
|
741
|
+
DEFINE_ACCESSOR(r7 )
|
742
|
+
DEFINE_ACCESSOR(im )
|
743
|
+
DEFINE_ACCESSOR(request )
|
744
|
+
DEFINE_ACCESSOR(resume )
|
745
|
+
DEFINE_ACCESSOR(iff1 )
|
746
|
+
DEFINE_ACCESSOR(iff2 )
|
747
|
+
DEFINE_ACCESSOR(q )
|
748
|
+
DEFINE_ACCESSOR(options )
|
749
|
+
DEFINE_ACCESSOR(int_line )
|
750
|
+
DEFINE_ACCESSOR(halt_line )
|
751
|
+
DEFINE_ACCESSOR(sf )
|
752
|
+
DEFINE_ACCESSOR(zf )
|
753
|
+
DEFINE_ACCESSOR(yf )
|
754
|
+
DEFINE_ACCESSOR(hf )
|
755
|
+
DEFINE_ACCESSOR(xf )
|
756
|
+
DEFINE_ACCESSOR(pf )
|
757
|
+
DEFINE_ACCESSOR(nf )
|
758
|
+
DEFINE_ACCESSOR(cf )
|
759
759
|
|
760
760
|
# undef DEFINE_ACCESSOR
|
761
761
|
|
@@ -778,10 +778,10 @@ void Init_z80(void)
|
|
778
778
|
rb_define_alias(klass, "t=", "cycles=" );
|
779
779
|
rb_define_alias(klass, "wz", "memptr" );
|
780
780
|
rb_define_alias(klass, "wz=", "memptr=" );
|
781
|
-
rb_define_alias(klass, "
|
782
|
-
rb_define_alias(klass, "
|
783
|
-
rb_define_alias(klass, "
|
784
|
-
rb_define_alias(klass, "
|
781
|
+
rb_define_alias(klass, "wzh", "memptrh" );
|
782
|
+
rb_define_alias(klass, "wzh=", "memptrh=");
|
783
|
+
rb_define_alias(klass, "wzl", "memptrl" );
|
784
|
+
rb_define_alias(klass, "wzl=", "memptrl=");
|
785
785
|
rb_define_alias(klass, "vf", "pf" );
|
786
786
|
rb_define_alias(klass, "vf=", "pf=" );
|
787
787
|
rb_define_alias(klass, "state", "to_h" );
|
data/lib/z80/version.rb
CHANGED
data/lib/z80.rb
CHANGED
data/z80.gemspec
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
require_relative 'lib/z80/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = 'z80'
|
5
|
+
s.version = Z80::VERSION
|
6
|
+
s.author = 'Manuel Sainz de Baranda y Goñi'
|
7
|
+
s.email = 'manuel@zxe.io'
|
8
|
+
s.homepage = 'https://zxe.io/software/Z80-Ruby'
|
9
|
+
s.license = '0BSD'
|
10
|
+
s.summary = "Ruby binding for the Z80 library."
|
11
|
+
|
12
|
+
s.description = <<~EOS
|
13
|
+
Z80-Ruby is a Ruby binding for the Zilog Z80 CPU emulator \
|
14
|
+
(https://github.com/redcode/Z80). It is ideal for analysis, \
|
15
|
+
hacking, testing and debugging. All from the comfort of Ruby.
|
16
|
+
EOS
|
17
|
+
|
18
|
+
s.metadata = {
|
19
|
+
'bug_tracker_uri' => "https://github.com/redcode/Z80-Ruby/issues",
|
20
|
+
'changelog_uri' => 'https://github.com/redcode/Z80-Ruby/blob/master/CHANGELOG.md',
|
21
|
+
'documentation_uri' => 'https://zxe.io/software/Z80/documentation/latest',
|
22
|
+
'github_repo' => 'ssh://github.com/redcode/Z80-Ruby',
|
23
|
+
'homepage_uri' => 'https://zxe.io/software/Z80-Ruby',
|
24
|
+
'source_code_uri' => 'https://github.com/redcode/Z80-Ruby'
|
25
|
+
}
|
26
|
+
|
27
|
+
s.files = [
|
28
|
+
# `git ls-files | sort`.split("\n")
|
29
|
+
'.editorconfig',
|
30
|
+
'.github/FUNDING.yml',
|
31
|
+
'.github/workflows/build-and-test-extension.yml',
|
32
|
+
'.github/workflows/publish-gem.yml',
|
33
|
+
'.gitignore',
|
34
|
+
'CHANGELOG.md',
|
35
|
+
'CITATION.cff',
|
36
|
+
'Gemfile',
|
37
|
+
'LICENSE-0BSD',
|
38
|
+
'README.md',
|
39
|
+
'Rakefile',
|
40
|
+
'ext/z80/extconf.rb',
|
41
|
+
'ext/z80/z80.c',
|
42
|
+
'lib/z80.rb',
|
43
|
+
'lib/z80/version.rb',
|
44
|
+
'z80.gemspec'
|
45
|
+
]
|
46
|
+
|
47
|
+
s.extensions = %w(ext/z80/extconf.rb)
|
48
|
+
s.add_development_dependency 'rake-compiler', '~> 1.2', '>= 1.2.0'
|
49
|
+
end
|
metadata
CHANGED
@@ -1,15 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: z80
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Manuel Sainz de Baranda y Goñi
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
11
|
+
date: 2024-01-02 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake-compiler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.2'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.2.0
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '1.2'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.2.0
|
13
33
|
description: 'Z80-Ruby is a Ruby binding for the Zilog Z80 CPU emulator (https://github.com/redcode/Z80).
|
14
34
|
It is ideal for analysis, hacking, testing and debugging. All from the comfort of
|
15
35
|
Ruby.
|
@@ -23,8 +43,12 @@ extra_rdoc_files: []
|
|
23
43
|
files:
|
24
44
|
- ".editorconfig"
|
25
45
|
- ".github/FUNDING.yml"
|
46
|
+
- ".github/workflows/build-and-test-extension.yml"
|
47
|
+
- ".github/workflows/publish-gem.yml"
|
26
48
|
- ".gitignore"
|
27
49
|
- CHANGELOG.md
|
50
|
+
- CITATION.cff
|
51
|
+
- Gemfile
|
28
52
|
- LICENSE-0BSD
|
29
53
|
- README.md
|
30
54
|
- Rakefile
|
@@ -32,15 +56,18 @@ files:
|
|
32
56
|
- ext/z80/z80.c
|
33
57
|
- lib/z80.rb
|
34
58
|
- lib/z80/version.rb
|
35
|
-
|
59
|
+
- z80.gemspec
|
60
|
+
homepage: https://zxe.io/software/Z80-Ruby
|
36
61
|
licenses:
|
37
62
|
- 0BSD
|
38
63
|
metadata:
|
39
64
|
bug_tracker_uri: https://github.com/redcode/Z80-Ruby/issues
|
40
65
|
changelog_uri: https://github.com/redcode/Z80-Ruby/blob/master/CHANGELOG.md
|
41
|
-
|
66
|
+
documentation_uri: https://zxe.io/software/Z80/documentation/latest
|
67
|
+
github_repo: ssh://github.com/redcode/Z80-Ruby
|
68
|
+
homepage_uri: https://zxe.io/software/Z80-Ruby
|
42
69
|
source_code_uri: https://github.com/redcode/Z80-Ruby
|
43
|
-
post_install_message:
|
70
|
+
post_install_message:
|
44
71
|
rdoc_options: []
|
45
72
|
require_paths:
|
46
73
|
- lib
|
@@ -55,8 +82,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
55
82
|
- !ruby/object:Gem::Version
|
56
83
|
version: '0'
|
57
84
|
requirements: []
|
58
|
-
rubygems_version: 3.
|
59
|
-
signing_key:
|
85
|
+
rubygems_version: 3.2.33
|
86
|
+
signing_key:
|
60
87
|
specification_version: 4
|
61
88
|
summary: Ruby binding for the Z80 library.
|
62
89
|
test_files: []
|