Sonic and Sega Retro Message Board: Debugging misaligned read/write - Sonic and Sega Retro Message Board

Jump to content

Hey there, Guest!  (Log In · Register) Help
  • 4 Pages +
  • 1
  • 2
  • 3
  • 4
    Locked
    Locked Forum

Debugging misaligned read/write Or how to get your hack to work on Regen/Kega/real hardware

#16 User is offline flamewing 

Posted 18 February 2012 - 08:14 PM

  • Elite Hacker
  • Posts: 759
  • Joined: 11-October 10
  • Gender:Male
  • Location:Brasil
  • Project:Sonic Classic Heroes; Sonic 2 Special Stage Editor; Sonic 3&K Heroes (on hold)
  • Wiki edits:12
When building with -g MAP, a file called s2.map is generated (for S2 hacks). You open it in a text editor and search for the addresses mentioned in the error screen; the map file will give you the line in s2.asm corresponding to the address in question.

#17 User is offline Chilly Willy 

Posted 18 February 2012 - 08:23 PM

  • Posts: 738
  • Joined: 10-April 09
  • Gender:Male
  • Project:Wolf3D MCD
Why do people have so much trouble with odd address errors? The "fix" is simple - find every place you have byte data (actual bytes or strings or byte arrays), and then ALWAYS follow the last one with an "even" directive. PROBLEM SOLVED. :eng101:

"But it's always an even number of bytes! I don't NEED to put an 'even' after it!!"

DO IT ANYWAY!! :argh:

#18 User is offline flamewing 

Posted 18 February 2012 - 09:05 PM

  • Elite Hacker
  • Posts: 759
  • Joined: 11-October 10
  • Gender:Male
  • Location:Brasil
  • Project:Sonic Classic Heroes; Sonic 2 Special Stage Editor; Sonic 3&K Heroes (on hold)
  • Wiki edits:12

View PostChilly Willy, on 18 February 2012 - 08:23 PM, said:

Why do people have so much trouble with odd address errors? The "fix" is simple - find every place you have byte data (actual bytes or strings or byte arrays), and then ALWAYS follow the last one with an "even" directive. PROBLEM SOLVED. :eng101:

This is more-or-less what I have been doing myself. But I still get the (increasingly less frequent) address error for other causes -- for example, the case I mentioned where an object calling DisplaySprite first and then calling DeleteObject afterwards due to its logic. Interestingly, I find that this is usually an S1 object.

#19 User is offline redhotsonic 

Posted 19 February 2012 - 06:20 AM

  • Also known as RHS
  • Posts: 1097
  • Joined: 31-January 05
  • Gender:Male
  • Location:United Kingdom
  • Project:Sonic 2 Recreation
  • Wiki edits:24

View Postflamewing, on 18 February 2012 - 08:14 PM, said:

When building with -g MAP, a file called s2.map is generated (for S2 hacks). You open it in a text editor and search for the addresses mentioned in the error screen; the map file will give you the line in s2.asm corresponding to the address in question.


I put "build -g MAP", then triggered the error, but no s2.map (or s2built.map) was created.




View PostChilly Willy, on 18 February 2012 - 08:23 PM, said:

Why do people have so much trouble with odd address errors? The "fix" is simple - find every place you have byte data (actual bytes or strings or byte arrays), and then ALWAYS follow the last one with an "even" directive. PROBLEM SOLVED. :eng101:

"But it's always an even number of bytes! I don't NEED to put an 'even' after it!!"

DO IT ANYWAY!! :argh:


I know you're meant to put it after all bytes like dc.b's and etc, but does that include all BINCLUDES and INCLUDES? Like:

; word_1E5A:
word_1E7A: BINCLUDE "art/palettes/EHZ ARZ Water.bin"; Emerald Hill/Aquatic Ruin Rotating Water palette
 even
word_1E9A: BINCLUDE "art/palettes/Hill Top Lava.bin"; Hill Top Lava palette
 even
