Dragon emulator written in Python ???

A place to discuss everything Dragon related that doesn't fall into the other categories.
jedie
Posts: 655
Joined: Wed Aug 14, 2013 12:23 pm
Location: germany
Contact:

Re: Dragon emulator written in Python ???

Post by jedie »

jedie wrote:Update, after last bugfixes:

Code: Select all

6809 EXTENDED BASIC
(C) 1982 BY MICROSOFT

OK
10 FOR I=1 TO 3
20 PRINT STR$(I)+" DRAGONPY"
30 NEXT I
RUN
 .0/////909 DRAGONPY
 .0/////909 DRAGONPY
OK
Strange :P
I found the Bug, i found the bug, i found the buuuuuug...

Code: Select all

6809 EXTENDED BASIC
(C) 1982 BY MICROSOFT

OK
10 FOR I=1 TO 3
20 PRINT STR$(I)+" DRAGONPY"
30 NEXT I
RUN
 1 DRAGONPY
 2 DRAGONPY
 3 DRAGONPY
OK
And the bug was... ...ADC doesn't store the result back into the register :twisted:
Bugfix commit: https://github.com/jedie/DragonPy/commi ... c498c62262


But maybe there are some undiscovered Bug. e.g.:

Code: Select all

?5/3
 1.25 
OK

?6/5
 1.75 
OK
XRoar:

Code: Select all

?5/3
 1.66666667
OK

?6/5
 1.2
OK
IMHO a good idea to compare the traces with my tools ;)
But not today ;)
... too many ideas and too little time ... Related stuff written in Python:
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809
jedie
Posts: 655
Joined: Wed Aug 14, 2013 12:23 pm
Location: germany
Contact:

Re: Dragon emulator written in Python ???

Post by jedie »

jedie wrote:XRoar:

Code: Select all

?5/3
 1.66666667
OK

?6/5
 1.2
OK
I have found this bug and get the same output in DragonPy, now. Commit: https://github.com/jedie/DragonPy/commi ... 4fac528353
:D
... too many ideas and too little time ... Related stuff written in Python:
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809
jedie
Posts: 655
Joined: Wed Aug 14, 2013 12:23 pm
Location: germany
Contact:

Re: Dragon emulator written in Python ???

Post by jedie »

IMHO neally all bugs should be catched in the CPU...

I add some tests with the monitor ROM from sbc09...

And i add a console script (witch not used socket interprocess communication) for fast tests.

Just run:

Code: Select all

...path/to/DragonPy$ python2 console_6809_test.py
or use PyPy:

Code: Select all

...path/to/DragonPy$ pypy console_6809_test.py
New performance values with this script:

With CPython there is round about 490.000 CPU cycles/sec. (ca. half as fast as the real Hardware)
With PyPy round about 6.900.000 - 8.000.000 CPU cycles/sec. (~8 times faster as the real Hardware :D )


Current screenshot with TkInter:
Image
... too many ideas and too little time ... Related stuff written in Python:
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809
jedie
Posts: 655
Joined: Wed Aug 14, 2013 12:23 pm
Location: germany
Contact:

Re: Dragon emulator written in Python ???

Post by jedie »

Short update:

I work on a better multiprocessing solution in a branch:

https://github.com/jedie/DragonPy/compa ... rocessing2

Only Simple6809 with Tkinter GUI works, yet. It seems that it is a good performance boost.

The concept of the new implementation can be seen in these two files:
https://github.com/jedie/DragonPy/blob/ ... process.py
https://github.com/jedie/DragonPy/blob/ ... process.py
... too many ideas and too little time ... Related stuff written in Python:
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809
jedie
Posts: 655
Joined: Wed Aug 14, 2013 12:23 pm
Location: germany
Contact:

Re: Dragon emulator written in Python ???

Post by jedie »

jedie wrote:I work on a better multiprocessing solution in a branch:

https://github.com/jedie/DragonPy/compa ... rocessing2
I have now merged the branch, because it seems to work good ;)

It looks now like this:

Code: Select all

 process_main.py                                     process_sub.py          
