Sonic and Sega Retro Message Board: Megadrive First Person Effect in Toy Story Video Game - Sonic and Sega Retro Message Board

Jump to content

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

Megadrive First Person Effect in Toy Story Video Game

#16 User is offline Neo 

Posted 14 September 2017 - 09:00 PM

  • Clackerjack
  • Posts: 1360
  • Joined: 10-December 04
  • Gender:Male
  • Location:Portugal
  • Project:Sonic 3 Unlocked
  • Wiki edits:1
Of course it helps to look at the actual code before passing judgment.

The function responsible for drawing the 3D stage appears to be at $77C74. The expanded macro code is at the very end of the ROM.

ROM:003E0796                 move.b  0(a0),0(a1)
ROM:003E079C                 move.b  3(a0),4(a1)
ROM:003E07A2                 move.b  6(a0),8(a1)
ROM:003E07A8                 move.b  9(a0),$C(a1)
ROM:003E07AE                 move.b  $C(a0),$10(a1)
ROM:003E07B4                 move.b  $F(a0),$14(a1)
ROM:003E07BA                 move.b  $13(a0),$18(a1)
ROM:003E07C0                 move.b  $16(a0),$1C(a1)
ROM:003E07C6                 move.b  $19(a0),$20(a1)
ROM:003E07CC                 move.b  $1C(a0),$24(a1)
ROM:003E07D2                 rts

For the first few passes which skip pixels from the source texture, direct offsets are applied to a0.

ROM:003E3634                 move.b  (a0)+,0(a1)
ROM:003E3638                 move.b  (a0)+,4(a1)
ROM:003E363C                 move.b  (a0)+,8(a1)
ROM:003E3640                 move.b  (a0)+,$C(a1)
ROM:003E3644                 move.b  (a0)+,$10(a1)
ROM:003E3648                 move.b  (a0)+,$14(a1)
ROM:003E364C                 move.b  (a0)+,$18(a1)
ROM:003E3650                 move.b  (a0)+,$1C(a1)
ROM:003E3654                 move.b  (a0)+,$20(a1)
ROM:003E3658                 move.b  (a0)+,$24(a1)
ROM:003E365C                 move.b  (a0)+,$28(a1)
ROM:003E3660                 move.b  (a0)+,$2C(a1)
ROM:003E3664                 move.b  (a0)+,$30(a1)
ROM:003E3668                 move.b  (a0)+,$34(a1)
ROM:003E366C                 move.b  (a0)+,$38(a1)
ROM:003E3670                 move.b  (a0)+,$3C(a1)
ROM:003E3674                 move.b  (a0)+,$40(a1)
ROM:003E3678                 move.b  (a0)+,$44(a1)
ROM:003E367C                 move.b  (a0)+,$48(a1)
ROM:003E3680                 move.b  (a0)+,$4C(a1)
ROM:003E3684                 move.b  (a0)+,$50(a1)
ROM:003E3688                 move.b  (a0)+,$54(a1)
ROM:003E368C                 move.b  (a0)+,$58(a1)
ROM:003E3690                 move.b  (a0)+,$5C(a1)
ROM:003E3694                 move.b  (a0)+,$60(a1)
ROM:003E3698                 move.b  (a0)+,$64(a1)
ROM:003E369C                 move.b  (a0)+,$68(a1)
ROM:003E36A0                 move.b  (a0)+,$6C(a1)
ROM:003E36A4                 move.b  (a0)+,$70(a1)
ROM:003E36A8                 move.b  (a0)+,$74(a1)
ROM:003E36AC                 move.b  (a0)+,$78(a1)
ROM:003E36B0                 move.b  (a0)+,$7C(a1)
ROM:003E36B4                 move.b  (a0)+,$80(a1)
ROM:003E36B8                 move.b  (a0)+,$84(a1)
ROM:003E36BC                 move.b  (a0)+,$88(a1)
ROM:003E36C0                 move.b  (a0)+,$8C(a1)
ROM:003E36C4                 move.b  (a0)+,$90(a1)
ROM:003E36C8                 move.b  (a0)+,$94(a1)
ROM:003E36CC                 move.b  (a0)+,$98(a1)
ROM:003E36D0                 move.b  (a0)+,$9C(a1)
ROM:003E36D4                 move.b  (a0)+,$A0(a1)
ROM:003E36D8                 move.b  (a0)+,$A4(a1)
ROM:003E36DC                 move.b  (a0)+,$A8(a1)
ROM:003E36E0                 move.b  (a0)+,$AC(a1)
ROM:003E36E4                 move.b  (a0)+,$B0(a1)
ROM:003E36E8                 move.b  (a0)+,$B4(a1)
ROM:003E36EC                 move.b  (a0)+,$B8(a1)
ROM:003E36F0                 move.b  (a0)+,$BC(a1)
ROM:003E36F4                 move.b  (a0)+,$C0(a1)
ROM:003E36F8                 move.b  (a0)+,$C4(a1)
ROM:003E36FC                 move.b  (a0)+,$C8(a1)
ROM:003E3700                 move.b  (a0)+,$CC(a1)
ROM:003E3704                 move.b  (a0)+,$D0(a1)
ROM:003E3708                 move.b  (a0)+,$D4(a1)
ROM:003E370C                 move.b  (a0)+,$D8(a1)
ROM:003E3710                 move.b  (a0)+,$DC(a1)
ROM:003E3714                 move.b  (a0)+,$E0(a1)
ROM:003E3718                 move.b  (a0)+,$E4(a1)
ROM:003E371C                 move.b  (a0)+,$E8(a1)
ROM:003E3720                 move.b  (a0)+,$EC(a1)
ROM:003E3724                 move.b  (a0)+,$F0(a1)
ROM:003E3728                 move.b  (a0)+,$F4(a1)
ROM:003E372C                 move.b  (a0)+,$F8(a1)
ROM:003E3730                 move.b  (a0)+,$FC(a1)
ROM:003E3734                 rts

