English Amiga Board


Go Back   English Amiga Board > Support > support.FS-UAE

 
 
Thread Tools
Old 28 December 2021, 14:42   #1
girv
Mostly Harmless
 
girv's Avatar
 
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
girv is offline  
Old 28 December 2021, 17:05   #2
jbl007
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
jbl007 is offline  
Old 28 December 2021, 17:34   #3
deimos
It's coming back!
 
deimos's Avatar
 
Join Date: Jul 2018
Location: comp.sys.amiga
Posts: 762
Quote:
Originally Posted by girv View Post
I believe patched versions of WinUAE exist with this kind of feature but I've not found anything for FSUAE.
You mean something like the way Bartman's VSCode / WinUAE works, but for FS-UAE?

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);
	}
}
deimos is offline  
Old 28 December 2021, 20:30   #4
girv
Mostly Harmless
 
girv's Avatar
 
Join Date: Aug 2004
Location: Northern Ireland
Posts: 1,109
Quote:
Originally Posted by deimos View Post
You mean something like the way Bartman's VSCode / WinUAE works, but for FS-UAE?

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).
girv is offline  
Old 28 December 2021, 20:31   #5
girv
Mostly Harmless
 
girv's Avatar
 
Join Date: Aug 2004
Location: Northern Ireland
Posts: 1,109
Quote:
Originally Posted by jbl007 View Post
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

I meant the base lua scripting built in to FSUAE. How does it work? What can it do?
girv is offline  
Old 06 February 2022, 12:35   #6
girv
Mostly Harmless
 
girv's Avatar
 
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.
girv is offline  
Old 09 November 2022, 02:29   #7
sikosis
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
sikosis is offline  
Old 09 November 2022, 09:39   #8
girv
Mostly Harmless
 
girv's Avatar
 
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.
girv is offline  
 


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 17:50.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.08895 seconds with 15 queries