28 December 2021, 14:42 | #1 |
Mostly Harmless
Join Date: Aug 2004
Location: Northern Ireland
Posts: 1,109
|
Debug output from Amiga code?
I'd like to get debug text output on the FSUAE console/log from Amiga side code, with minimal cost on the Amiga side. Ideally it would be something like Amiga code setting up RawDoFmt-style arguments and triggering something on the host side to format and output them.
The Amiga code would be a game, running without the OS, so using the usual library functions or squirting stuff down the serial port isn't possible and/or fast enough to not disturb the Amiga side. I believe patched versions of WinUAE exist with this kind of feature but I've not found anything for FSUAE. I've seen mention of lua scripting that might help, but I can't find any guides or examples, only a few years-old snippets. Open to suggestions... Last edited by girv; 28 December 2021 at 14:42. Reason: formatting |
28 December 2021, 17:05 | #2 |
Registered User
Join Date: Mar 2013
Location: Leipzig/Germany
Posts: 466
|
I'm not sure what the primary goals of the lua shell were but it was later used to control the emulator, not to debug the running software.
http://eab.abime.net/showthread.php?t=76800 https://lallafa.de/blog/2015/04/a-lua-shell-for-fs-uae/ Perhaps this is more helpful for you: https://lallafa.de/blog/2016/09/libt...er-for-fs-uae/ or that: https://github.com/cnvogelg/ucon https://github.com/cnvogelg/fs-uae/tree/ucon |
28 December 2021, 17:34 | #3 | |
It's coming back!
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
|
Quote:
Code:
__attribute__((noinline)) __attribute__((optimize("O1"))) void KPrintF(const char* fmt, ...) { va_list vl; va_start(vl, fmt); long(*UaeDbgLog)(long mode, const char* string) = (long(*)(long, const char*))0xf0ff60; if(*((UWORD *)UaeDbgLog) == 0x4eb9 || *((UWORD *)UaeDbgLog) == 0xa00e) { char temp[128]; RawDoFmt((CONST_STRPTR)fmt, vl, PutChar, temp); UaeDbgLog(86, temp); } else { RawDoFmt((CONST_STRPTR)fmt, vl, KPutCharX, 0); } } |
|
28 December 2021, 20:30 | #4 | |
Mostly Harmless
Join Date: Aug 2004
Location: Northern Ireland
Posts: 1,109
|
Quote:
Kind of, yes, but with the format part happening on the host side as well. I was thinking lua because it looks like it can trap or at least examine the Amiga memory. Something like the Amiga code loads known addresses with a "command" value and some parameters in just a couple of 68k instructions, then the lua side detects that and performs the "command" (eg: logging a printf string). |
|
28 December 2021, 20:31 | #5 |
Mostly Harmless
Join Date: Aug 2004
Location: Northern Ireland
Posts: 1,109
|
|
06 February 2022, 12:35 | #6 |
Mostly Harmless
Join Date: Aug 2004
Location: Northern Ireland
Posts: 1,109
|
FWIW, I ported the 0xbfff00 debug output and on-the-fly warpmode switching (any config setting really) from WinUAE to my local build of FS-UAE quite easiy.
|
09 November 2022, 02:29 | #7 |
Registered User
Join Date: Dec 2020
Location: Brisbane, Australia
Posts: 1
|
Would you care to share how you did this? I'd like to be able to debug when using FS-UAE
|
09 November 2022, 09:39 | #8 |
Mostly Harmless
Join Date: Aug 2004
Location: Northern Ireland
Posts: 1,109
|
I just copied the relevant code from WinUAE and recompiled.
I updated this patch to work off the current FS-UAE master at commit bfa0c752: https://gist.github.com/johngirvin/5...4caed91daf7b7f You'll see it just does a fprintf at the end of debug_sprintf_do instead of a write_log ... you may want to change that. The code came from WinUAE so I guess the patch could be merged to FS-UAE without any issues. |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Assembler files and C in GCC / bartman's amiga-debug | zero | Coders. C/C++ | 11 | 12 March 2021 16:17 |
Amiga 600 vs Amiga 1200 Composite Output Quality | Marle | support.Hardware | 2 | 22 March 2020 23:20 |
Sending debug output to the serial port OS3.x | NovaCoder | Coders. C/C++ | 0 | 18 February 2013 06:56 |
Help me debug my shitty code? | h0ffman | Coders. General | 13 | 22 March 2011 15:17 |
Avoid debug output? | Flinx | support.WinUAE | 0 | 23 July 2002 09:35 |
|
|