Emulator for 6809 CPU based system like Dragon 32 / CoCo written in Python...
Project description
Dragon/CoCO emulator written in Python
DragonPy is a Open source (GPL v3 or later) emulator for the 30 years old homecomputer Dragon 32 and Tandy TRS-80 Color Computer (CoCo)…
The MC6809 project is used to emulate the 6809 CPU.
Dragon 32 with CPython 3 under Linux:
Tandy TRS-80 Color Computer 2b with CPython 2 under Windows:
(Note: Python 2 support was removed)
DragonPy is written in Python. It’s platform independent and runs with Python and PyPy under Linux/Windows/OSX/… It’s tested with Python 3.x, PyPy
DragonPy will not be a second XRoar written in Python. This project is primarily to lean and understand.
Future goals are:
Implement a integrated development environment for BASIC programs
A full featured Dragon / CoCo emulator is XRoar.
Current state
The Dragon 32 / 64 and CoCo ROMs works in Text mode. Also the “single board computer” ROMs sbc09, Simple6809 and Multicomp6809 works well.
There is a rudimentary BASIC editor with save/load BASIC programm listings direct into RAM.
Looks like this:
(older version of the editor)
Vectrex
The Vectrex (Wikipedia) is a vector display-based video game console. The Hardware are only the 6809 CPU, a 6522 Versatile Interface Adapter and the AY-3-8912 sound chip.
Current state is completely not usable. The 6522 is only a dummy implementation. It makes only sense to display some trace lines, e.g.:
.../DragonPy$ poetry run DragonPy --verbosity 0 --machine=Vectrex run --trace --max_ops=1
BASIC Editor
Use “BASIC editor / open” in the main menu to open the editor.
You can load/save ASCII .bas files from you local drive or just type a BASIC listing ;) With “inject into DragonPy” you send the current listing from the Editor to the Emulator and with “load from DragonPy” back from emulator to editor. Note: The is currently no “warning” that un-saved content will be “overwritten” and there is no “auto-backup” ;)
The “renumbering” tool can be found in the editor window under “tools”
You can also run the BASIC Editor without the Emulator:
.../DragonPy$ make editor # or: .../DragonPy$ poetry run DragonPy editor
A rudimentary BASIC source code highlighting is available and looks like this:
Special feature: The Line number that are used in GOTO, SOGUB etc. are extra marked on the left side.
installation
IMPORTANT: The PyPi package name is DragonPyEmulator and not only “DragonPy”!!!
pip install DragonPyEmulator
from source
~$ git clone https://github.com/jedie/DragonPy.git ~$ cd DragonPy/ ~/DragonPy$ make help List all commands install-poetry install or update poetry install install DragonPy via poetry update Update the dependencies as according to the pyproject.toml file lint Run code formatters and linter fix-code-style Fix code formatting tox-listenvs List all tox test environments tox Run pytest via tox with all environments tox-py36 Run pytest via tox with *python v3.6* tox-py37 Run pytest via tox with *python v3.7* tox-py38 Run pytest via tox with *python v3.8* pytest Run pytest update-rst-readme update README.rst from README.creole publish Release new version to PyPi download-roms Download/Test only ROM files profile Profile the MC6809 emulation benchmark benchmark Run MC6809 emulation benchmark editor Run only the BASIC editor Vectrex Run GUI with Vectrex emulation (not working, yet!) sbc09 Run GUI with sbc09 ROM emulation Multicomp6809 Run GUI with Multicomp6809 ROM emulation Simple6809 Run GUI with Simple6809 ROM emulation CoCo2b Run GUI with CoCo 2b emulation Dragon32 Run GUI with Dragon 32 emulation Dragon64 Run GUI with Dragon 64 emulation run *Run the DragonPy Emulator GUI* ~/DragonPy$ make install-poetry ~/DragonPy$ make install ~/DragonPy$ make run # use the CLI: ~/DragonPy$ poetry run DragonPy --help ~/DragonPy$ poetry run DragonPy
install in virtualenv by foot:
e.g.:
# Create virtualenv: .../$ python3 -Im venv DragonPy # activate created virtualenv: .../$ cd DragonPy .../DragonPy$ source bin/activate # update pip before install: (DragonPy) .../DragonPy$ pip install -U pip ... # Install DragonPy: (DragonPy) .../DragonPy$ pip install DragonPyEmulator Collecting DragonPyEmulator ... Installing collected packages: click, six, dragonlib, pygments, MC6809, DragonPyEmulator Successfully installed DragonPyEmulator-0.5.3 MC6809-0.5.0 click-6.7 dragonlib-0.1.7 pygments-2.2.0 six-1.11.0 # start Emulator (DragonPy) .../DragonPy$ DragonPy
Windows
There are several ways to install the project under windows.
The following is hopeful the easiest one:
Install Python 3, e.g.: https://www.python.org/downloads/
Download the DragonPy git snapshot from Github: master.zip
Extract the Archive somewhere
Maybe, adjust paths in boot_dragonpy.cmd
Run boot_dragonpy.cmd
The default boot_dragonpy.cmd will install via Python Package Index (PyPi) into %APPDATA%\DragonPy_env
start DragonPy
The is a simple “starter GUI”, just call the cli without arguments:
%APPDATA%\DragonPy_env\Scripts\DragonPy.exe
It looks like this:
ROMs
All needed ROM files, will be downloaded automatically.
The files will be downloaded from:
Dragon 32 + 64 |
|
CoCo 2b |
|
Multicomp |
|
Simple6809 |
sbc09 and vectrex ROMs are included.
All ROM files and download will be checked by SHA1 value, before use.
run tests
You can run tests with PyPy, Python 2 and Python 3:
~/DragonPy$ make pytest # or: ~/DragonPy$ make tox # or: ~/DragonPy$ poetry run pytest
more screenshots
“sbc09” ROM in Tkinter window:
“Simple6809” ROM in Tkinter window:
Dragon Keyboard
The keyboard mapping is stored into dragonpy/Dragon32/keyboard_map.py.
Some notes:
“CLEAR” is mapped to “Home” / “Pos 1” key
“BREAK” is mapped to “Escape” button
“LEFT” is mapped to left cursor key and to normal backspace, too.
A “auto shift” mode is implemented. So normal lowercase letters would be automaticly converted to uppercase letters.
paste clipboard
It is possible to paste the content of the clipboard as user input in the machine. Just copy (Ctrl-C) the follow content:
10 CLS 20 FOR I = 0 TO 255: 30 POKE 1024+(I*2),I 40 NEXT I 50 I$ = INKEY$:IF I$="" THEN 50
Focus the DragonPy window and use Ctrl-V to paste the content.
Looks like:
Then just RUN and then it looks like this:
DragonPy schematic
+------------------+ +---------------------+ | | | | | +-------------+ | | 6809 CPU | | | | | | + ^ | | | GUI | | | | | | | | | | Display RAM callback | +--v-----+--+ | | | .--------------------------------------------+ Memory | | | | | | | | +--+-----^--+ | | | | | | | | | | | | | | | | +-----v-----+-----+ | | | | | | | | Periphery | | | | | | | Keyboard queue | | MC6883 SAM | | | | | +--------------------------------->MC6821 PIA | | | | | | | | | | | | +--+-----^----+ | | | | | | | | | | +-----------------+ | | | | | | | | +--v-----+----+ | | | | | | | | | | | Display | | | | | | | | | | | +-------------+ | | | +------------------+ +---------------------+
performance
The current implementation is not really optimized.
With CPython there is round about 490.000 CPU cycles/sec. in console version. This is half as fast as the real Hardware.
With PyPy round about 6.900.000 - 8.000.000 CPU cycles/sec. In other words with PyPy it’s 8 times faster as the real Hardware.
e.g. The Dragon 32 6809 machine with a 14.31818 MHz crystal runs with: 0,895MHz (14,31818Mhz/16=0,895MHz) in other words: 895.000 CPU-cycles/sec.
TODO:
implement more Dragon 32 periphery
missing 6809 unittests after coverage run:
MUL
BVS
PyDragon32
Some Python/BASIC tools/scripts around Dragon32/64 / CoCo homecomputer.
All script are copyleft 2013-2020 by Jens Diemer and license unter GNU GPL v3 or above, see LICENSE for more details.
Python scripts:
PyDC - Convert dragon 32 Cassetts WAV files into plain text:
Filter Xroar traces:
BASIC programms:
Simple memory HEX viewer:
Test CC Registers:
Input/Output Tests
/BASIC/InputOutput/keyboard.bas Display memory Locations $0152 - $0159 (Keyboard matrix state table)
Example screenshow with the “Y” key is pressed down. You see that this is saved in $0153:
Example with “U” is hold down:
Links
Grant Searle’s Multicomp FPGA project:
Lennart Benschop 6809 Single Board Computer:
Grant Searle’s Simple 6809 design:
Some links:
http://www.maddes.net/m6809pm/ - Programming Manual for the 6809 microprocessor from Motorola Inc. (now Freescale)
http://dragondata.worldofdragon.org/Publications/inside-dragon.htm
http://koti.mbnet.fi/~atjs/mc6809/ - 6809 Emulation Page
Source codes:
Dragon 32 resources:
Credits
Some code based on:
ApplePy
An Apple ][ emulator in Python
Author: James Tauber
License: MIT
XRoar A really cool Dragon / CoCo emulator
Author: Ciaran Anscomb
License: GNU GPL v2
included Python modules:
python-pager Page output and find dimensions of console.
Author: Anatoly Techtonik
License: Public Domain
Stored here: /dragonpy/utils/pager.py
srecutils.py Motorola S-Record utilities
Author: Gabriel Tremblay
License: GNU GPL v2
Homepage: https://github.com/gabtremblay/pysrec
Stored here: /dragonpy/utils/srecord_utils.py
requirements
dragonlib Dragon/CoCO Python Library
Author: Jens Diemer
License: GNU GPL v3
MC6809 Implementation of the MC6809 CPU in Python
Author: Jens Diemer
License: GNU GPL v3
pygments generic syntax highlighter
Author: Georg Brandl
License: BSD License
History
-
tbc
-
Modernize project testing, CI pipeline, usw poetry etc.
Many Code updates
Remove Python v2 fallback code parts
Update ROM Download Links
Bugfix “–max_ops” cli options
-
Update to new MC6809 API
reimplementing Simple6809, contributed by Claudemir Todo Bom
TODO: Fix speedlimit
Fix No module named 'nose' on normal PyPi installation
-
Bugfix for “freeze” after “speed limit” was activated
-
Add run ‘MC6809 benchmark’ button to ‘starter GUI’
bugfix ‘file not found’ in ‘starter GUI’
change the GUI a little bit
-
Add a “starter GUI”
Add work-a-round for tkinter usage with virtualenv under windows, see: virtualenv issues #93
bugfix e.g.: keyboard input in “sbc09” emulation
use nose to run unittests
-
ROM files will be downloaded on-the-fly (.sh scripts are removed. So it’s easier to use under Windows)
-
The MC6809 code is out sourced to: https://github.com/6809/MC6809
-
Use Pygments syntax highlighter in BASIC editor
-
Release as v0.3.1
30.09.2014 - Enhance the BASIC editor
29.09.2014 - Merge PyDragon32 project
-
Reimplement Multicomp 6809 and SBC09
Many code refactoring and cleanup
-
Add a speedlimit, config dialog and IRQ: Forum post 11780
-
Implement pause/resume, hard-/soft-reset 6809 in GUI and improve a little the GUI/Editor stuff
see also: Forum post 11719.
27.08.2014 - Run CoCo with Extended Color Basic v1.1, bugfix transfer BASIC Listing with 8fe24e5…697d39e see: Forum post 11696.
20.08.2014 - rudimenary BASIC IDE works with 7e0f16630…ce12148, see also: Forum post 11645.
05.08.2014 - Start to support CoCo, too with 0df724b, see also: Forum post 11573.
04.08.2014 - Use the origin Pixel-Font with Tkinter GUI, see: Forum post 4909 and Forum post 11570.
27.07.2014 - Copyrigth info from Dragon 64 ROM is alive with 543275b, see: Forum post 11524.
29.06.2014 - First “HELLO WORLD” works, see: Forum post 11283.
27.10.2013 - “sbc09” ROM works wuite well almist, see: Forum post 9752.
16.10.2013 - See copyright info from “Simple6809” ROM with 25a97b6 see also: Forum post 9654.
10.09.2013 - Start to implement the 6809 CPU with 591d2ed
28.08.2013 - Fork “Apple ][ Emulator” written in Python: https://github.com/jtauber/applepy to https://github.com/jedie/DragonPy
Links:
Forum |
|
IRC |
|
Jabber |
|
PyPi |
|
Github |
donation
Note: this file is generated from README.creole 2020-10-01 13:19:41 with "python-creole"
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file DragonPyEmulator-0.7.0.tar.gz
.
File metadata
- Download URL: DragonPyEmulator-0.7.0.tar.gz
- Upload date:
- Size: 363.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae6ee5c7f0d651e51dc48c182079c748440ba78646b95c2ac83652fbaa710927 |
|
MD5 | fee9678262cc4b4df0daf7c3a398c82d |
|
BLAKE2b-256 | cde0c85e1be90c595c6821c5e09cb410fd2ec0cfbb6f20d16709ce69f3478a73 |
Provenance
File details
Details for the file DragonPyEmulator-0.7.0-py3-none-any.whl
.
File metadata
- Download URL: DragonPyEmulator-0.7.0-py3-none-any.whl
- Upload date:
- Size: 388.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1777f3458279a577ca58ec284b02a1327ccd72a5cad20a048a47cd00805fb82c |
|
MD5 | c28cede2cea57e66c7f4358d5667667f |
|
BLAKE2b-256 | 5633d8a23b51afd474f53bb1883ffe65ac591be25351d136c5b80cc7b91489c9 |