Quantcast

Page 1 of 2 12 LastLast
Results 1 to 15 of 28

Thread: Genesis/SEGA CD multi tool homebrew.

  1. #1
    State Laced Master of Shinobi ComradeOj's Avatar
    Join Date
    Dec 2012
    Location
    New Mexico, USA
    Age
    23
    Posts
    1,144
    Rep Power
    46

    Genesis Genesis/SEGA CD multi tool homebrew.

    Hi, everyone!
    I've been working this for a while, and actually have had it completed for a while. I've been kind of lazy in releasing it though
    It's a collection of different useful programs that run on the genesis, packed into one ROM image.
    This is the very first program I wanted to create when learning Genesis programming. This is my third attempt at it, and I finally succeeded!
    The program was coded in 68k assembly over the course of about a week.

    Included is both the Genesis and SEGA CD versions of the program. The SCD version is kind of a jankey port, but it works. It's great for people without flash carts.
    Both versions ran fine for me, but let me know if you run into any issues. 6 button controllers don't work well in either version, and the control is a bit unresponsive in the SEGA CD version.

    Download link: Get it here!

    Anyway... Here are the sub-programs it contains:

    Info screen. Region, TMSS, TAS, 32X, etc.
    CPU benchmark
    Exception testing
    Controller input testing
    Hex data reader
    Data writer <-my personal favorite
    Simple VDP test
    Simple sound test
    CPU register viewer

    You can can change between different sub-programs by holding A+using the Dpad. You only need to hold A if you want to switch to a different sub-program. Otherwise, just use the d-pad like normal.



    The first screen has the info+benchmark score. It looks like this:





    Here is the exception test. I mostly included it for testing emulators. It actually works by creating a real error, not a simulated one.
    For example, divide by zero clears a data register, then tries to divide it by itself. The address error works by trying to read an oddly numbered word.




    The input test uses the standard 3-button reading code and displays the output on the screen.




    The hex data dumper reads from any selected memory address, and displays the data onto the screen. It's really cool!





    This one is my favorite. It lets you write data to anywhere in memory. Maybe it could be used to hack save files?




    There is also a simple VDP test that has two sprites. One with priority, one without, and time background tiles.
    It also give instructions on how to set VDP registers. I have found a lot of neat (and possibly undocumented) effects that only worked on real hardware.




    There is a simple sound test, which can test FM, PSG, and PCM.




    A live CPU register display is included, even though it's not that useful.




    Lastly, the credits screen.
    Last edited by ComradeOj; 07-18-2015 at 01:20 PM.
    Modded consoles:
    Master System (v7040) with s-video & direct AV out
    Model 1 with 10mhz overclock & halt switches
    Model 1 with 10mhz 68010
    Model 2 VA2.3 with unfiltered Mega Amp, & s-video
    Model 3 VA1 with compatibility fixes & s-video
    32X with s-video
    Visit my web site at www.mode5.net
    Or my collection of homebrew Genesis games, programs, and music on SEGA-16!

  2. #2
    16-bits is all he needs Master of Shinobi matteus's Avatar
    Join Date
    Apr 2006
    Location
    UK
    Age
    35
    Posts
    1,841
    Rep Power
    48

    Default

    What kind of undocumented effects have you found? did you post on sprites mind?


  3. #3
    State Laced Master of Shinobi ComradeOj's Avatar
    Join Date
    Dec 2012
    Location
    New Mexico, USA
    Age
    23
    Posts
    1,144
    Rep Power
    46

    Default

    Quote Originally Posted by matteus View Post
    What kind of undocumented effects have you found? did you post on sprites mind?
    I haven't posted this to sprites mind. I probably won't, mostly because I don't have an account. Anyone that wants to post it there themselves is more than welcome to do so though.

    I found one register that made the colors fade to an odd look. It didn't work on any emulators, and I had a tough time capturing the effect with my capture card.
    It can be done by writing "8CA1" to VDP control at $C00004. It might be documented already, I'm not totally sure.

    Here's a photo. The colors looked more saturated in person. You can see that the white text turned yellow, blue turned green, and reds turned purple.
    I was able to get the colors looking half normal by cranking the tint control on my TV all the way to the green side.
    Modded consoles:
    Master System (v7040) with s-video & direct AV out
    Model 1 with 10mhz overclock & halt switches
    Model 1 with 10mhz 68010
    Model 2 VA2.3 with unfiltered Mega Amp, & s-video
    Model 3 VA1 with compatibility fixes & s-video
    32X with s-video
    Visit my web site at www.mode5.net
    Or my collection of homebrew Genesis games, programs, and music on SEGA-16!

  4. #4
    Hard Road! ESWAT Veteran Barone's Avatar
    Join Date
    Aug 2010
    Location
    Brazil
    Posts
    7,040
    Rep Power
    150

    Default

    Quote Originally Posted by ComradeOj View Post
    I found one register that made the colors fade to an odd look. It didn't work on any emulators, and I had a tough time capturing the effect with my capture card.
    It can be done by writing "8CA1" to VDP control at $C00004. It might be documented already, I'm not totally sure.

    Here's a photo. The colors looked more saturated in person. You can see that the white text turned yellow, blue turned green, and reds turned purple.
    I was able to get the colors looking half normal by cranking the tint control on my TV all the way to the green side.
    Very interesting.
    I wonder if the colors generated at such mode are present in the regular palette or if they're exclusive/new ones.
    If they're new or even if just some of them are new, it could be HUGE.

    I mean, can it produce colors which aren't contained here?


    If it does it could be wonderful for some color hacks, even if for stills or title screens only.

  5. #5
    State Laced Master of Shinobi ComradeOj's Avatar
    Join Date
    Dec 2012
    Location
    New Mexico, USA
    Age
    23
    Posts
    1,144
    Rep Power
    46

    Default

    Quote Originally Posted by Barone View Post
    Very interesting.
    I wonder if the colors generated at such mode are present in the regular palette or if they're exclusive/new ones.
    If they're new or even if just some of them are new, it could be HUGE.

    I mean, can it produce colors which aren't contained here?


    If it does it could be wonderful for some color hacks, even if for stills or title screens only.
    I don't think the colors it was showing were "Genesis colors". The reason I say that, is because the color change was a "fade" not a sudden change. When I wrote 8CA1 to the VDP, it faded from the Genesis's regular colors to the odd colors in the space of about 1 second. The Genesis doesn't have enough colors available to do that kind of gradual palette change.

    I have an idea though. I'm going to try to program a demo that draws half the screen in "normal mode" and half the screen with this new unknown setting. Since it took about a second to do the transition, I'm not sure if my idea will work. I'll certainly try though!
    Modded consoles:
    Master System (v7040) with s-video & direct AV out
    Model 1 with 10mhz overclock & halt switches
    Model 1 with 10mhz 68010
    Model 2 VA2.3 with unfiltered Mega Amp, & s-video
    Model 3 VA1 with compatibility fixes & s-video
    32X with s-video
    Visit my web site at www.mode5.net
    Or my collection of homebrew Genesis games, programs, and music on SEGA-16!

  6. #6
    State Laced Master of Shinobi ComradeOj's Avatar
    Join Date
    Dec 2012
    Location
    New Mexico, USA
    Age
    23
    Posts
    1,144
    Rep Power
    46

    Default

    Okay, I'm back. That didn't take long!

    I made the test program, and ran it on my Genesis.

    It works by enabling the register when the image is half-drawn. In then disables it when the image starts being drawn from the top again.
    I tested it with the shadow/highlight register, just to make sure my program was working.
    Ignore the text, I just re-used the background from something else.

    As you can see, it works correctly. The top half is normal, the bottom half is shadowed.


    Here's what happened when I switched out the shadow/highlight register with the unknown register.
    Not only is the change not centered, but it made half the of the screen black and white, and it added this indentation in the middle...
    I'm not sure what to make of this.
    Modded consoles:
    Master System (v7040) with s-video & direct AV out
    Model 1 with 10mhz overclock & halt switches
    Model 1 with 10mhz 68010
    Model 2 VA2.3 with unfiltered Mega Amp, & s-video
    Model 3 VA1 with compatibility fixes & s-video
    32X with s-video
    Visit my web site at www.mode5.net
    Or my collection of homebrew Genesis games, programs, and music on SEGA-16!

  7. #7
    Road Rasher
    Join Date
    Apr 2013
    Location
    SF Bay Area, California
    Posts
    250
    Rep Power
    12

    Default

    Looking at Charles MacDonald's VDP doc, it seems that you're selecting H40 mode and setting the undocumented fifth bit. His document suggests that setting bit 5 has a similar effect to the invalid version of H40 you get by writing $8C01. I believe Nemesis described RS0 (bit 0) as controlling the hcounter behavior and RS1 (bit 7) as controlling the clock divider. Assuming that's correct, essentially what you get with $8C01 is an H40 display driven by an H32 clock which is way out of spec of standard NTSC (or PAL) signaling. Assuming bit 5 does something similar, the color shift you're seeing is probably the result of the color burst getting messed up.

    As for the weird tear, that's probably the result of the mid-screen mode change. You'll see similar problems moving between H32 and H40 unless you're rather careful about when you change modes.

  8. #8
    Wildside Expert bgvanbur's Avatar
    Join Date
    Jul 2011
    Location
    NY, USA
    Age
    35
    Posts
    197
    Rep Power
    18

    Default

    Very cool!

    Quote Originally Posted by ComradeOj View Post
    This one is my favorite. It lets you write data to anywhere in memory. Maybe it could be used to hack save files?
    Since save state locations can easily change since the latest written save moves to the bottom of the file data area, this will be a very rough way to modify save states. And any saves that use the data protection block format will be complex to edit. Luckily there may be a tool coming out soon that will allow easy Sega CD save states changes.

  9. #9
    Outrunner
    Join Date
    Jul 2009
    Location
    Azeitão - PT
    Age
    30
    Posts
    721
    Rep Power
    12

    Default

    Quote Originally Posted by Mask of Destiny View Post
    Looking at Charles MacDonald's VDP doc, it seems that you're selecting H40 mode and setting the undocumented fifth bit. His document suggests that setting bit 5 has a similar effect to the invalid version of H40 you get by writing $8C01. I believe Nemesis described RS0 (bit 0) as controlling the hcounter behavior and RS1 (bit 7) as controlling the clock divider. Assuming that's correct, essentially what you get with $8C01 is an H40 display driven by an H32 clock which is way out of spec of standard NTSC (or PAL) signaling. Assuming bit 5 does something similar, the color shift you're seeing is probably the result of the color burst getting messed up.

    As for the weird tear, that's probably the result of the mid-screen mode change. You'll see similar problems moving between H32 and H40 unless you're rather careful about when you change modes.

    Bit5 of reg 8C is an HSync-pin signal killer which in turn makes EDClk stuck at 13.4MHz and results in a sync rate of ~16kHz
    The tear is the result of the sync changing midline and the TV resyncing the raster to the new horizontal frequency

    Just a note about H40/32 is that bit0:RS1 changes the VDP resolution AND the internal pixel clk divider, while bit7:RS0 switches pixel clock source (internally divided from 53M, or EDClk)

    As EDClk requires the HSync pulse to work normally for it's own generation, killing it or otherwise messing with it (I'm looking at you bit3-reg0) will disrupt the H40 video timing

  10. #10
    State Laced Master of Shinobi ComradeOj's Avatar
    Join Date
    Dec 2012
    Location
    New Mexico, USA
    Age
    23
    Posts
    1,144
    Rep Power
    46

    Default

    Quote Originally Posted by Jorge Nuno View Post
    Bit5 of reg 8C is an HSync-pin signal killer which in turn makes EDClk stuck at 13.4MHz and results in a sync rate of ~16kHz
    The tear is the result of the sync changing midline and the TV resyncing the raster to the new horizontal frequency

    Just a note about H40/32 is that bit0:RS1 changes the VDP resolution AND the internal pixel clk divider, while bit7:RS0 switches pixel clock source (internally divided from 53M, or EDClk)

    As EDClk requires the HSync pulse to work normally for it's own generation, killing it or otherwise messing with it (I'm looking at you bit3-reg0) will disrupt the H40 video timing
    Thanks for the info!

    I guess that explains why the effect looked different when I tried to record it with my capture card. The demo program I made also didn't work well on my HDTV; it looked different and kept losing the signal. CRTs are WAY less picky about the signal they receive.
    Modded consoles:
    Master System (v7040) with s-video & direct AV out
    Model 1 with 10mhz overclock & halt switches
    Model 1 with 10mhz 68010
    Model 2 VA2.3 with unfiltered Mega Amp, & s-video
    Model 3 VA1 with compatibility fixes & s-video
    32X with s-video
    Visit my web site at www.mode5.net
    Or my collection of homebrew Genesis games, programs, and music on SEGA-16!

  11. #11
    Road Rasher
    Join Date
    Apr 2013
    Location
    SF Bay Area, California
    Posts
    250
    Rep Power
    12

    Default

    Quote Originally Posted by Jorge Nuno View Post
    Bit5 of reg 8C is an HSync-pin signal killer which in turn makes EDClk stuck at 13.4MHz and results in a sync rate of ~16kHz
    That saves me some testing, thanks!

    Quote Originally Posted by Jorge Nuno View Post
    Just a note about H40/32 is that bit0:RS1 changes the VDP resolution AND the internal pixel clk divider, while bit7:RS0 switches pixel clock source (internally divided from 53M, or EDClk)
    Not sure I follow. I was under the impression that the VDP operated entirely from a single clock, either MCLK/5 or EDClk (mostly MCLK/4 with some MCLK/5 mixed in during HSync) with the pixel clock just being half of that. Is the clock used for outputting pixels from the sprite line buffer/plane buffers separate from what drives !SC or something?

    Quote Originally Posted by Jorge Nuno View Post
    As EDClk requires the HSync pulse to work normally for it's own generation, killing it or otherwise messing with it (I'm looking at you bit3-reg0) will disrupt the H40 video timing
    Would I be correct in saying that bit3-reg0 kills HSync completely whereas bit5-regC just prevents HSync from being fed to the EDClk circuitry?

  12. #12
    Outrunner
    Join Date
    Jul 2009
    Location
    Azeitão - PT
    Age
    30
    Posts
    721
    Rep Power
    12

    Default

    No no, the pixel clock is in sync with EDClk (in proper H40) or with internal stuff in H32 always..
    EDClk is an "external" pixel clock, meaning, generated off-chip.. in the beginning there were a few discrete chips for it, which in turn got into a PLA, and then integrated into the bus arbiter, and so on..

    The RS1 bit is the internal VDP counter changer with a side effect of setting the internal clock divider to MClk/4 when set. Setting this alone makes the "fast H40" mode
    Otherwise when clear you get H32.
    Now RS0 is independent of this one, as it's just a clock source selector: either use the internal divider or switch over to EDClk.. You could have H32 running over with EDClk (or even faster by killing HSync) but it just wrecks havok with 19-20kHz-ish.. No monitor will lock into this crap.. but it's still H32, just running too fast
    They are called RS1/0 but they have very little relation with each other, one sets display resolution, the other selects the pixel/vram clk source


    bit5 of reg C kill HSync in the way that it makes the pin stuck at H level and takes priority over the following:
    bit3 of reg 0 makes HSync pin toggle every line, which will break H40 obviously, hence the "1=invalid display" nickname sometimes you see on some docs (on H32 it's harmless)
    Note that CSync/VSync are unaffected by these settings, they still work as normal (although each with alternate functions as well to complicate things even more)

  13. #13
    Road Rasher
    Join Date
    Apr 2013
    Location
    SF Bay Area, California
    Posts
    250
    Rep Power
    12

    Default

    Ah, I see. So a setting reg $C to $01 or $A1 will get similar results, but for slightly different reasons. $01 will give you H40 logic driven by a pure MCLK/4 clock source and $A1 will give you H40 logic driven by EDClk, but force EDClk to always be MCLK/4 due to HSync being forced high.

    I wonder what the point of having an internal MClk/4 was. Was it just for testing the H40 mode logic indpendent of the EDClk generator or were they just hoping to get away with the out of spec "fast H40" mode and only added EDClk as a last minute change?

  14. #14
    A Light In The Building. Master of Shinobi
    Join Date
    Jun 2009
    Location
    At the mercy of opinions.
    Posts
    1,075
    Rep Power
    22

    Default

    Quote Originally Posted by ComradeOj View Post
    Anyway... Here are the sub-programs it contains:

    Info screen. Region, TMSS, TAS, 32X, etc.
    CPU benchmark
    Exception testing
    Controller input testing
    Hex data reader
    Data writer <-my personal favorite
    Simple VDP test
    Simple sound test
    CPU register viewer
    Where's the RAM test?

  15. #15
    State Laced Master of Shinobi ComradeOj's Avatar
    Join Date
    Dec 2012
    Location
    New Mexico, USA
    Age
    23
    Posts
    1,144
    Rep Power
    46

    Default

    Quote Originally Posted by chessage View Post
    Where's the RAM test?
    Nowhere. But if you want, I might add it. I was thinking about updating the program to include a few extra things, as well as fixing the SEGA CD port.
    I'm not sure how I could test the RAM. Maybe I could write a random word to RAM, then read it back to see if it was written correctly. I could just do that for all 32k words of memory.
    I could also do the same thing for VRAM and Z80 ram. That's actually a good suggestion for something to add.

    I also tested VDP register $C bit 5 on my model 3. The results were different. When toggling it once, the colors were fine, but the screen waved back and forth.
    When I ran that demo program that runs half the screen with the bit enabled and half disabled, it had odd results again.
    The top half of the screen looked fine, and there was a bigger indentation in the middle. The indented parts also had a green tint to it.

    Maybe I'll try it on my nomad later. My model 2 had the same results as my model 1.
    Modded consoles:
    Master System (v7040) with s-video & direct AV out
    Model 1 with 10mhz overclock & halt switches
    Model 1 with 10mhz 68010
    Model 2 VA2.3 with unfiltered Mega Amp, & s-video
    Model 3 VA1 with compatibility fixes & s-video
    32X with s-video
    Visit my web site at www.mode5.net
    Or my collection of homebrew Genesis games, programs, and music on SEGA-16!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •