• Welcome to PCEngineFans.com - The PC Engine and TurboGrafx-16 Community Forum .
 

Article on programming the Saturn in 1995

Started by Sadler, January 03, 2013, 04:28:08 AM

Previous topic - Next topic

Sadler

Ran across this article on programming the Saturn in 1995. Thought it was pretty interesting so I figured I'd share it here. :D

_joshuaTurbo

Quote from: Saturn Assembly on September 16, 1973, 09:56:45 AM/**************************************************************/
/* Trigger jumping if needed, also variable height jump logic */

Man_JumpTrigger()
{
  if ( Man.JumpFudge )
  {
    Man.JumpFudge--;
  }

  if ( Man.Mode != M_Crouch || Man_StandingRoom() )    // ok if not crouched, or there is headroom
  {
    if (Pad_Jump->Pressed)               /* jump button pressed */
    {
      if ((Man.Contact || (Man.Mode == M_Hang) || Man.JumpFudge) && Pad_Jump->Triggered && !Man.Blocking) /* and not already jumping */
      {
        if (Man.Mode == M_Hang && Pad1.Down.Pressed)
        {
          Man.Contact=0;
          Man.Mode=M_Jump;
          Man.AnimBase = LS_Jumping;    /* Change base anim to jumping */
          Man_TriggerSeq(LS_Jump);    /* start the jumping start anim */
          Man.YV.f = 0x10000;           /* and have no YV */
          Man.Y.i += 4;           /* and have no YV */
        }
        else
        {
          Pad_Jump->Triggered = 0;
          if ( !JetPacCheat )
            Man.YV.f = -0x00080000;     /* Initial jump speed */
          else
            Man.YV.f = -0x00008000;     // Initial speed in Jetpac mode
          Man.Contact = 0;          /* not on the ground any more */
          Man.JumpTime = 0;         /* just started jumping */
          Man.AnimBase = LS_Jumping;    /* Change base anim to jumping */
          Man_TriggerSeq(LS_Jump);    /* start the jumping start anim */
          Man.XV.f+=Man.FlyVel;

          if (Man.HangEnd && Man.Mode == M_Hang)  // if hanging
          {                   // and on the end of a path
            Man.HangEnd = 0;
            Man.X.i += 12*Man.Facing; // the move past end of path
            Man.JumpTime = -3;      // bit more fixed v jump time
          }
          Man.Mode = M_Jump;    /* change mode to jumping */

        }
      }
      else                        /* Already jumping */
      {
        if (Man.JumpTime++ < MaxJumpTime) /* Still in initial jump period */
          Man.YV.f -= 0x0005000;        /* So can maintain jump YV */
      }
    }
    else                      /* jump button not pressed */
    {
      Man.JumpTime = MaxJumpTime+1;     /* so can't alter YV again until landed */
    }

  }

}
I always heard that the Saturn was hard to program for... but damn.

nodtveidt

Meh, that's pretty basic stuff right there... very clean, standard C. The code in question is clearly a state controller with some very basic math. I'm more puzzled by the fact that the forum says "Quote from: Saturn Assembly on September 16, 1973, 04:56:45 PM"... 1973? ...really?

SignOfZeta


_joshuaTurbo

Quote from: The Old Rover on January 04, 2013, 07:07:39 PMMeh, that's pretty basic stuff right there... very clean, standard C. The code in question is clearly a state controller with some very basic math. I'm more puzzled by the fact that the forum says "Quote from: Saturn Assembly on September 16, 1973, 04:56:45 PM"... 1973? ...really?
LOL I was screwing around with this bit of the 'quote' section= date=1357373259

Not sure how to make it go to 1995 or 1996.  :P

Necromancer

U.S. Collection: 98% complete    161/165 titles

Arkhan

Quote from: _joshuaTurbo on January 08, 2013, 07:22:34 AM
Quote from: The Old Rover on January 04, 2013, 07:07:39 PMMeh, that's pretty basic stuff right there... very clean, standard C. The code in question is clearly a state controller with some very basic math. I'm more puzzled by the fact that the forum says "Quote from: Saturn Assembly on September 16, 1973, 04:56:45 PM"... 1973? ...really?

LOL I was screwing around with this bit of the 'quote' section= date=1357373259

Not sure how to make it go to 1995 or 1996.  :P


That's Epoch time.


http://www.epochconverter.com/


GET SOME, BITCH
[Fri 19:34]<nectarsis> been wanting to try that one for awhile now Ope
[Fri 19:33]<Opethian> l;ol huge dong

I'm a max level Forum Warrior.  I'm immortal.
If you're not ready to defend your claims, don't post em.

spenoza

Quote from: _joshuaTurbo on January 04, 2013, 08:06:03 AMI always heard that the Saturn was hard to program for... but damn.
Looks pretty clean to me. I don't necessarily follow all of it, but the comments help clear much of it up. The Saturn was hard to program for if you wanted optimized code that actually took advantage of its horsepower and features (which was in abundance, if you could figure out how to use it). If you're just programming something pretty basic it is likely just like any other system.
<a href="http://www.pcedaisakusen.net/2/34/103/show-collection.htm" class="bbc_link" target="_blank">My meager PC Engine Collection so far.</a><br><a href="https://www.pcenginefx.com/forums/" class="bbc_link" target="_blank">PC Engine Software Bible</a><br><a href="http://www.racketboy.com/forum/" c