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.

- Installed the KOS devkit (OSX and Ubuntu versions; thanks bogglez);
- Installed an emulator (lxdream);
- Re-acquired a Dreamcast;
- Acquired a serial port SD card reader (plus DreamShell RC4 and beta 4, and a compatible SD card);
- Restructured one of my existing Nintendo DS homebrew games so it will also compile and run under lxdream.

Now I have a .elf file that I can play with in an emulator, but how do I get that running on the Dreamcast? DreamShell RC4 refuses to have anything to do with the file. Beta 4 appears to try and load it but gets stuck after showing its console. I found this suggestion to convert the .elf to a .bin file, but neither version of DreamShell will load the resultant file (RC4 doesn't try; beta 4 switches to console and again gets stuck).

sh-elf-objcopy (or kos-objcopy) should do the trick to create an unscrambled binary for you. You don't need the "-R .stack" part any more (and haven't for a while now), but that effectively doesn't do anything anyway.

Honestly, I know pretty much nothing about DreamShell, so I can't really help other than to confirm that objcopy is what you should need...

I haven't used Dreamshell but it seems that you can write standalone programs for it which might be why it's trying to load your .elf.

Apparently, Dreamshell is able to load iso images so I would suggest converting your elf into a bootable iso by converting to binary, scrambling, creating iso, inserting ip.bin etc. KOS might have a script for automating this or you could follow the instructions on the legendary Marcus Comstedt's site http://mc.pp.se/dc/cdr.html

I have a broadband adapter so I boot dcload from a Cdr and use the host program to load elf files directly.

It's still got a few issues to sort out (I forgot that 320x240@60Hz really means 320x200@60Hz, so stuff on the edge of the screen is missing, and the graphics are the wrong color because the DS and the DC order their RGB components differently), but it all seems to be working.

Which libraries did you use to make the game in the end?
I wonder whether SDL2 can be ported to the Dreamcast easily. Didn't find porting instructions and don't feel like exploring their code base right now.

Almost nothing Dreamcast-specific. I use the Maple functions for polling the joypad, a waitvbl function, and vram_s[] for writing to the framebuffer. Everything else is a homegrown set of libraries that gives me a reference counted, object oriented MVC GUI framework in C that compiles for Nintendo DS, SDL2 and now Dreamcast. But for the next project I'll probably switch to DC sprites.

You're writing to vram_s directly? I noticed better performance by writing to a framebuffer in ram first and then copying everything over to vram using store queues or dma. Best way would of course be to use the pvr (sprite mode even)

- Switched to store queues instead of writing to VRAM directly (much faster);
- Enabled sound (though I've only tested it in lxdream, where it sounds horrible, so hopefully it sounds better on the real hardware);
- Restored the correct color palette;
- Reorganized the screen layout to fit on an NTSC TV.

- Switched to store queues instead of writing to VRAM directly (much faster);
- Enabled sound (though I've only tested it in lxdream, where it sounds horrible, so hopefully it sounds better on the real hardware);
- Restored the correct color palette;
- Reorganized the screen layout to fit on an NTSC TV.