Sonic and Sega Retro Message Board: Sonic 1 Disassembly - Sonic and Sega Retro Message Board

Jump to content

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

Sonic 1 Disassembly

#1 User is offline Hivebrain 

Posted 25 December 2008 - 07:40 PM

  • Posts: 2733
  • Joined: 15-January 03
  • Gender:Male
  • Location:53.4N, 1.5W
  • Project:HivePal 2.0
  • Wiki edits:6,176
Discuss changes here, particularly controversial changes. The disassembly builds a ROM which is almost identical to the original ROM. There is one instruction that had to be changed. It may be possible to correct this now that we're using asm68k.

Here's a brief to-do list:
- Split some more stuff.
- Use more local labels in objects that don't have them.
- Do text search for "loc_" and "locret_" and rename them better.
- Use ids instead of object numbers, level numbers and game modes.
- Implement ids in all files (already done for sonic.asm).
- Macros for angle/trig object stuff.
- Merge obRange and obRanges macros.
- Add JP1 files with 0/1 variable to switch between them.

#2 User is offline Oerg866 

Posted 25 December 2008 - 08:43 PM

  • Posts: 1767
  • Joined: 07-September 06
  • Gender:Male
  • Location:Frankfurt, Germany
  • Wiki edits:3
Mind telling what this instruction was?

#3 User is offline drx 

Posted 25 December 2008 - 08:48 PM

  • <Shade> fuck MJ
  • Posts: 2171
  • Joined: 02-March 04
  • Gender:Male
  • Project::rolleyes:
  • Wiki edits:8
I'm guessing exg d0,d1

#4 User is offline Hivebrain 

Posted 25 December 2008 - 08:50 PM

  • Posts: 2733
  • Joined: 15-January 03
  • Gender:Male
  • Location:53.4N, 1.5W
  • Project:HivePal 2.0
  • Wiki edits:6,176
Line 133 in "_incObj\85 Boss - Final.asm"

