dc-tool and network enabled code

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
Post Reply
nogginthenog
DCEmu Fast Newbie
DCEmu Fast Newbie
Posts: 21
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Fri Mar 10, 2006 7:57 am
Has thanked: 0
Been thanked: 0

dc-tool and network enabled code

Post by nogginthenog »

Hi dreamcast gurus,

After playing with dc development over the years with a slow serial cable I finally bought a broadband adapter.
Works great. I just compiled insight (gdb gui) which is really, really cool.

One question: does anyone know why network code on the kos is not compatible with the '-n' flag in dc-tool? (i.e. do not attach console and fileserver).

At least I can't get it to work.

Any ideas?

BTW, I made a quick port of the sdl rdesktop (rdp client) for the Dreamcast. Amazingly it works pretty well, but after a while crashes. I'd like to debug this but I believe dc-tool needs to be running (i.e. no -n).
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5652
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: dc-tool and network enabled code

Post by BlueCrab »

If you're using the built-in KOS network stack (in the Subversion repo version of KOS), then everything should work fine with dcload/dc-tool with or without the -n flag. Just make sure you have INIT_NET in the KOS_INIT_FLAGS, and it should "just work" (as long as you're using any revision from the past year or so (fs_dclsocket was added in r570, but I'm sure there have been changes since then that will affect it)).

If you're trying to use lwIP, you're stuck pretty much, unless you can manage to make KOS' fs_dclsocket work with lwIP (I've never tried personally, so it may work just fine).
nogginthenog
DCEmu Fast Newbie
DCEmu Fast Newbie
Posts: 21
Joined: Fri Mar 10, 2006 7:57 am
Has thanked: 0
Been thanked: 0

Re: dc-tool and network enabled code

Post by nogginthenog »

Thanks for the info BlueCrab. I'm using lwip. Latest svn version of KOS.
If I understand correctly KOS internal networking and lwip cannot both be used at the same time?

It looks like KOS only supports UDP.

So I guess there are a couple of solutions:
- Try to get dcload-lwip working (it's in the 1.2 branch). dcplaya seems to have something similar built in.
- Implement KOS support for TCP connections (gulp!)
- Your suggestion of trying fs_dclsocket with lwIP. I need to try to understand this...
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5652
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: dc-tool and network enabled code

Post by BlueCrab »

nogginthenog wrote:Thanks for the info BlueCrab. I'm using lwip. Latest svn version of KOS.
Good to know I haven't managed to break lwIP. :lol:
If I understand correctly KOS internal networking and lwip cannot both be used at the same time?
Correct. Both expect to get direct input from the various network drivers. You might be able to hack up lwIP to send things along to KOS' internal network stack for UDP packets, but that'd probably be pretty ugly (and would require changing both lwIP and the internal network stack too, most likely).
It looks like KOS only supports UDP.
Correct.
So I guess there are a couple of solutions:
- Try to get dcload-lwip working (it's in the 1.2 branch). dcplaya seems to have something similar built in.
I've never used it, and have no idea if it'd still work, but I suspect it won't be too bad to get working (in fact, I hadn't really noticed it there before you mentioned it).
- Implement KOS support for TCP connections (gulp!)
Eventually I'll have this in KOS' tree, but what I have right now is broken and incomplete.
- Your suggestion of trying fs_dclsocket with lwIP. I need to try to understand this...
From my perspective (I wrote fs_dclsocket), probably the easiest option. The code isn't too horrible, and from looking at it, as long as you don't need to do any printing in an IRQ, it should be relatively easy to port.
nogginthenog
DCEmu Fast Newbie
DCEmu Fast Newbie
Posts: 21
Joined: Fri Mar 10, 2006 7:57 am
Has thanked: 0
Been thanked: 0

Re: dc-tool and network enabled code

Post by nogginthenog »

BlueCrab wrote:
nogginthenog wrote:Thanks for the info BlueCrab. I'm using lwip. Latest svn version of KOS.
Good to know I haven't managed to break lwIP. :lol: (actually it doesn't work at all now, I've broke something!)
Well, my quick rdesktop port does crash after a while :roll:
So I guess there are a couple of solutions:
- Try to get dcload-lwip working (it's in the 1.2 branch). dcplaya seems to have something similar built in.
I've never used it, and have no idea if it'd still work, but I suspect it won't be too bad to get working (in fact, I hadn't really noticed it there before you mentioned it).
I'll have a play with this tomorrow.
- Your suggestion of trying fs_dclsocket with lwIP. I need to try to understand this...
From my perspective (I wrote fs_dclsocket), probably the easiest option. The code isn't too horrible, and from looking at it, as long as you don't need to do any printing in an IRQ, it should be relatively easy to port.
OK, I see what you mean now. I had a quick play around but simply calling lwip_kos_init() in fs_dclsocket_init() adds a whole bunch of stuff that probably doesn't belong in the kernel.

Out of interest how do you debug low-level stuff on the dc? On the Amiga I would simply write to the hardware colour registers (maybe in a small loop, or wait for the start of a frame) and I'd see a flicker of colour. But I'm kinda stuck on the dc.
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5652
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: dc-tool and network enabled code

Post by BlueCrab »

nogginthenog wrote:Out of interest how do you debug low-level stuff on the dc? On the Amiga I would simply write to the hardware colour registers (maybe in a small loop, or wait for the start of a frame) and I'd see a flicker of colour. But I'm kinda stuck on the dc.
The easiest way is using a serial cable, and loading stuff up over it. Then you don't have to worry about when you do printfs and such, because they should work any time. That's how I debugged a lot of the network stack in the beginning (once things were stable enough, I imported fs_dclsocket so I could printf without a serial cable).

Other than using dcload, your options are limited to playing with the video somehow... You could set up some printing using the bios font or do some border color changing to debug stuff, if you wanted to.
nogginthenog
DCEmu Fast Newbie
DCEmu Fast Newbie
Posts: 21
Joined: Fri Mar 10, 2006 7:57 am
Has thanked: 0
Been thanked: 0

Re: dc-tool and network enabled code

Post by nogginthenog »

BlueCrab wrote:
nogginthenog wrote:Out of interest how do you debug low-level stuff on the dc? On the Amiga I would simply write to the hardware colour registers (maybe in a small loop, or wait for the start of a frame) and I'd see a flicker of colour. But I'm kinda stuck on the dc.
The easiest way is using a serial cable, and loading stuff up over it. Then you don't have to worry about when you do printfs and such, because they should work any time. That's how I debugged a lot of the network stack in the beginning (once things were stable enough, I imported fs_dclsocket so I could printf without a serial cable).
Doh! <slaps head> I have a serial cable, of course I can just use that for debugging! Didn't think of that :lol:
Post Reply