Basic Questions and Answers Thread

Discussion in 'Discussion & Q&A' started by Malevolence, Jul 7, 2009.

  1. Samario

    Samario Newcomer Trialist

    Joined:
    Dec 19, 2013
    Messages:
    18
    Location:
    In s2.asm
    <annoyingquestion> How do I port this to S2, since there's no loc_37B6 in S2? </annoyingquestion>
     
  2. RocketRobz

    RocketRobz Coolest of TWL, and Sonic fan Member

    Joined:
    Aug 20, 2009
    Messages:
    80
    Goto the label "Level:" in S2, and below


        bsr.w    PlaySound    ; fade out music

    you will see "+" as the label instead of "loc_37B6:".
     
    Last edited by a moderator: Jan 3, 2014
  3. Devon

    Devon Down you're going... down you're going... Member

    Joined:
    Aug 26, 2013
    Messages:
    1,372
    Location:
    your mom
    I have fixed your problem, I PM'd you what you are supposed to do. It involves extending the mapping and animation limits.
     
  4. TheStoneBanana

    TheStoneBanana banana Member

    Joined:
    Nov 27, 2013
    Messages:
    602
    Location:
    The Milky Way Galaxy
    Question.

    When recently trying to fix up my code thanks to MarkeyJester's suggestion, I've come across a problem.

    I attempted to build after much trial and error, and was met with this screen:

    [​IMG]

    After I saw it, I checked my sonic1.asm to see the area of problem, and it led to the "ErrorTrap" coding.

    Thinking that, oh, I must of slipped up on something and forgot to fix it, I checked a clean Sonic 1 Hivebrain disassembly, and to my surprise, the code was exactly the same. Now, knowing that this was simply a warning, I continued on and opened the ROM in my emulator.

    It gave me a checksum error, something which shouldn't happen, considering I use "fixheadr.exe" when building my ROM.

    So, my question is, what is the explanation, and problem, behind this? :(
     
  5. fdswerty

    fdswerty Well-Known Member Member

    Joined:
    Apr 10, 2013
    Messages:
    138
    You could try to put " align $20 " behind these lines that give you the warning. I've had this bug before but I think that was the way I fixed it, if I can remember correctly.
     
  6. TheStoneBanana

    TheStoneBanana banana Member

    Joined:
    Nov 27, 2013
    Messages:
    602
    Location:
    The Milky Way Galaxy
    Now that that's fixed, what about the checksum problem?
     
  7. fdswerty

    fdswerty Well-Known Member Member

    Joined:
    Apr 10, 2013
    Messages:
    138
    Comment out or delete all the code of the checksum. It's not needed.
     
    Last edited by a moderator: Jan 4, 2014
  8. TheStoneBanana

    TheStoneBanana banana Member

    Joined:
    Nov 27, 2013
    Messages:
    602
    Location:
    The Milky Way Galaxy
    o.o

    I booted the ROM, and all of the GHZ art is garbled.

    You sure I don't need the checksum?
     
  9. fdswerty

    fdswerty Well-Known Member Member

    Joined:
    Apr 10, 2013
    Messages:
    138
    Yeah, I'm sure that the checksum isn't needed, as I've removed it out of my hack. Now, regarding the GHZ art, I'm unsure why it is garbled, you've probably edited something of it and I can't help out in this. Try restoring its art.
     
    BTW, all you had to comment out was this, so your checksum code should have looked like this:


    CheckSumCheck:
    ;        movea.l    #ErrorTrap,a0    ; start    checking bytes after the header    ($200)
    ;        movea.l    #RomEndLoc,a1    ; stop at end of ROM
    ;        move.l    (a1),d0
    ;        moveq    #0,d1
    ;
    ;loc_32C:
    ;        add.w    (a0)+,d1
    ;        cmp.l    a0,d0
    ;        bcc.s    loc_32C
    ;        movea.l    #Checksum,a1    ; read the checksum
    ;        cmp.w    (a1),d1        ; compare correct checksum to the one in ROM
    ;        bne.w    CheckSumError    ; if they don't match, branch
             lea    ($FFFFFE00).w,a6
             moveq    #0,d7
             move.w    #$7F,d6
    EDIT: Oh and too, is the art for the other zones garbled too?
     
    Last edited by a moderator: Jan 4, 2014
  10. TheStoneBanana

    TheStoneBanana banana Member

    Joined:
    Nov 27, 2013
    Messages:
    602
    Location:
    The Milky Way Galaxy
    Yeah, I got that part, but, I haven't modded GHZ in any way, shape, or form.

    I've been, for the most part, just porting Tails over. :
     
  11. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    All instructions of the 68k need to start on an even address as the 68k cannot process word or long-word instructions/data on odd addresses.

    In the original Sonic The Hedgehog game, the header data of the ROM is exactly 200 bytes (hex), with that "nop" instruction being at offset 000200. The fact that the assembler is warning you the instruction is on an odd address, means that it is no longer at offset 000200, which means the header data has been altered in such a way that it is either larger than before, or smaller than before.

    The header doesn't necessarily need to be 200 bytes (hex), and it doesn't necessarily need to be set out the same. Only certain aspects are required, such as the "SEGA" text for the console name. However, since you don't know much about the header, it is recommended that you keep it the same size, with more or less the same details (with exception to the title name change, copyright and perhaps a few other straight forward pieces of information.

    Chances are, you've changed maybe the game title name, but when you did, you didn't keep the string length the same, for example:

    dc.b 'SONIC THE HEDGEHOG 'Changed to:
    Code:
    		dc.b	'Sonic New Hack Name Here Edition                   '
    Notice how the string contains more space characters on the end than it did before, now making the string an extra 3 bytes bigger. This makes the header now 203 bytes big, with the nop starting at offset 000203, i.e. an odd address.
    Changes to the header data may have effects on the game itself.

    As for the check-sum, I recommend keeping it in.
     
    Last edited by a moderator: Jan 4, 2014
  12. TheStoneBanana

    TheStoneBanana banana Member

    Joined:
    Nov 27, 2013
    Messages:
    602
    Location:
    The Milky Way Galaxy
    Alright, fair enough, but what do I do about the Checksum Error, since it's not fixing itself during building?
     
  13. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    Is the ROM size even?
     
  14. TheStoneBanana

    TheStoneBanana banana Member

    Joined:
    Nov 27, 2013
    Messages:
    602
    Location:
    The Milky Way Galaxy
    Yep. A nice 1,024 KB.
     
  15. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    What check-sum value is inside the header of your newly built ROM? Additionally, have you tampered with the check-sum routine at all? I know the check-sum routine reads the end ROM address from the header to determine how many words it should sum up. If your header has been tampered with in such a way that it can no longer obtain the end address correctly, or the end address is wrong, then obviously, it's gonna add up to a different word value.

    Perhaps you should paste your header and check-sum code here so we can take a look?
     
  16. TheStoneBanana

    TheStoneBanana banana Member

    Joined:
    Nov 27, 2013
    Messages:
    602
    Location:
    The Milky Way Galaxy
    Here you go.


    Console: dc.b 'SEGA GENESIS ' ; Hardware system ID
    Date: dc.b 'THESTONEBANANA 20??.???' ; Release date
    Title_Local: dc.b 'SONIC THE HEDGEHOG ' ; Domestic name
    Title_Int: dc.b 'TAILS UNDECIDED TITLE ' ; International name
    Serial: dc.b 'GM 00001009-00' ; Serial/version number
    Checksum: dc.w 0
    dc.b 'J ' ; I/O support
    RomStartLoc: dc.l StartOfRom ; ROM start
    RomEndLoc: dc.l EndOfRom-1 ; ROM end
    RamStartLoc: dc.l $FF0000 ; RAM start
    RamEndLoc: dc.l $FFFFFF ; RAM end
    SRAMSupport: dc.l $20202020 ; change to $5241E020 to create SRAM
    dc.l $20202020 ; SRAM start
    dc.l $20202020 ; SRAM end
    Notes: dc.b 'UNOFFICAL SONIC THE HEDGEHOG ASM GAME MODIFICATION BY THESTONEBANANA'
    Region: dc.b 'JUE ' ; Region


    And I took advantage of the unused note section of the header, so I understood why there were some problems that are nonexistent now.
     
  17. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    There's your problem.

    'THESTONEBANANA 20??.???'And
    Code:
    'TAILS UNDECIDED TITLE                       '
    And
    Code:
    'UNOFFICAL SONIC THE HEDGEHOG ASM GAME MODIFICATION BY THESTONEBANANA'
    They are all, longer or shorter than the original. The program that writes the correct check-sum value into your ROM after it is built, expects to put the value into the ROM at offset 00018E, but you're copyright date and title names are incorrect sizes, so the offset of your check-sum storage space is not 00018E.
    The program will put the value at 00018E anyway, and your check-sum routine will read the check-sum from a different location in the header.

    Like I said a few posts ago:

    Ensure the size of the string is the same as the original.

    • Your copyright data string should be 16 decimal characters long.
    • Your title name string should be 48 decimal characters long.
    • Your notes section should be 52 decimal characters long. (You might get away with this one though)
     
    Last edited by a moderator: Jan 5, 2014
  18. TheStoneBanana

    TheStoneBanana banana Member

    Joined:
    Nov 27, 2013
    Messages:
    602
    Location:
    The Milky Way Galaxy
    Alright. Sorry for the hassle, Markey.
     
  19. MarkeyJester

    MarkeyJester ♡ ! Member

    Joined:
    Jun 27, 2009
    Messages:
    2,867
    It's no hassle. If it were, I wouldn't have bothered responding ;{P
     
    Last edited by a moderator: Jan 5, 2014
  20. TheStoneBanana

    TheStoneBanana banana Member

    Joined:
    Nov 27, 2013
    Messages:
    602
    Location:
    The Milky Way Galaxy
    Also, not to bug, but while this is active, what do you suggest about the scrambled GHZ?

    EDIT: Now, everything's garbled, but its playable. Still, what's happening here?
     
    Last edited by a moderator: Jan 5, 2014