27
27
28
28
## What is it?
29
29
30
- This project is a Chip 8 emulator written in Python 2.7 . The original purpose
30
+ This project is a Chip 8 emulator written in Python 3.6+ . The original purpose
31
31
of the project was to create a simple learning emulator that was well
32
32
documented and coded in terms that were easy to understand. It was also an
33
33
exercise to learn more about Python. The result is a simple command-line
@@ -54,7 +54,7 @@ This project makes use of an MIT style license. Please see the file called LICEN
54
54
Copy the source files to a directory of your choice. In addition to
55
55
the source, you will need the following required software packages:
56
56
57
- * [ Python 2.7 ] ( http://www.python.org )
57
+ * [ Python 3.6.8 or better ] ( http://www.python.org )
58
58
* [ pygame] ( http://www.pygame.org )
59
59
60
60
I strongly recommend creating a virtual environment using the
@@ -66,41 +66,43 @@ and run the emulator in, without touching your master Python environment.
66
66
67
67
### Ubuntu Installation
68
68
69
- The installation under Ubuntu requires several different steps:
69
+ The installation under Ubuntu 20.04 requires several different steps:
70
70
71
71
1 . Install SDL libraries. The SDL (Simple DirectMedia Layer) libraries are used by PyGame to draw
72
72
images on the screen. Several other dependencies are needed by SDL in order to install PyGame.
73
73
To install the required SDL libraries (plus dependencies) from the command-line:
74
74
75
75
```
76
- sudo apt-get install libfreetype6 -dev libsdl-dev libsdl-image1.2- dev \
77
- libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsdl-sound1.2-dev \
78
- libportmidi-dev python-dev
76
+ sudo apt install python3 python3 -dev libsdl-dev libfreetype6- dev \
77
+ libsdl-image1.2-dev libsdl- mixer1.2-dev libsdl-ttf2.0-dev libsdl-sound1.2-dev \
78
+ libportmidi-dev
79
79
```
80
80
81
81
2 . Install PIP. The ` pip ` package manager is used for managing Python packages. To install ` pip `
82
82
from the command-line:
83
83
84
84
```
85
- sudo apt-get install python -pip
85
+ sudo apt install python3 -pip
86
86
```
87
87
88
88
3 . (* Optional* ) Install virtual environment support for Python:
89
89
90
90
1 . Install virtual environment support:
91
91
92
92
```
93
- pip install virtualenv
94
- pip install virtualenvwrapper
93
+ pip3 install virtualenv
94
+ pip3 install virtualenvwrapper
95
95
```
96
96
97
97
2. First you must update your `.bashrc` file in the your home directory and add a few lines
98
98
to the bottom of that file:
99
99
100
100
```
101
101
cat >> ~/.bashrc << EOF
102
+ export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
102
103
export WORKON_HOME=$HOME/.virtualenvs
103
- source /usr/local/bin/virtualenvwrapper.sh
104
+ export PATH=$PATH:$HOME/.local/bin
105
+ source $HOME/.local/bin/virtualenvwrapper.sh
104
106
EOF
105
107
```
106
108
@@ -119,7 +121,7 @@ from the command-line:
119
121
5. Clone (or download) the Chip 8 emulator project:
120
122
121
123
```
122
- sudo apt-get install git
124
+ sudo apt install git
123
125
git clone https://github.com/craigthomas/Chip8Python.git
124
126
```
125
127
@@ -132,8 +134,9 @@ from the command-line:
132
134
133
135
### Windows Installation
134
136
135
- 1. Download and install [Python 2.7.15 for Windows](https://www.python.org/downloads/release/python-2715/).
136
- Make sure that `pip` and `Add python.exe to Path` options are checked when performing the installation.
137
+ 1. Download and install [Python 3.6.8 for Windows](https://www.python.org/downloads/release/python-368/).
138
+ Make sure that `pip` and `Add python.exe to Path` options are checked when performing the installation. Later
139
+ versions of Python 3 are also likely to work correctly with the emulator.
137
140
138
141
2. (*Optional*) Install virtual environment support for Python. Run the following commands from a command prompt:
139
142
@@ -170,34 +173,35 @@ in the directory where you cloned or downloaded the source files:
170
173
171
174
### Running a ROM
172
175
176
+ Note that if you created a virtual environment as detailed above,
177
+ you will need to `workon` that environment before starting the emulator:
178
+
179
+ workon chip8
180
+
173
181
The command-line interface requires a single argument, which is the full
174
182
path to a Chip 8 ROM. Run the following command in the directory where you
175
183
cloned or downloaded the source files:
176
184
177
- python chip8/ yac8e.py /path/to/rom/filename
185
+ python yac8e.py /path/to/rom/filename
178
186
179
- This will start the emulator with the specified ROM. Note that if you created
180
- a virtual environment as detailed above, you will need to `workon` that
181
- environment before starting the emulator:
182
-
183
- workon chip8
187
+ This will start the emulator with the specified ROM.
184
188
185
189
### Screen Scale
186
190
187
- The `-s ` switch will scale the size of the window (the original size at 1x
191
+ The `--scale ` switch will scale the size of the window (the original size at 1x
188
192
scale is 64 x 32):
189
193
190
- python chip8/ yac8e.py /path/to/rom/filename -s 10
194
+ python yac8e.py /path/to/rom/filename --scale 10
191
195
192
196
The command above will scale the window so that it is 10 times the normal
193
197
size.
194
198
195
199
### Execution Delay
196
200
197
- You may also wish to experiment with the `-d ` switch, which instructs
201
+ You may also wish to experiment with the `--delay ` switch, which instructs
198
202
the emulator to add a delay to every operation that is executed. For example,
199
203
200
- python chip8/ yac8e.py /path/to/rom/filename -d 10
204
+ python yac8e.py /path/to/rom/filename --delay 10
201
205
202
206
The command above will add a 10 ms delay to every opcode that is executed.
203
207
This is useful for very fast computers (note that it is difficult to find
@@ -253,11 +257,17 @@ keys that impact the execution of the emulator.
253
257
254
258
## ROM Compatibility
255
259
256
- Here are the list of public domain ROMs and their current status with the emulator.
257
-
258
- | ROM Name | Works Correctly | Notes |
259
- | :---------------: | :----------------: | :---: |
260
- | MAZE | :heavy_check_mark: | |
260
+ Here are the list of public domain ROMs and their current status with the emulator, along
261
+ with keypresses based on the default keymap:
262
+
263
+ | ROM Name | Works Correctly | Notes |
264
+ | :-------- | :----------------: | :---------------------------------------------------------------------------------- |
265
+ | MAZE | :heavy_check_mark: | |
266
+ | MISSILE | :heavy_check_mark: | `U` fires |
267
+ | PONG | :heavy_check_mark: | `4` left player up, `7` left player down, `V` right player up, `B` right player down|
268
+ | TANK | :heavy_check_mark: | `R` fires, `T` moves right, `7` moves left, `5` moves down, `U` moves up |
269
+ | TETRIS | :heavy_check_mark: | `R` moves left, `T` moves right, `Y` moves down, `7` rotates |
270
+ | UFO | :heavy_check_mark: | `R` fires up, `T` fires right, `7` fires left |
261
271
262
272
263
273
## Further Documentation
0 commit comments