Oricutron feature request: external debugger support.

Comments, problems, suggestions about Oric emulators (Euphoric, Mess, Amoric, etc...) it's the right place to ask. And don't hesitate to give your tips and tricks that help using these emulations in the best possible way on your favorite operating system.
Post Reply
User avatar
NekoNoNiaow
Flying Officer
Posts: 143
Joined: Sun Jan 15, 2006 10:08 pm
Location: Montreal, Canadia

Oricutron feature request: external debugger support.

Post by NekoNoNiaow » Tue Nov 06, 2018 12:59 am

I have created an issue for Oricutron requesting external debugger support.
https://github.com/pete-gordon/oricutron/issues/126

Since I found that Chema's request in another post was absolutely sound and useful I had to make sure it was not forgotten. ;)
If you find it important and worth sponsoring, do not hesitate to demonstrate interest by saying so in the issue posted above.

Note that I hesitated to post this on the emulators forum. Feel free to move it if that is more proper. ;)

User avatar
Dbug
Site Admin
Posts: 2724
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Oricutron feature request: external debugger support.

Post by Dbug » Tue Nov 06, 2018 9:02 am

I moved the topic from "Cross Development Tools" to "Emulators"

ThomH
Flying Officer
Posts: 147
Joined: Thu Oct 13, 2016 9:55 pm

Re: Oricutron feature request: external debugger support.

Post by ThomH » Wed Nov 07, 2018 10:42 pm

Your interpretation of this may differ from mine, but it looks like GDB doesn't obtain architecture information from the server, it has to be rebuilt for every architecture you want to debug. E.g. per https://docs.faircom.com/doc/knowledgebase/62424.htm "The gdb must be specially compiled to be aware of the target architecture".

If so, that sounds like a significant impediment?

User avatar
NekoNoNiaow
Flying Officer
Posts: 143
Joined: Sun Jan 15, 2006 10:08 pm
Location: Montreal, Canadia

Re: Oricutron feature request: external debugger support.

Post by NekoNoNiaow » Fri Nov 16, 2018 12:32 am

ThomH wrote:
Wed Nov 07, 2018 10:42 pm
Your interpretation of this may differ from mine, but it looks like GDB doesn't obtain architecture information from the server, it has to be rebuilt for every architecture you want to debug. E.g. per https://docs.faircom.com/doc/knowledgebase/62424.htm "The gdb must be specially compiled to be aware of the target architecture".

If so, that sounds like a significant impediment?
You are correct in interpreting that a new debugging target needs to be added (via code) to GDB so it can support the 6502 and the Oric "OS" more specifically.

However, this is doable, there are many forks of sourceware.org/git/binutils-gdb on GitHub which precisely aim to add support for new targets (N64, Z-80, etc.).
Moreover, any effort to have 6502 support would benefit a very large retro community of 6502-based machines (I should not have to list them here ;)).

I am not sure how Visual Studio support of the GDB protocol would be able to deal with new targets though.

User avatar
iss
Squad Leader
Posts: 685
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: Oricutron feature request: external debugger support.

Post by iss » Sun Nov 18, 2018 12:51 am

Well guys,
as someone somewhen said or wrote:Be careful what you wish for, it might just come true!


Here is what you need:
  • Oricutron with serial support in 'modem' mode.
    Use command line switch: --serial modem:65020 or edit your 'oricutron.cfg' file:

    Code: Select all

    serial = 'modem:65020'
    serial_address = $31c
    Here 65020 is the port on which Oricutron will listen for connection. I used 65020 because it's exactly equal to 10 times 6502, you can use any other free port :).
  • mon6502.dsk or mon6502.tap in the attached file NoICE-debugger-for-Oricutron.zip
    This is the debugger core - Start Oricutron and load it.
  • Start NoICE debugger and use File|Play... to load noice-test.noi from attached file NoICE-debugger-test.zip - you have to unpack the zip file to a working directory.
For everything else follow the video and be creative, if there still problems I'll be glad to help!
Enjoy your remote debugger for Oricutron!

What can be done with debugger: I will leave this to the requester of this feature and everyone who is interested to explore and find all possibilities... and why not to write some useful info?

But what can't be done with it: Definitely you can't debug programs which change the IRQ vector!

And at end some additional personal opinions and notes:

The coolest thing is the debugger core - it runs entirely inside Oric i.e. Oricutron doesn't even know what's going on :).
After you install NoICE program you can find in NoICE/monitors/ sub-folder the original source of the debugger core.
I "ported" it for Oric and you can find the modified source in the attached file - take a look at it, compare with the original - it's beautiful piece of software, I really like it!

Next, maybe you ask yourself to buy NoICE - you decide - but in my not so humble opinion the price of NoICE for 65(C)02 - $79.95 is too high for the sake of hobbyist and for fun only usage. If someone plans to sale software for Oric in big volumes - maybe it's worth the money :lol:. We can ask the author for a 'special' discount for retro maniacs, but I don't believe that we will get something reasonable*. Actually, speaking honestly, I'm ready to give this $80 for the 6502 debugger's core source code which is free, but not for the Windows program which I use with 'wine' under Linux :).

Interesting is the debugger protocol - it uses simple 1 byte commands with parameters. You can see the transferred data in above video (in the log window on the right). The commands are:

Code: Select all

; Communications function codes.
FN_GET_STATUS    =      $FF     ;reply with device info
FN_READ_MEM      =      $FE     ;reply with data
FN_WRITE_MEM     =      $FD     ;reply with status (+/-)
FN_READ_REGS     =      $FC     ;reply with registers
FN_WRITE_REGS    =      $FB     ;reply with status
FN_RUN_TARGET    =      $FA     ;reply (delayed) with registers
FN_SET_BYTES     =      $F9     ;reply with data (truncate if error)
FN_IN            =      $F8     ;input from port
FN_OUT           =      $F7     ;output to port
;
so, nothing extremely special here ...

As conclusion: I highly recommend to try NoICE just to get the feeling of the remote debugging and make a list with the options which are really useful and which we don't need. Next, obviously the Oricutron's networking sockets are working fine and implementing the debugger's core functionality in the emulator seems pretty easy. Then we can write our (free, open source, portable) remote debugger - maybe good idea is to merge it into the OricExplorer - there are already implemented disassembler, hex dump viewer etc., what do you think?
NoICE-debugger-for-Oricutron.zip
NoICE-debugger-for-Oricutron.zip: contains debugger source, DSK and TAP:
mon6502.asm
mon6502.dsk
mon6502.tap
(40.49 KiB) Not downloaded yet
NoICE-debugger-test.zip
NoICE-debugger-test.zip: contains:
noice-test.s - test source code
noice-test - test compiled binary for debugging
noice-test.sym - symbol file generated during compilation (not used in debbuging)
noice-test.noi - script file to load binary, define symbols and set 6502 registers
(1.19 KiB) Not downloaded yet
______________________
* interesting for reading are author's thoughts about software pricing here, his opinion sounds a little bit 'sharp' to me, but I fully understand him.

Post Reply