PPC603e division by zero

Technical discussion for those interested in Supermodel development and Model 3 reverse engineering. Prospective contributors welcome.
Forum rules
Keep it classy!

  • No ROM requests or links.
  • Do not ask to be a play tester.
  • Do not ask about release dates.
  • No drama!

Re: PPC603e division by zero

Postby Ian » Wed Feb 15, 2017 2:19 pm

Bart wrote:I recall the Real3D documentation implying that the device could be locked to certain frame rates but it isn't clear how this is achieved. You would think that it would take as much time as it needed to render, with the onus being on the programmer to ensure the scene database isn't too complex to render in 1/60th of a second.

The tilegen is definitely synced to vsync. That is to say, there is definitely an IRQ that is fired at every vblank. But the game can time itself in a number of different ways. It's a tricky problem...

Overload mode. Definitely strange by modern standards ..
According to docs the renderer would switch to lower LOD models, or worst case discard geometry.

I tried messing with the status bit to change the timing, but it made no difference to mag truck :(
Posts: 1434
Joined: Tue Feb 23, 2016 9:23 am

Re: PPC603e division by zero

Postby Bart » Wed Feb 22, 2017 10:12 pm

During the initial, working phase of the attract mode, the values written to the pairs of variables I found are different:

Code: Select all
24f424+0 = 442eff63     @ pc=00019e60, lr=00019e44
24f424+8 = c4a5b1c7     @ pc=00019e68, lr=00019e44
24f424+c = 4415b7aa     @ pc=0001a168, lr=0001a124
24f424+14 = c48080c4    @ pc=0001a1f8, lr=0001a124

Remember that offset 0 pairs with offset 0xc, and 8 with 0x14.

The trouble starts immediately at the next 3D sequence (after the Sega logo):

Code: Select all
24f424+0 = 4412402c     @ pc=00019e60, lr=00019e44
24f424+8 = c4643abc     @ pc=00019e68, lr=00019e44
24f424+c = 4412402c     @ pc=0001a168, lr=0001a124
24f424+14 = c4643abc    @ pc=0001a1f8, lr=0001a124

Need to figure out what the functions that populate these values are doing and when they get called. They are only called once per frame, however.

Looks to me like both pairs of writes happen inside a gigantic subroutine at 0x19c40. It's virtually impossible to figure out what this is supposed to be doing at first glance. The routine is called in two places: 0xd276c and 0xd2d48. These two pieces of code look extremely similar, calling many of the same functions in the same order, but with slight differences.

I suspect this is all very close to the game's main loop. I found Scud Race Plus's main loop and didn't seem to help much but perhaps this will make something clear. Hopefully, these magic values are computed relatively independently to the rest of the massive routine and we can discern from their inputs what the function is trying to do.
User avatar
Site Admin
Posts: 2169
Joined: Thu Sep 01, 2011 2:13 pm
Location: New York City

Re: PPC603e division by zero

Postby Ian » Thu Feb 23, 2017 3:03 am

I think it actually draws 1 frame after the sega logo, and then dies immediately after. Not sure if that helps at all
Posts: 1434
Joined: Tue Feb 23, 2016 9:23 am


Return to The Dark Room

Who is online

Users browsing this forum: No registered users and 2 guests