+-------------------------+                         +-----------------------+
|                         |                         |                       |
| BusCommunicationThread<--->multiprocessing.Queue<--------->Memory         |
|        +    ^           |                         |        +    ^         |
|        |    |           |                         |        |    |         |
|        |    |           |                         |        |    |         |
|        |    |           |                         |        |    |         |
|        v    +           |                         |        v    +         |
|       periphery         |                         |    6809 CPU Thread    |
|         +  ^            |                         |       +      ^        |
|         |  |            |                         |       |      |        |
|         |  |            |                         |       |      |        |
|         |  |            |                         |       v      +        |
|         v  +            |                         |  http control server  |
|     GUI mainloop        |                         |                       |
|                         |                         |                       |
+-------------------------+                         +-----------------------+
Next thing would like to use http://bottlepy.org as the CPU http server.
... too many ideas and too little time ... Related stuff written in Python:
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809
jedie
Posts: 655
Joined: Wed Aug 14, 2013 12:23 pm
Location: germany
Contact:

Re: Dragon emulator written in Python ???

Post by jedie »

I'm happy!!!! Because i see with https://github.com/jedie/DragonPy/commi ... b54296fc15 this:

Code: Select all

````hCi`qyxr`DRAGON`DATA`LTD````````qvK`BASIC`INTERPRETER`qnp```````hCi`qyxr`BY`MICROSOFT```````````````````````````````````````````OK`
It's just a char = chr(byte), so only a few characters are right. But hey, this is the first time that i see the copyright info from the Dragon ROM. To get the right text, i must use my old Information from http://archive.worldofdragon.org/index. ... le=CharMap resp. https://gist.github.com/jedie/6975555 :D

Currently it's the Dragon 64 ROM, because of the better ROM info, from: viewtopic.php?f=5&t=4370&start=10#p11378

The SAM/PIA implementation does nothing. Just dummy write/read functionality. I hope that is enough for playing with BASIC in text mode. That was was my first goal :mrgreen:

EDIT: Just hacked cha charmap stuff and see:
(C) 1982 DRAGON DATA LTD
16K BASIC INTERPRETER 1.0
(C) 1982 BY MICROSOFT
OK
:mrgreen:
... too many ideas and too little time ... Related stuff written in Python:
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809
jedie
Posts: 655
Joined: Wed Aug 14, 2013 12:23 pm
Location: germany
Contact:

Re: Dragon emulator written in Python ???

Post by jedie »

Now after the keyboard matrix / PIA stuff works, i have implemented a simple Text Mode display with "PyGame"...

So Dragon 32 / 64 Text mode is now a little bit useable:

Image

You can input something and run. You see the cursor blinking. You can do "CLS 3" or other colors, and see colors like on real hardware:

Image


But there is a problem: scrolling doesn't work right. It moves only every second char one line above :o
EDIT: Ah! I have mapped "read/write word" to "read/write byte" :oops:
... too many ideas and too little time ... Related stuff written in Python:
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809
jedie
Posts: 655
Joined: Wed Aug 14, 2013 12:23 pm
Location: germany
Contact:

Re: Dragon emulator written in Python ???

Post by jedie »

jedie wrote:But there is a problem: scrolling doesn't work right. It moves only every second char one line above :o
EDIT: Ah! I have mapped "read/write word" to "read/write byte" :oops:
Yes, it was my mistake that i don't split byte/word in periphery probably :?
... too many ideas and too little time ... Related stuff written in Python:
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809
jedie
Posts: 655
Joined: Wed Aug 14, 2013 12:23 pm
Location: germany
Contact:

Re: Dragon emulator written in Python ???

Post by jedie »

I'm work on the GUI... I have removed Pygame and use Tk only...

Now it looks like this:

Image
(RUN output here: viewtopic.php?f=5&t=4909&p=11571#p11571 )

Big TODO is to cleanup all the code and bring the CLI back...

I have try some of my BASIC listings (per copy clipboard) and they work good.
... too many ideas and too little time ... Related stuff written in Python:
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809
jedie
Posts: 655
Joined: Wed Aug 14, 2013 12:23 pm
Location: germany
Contact:

Re: Dragon emulator written in Python ???

Post by jedie »

With https://github.com/jedie/DragonPy/commi ... 41e9772eb4 i started to add a CoCo, too. But don't know much about CoCo. Seems that CoCo 1 and 2 are very similar to the Dragon Hardware, but CoCo 3 is more advanced.

At least i have to change the keyboard matrix.

I just used the CoCo "Color BASIC v1.3" ROM... It's "boots up" and i see the color animated cursor... But input doesn't work yet. Maybe the PIA kerboard polling is a little bit changed, than the Dragon ROM code...

Image
... too many ideas and too little time ... Related stuff written in Python:
Dragon 32 emulator / PyDC - Python Dragon 32 converter: https://github.com/jedie/DragonPy
DWLOAD server / Dragon-Lib and other stuff: https://github.com/6809
Post Reply