Syntax Highlighted Code: ASM
[color= #00bfff;]exg[/color]	d0,d1


Swapping d0 and d1 has no effect on the output ROM.

#5 User is offline Sik 

Posted 26 December 2008 - 01:27 AM

  • Sik is pronounced as "seek", not as "sick".
  • Posts: 6719
  • Joined: 17-March 06
  • Gender:Male
  • Project:being an asshole =P
  • Wiki edits:11
...

What the hell was rejecting that instruction? o_o;

#6 User is offline nineko 

Posted 26 December 2008 - 04:12 AM

  • I am the Holy Cat
  • Posts: 5648
  • Joined: 17-August 06
  • Gender:Male
  • Location:italy
  • Project:I... don't even know anymore :U
  • Wiki edits:5,251
Maybe I'm using an outdated disassembly so I don't know if this has been fixed, but right after Title_LoadText there is this line:
move.w	#0,($FFFFFFF0).w; disable debug mode
The comment is misleading, it should read "disable DEMO mode".
I'll post more if I find them.

#7 User is offline drx 

Posted 26 December 2008 - 04:49 PM

  • <Shade> fuck MJ
  • Posts: 2171
  • Joined: 02-March 04
  • Gender:Male
  • Project::rolleyes:
  • Wiki edits:8

View PostSik, on Dec 26 2008, 07:27 AM, said:

...

What the hell was rejecting that instruction? o_o;


Assemblers tend to assemble exg d1,d0 into exg d0,d1. While those instructions do (almost) exactly the same, they have different opcodes.

#8 User is offline Hivebrain 

Posted 27 December 2008 - 04:13 PM

  • Posts: 2733
  • Joined: 15-January 03
  • Gender:Male
  • Location:53.4N, 1.5W
  • Project:HivePal 2.0
  • Wiki edits:6,176
Object ids are defined in "_inc\Object Pointers.asm". I've used them in sonic.asm, but they still need adding to all the smaller asm files where relevant.

Could exg be redefined with a macro?

#9 User is offline FraGag 

Posted 28 December 2008 - 06:25 PM

  • Posts: 659
  • Joined: 09-January 08
  • Gender:Male
  • Location:Qu├ębec, Canada
  • Project:an assembler
  • Wiki edits:6
Thanks, I've been waiting for this for a while! I'll have to get used to your naming convention before I get started though. Speaking of which, we should decide whether we take your names or Xenowhirl's for Sonic 2, to make porting code between both games easier.

#10 User is offline Sik 

Posted 29 December 2008 - 04:58 PM

  • Sik is pronounced as "seek", not as "sick".
  • Posts: 6719
  • Joined: 17-March 06
  • Gender:Male
  • Project:being an asshole =P
  • Wiki edits:11

View Postdrx, on Dec 26 2008, 07:49 PM, said:

View PostSik, on Dec 26 2008, 07:27 AM, said:

...

What the hell was rejecting that instruction? o_o;

Assemblers tend to assemble exg d1,d0 into exg d0,d1. While those instructions do (almost) exactly the same, they have different opcodes.

So basically assembler developers love to make their life harder? Because implementing such a behaviour requires extra code, in fact >_>

#11 User is offline Overlord 

Posted 29 December 2008 - 08:13 PM

  • Substitute Meerkovo IT Chief
  • Posts: 17029
  • Joined: 12-January 03
  • Gender:Male
  • Location:Berkshire, England
  • Project:VGDB
  • Wiki edits:3,204

View PostSik, on Dec 29 2008, 09:58 PM, said:

View Postdrx, on Dec 26 2008, 07:49 PM, said:

View PostSik, on Dec 26 2008, 07:27 AM, said:

...

What the hell was rejecting that instruction? o_o;

Assemblers tend to assemble exg d1,d0 into exg d0,d1. While those instructions do (almost) exactly the same, they have different opcodes.

So basically assembler developers love to make their life harder? Because implementing such a behaviour requires extra code, in fact >_>

For anyone still coding in assembly today voluntarily, that's probably true, to be honest =P

Note I said voluntarily, before the legions of hack coders jump on me.

#12 User is offline Sik 

Posted 30 December 2008 - 09:31 AM

  • Sik is pronounced as "seek", not as "sick".
  • Posts: 6719
  • Joined: 17-March 06
  • Gender:Male
  • Project:being an asshole =P
  • Wiki edits:11

View PostOverlord, on Dec 29 2008, 11:13 PM, said:

Note I said voluntarily, before the legions of hack coders jump on me.

And OS developers.

Besides when proramming for very old (and hence slow) hardware trying to achieve for full speed, assembly is the only option. Now, if you try to do that with new hardware...

#13 User is offline Overlord 

Posted 30 December 2008 - 09:10 PM

  • Substitute Meerkovo IT Chief
  • Posts: 17029
  • Joined: 12-January 03
  • Gender:Male
  • Location:Berkshire, England
  • Project:VGDB
  • Wiki edits:3,204

View PostSik, on Dec 30 2008, 02:31 PM, said:

View PostOverlord, on Dec 29 2008, 11:13 PM, said:

Note I said voluntarily, before the legions of hack coders jump on me.

And OS developers.

I thought most of modern-day OSes were written in C now?

Quote

Besides when proramming for very old (and hence slow) hardware trying to achieve for full speed, assembly is the only option. Now, if you try to do that with new hardware...

You're quite correct on the first sentence. The second - it's a bit ehhh. It's like Gentoo users who compile every app for their system - sure, it'll go faster, but is an app starting in 0.98 seconds really noticable over 1.0?

#14 User is offline Delta 

Posted 31 December 2008 - 03:51 AM

  • Posts: 367
  • Joined: 11-January 03
  • Gender:Male
  • Location:California
  • Wiki edits:47

View PostOverlord, on Dec 30 2008, 06:10 PM, said:

View PostSik, on Dec 30 2008, 02:31 PM, said:

View PostOverlord, on Dec 29 2008, 11:13 PM, said:

Note I said voluntarily, before the legions of hack coders jump on me.

And OS developers.

I thought most of modern-day OSes were written in C now?

Ideally most of it would be written in C. However, at the very lowest levels of the OS, you'd eventually have to get into assembly because you simply can't directly interact with hardware in the same way you can with assembly. That said, you can create a higher-level C interface over some nitty-gritty asm and have the vast majority of the OS written in C/C++.

Not that I'm an expert on OS design or anything, but that's how I understand it. :P

Semi on-topicness: One of these days I should get into Genesis programming and 68k asm, and create/hack something awesome. Just that I'm already doing a ton of other stuff.

I do love all the work that's gone into Sonic disassemblies; I can almost understand it, even without extensive knowledge of assembly.

#15 User is offline Sik 

Posted 01 January 2009 - 02:17 AM

  • Sik is pronounced as "seek", not as "sick".
  • Posts: 6719
  • Joined: 17-March 06
  • Gender:Male
  • Project:being an asshole =P
  • Wiki edits:11

View PostDelta, on Dec 31 2008, 06:51 AM, said:

View PostOverlord, on Dec 30 2008, 06:10 PM, said:

View PostSik, on Dec 30 2008, 02:31 PM, said:

View PostOverlord, on Dec 29 2008, 11:13 PM, said:

Note I said voluntarily, before the legions of hack coders jump on me.

And OS developers.

I thought most of modern-day OSes were written in C now?

Ideally most of it would be written in C. However, at the very lowest levels of the OS, you'd eventually have to get into assembly because you simply can't directly interact with hardware in the same way you can with assembly. That said, you can create a higher-level C interface over some nitty-gritty asm and have the vast majority of the OS written in C/C++.

This. No matter what, some things are very processor specific, and those things have to be done in assembler because they aren't featured in any high-level language. They're often wrapped into functions, indeed, but still you need to use assembly, unless you're so crazy you create your own high-level language exclusively for the operating system. But then you're using assembly for the compiler, unless you're even crazier and compile directly into machine language X_X

View PostOverlord, on Dec 31 2008, 12:10 AM, said:

Quote

Besides when proramming for very old (and hence slow) hardware trying to achieve for full speed, assembly is the only option. Now, if you try to do that with new hardware...

You're quite correct on the first sentence. The second - it's a bit ehhh. It's like Gentoo users who compile every app for their system - sure, it'll go faster, but is an app starting in 0.98 seconds really noticable over 1.0?

More to my point. There's little point programming in assembly for new hardware both because most likely it won't be noticeable, and actually there are so many different types of technology that what speeds up in one processor may slow down horribly in another one - even if newer. Sometimes it may even hurt (using RDTSC for timing fails miserably in any kind of multiprocessor or multicore enviroment). So no.

  • 5 Pages +
  • 1
  • 2
  • 3
  • Last ►
    Locked
    Locked Forum

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