Spindash dust glitchy in sonic 1 for mega cd

Discussion in 'Discussion & Q&A' started by Dark Lips, Sep 2, 2017.

Thread Status:
Not open for further replies.
  1. Dark Lips

    Dark Lips Well-Known Member Member

    Joined:
    Nov 14, 2008
    Messages:
    290
    Location:
    Wolverhampton UK
    Hi there, I have been working on a hack based off the sonic 1 for megacd port - i have got peelout, super sonic and spindash all working fine however there are graphical glitches in the spindash dust and after about 3 days of redoing it, reading guides and going through some of my old work i am certain it is correct well for a megadrive... I think it may have something to do with being on the megacd? Can anybody shed some light on this please?
     
  2. Ashuro

    Ashuro Well-Known Member Member

    Joined:
    Sep 27, 2014
    Messages:
    514
    Location:
    France
    Maybe you should change the VRAM adress for it? :(
     
  3. Dark Lips

    Dark Lips Well-Known Member Member

    Joined:
    Nov 14, 2008
    Messages:
    290
    Location:
    Wolverhampton UK
    I am not great with vram addressing - any suggestions/ideas would be greatly appreciated?
     
  4. Novedicus

    Novedicus Pour your misery down on me Member

    Joined:
    Aug 26, 2013
    Messages:
    921
    What exactly does the spindash dust art look like? It could be due to a hardware bug involving DMAing from Word RAM. To fix that, you just add 2 to the source address for QueueDMATransfer (which is stored in d1 before calling it). You also have to manually write the first 2 words of the art to VRAM.

    Give this a read.
     
  5. Dark Lips

    Dark Lips Well-Known Member Member

    Joined:
    Nov 14, 2008
    Messages:
    290
    Location:
    Wolverhampton UK
  6. Novedicus

    Novedicus Pour your misery down on me Member

    Joined:
    Aug 26, 2013
    Messages:
    921
    Yeah, I'm pretty sure it's just the Word RAM DMA bug. I've already posted the solution above.
     
  7. MarkeyJester

    MarkeyJester ! % # @ Member

    Joined:
    Jun 27, 2009
    Messages:
    2,761
    No, there's more to it than this Novedicus.

    The bug in question will happen, yes. But it would not cause the entire art to be shifted by a word, only the first word would be scrambled. Furthermore, emulators do not emulate the word DMA transfer bug.

    I believe either the source address is +2, or the destination address is +2 (probably for the purpose of trying to avoid the word transfer bug, and failing badly). They both need to be exactly the same, the word transfer bug will happen of course, but, the remaining art will transfer fine, only then must the first word be manually transferred. But you must fix the source/destination DMA address first.

    EDIT: To be fair, it might be worth sharing the code responsible for the transfer, so we could have a clearer look and find out specifically what's wrong?
     
    AkumaYin likes this.
  8. Dark Lips

    Dark Lips Well-Known Member Member

    Joined:
    Nov 14, 2008
    Messages:
    290
    Location:
    Wolverhampton UK
    so is this a quirk of the mega cd then guys? if so it seems a bit erm well daft lol!!
     
  9. Novedicus

    Novedicus Pour your misery down on me Member

    Joined:
    Aug 26, 2013
    Messages:
    921
    @MarkeyJester I wasn't talking about the word transfer bug, I was talking about the Word RAM transfer bug in which if you try to DMA from Word RAM, there's a delay, and it'll transfer the data wrong.
     
  10. MarkeyJester

    MarkeyJester ! % # @ Member

    Joined:
    Jun 27, 2009
    Messages:
    2,761
    Oh, my mistake.
     
  11. Dark Lips

    Dark Lips Well-Known Member Member

    Joined:
    Nov 14, 2008
    Messages:
    290
    Location:
    Wolverhampton UK
    ok so I am totally confused now guys lol
     
  12. Novedicus

    Novedicus Pour your misery down on me Member

    Joined:
    Aug 26, 2013
    Messages:
    921
    Lemme restate then...

    Due to a hardware bug on the CD, there is a delay when you DMA art from Word RAM, which I assume is where your art is stored at, and therefore, it'll transfer wrong, like it did in your screenshot. To get around this, the manual stated that you should just add 2 to your source address for DMA, and then manually rewrite the first 2 words of the art that you want to transfer.
     
  13. FireRat

    FireRat "The grand imitator..." Member

    Joined:
    Oct 31, 2009
    Messages:
    539
    Due to SegaCD's bus error, for all DMA you do from Word RAM, all you need is to set source offset as <addr>+2
    Then there's another issue, where the first few pixels will get corrupt, again because the hardware's bug. To what I seen, so far, Genesis Plus GX is the only emulator to take this behavior into account.
    To be fair I haven't checked again in years (hope my memory isn't too blurry), but if you use Hcktrox's messy MegaCD port, you don't have to worry about it if I remember correctly, because those first pixels get automatically patched with a typical direct write.

    As a side note, real hardware compatibility regarding Word RAM access is a pain unless you have the actual real hardware to test on, because only one processor, either MainCPU or SubCPU, can access it at same time (unless you set 1M mode, which splits WRAM into two halves that can be accessed by either processor individually). If I remember correctly, no emulators take this behavior into account, and instead allow the program from either CPU to access WRAM anytime, no matter the settings
    You can manually add this check to an emulator though, Genesis Plus GX.
    By editing its source code with the instructions from here: http://gendev.spritesmind.net/forum/viewtopic.php?p=26004#p26004
     
  14. Dark Lips

    Dark Lips Well-Known Member Member

    Joined:
    Nov 14, 2008
    Messages:
    290
    Location:
    Wolverhampton UK
    wow thank you all for the quick and complete information - plenty for me to look into and have a play with, I am just starting to get back into the asm stuff after a long and I mean long break and am finding it just as enjoyable as when I first started all those years ago.
     
    Dandaman955 likes this.
Thread Status:
Not open for further replies.