word_1F1A: BINCLUDE "art/palettes/Wood Conveyor.bin"; Wood Conveyor Belts palette
 even
byte_1F2A: BINCLUDE "art/palettes/MTZ Cycle 1.bin"; Metropolis Cycle #1 palette
 even


Or

; word_1E5A:
word_1E7A: BINCLUDE "art/palettes/EHZ ARZ Water.bin"; Emerald Hill/Aquatic Ruin Rotating Water palette
word_1E9A: BINCLUDE "art/palettes/Hill Top Lava.bin"; Hill Top Lava palette
word_1F1A: BINCLUDE "art/palettes/Wood Conveyor.bin"; Wood Conveyor Belts palette
byte_1F2A: BINCLUDE "art/palettes/MTZ Cycle 1.bin"; Metropolis Cycle #1 palette
 even


#20 User is offline flamewing 

Posted 19 February 2012 - 07:24 AM

  • Elite Hacker
  • Posts: 759
  • Joined: 11-October 10
  • Gender:Male
  • Location:Brasil
  • Project:Sonic Classic Heroes; Sonic 2 Special Stage Editor; Sonic 3&K Heroes (on hold)
  • Wiki edits:12

View Postredhotsonic, on 19 February 2012 - 06:20 AM, said:

I put "build -g MAP", then triggered the error, but no s2.map (or s2built.map) was created.

Then you are putting it in the wrong place. Where you are supposed to put the "-g MAP" is in this line in build.bat:
"win32/asw" -xx -c -A s2.asm 

It should look like this:
"win32/asw" -xx -c -g MAP -A s2.asm 

(the line is different in the Hg disassembly, by the way)

View Postredhotsonic, on 19 February 2012 - 06:20 AM, said:

I know you're meant to put it after all bytes like dc.b's and etc, but does that include all BINCLUDES and INCLUDES? Like:

Ideally, it must also be placed after all bincludes; also, after every include that has anything other than code (but if you are paranoid, even if it only has code).
This post has been edited by flamewing: 19 February 2012 - 07:25 AM

#21 User is offline Hitaxas 

Posted 19 February 2012 - 07:41 AM

  • SEGA: Sorry Classic Sonic, we are sending you back to 1994
  • Posts: 1404
  • Joined: 30-September 07
  • Gender:Male
  • Location:Back in Litchfield,CT
  • Project:Sonic: Super Deformed (head director) - Slowly working on it.
  • Wiki edits:196
Alright. I have added this to my hack, because I think it will be vital for me to have this in the future. But I have no address errors currently, what would be a simple way to test this? (IE: cause an address error on purpose)

#22 User is offline MarkeyJester 

Posted 19 February 2012 - 07:53 AM

  • Driving The Last Spike
  • Posts: 1533
  • Joined: 22-July 08
  • Gender:Male
  • Location:Japan
  • Wiki edits:16
		ILLEGAL

Is the most common to use, you can always do stuff such as:

		movea.w	#$0001,a0
		jmp	(a0)

To cause address errors.

#23 User is offline Hitaxas 

Posted 19 February 2012 - 08:02 AM

  • SEGA: Sorry Classic Sonic, we are sending you back to 1994
  • Posts: 1404
  • Joined: 30-September 07
  • Gender:Male
  • Location:Back in Litchfield,CT
  • Project:Sonic: Super Deformed (head director) - Slowly working on it.
  • Wiki edits:196
The screen doesn't display for me when using either of those methods. I renamed everything to work with the xenowhirl 2007 version and all that. I just get a black screen, nothing more.

#24 User is offline flamewing 

Posted 19 February 2012 - 08:10 AM

  • Elite Hacker
  • Posts: 759
  • Joined: 11-October 10
  • Gender:Male
  • Location:Brasil
  • Project:Sonic Classic Heroes; Sonic 2 Special Stage Editor; Sonic 3&K Heroes (on hold)
  • Wiki edits:12