In the first pass where all the pixels from the source texture are read, autoincrement is used.

ROM:003E677C                 move.b  (a0),0(a1)
ROM:003E6780                 move.b  (a0)+,4(a1)
ROM:003E6784                 move.b  (a0),8(a1)
ROM:003E6788                 move.b  (a0)+,$C(a1)
ROM:003E678C                 move.b  (a0),$10(a1)
ROM:003E6790                 move.b  (a0)+,$14(a1)
ROM:003E6794                 move.b  (a0)+,$18(a1)
ROM:003E6798                 move.b  (a0),$1C(a1)
ROM:003E679C                 move.b  (a0)+,$20(a1)
ROM:003E67A0                 move.b  (a0),$24(a1)
ROM:003E67A4                 move.b  (a0)+,$28(a1)
ROM:003E67A8                 move.b  (a0)+,$2C(a1)
ROM:003E67AC                 move.b  (a0),$30(a1)
ROM:003E67B0                 move.b  (a0)+,$34(a1)
ROM:003E67B4                 move.b  (a0),$38(a1)
ROM:003E67B8                 move.b  (a0)+,$3C(a1)
ROM:003E67BC                 move.b  (a0)+,$40(a1)
ROM:003E67C0                 move.b  (a0),$44(a1)
ROM:003E67C4                 move.b  (a0)+,$48(a1)
ROM:003E67C8                 move.b  (a0),$4C(a1)
ROM:003E67CC                 move.b  (a0)+,$50(a1)
ROM:003E67D0                 move.b  (a0),$54(a1)
ROM:003E67D4                 move.b  (a0)+,$58(a1)
ROM:003E67D8                 move.b  (a0)+,$5C(a1)
ROM:003E67DC                 move.b  (a0),$60(a1)
ROM:003E67E0                 move.b  (a0)+,$64(a1)
ROM:003E67E4                 move.b  (a0),$68(a1)
ROM:003E67E8                 move.b  (a0)+,$6C(a1)
ROM:003E67EC                 move.b  (a0)+,$70(a1)
ROM:003E67F0                 move.b  (a0),$74(a1)
ROM:003E67F4                 move.b  (a0)+,$78(a1)
ROM:003E67F8                 move.b  (a0),$7C(a1)
ROM:003E67FC                 move.b  (a0)+,$80(a1)
ROM:003E6800                 move.b  (a0)+,$84(a1)
ROM:003E6804                 move.b  (a0),$88(a1)
ROM:003E6808                 move.b  (a0)+,$8C(a1)
ROM:003E680C                 move.b  (a0),$90(a1)
ROM:003E6810                 move.b  (a0)+,$94(a1)
ROM:003E6814                 move.b  (a0)+,$98(a1)
ROM:003E6818                 move.b  (a0),$9C(a1)
ROM:003E681C                 move.b  (a0)+,$A0(a1)
ROM:003E6820                 move.b  (a0),$A4(a1)
ROM:003E6824                 move.b  (a0)+,$A8(a1)
ROM:003E6828                 move.b  (a0),$AC(a1)
ROM:003E682C                 move.b  (a0)+,$B0(a1)
ROM:003E6830                 move.b  (a0)+,$B4(a1)
ROM:003E6834                 move.b  (a0),$B8(a1)
ROM:003E6838                 move.b  (a0)+,$BC(a1)
ROM:003E683C                 move.b  (a0),$C0(a1)
ROM:003E6840                 move.b  (a0)+,$C4(a1)
ROM:003E6844                 move.b  (a0)+,$C8(a1)
ROM:003E6848                 move.b  (a0),$CC(a1)
ROM:003E684C                 move.b  (a0)+,$D0(a1)
ROM:003E6850                 move.b  (a0),$D4(a1)
ROM:003E6854                 move.b  (a0)+,$D8(a1)
ROM:003E6858                 move.b  (a0)+,$DC(a1)
ROM:003E685C                 move.b  (a0),$E0(a1)
ROM:003E6860                 move.b  (a0)+,$E4(a1)
ROM:003E6864                 move.b  (a0),$E8(a1)
ROM:003E6868                 move.b  (a0)+,$EC(a1)
ROM:003E686C                 move.b  (a0),$F0(a1)
ROM:003E6870                 move.b  (a0)+,$F4(a1)
ROM:003E6874                 move.b  (a0)+,$F8(a1)
ROM:003E6878                 move.b  (a0),$FC(a1)
ROM:003E687C                 move.b  (a0)+,$100(a1)
ROM:003E6880                 move.b  (a0),$104(a1)
ROM:003E6884                 move.b  (a0)+,$108(a1)
ROM:003E6888                 move.b  (a0)+,$10C(a1)
ROM:003E688C                 move.b  (a0),$110(a1)
ROM:003E6890                 move.b  (a0)+,$114(a1)
ROM:003E6894                 move.b  (a0),$118(a1)
ROM:003E6898                 move.b  (a0)+,$11C(a1)
ROM:003E689C                 rts

