Results 1 to 2 of 2

Thread: [Guide]

  1. #1
    Nooblet FoodFx's Avatar
    Join Date
    May 2011
    Posts
    43
    Points
    67
         User Info     Contact     Gamer ID
    Join Date
    May 2011
    Posts
    43
    Points
    67

    Default [Guide]

    Today I will teach you how to make a code where you control something's movement.

    Requirements:

    • Working Hook for your game.
    • X,Y,Z Co-ords of the object you want to move.
    • A nop area for your game.

    Basic MIPS you should know:
    • lui
    • lw
    • addiu
    • t0 - t9 Temporary Registers
    • bne
    • jr
    • ra
    • nop
    • zero

    Vague Explination of Floating Point MIPS:
    • lwc1 - loads a value as a float and stores it in your desired floating point register
    • swc1 - stores the float value in the desired register back to an address or value you have previously set
    • add.s - adds two floating point registers and stores the result into another floating point register.
    • sub.s - subtracts two floating point registers and stores the result into another floating point register.
    • mtc1 - stores the value in a temporary register into a floating point register.
    • $f0 - $f31 - Floating point registers, used to load and store floats.

    Explination of floating Point MIPS:

    lwc1 and swc1 loading and storeing the value into a floating point.

    explination of lwc1, mtc1, swc1:

    Code:
    lui t0 $0880
    lwc1 $f12 $0010(t0)
    lui t1 $3DCC
    mtc1 t1 $f13
    add.s $f14 $f12 $f13
    swc1 $f14 $0010(t0)
    loading 08800010 value in floating point $f12. Then their is an add then it stores $f14 back into 08800010. mtc1 is takeing the value in t1 and storeing it in a floating point register.

    explination of add.s and sub.s:

    Code:
    lui t0 $0880
    lwc1 $f12 $3FFC(t0)
    lwc1 $f13 $3FF8(t0)
    add.s $f14 $f12 $f13
    sub.s $f15 $f14 $f13
    swc1 $f15 $3FFC(t0)
    ok so this line add.s $f14 $f12 $f13 it adds the floats stored in $f12 and $f13 and stores it into $f14. The same goes for sub.s but instead of adding it is subtracting $f14 and $f13 and stores it into $f15. If you know the regular "add" and "sub" mips it's basically the same but with floating point registers.

    Explination of floating point registers($f0 - $f31)

    Floating points store the value into a floating point.

    Floating points are numbers stored in specific values.

    Some floats:
    3F800000 - 1.000000
    40000000 - 2.000000
    41000000 - 8.000000
    41100000 - 9.000000
    41A00000 - 20.000004

    $f0-$f2 - Used in functions to store results.
    $f4 - $f10 and $f16 $f18 - Are used like temporary registers (t0-t9)
    $f12 - $f14 - Can be used as argument registers (a0-a3)
    $f20 - $f30 - Are used as saved registers (s0-s9)

    Explination of how Moveing Objects work

    Code:
    - It loads the controller address
    - Then we are loading the pointer/address of our objects
    - Then we have a check if we are pressing the button value we put in t1,
    If it is pressed go on meaning
    it will load the offset add a certain value then store back to the offset.
    But if it's not pressed go on to the next check
    if we are pressing the button so and so forth
    - Why does it work?
    Well when you load the offset it's loading the postion the object is in.
    Then we add and/or subtract causeing it to move.
    Subroutine Template:
    Code:
    lui t0, XXXX (First half of controller address 0880)
    lw t0, $XXXX(t0) (Seconed half of controller address)
    addiu t1, zero, $XXXX (Button value to increase X-Axis)
    addiu t2, zero, $XXXX (Button value to increase Y-Axis)
    addiu t3, zero, $XXXX (Button value to increase Z-Axis)
    addiu t4, zero $XXXX (Button value to decrease X-Axis)
    addiu t5 zero, $XXXX (Button value to decrease Y-Axis)
    addiu t6, zero, $XXXX (Button value to decrease Z-Axis)
    lui t7, $XXXX (First half of pointer that you want to control)
    lw t7, $XXXX(t7) (Seconed half of pointer)
    bne t0, t1, $XXXX (Branch to next bne)
    nop
    // X-Axis Incease
    lwc1 $f12, $XXXX(t7) (X-Axis offset)
    lui t2, $XXXX (Amount of increment)
    mtc1 t2, $f13 (Moves what we just loaded to a float point)
    add.s $f14, $f12, $f13 (Adds the current value of the x coord with the amount of increment into $f14)
    swc1 $f14, $XXXX(t7) (Stores $f14 onto the X-Axis offset)
    bne t0, t2, $To next bne
    nop
    //Y-Axis Increase
    lwc1 $f12, $XXXX(t7) (Y-Axis offset)
    lui t2, $XXXX (Amount of increment)
    mtc1 t2, $f13 (Moves what we just loaded to a float point)
    add.s $f14, $f12, $f13 (Adds the current value of the y coord with the amount of increment into $f14)
    swc1 $f14, $XXXX(t7) (Stores $f14 onto the Y-Axis offset)
    bne t0, t3, $XXXX (To Next bne)
    nop
    //Z-Axis Increase
    lwc1 $f12, $XXXX(t7) (Z-Axis offset)
    lui t2, $XXXX (Amount of increment)
    mtc1 t2, $f13 (Moves what we just loaded to a float point)
    add.s $f14, $f12, $f13 (Adds the current value of the z coord with the amount of increment into $f14)
    swc1 $f14, $XXXX(t7) (Stores $f14 onto the Z-Axis offset)
    bne t0, t4, $XXXX (To next bne)
    nop
    //X-Axis Decrease
    lwc1 $f12, $XXXX(t47) (X-Axis offset)
    lui t2, $XXXX (Amount of decrement)
    mtc1 t2, $f13 (Moves what we just loaded to a float point)
    sub.s $f14, $f12, $f13 (Subtracts the current value of the x coord with the amount of decrement into $f14)
    swc1 $f14, $XXXX(t7) (Stores $f14 onto the X-Axis offset)
    bne t0,t5 $XXXX (To next bne)
    nop
    //Y-Axis Decrease
    lwc1 $f12, $XXXX(t47) (Y-Axis offset)
    lui t2, $XXXX (Amount of decrement)
    mtc1 t2, $f13 (Moves what we just loaded to a float point)
    sub.s $f14, $f12, $f13 (Subtracts the current value of the y coord with the amount of decrement into $f14)
    swc1 $f14, $XXXX(t7) (Stores $f14 onto the Y-Axis offset)
    bne t0, t6, $XXXX (To jr ra)
    nop
    //Z-Axis Decrease
    lwc1 $f12, $XXXX(t47) (Z-Axis offset)
    lui t2, $XXXX (Amount of decrement)
    mtc1 t2, $f13 (Moves what we just loaded to a float point)
    sub.s $f14, $f12, $f13 (Subtracts the current value of the z coord with the amount of decrement into $f14)
    swc1 $f14, $XXXX(t7) (Stores $f14 onto the Z-Axis offset)
    jr ra (Ends our Subroutine)
    Notes:

    • You should keep the value the same for each one in this line: lui t2, $XXXX (Amount of decrement/increment)


    -FoodFx-

    0 Not allowed! Not allowed!

  2. #2
    1337/PWNR
    Programmer
    Emu's Avatar
    Join Date
    Aug 2010
    Location
    Virginia
    Posts
    161
    Points
    292
         User Info     Contact     Gamer ID
    Join Date
    Aug 2010
    Location
    Virginia
    Posts
    161
    Points
    292
    Gamer IDs

    Gamertag: SpidermaN EaT PSN ID: Shaq23Jordan

    Contact info:

    Youtube Channel: www.youtube.com/eemuohg Kik Username: ShaqGlizzy

    Default

    First off, you coded this in a dumbass way, next, you fucking suck and should kill yourself. Lastly you a bitch, dats jocks OHG and CL, by ripping shit from their sites and posting it on your without acknowledging them. Watch what the favor returns to you. You also failed to mention I fix your mistakes and tell you what a command does, fail to tell people that? Fuck you lil Mexi boarder hopp'n ass.

    0 Not allowed! Not allowed!
    Last edited by Emu; 08-06-2011 at 04:07 AM.

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -10. The time now is 02:33 AM.
Powered by vBulletin®
Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.