Corrupted title cards?

Discussion in 'Discussion and Q&A Archive' started by DeoxysKyogre, Oct 24, 2010.

Thread Status:
Not open for further replies.
  1. DeoxysKyogre

    DeoxysKyogre No idea what to put here .-. Member

    Joined:
    Jan 31, 2009
    Messages:
    298
    Well, I was importing recently a bigger and cleaner version of the title card i shown before. It came fine, but there's something I don't understand why it happens. The thing is that some letters appear, some not. The funniest thing is that in SonMapED it's just fine, but not when it comes to the real game. In SonMapED:


    [​IMG]


    But in game...


    [​IMG]


    I know this situation is VRAM-wise, but, how do I fix this? I'd appreciate some help... Thanks in advance!
     
  2. DrHackMan

    DrHackMan I don't always herp, but when I herp, I derp Member

    Joined:
    Oct 16, 2010
    Messages:
    33
    Location:
    Eggmanland
    My suggestion would be to decompress the letter sprites and load the already uncompressed directly from rom instead of loading the decompressed into ram.


    That would blow the file size a bit up, but the card would show properly and you would have some free ram for other stuff.


    FraGag made a tutorial on how to do this with chunks, but I'm sure that it'll work with the title card with some modification ^^


    http://info.sonicretro.org/SCHG_How-to:Loa..._ROM_in_Sonic_1


    P.S.: Epic title card!
     
    Last edited by a moderator: Oct 24, 2010
  3. DeoxysKyogre

    DeoxysKyogre No idea what to put here .-. Member

    Joined:
    Jan 31, 2009
    Messages:
    298
    Kind of a good idea, might check it out now.


    EDIT: Looked through the guide, but seems it's completely different at how the art & mappings of the objects and the levels load like. But I think it's a good idea uncompressing the art and making it load from the ROM, but I'm not quite sure how to do it :|
     
    Last edited by a moderator: Oct 24, 2010
  4. DrHackMan

    DrHackMan I don't always herp, but when I herp, I derp Member

    Joined:
    Oct 16, 2010
    Messages:
    33
    Location:
    Eggmanland
    You leave the decompression (KosDec / NemDec) command out, because the file is already uncompressed and skip the lea commands, because these would load them into the ram.
     
  5. amphobius

    amphobius spreader of the pink text Member

    Joined:
    Feb 24, 2008
    Messages:
    970
    Location:
    United Kingdom
    You could make the letters a bit smaller to co-inside with the original font, but whatever works.


    Looks a lot cleaner now, btw. :)
     
    Last edited by a moderator: Oct 24, 2010
  6. Crash

    Crash Well-Known Member Member

    Joined:
    Jul 15, 2010
    Messages:
    302
    Location:
    Australia
    I don't think changing to uncompressed graphics will help much, but if you're using the SVN disassembly you need to change this:




    locVRAM $B000


    lea (Nem_TitleCard).l,a0 ; load title card patterns


    bsr.w NemDec



    to this




    lea ($C00000).l,a6


    locVRAM $B000,4(a6)


    lea (Art_TitleCard).l,a5 ; uncompressed title card graphics location


    move.w #$7FF,d1 ; if you're using more than the dafault number of 8x8 tiles you need to increase this number


    @LoadTitleCardGFX:


    move.w (a5)+,(a6)


    dbf d1,@LoadTitleCardGFX



    If you're using an older disassembly then I think the 'locVRAM' line will be different (I don't know what it will be though)
     
    Last edited by a moderator: Oct 24, 2010
  7. DeoxysKyogre

    DeoxysKyogre No idea what to put here .-. Member

    Joined:
    Jan 31, 2009
    Messages:
    298
    Sadly, I'm using the 2005 Sonic 1 Dissasembly. :)


    Tried to convert it to the old dissasembly:




    lea ($C00000).l,a6


    move.w #$B000,4(a6)


    lea (Nem_TitleCard).l,a5 ; uncompressed title card graphics location


    move.w #$9FF,d1 ; if you're using more than the dafault number of 8x8 tiles you need to increase this number


    @LoadTitleCardGFX:


    move.w (a5)+,(a6)


    dbf d1,@LoadTitleCardGFX



    But when I go to a level, it freezes. Why does this happen?
     
    Last edited by a moderator: Oct 24, 2010
  8. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    Because you cannot just move the location of V-ram to ($C00004) and expect it to work, you have to correctly align the data the way the VDP is set and wants, please read this first.


    Secondly, having the data uncompressed in the rom excludes the use of using the compression formats, BUT, that excludes the whole point in WHY they're used, the idea is to reduce rom space so you can fit more programming and resources into the rom, you'll find that when you have all the data uncompressed, eventually you're gonna run out of rom space to fit anything new in.
     
  9. Crash

    Crash Well-Known Member Member

    Joined:
    Jul 15, 2010
    Messages:
    302
    Location:
    Australia
    Actually, how many extra 8x8 tiles are you adding?


    This is what's in the vram in a normal rom:


    [​IMG]


    If your graphics are extending into that garbage looking area, then they're not going to work because that area is used for something other than graphics (I think).
     
  10. DeoxysKyogre

    DeoxysKyogre No idea what to put here .-. Member

    Joined:
    Jan 31, 2009
    Messages:
    298
    Or probably a solution could be modifying the NemDec code... I think


    EDIT: @Crash: I don't think VRAM could support things other than graphics :/
     
    Last edited by a moderator: Oct 25, 2010
  11. vladikcomper

    vladikcomper Well-Known Member Member

    Joined:
    Dec 2, 2009
    Messages:
    415
    The problem is that you use too much tiles for your title cards, and some of them get overwritten.


    Like Crash showed on a screenshot, title cards' tiles can only take very limited space:

    The area straight after them is used for Plane A or Plane B mappings, I don't remember exactly. This area is often updated, so last tiles from your title cards got overwritten.


    To fix this, you could load your tiles in another destination, a bit upper, where shield tiles are meant to be, then load shield and invincibility tiles when title card is over.


    Also, i think it possible to optimize your tiles a bit, there can be some similar tile sets, that can be replaced with flipped another ones. =P


    Also, if you want to access VRAM in a very simple way, like this in SVN:



    locVRAM $B000



    Just take a macro from it, it's simple. I did so, but fixed that macro a bit, so it looks like this:



    vram macro
    if (narg=1)


    move.l #($40000000+((\1&$3FFF)<<16)+((\1&$C000)>>14)),($C00004).l


    else


    move.l #($40000000+((\1&$3FFF)<<16)+((\1&$C000)>>14)),\2


    endc


    endm



    Note: macro's named "vram" here.


    Just insert it in the very beginning of sonic1.asm or create a separate file which will be included in sonic1.asm, and insert macro's code into it. And you won't have to compose complicated values.

    In fact, it supports =P


    VRAM is also used for plane mappings, sprite data and even horizontal scroll RAM.


    EDIT: grammar
     
    Last edited by a moderator: Oct 25, 2010
  12. DeoxysKyogre

    DeoxysKyogre No idea what to put here .-. Member

    Joined:
    Jan 31, 2009
    Messages:
    298
    Okay, all understood, except moving in what location the art loads using this...



    Code:
    move.l	#$70000002,&#40;$C00004&#41;.l&#59; I think $70000002 is the number we need to edit if I&#39;m not mistaken.
    
    		lea	&#40;Nem_TitleCard&#41;.l,a0&#59; load Sonic patterns
    
    		bsr.w	NemDec
    How'd it be?
     
  13. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    Wait... wait...


    Did you just outright ignore me?

    Your answer = this! Come on man! I'm trying to help here! =(
     
  14. vladikcomper

    vladikcomper Well-Known Member Member

    Joined:
    Dec 2, 2009
    Messages:
    415
    If you wonder, here is the description of that number's format: http://info.sonicretro.org/SCHG:VDP_Docume...ting_VDP_access


    Also, read VDP Questions Topic. MarkeyJester has already given you the link, but it looks like you haven't followed it.


    EDIT: MarkeyJester has already remembered you about this once more =P His post just wasn't here when I wrote these lines.


    Install the macro i gave you, so you won't need to bother about this number at all. If you want to load your code where the shield's tiles were meant to be, check out "_inc\Pattern Load Cues.asm". There, you'll see:



    ; ---------------------------------------------------------------------------
    ; Pattern load cues - standard block 2


    ; ---------------------------------------------------------------------------


    PLC_Main2: dc.w 2


    dc.l Nem_Monitors ; monitors


    dc.w $D000


    dc.l Nem_Shield ; shield


    dc.w $A820


    dc.l Nem_Stars ; invincibility stars


    dc.w $AB80



    The numeric values are raw VRAM addresses. Since you want to find new destination, you don't have to bother about $70000002 value at all. So take $A820, and place in your code:



    vram $A820,($C00004).l



    And that's it! =)


    EDIT: grammar


    EDIT2: more grammar
     
    Last edited by a moderator: Oct 25, 2010
  15. DeoxysKyogre

    DeoxysKyogre No idea what to put here .-. Member

    Joined:
    Jan 31, 2009
    Messages:
    298
    Well, it works perfectly now. Thanks, vladikcomper! Thanks, Markey! And thanks to Crash, DrHackMan, and everybody that helped me. Much appreciated.
     
  16. OrdosAlpha

    OrdosAlpha RIGHT! Naebody move! Root Admin

    Joined:
    Aug 5, 2007
    Messages:
    1,793
    Location:
    Glasgow, Scotland
    Those garbage areas to which you refer is actually the scroll, sprite and plane mapping data.


    Update: Bollocks, just noticed Vlad already mentioned this in one of his earlier posts.
     
    Last edited by a moderator: Oct 25, 2010
Thread Status:
Not open for further replies.