For the passes where source pixels are duplicated, the macro generated a pattern of increment and non-increment operations.

Also, the screen is mirrored by writing the same nine rows twice to the Plane A pattern table, except the first nine are in reverse order and with the V flip bit set. That's not really what I was expecting but then again, I dunno what I was expecting.

#17 User is offline flamewing 

Posted 15 September 2017 - 04:09 AM

  • Emerald Hunter
  • Posts: 1137
  • Joined: 11-October 10
  • Gender:Male
  • Location:🇫🇷 France
  • Project:Sonic Classic Heroes; Sonic 2 Special Stage Editor; Sonic 3&K Heroes (on hold)
  • Wiki edits:12
That is pretty much what I expected to see, to be honest; I have also written macros to generate exactly this kind of code for Natsumi (before dumping to macros and writing a program that does the same thing, because the macros took minutes to assemble in modern hardware).

I think I will disassemble those portions of the game because I am interested in how they dealt with the bandwidth issue I mentioned.

#18 User is offline MarkeyJester 

Posted 15 September 2017 - 05:41 AM

  • The architect of the universe, didn't build a stairway, leading nowhere.
  • Posts: 1844
  • Joined: 22-July 08
  • Gender:Male
  • Location:Japan
  • Wiki edits:16

View PostNeo, on 14 September 2017 - 09:00 PM, said:

Of course it helps to look at the actual code before passing judgment.

I did look at the code, in fact, if you read my comment on that very video that was linked, you would've seen:


By all means, I don't just have an understanding of 68k, I have a thorough understanding of the Mega Drive's VDP too. I was led to believe the same though, that you dumbed down the logic just to help explain it, in fact, I was told by a friend that this may be the case, in the end, she encouraged me to disassemble Toy Story to varify.

Unfortunately, indeed, you could've optimised:

ROM:003E403E move.b 0(a0),0(a1)
ROM:003E4044 move.b 1(a0),4(a1)
ROM:003E404A move.b 2(a0),8(a1)
ROM:003E4050 move.b 3(a0),$C(a1)
ROM:003E4056 move.b 4(a0),$10(a1)
ROM:003E405C move.b 5(a0),$14(a1)
ROM:003E4062 move.b 6(a0),$18(a1)
ROM:003E4068 move.b 7(a0),$1C(a1)
ROM:003E406E move.b 8(a0),$20(a1)
ROM:003E4074 move.b 9(a0),$24(a1)

