Sega CD Template

Discussion in 'Technical Discussion' started by theocas, Apr 29, 2012.

  1. theocas

    theocas

    Tech Member
    346
    0
    16
    I've been bored out of my mind recently, so I just wrote a simple template that allows me to run arbitrary code on the Sega CD. I figured this might actually come in handy for some other people, so here it is.

    There really isn't much else to say about this besides read the readme, as that basically explains how the entire thing works. Anyways, the code is available on Github. I also wrote a few tools that may come in use at some point (mainly a thingie to generate sinewaves, and a tool that takes a bitmap and turns it to Sega CD ASIC data (incomplete)) The tools are also available on Github.

    Hopefully the documentation I included with these things tells you all you need to know, although I know my documentation writing skills aren't the best. So don't be afraid to ask here if you can't figure something out. After all, I'm hoping people will improve on this template and tools.

    There really isn't much else to say about this schits... so a quick shout-out goes to Bgvanbur for SCDTools. And hope you enjoy this =P I look forward to seeing what amazing things everyone will come up with.
     
  2. SoullessSentinel

    SoullessSentinel

    Member
    257
    0
    16
    Grimsby, England
    Cxbx-Reloaded
    Good work. I released my own Mega CD template a while back, and it's nice to see other people are also beginning to develop for it. I'll have a look over the code later, I haven't looked into the PCM or graphics ASIC yet, so I'll likely learn something from this.
     
  3. theocas

    theocas

    Tech Member
    346
    0
    16
    Thanks.

    I haven't written much code for the ASIC and PCM since my ASIC converter tool currently doesn't do much currently, and I need to really write a PCM driver (even if it's just streaming PCM from the disc or a tracked format) =P
     
  4. Nice work! Now all I have to do is get an SCD :D
     
  5. Ravenfreak

    Ravenfreak

    Is actually a guy. Tech Member
    2,964
    98
    28
    O'Fallon Mo
    Hacking Sonic Drift, Writer at Sonic Cage Dome
    While at the moment I have no interest in homebrew stuff (let alone Mega CD homebrew stuff) this is awesome stuff you got here. :) I can't wait to see more stuff from you. ^_^
     
  6. Bgvanbur

    Bgvanbur

    Tech Member
    128
    0
    0
    USA
    a disassembly, some small Sega CD projects
    Looks nice. And it is great to see that someone is making use of my tools (and remember suggestions are always welcomed).
    Sounds like fun work. I haven't touched the ASIC yet but would be cool to see what things you can come up in this space.

    I have also been planning on making a PCM driver for the game I am working on. The plan for my driver is to have the sound effects in SCD memory and stream it using from RAM which allows me to use CDDA for background music. But still working on gameplay for now. But the PCM seems simpler than I thought after I disassembled the Cinepak code.
     
  7. theocas

    theocas

    Tech Member
    346
    0
    16
    You might be happy to know that a thingie that I'm currently working on gets rid of the need to burn CDs =P

    Heh, thanks. I'm rather unpredictable so yeah (maybe there'll be a PCM driver up soon? WHO KNOWS? FIND OUT NEXT EPISODE!)

    Yeah, the way I originally designed my driver to work (key word designed - not a single line of code was written) was that it had a table of songs and their sector addresses, and a word offset into another table that points to the sample banks as I called them. Sample banks, as well as song data would be loaded to Program RAM, and the driver would operate on that. I had a few coordination flags to mainly do looping (which I envision to be a bitch and three quarters) panning, volume, and sample changing. Any byte from $0-$CF would be interpreted as a note, while anything above is a flag.

    I should actually just get off my lazy arse and write the damn driver. Of course, there's the lack of samples. Plus I have no earthly idea how I'm going to time this properly. There's the level 3 interrupt, but that happens ~7.3 ms which might be a little too quickly, but it could give me accurate sample timing. Although I can probably circumvent this with a 'null note flag' or a tempo header. Probably I'll also write a converter to convert from XM to this. I should probably learn how to properly use an XM tracker, though =P



    But thanks for all the feedback, guys. I appreciate it.
     
  8. Bgvanbur

    Bgvanbur

    Tech Member
    128
    0
    0
    USA
    a disassembly, some small Sega CD projects
    That is how I imagine most people would design a PCM driver for the Sega CD since it could be similar to tracker approach to music.
     
  9. theocas

    theocas

    Tech Member
    346
    0
    16
    I'm working on writing up some design documents I'm hopefully plopping on GitHub when I get back from school today, as well as hopefully a tool to create sample banks. The one thing I just can not figure out is how to figure out the proper playback frequency for a note. The chip had some register that let you configure how many bytes it would skip after outputting a sample - would I screw with that, or the FD regs? I'd still need to make a table nevertheless.
     
  10. theocas

    theocas

    Tech Member
    346
    0
    16
    Quick update on the progress of this - I've been extremely busy with school recently, so I haven't gotten much done. I wrote the tool to create a sample bank (linky) which is rather primitive as is. There's no specific order in which samples are added to the bank, but if you have a suggestion, feel free to tell me or fork my code. I'll be glad to accept merge requests.

    I also wrote some basic code for the PCM driver (mainly to load a new sample as well as initially load the sample bank and song from the disc) as well as added some tables for data the driver will need. I haven't written code to deal with re-loading of samples to the sample memory, nor with actual parsing of music files, so that'll come at a later point in time. I need to get some basic things finished first. There's some notes describing how the driver should work(flags, etc) in the PCM folder as well.