Try putting an 'even' right before the address error include.

Edit: nevermind, it can't be this.
This post has been edited by flamewing: 19 February 2012 - 08:15 AM

#25 User is offline Hitaxas 

Posted 19 February 2012 - 08:14 AM

  • SEGA: Sorry Classic Sonic, we are sending you back to 1994
  • Posts: 1404
  • Joined: 30-September 07
  • Gender:Male
  • Location:Back in Litchfield,CT
  • Project:Sonic: Super Deformed (head director) - Slowly working on it.
  • Wiki edits:196
Nevermind, I got it. I had to mess with the vdpComm and dma68kToVDP. It's all working quite nicely now. :)

#26 User is offline flamewing 

Posted 19 February 2012 - 08:15 AM

  • Elite Hacker
  • Posts: 759
  • Joined: 11-October 10
  • Gender:Male
  • Location:Brasil
  • Project:Sonic Classic Heroes; Sonic 2 Special Stage Editor; Sonic 3&K Heroes (on hold)
  • Wiki edits:12
Time now to collect everything for the 2007 disassembly into the main post.

Edit: done.
This post has been edited by flamewing: 19 February 2012 - 08:31 AM

#27 User is offline SonicVaan 

Posted 19 February 2012 - 01:47 PM

  • The probably one and only cybergoth in this community. '_'
  • Posts: 372
  • Joined: 16-May 08
  • Gender:Male
  • Location:Germany, Cologne
  • Project:Betatesting, Various hacking projects, programming synthesizers, music production
  • Wiki edits:52

View PostHitaxas, on 19 February 2012 - 08:14 AM, said:

Nevermind, I got it. I had to mess with the vdpComm and dma68kToVDP. It's all working quite nicely now. :)


Would you mind telling how you did that? I have the same problem here, only getting a black screen.

#28 User is offline flamewing 

Posted 19 February 2012 - 02:59 PM

  • Elite Hacker
  • Posts: 759
  • Joined: 11-October 10
  • Gender:Male
  • Location:Brasil
  • Project:Sonic Classic Heroes; Sonic 2 Special Stage Editor; Sonic 3&K Heroes (on hold)
  • Wiki edits:12

View PostSonicVaan, on 19 February 2012 - 01:47 PM, said:

Would you mind telling how you did that? I have the same problem here, only getting a black screen.

The first post now explains what has to be done.

#29 User is offline redhotsonic 

Posted 20 February 2012 - 06:38 AM

  • Also known as RHS
  • Posts: 1097
  • Joined: 31-January 05
  • Gender:Male
  • Location:United Kingdom
  • Project:Sonic 2 Recreation
  • Wiki edits:24
Stupid 2 questions, but does EVEN go above or below?

word_1E7A: BINCLUDE "art/palettes/EHZ ARZ Water.bin"; Emerald Hill/Aquatic Ruin Rotating Water palette
	even


OR

	even
word_1E7A: BINCLUDE "art/palettes/EHZ ARZ Water.bin"; Emerald Hill/Aquatic Ruin Rotating Water palette



Second question. There are a lot of align commands. Mainly "align 4" Then there's a few "align 100" and "align 200" and with Sonic and Tails, etc, "align $20000". Should these be replaced with even or should be left alone?

#30 User is offline Hitaxas 

Posted 20 February 2012 - 09:50 AM

  • SEGA: Sorry Classic Sonic, we are sending you back to 1994
  • Posts: 1404
  • Joined: 30-September 07
  • Gender:Male
  • Location:Back in Litchfield,CT
  • Project:Sonic: Super Deformed (head director) - Slowly working on it.
  • Wiki edits:196
Align goes above and even goes below. It does not hurt for them to be used with each other, never caused a problem for me.

  • 4 Pages +
  • 1
  • 2
  • 3
  • 4
    Locked
    Locked Forum

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users