This is related to the wall rendering, of which could've been auto-incremented, but wasn't. There was a copy of this below which did have the auto-increment, but the CPU ran through this code and other non-auto increments.

I would like to apologise though, I didn't mean to come off so negative in my response, nor did I mean to put any negative impact to the work you guys put in, you did an outstanding job! Truely wonderful work, I was just quite shocked and taken off guard, I honestly didn't expect a lack of auto-increment in your code. That's all. I hope I haven't offended anyone, and if so, my apologies entirely...

I did look at the code, and I did also mention that I did notice increment versions below. I did do my research, thank you very much.

I did also note that I made a comment on the video in this thread, and that he responded to it:

View PostMarkeyJester, on 14 September 2017 - 01:50 PM, said:

GameHut responded to my comment, claims the code was generated by a macro, hence the lack of increment.

It often helps to read the thread before passing judgement.

...being serious though, everything to aside, you didn't need to be rude about it =(
This post has been edited by MarkeyJester: 15 September 2017 - 06:20 AM

#19 User is offline nineko 

Posted 15 September 2017 - 05:48 AM

  • I am the Holy Cat
  • Posts: 5636
  • Joined: 17-August 06
  • Gender:Male
  • Location:italy
  • Project:I... don't even know anymore :U
  • Wiki edits:5,251
Since you guys are disassembly Toy Story, make sure to extract the MOD player while that you're at it, it would make for awesome title screens in hacks :U
This post has been edited by nineko: 15 September 2017 - 05:52 AM

#20 User is offline Neo 

Posted 15 September 2017 - 08:12 AM

  • Clackerjack
  • Posts: 1360
  • Joined: 10-December 04
  • Gender:Male
  • Location:Portugal
  • Project:Sonic 3 Unlocked
  • Wiki edits:1

View PostMarkeyJester, on 15 September 2017 - 05:41 AM, said:

I did look at the code, in fact, if you read my comment on that very video that was linked

I didn't see your full reply, thanks to YouTube's shitty comment system showing me a "View all replies" link, which doesn't look like a link, but at least has a chevron next to it, except then each individual reply has a "Read more" link, which also doesn't look like a link, this time without the chevron. Stellar web design.

If I knew you had already looked at code, I wouldn't have stayed up until 3 AM disassembling it myself. Why didn't you post the code here?

View PostMarkeyJester, on 15 September 2017 - 05:41 AM, said:

It often helps to read the thread before passing judgement.

Markey, be reasonable. You were the one to raise an eyebrow, and to transcribe the obviously inaccurate code from the YouTube video. From there, what I saw was a full page of baseless speculation without one single person checking if the code in the video was accurate to the one in the ROM. If you thought there was something fishy about it, and had the motivation to disassemble the ROM to figure out what was going on, then how come didn't you do that vital research before you brought up the subject?

I don't think I was rude, nor did I single you out. I was just commenting on the fact that somehow we ended up with a full page discussing the post-increment operator in C/C++ without anyone touching the actual 68k code. I now realize that was an incorrect observation, but I didn't know it at the time of my post.

#21 User is offline MarkeyJester 

Posted 15 September 2017 - 08:40 AM

  • The architect of the universe, didn't build a stairway, leading nowhere.
  • Posts: 1844
  • Joined: 22-July 08
  • Gender:Male
  • Location:Japan
  • Wiki edits:16
Fair points, I guess I should've shared it here too, you're right about YouTube's poor site design... I've had quite a lot going on lately, so it wasn't exactly something that occurred to me at the time.

As for not researching when I initially found it fishy, well, being honest, I wasn't intending on disassembling it at all, in fact, I actually have no interest in the effect at all as far as research goes, it's a nice cool effect, but I just don't find it to be that interesting enough to want to delve into it. I simply brought the question up since no-one else even remotely mentioned it on YouTube, not one person questioned. I was hoping to ask the question, and hope I got a response that would satisfy my curiosity. The only reason I bothered to disassemble to verify, was because I was encouraged to do so by Natsumi, otherwise I wouldn't have bothered and would've left the question as is, and not gotten involved at all. You're right that I could've gone about it better, but I really didn't want to disassemble it just to answer a question that lingered on my mind, but ended up doing that anyway, and feel like I've wasted time in the process.

I will apologise though for creating a rather wedge in the situation. But, to be fair, if I hadn't have questioned it the way I did, you guys probably wouldn't be ripping and sharing parts of it here d= Not that it's any excuse, but I'm sticking with that >=3

  • 2 Pages +
  • 1
  • 2
    Locked Forum

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