XRoar API ?!?

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

XRoar API ?!?

Post by jedie »

What's about to add a API in XRoar, so that e.g. a Python script can interact with the simulated machine?
... 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
sixxie
Posts: 1346
Joined: Fri Jul 18, 2008 8:36 am
Location: Hertfordshire
Contact:

Re: XRoar API ?!?

Post by sixxie »

Well the GDB interface already exists...

https://sourceware.org/gdb/onlinedocs/g ... tocol.html for the general approach and check the top of gdb.c for XRoar specifics.

You'd doubtless want more hardware inspection commands - outside the CPU, the only one there at the moment is query/set of the SAM register, but more can be added.
jedie
Posts: 655
Joined: Wed Aug 14, 2013 12:23 pm
Location: germany
Contact:

Re: XRoar API ?!?

Post by jedie »

GDB is very low level and more for debugging. Isn't it?

I mean something like:
* stop/resume machine
* read/write machine RAM/ROM
* raise software reset
... 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
sixxie
Posts: 1346
Joined: Fri Jul 18, 2008 8:36 am
Location: Hertfordshire
Contact:

Re: XRoar API ?!?

Post by sixxie »

jedie wrote:GDB is very low level and more for debugging. Isn't it?
It's low level, but it'll do what you want:
I mean something like:
* stop/resume machine
Send an BREAK (0x03), send continue ('c').
* read/write machine RAM/ROM
'm' and 'M' - though if you want to write ROM, I'd need to extend that.
* raise software reset
Not directly supported at the mo, though you could obviously set PC to an appropriate value. Extending to support a particular signal type could impose a full reset.

GDB itself is the program that does the debugging - it does it by stopping/starting the target and reading/writing memory in the way you want.

The GDB packet format is very simple, and operates over a simple TCP connection.

..ciaran
jedie
Posts: 655
Joined: Wed Aug 14, 2013 12:23 pm
Location: germany
Contact:

Re: XRoar API ?!?

Post by jedie »

Hm. Seems to be interesting. I will take a look, thanks!
... 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: XRoar API ?!?

Post by jedie »

I have no experience in this.

I created a first test script in Python, here: https://github.com/jedie/PyDragon32/blo ... b_tests.py

I just send a "g" and get '$S02#b5' back. This seems to be wrong.

Can you give some examples?
... 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
User avatar
tormod
Posts: 416
Joined: Sat Apr 27, 2013 12:06 pm
Location: Switzerland
Contact:

Re: XRoar API ?!?

Post by tormod »

As an alternative path, you might be interested in gdb's support for python scripting: https://sourceware.org/gdb/current/onli ... tml#Python In this case you would run python scripts from inside gdb and you wouldn't need to take care of the low-level communication.

Your m6809-gdb will have to be compiled with python support (Ciaran's binaries are not).
Post Reply