Banner
The Questionable Level Design Contest ends in…
8 DAYS, 10 HOURS, 51 MINUTES AND 7 SECONDS
Views: 915,248,948
Time:
13 users online: ASSATAKKU, BlueToad,  brickblock369, Daizo Dee Von, drkrdnk, monkey03297, NINTENLUIGI, OEO6, PokerFace, Saela, Segment1Zone2, wulv257,  XenonZed - Guests: 26 - Bots: 69 Users: 51,264 (2,249 active)
Latest: He Yuxia
Tip: Before asking for help on the forums, make sure you've tried to figure out the problem on your own first.
Not logged in.
Misc Useful ASM Code
Forum Index - Non-SMW Hacking - Super Mario 64 Hacking - Misc Useful ASM Code
Pages: « 1 » Link - Thread Closed
Thought I might share some useful MIPS code I have written.

BASIC SCROLLING TEXTURES:
//START
ADDIU R29, R29, $FFE8
SW R31, $0014 (R29)

//LOCATION
LUI R17, $8042 - first polygon
ORI R17, R17, $281A
LUI R20, $8042 - final polygon
ORI R20, R20, $292A
LUI R21, $803F - loop counter location
ORI R21, R21, $F020

//CHECK LOOP COUNTER
LH R18, $0000 (R21)
SLTI R19, R18, $0040 - loop point
BNEZ R19, STORE LOOP COUNTER
ADDIU R18, R18, $0001 - increment counter
ADDIU R18, R0, $0001 - reset counter

//STORE LOOP COUNTER
SH R18, $0000 (R21)

//UPDATE POSITION
LH R18, $0000 (R17)
BNEZ R19, STORE POSITION
ADDI R18, R18, $0020 - distance to move
ADDI R18, R18, $F7FF - (0xFFFF - distance to move * loop point)

//STORE POSITION
SH R18, $0000 (R17)
BNE R17, R20, UPDATE POSITION
ADDIU R17, R17, $0010

//END
LW R31, $0014 (R29)
JR R31
ADDIU R29, R29, $0018

CORRECT MUSIC VOLUME (for the music stopping bug):
0x56F00:
//START
ADDIU R29, R29, $FFE8
SW R31, $0014 (R29)

//END IF VOLUME IS ON FULL
LUI R17, $8022
LH R17, $2630 (R17)
ADDIU R18, R0, $3F0D
SUB R18, R17, R18
BGEZ R18, END

//END IF IN LOOK-AROUND VIEW
LUI R17, $8022
LB R17, $261A (R17)
ADDIU R18, R0, $0004
BEQ R17, R18, END

//RESET VOLUME
LUI R17, $8022
ORI R17, R17, $2630
LUI R18, $3F10
ORI R18, R18, $4285
SW R18, $0000 (R17)

//END
LW R31, $0014 (R29)
JR R31
ADDIU R29, R29, $0018

OBJECTS DO NOT VANISH AT SCREEN EDGE:
0x3855C: LUI R1, $4740
0xF71D4: LUI R1, $46C0

EDIT:
I uploaded a heap of old documents here, including SM64 multiplayer: https://sites.google.com/site/supermario64starroad/home/sm64-documents
WOW! I'm surprised. This code is really useful. I might post some of mine too in the next days. (after I corrected my header files)

--------------------
Tarek701 is dead.
I know how to insert the code into the ROM using LemAsm but how do you use it? I use messian's Level Importer by the way if that helps answering my question.
Originally posted by Warwiio
I know how to insert the code into the ROM using LemAsm but how do you use it? I use messian's Level Importer by the way if that helps answering my question.


Does this thread help? If you need any more assistance be sure to ask there.
Sorry, it doesn't help. What I mean is how do I assign the scrolling behavior on a texture that I'm using for my custom level?
Originally posted by Warwiio
Sorry, it doesn't help. What I mean is how do I assign the scrolling behavior on a texture that I'm using for my custom level?


For scrolling textures, overwrite the code where an 0x0C command points in a behavior. Create a simple behavior script which loops that 0x0C with an 0x08 command, then place an object with that behavior in the level using TT64.

You need to find where the vertex data for your level is copied into memory, I suggest using renegade to search for the data.
Thanks! Luckily, I understand what you mean.
Why don't you use register names? Using register numbers makes your code unreadable, especially in situations where register conventions are used (calling functions, stack pointers, etc).
Originally posted by messiaen
Why don't you use register names? Using register numbers makes your code unreadable, especially in situations where register conventions are used (calling functions, stack pointers, etc).


Finally someone who thinks like me. It's really confusing, when people use register numbers, because I can't really remember them. The names are way easier to know than the numbers. For example SP stands for Stack Pointer. It's way easier than remembering the register number 29.

Good to see you're back. I hope you can give me a feedback on the C tutorial I made for the SM64 Hacking Community.

--------------------
Tarek701 is dead.
I'm not back, I just occasionally lurk around to see what others have been doing.

Your tutorials are fine, however I noticed that parts of them (and your site) are a direct rip of the content in my site or at Jul. Curiously, you don't have a link to my site on yours. Not that I really care much about it, my information was written to be used and you do a fine job providing screenshots.

What worries me is that there's a lot of innacurate information and misconceptions and some very basic C errors, so it seems you need to study much more.
Originally posted by messiaen
Why don't you use register names? Using register numbers makes your code unreadable, especially in situations where register conventions are used (calling functions, stack pointers, etc).

Just a mistake I keep overlooking, when I copy my code out of LemASM I sometimes forget to make it show that actual register names.
Originally posted by messiaen
I'm not back, I just occasionally lurk around to see what others have been doing.

Your tutorials are fine, however I noticed that parts of them (and your site) are a direct rip of the content in my site or at Jul. Curiously, you don't have a link to my site on yours. Not that I really care much about it, my information was written to be used and you do a fine job providing screenshots.

What worries me is that there's a lot of innacurate information and misconceptions and some very basic C errors, so it seems you need to study much more.


Oh, I'm happy that my tutorials aren't that bad. The tutorial on my googlesite is just horrible. The one I posted on Youtube (which has a length of 38 minutes) is way better than my old ones.

So, I just posted all links, where I got the stuff from. Look here:
http://www.smwcentral.net/?p=viewthread&t=60539&page=1&pid=986139
Look for the underlined text in my thread,

Also, I don't know what C errors you meant. The codes are compiling and working fine. Are you talking about my video now(The tutorial on how to setup the N64Toolchain, where I made some basic C codes) or about the beginner C tutorial in my thread? Well, the video was embarassing, because I made simple mistakes, which could be prevented.

Maybe you could help me a bit with the tutorial and I fix up the errors.

But, well I don't want to go off-topic here.

--------------------
Tarek701 is dead.
Okay my turn now.

PLAY A MUSIC IF YOU HAVE XXX STARS
//START
ADDIU SP, SP, $FFE8 - Start
SW RA, $0014 (SP)

//CHECK STARS
LUI S1, $8034 - load current star amount
LH S1, $B21A (S1)
ADDIU S2, R0, $0078 - needed stars
BEQ S2, S1, $PLAY MUSIC
NOP

//END IF NOT ENOUGH STARS
LW RA, $0014 (SP)
JR RA
ADDIU SP, SP, $0018
NOP

//PLAY MUSIC
ADDIU A0, R0, $0000
ADDIU A1, R0, $00XX - sequence to play
ADDIU A2, R0, $0000
JAL $00320544 - play music

//END
LW RA, $0014 (SP)
JR RA
ADDIU SP, SP, $0018
NOP

replace a 0C behavior command and make a looping behavior with a 08 command. Place the behavior in your level.

--------------------
My Channel - http://www.youtube.com/skilllux64
Hey frauber, is this a fire mario asm code, because i cant turn it into a gs code, and i got this code from your missing stars source files:


; Behavior (modified 0x13001184 behavior)


; pointer = 0x130001f4

00 04 00 00
11 01 00 01
2F 00 00 00 00 04 00 00
0E 15 00 1E
2B 00 00 00 00 32 00 19 00 19 00 00
30 00 00 00 00 1E FE 30 FF 9A 03 E8 03 E8 00 C8 00 00 00 00
21 00 00 00
32 00 00 98
08 00 00 00
0C 00 00 00 80 2A F4 48
0F 1A 00 01
09 00 00 00



; Mario fireball (modified 0x802af448 function)

.ORG 0x80406B00

ADDIU SP, SP, 0xFFD8
SW RA, 0x001C (SP)
SW S0, 0x0018 (SP)
LUI T6, 0x8036
LW T6, 0x1160 (T6)
LH T7, 0x0074 (T6)
ORI T8, T7, 0x0400
SH T8, 0x0074 (T6)
JAL 0x802A2320
ADDIU R0, R0, 0x0000
LUI T9, 0x8036
LW T9, 0x1160 (T9)
LW S0, 0x014C (T9)
BEQ S0, R0, JumpF498
ADDIU R0, R0, 0x0000
ADDIU AT, R0, 0x0001
BEQ S0, AT, JumpF524
ADDIU R0, R0, 0x0000
BEQ R0, R0, JumpF5A4
ADDIU R0, R0, 0x0000

JumpF498:
LUI T0, 0x8036
LW T0, 0x1160 (T0)
LW T1, 0x0154 (T0)
BNEZ T1, JumpF4F0
ADDIU R0, R0, 0x0000
JAL 0x80383CB4
ADDIU R0, R0, 0x0000
LUI AT, 0x4120
MTC1 AT, F4
LUI T4, 0x8036
LW T4, 0x1160 (T4)
MUL.S F6, F0, F4
TRUNC.W.S F8, F6
MFC1 T3, F8
ADDIU R0, R0, 0x0000
SW T3, 0x00F0 (T4)
LUI AT, 0x3F80 ; modified
LUI T5, 0x8036
LW T5, 0x1160 (T5)
MTC1 AT, F10
ADDIU R0, R0, 0x0000
SWC1 F10, 0x00B0 (T5)

JumpF4F0:
LUI T7, 0x8036
LW T7, 0x1160 (T7)
LW T8, 0x00EC (T7)
ANDI T6, T8, 0x0001
BEQ T6, R0, JumpF5A4
ADDIU R0, R0, 0x0000
LUI T9, 0x8036
LW T9, 0x1160 (T9)
LW T0, 0x014C (T9)
ADDIU T1, T0, 0x0001
SW T1, 0x014C (T9)
BEQ R0, R0, JumpF5A4
ADDIU R0, R0, 0x0000

JumpF524:
LUI T2, 0x8036
LW T2, 0x1160 (T2)
LW T3, 0x0154 (T2)
BNEZ T3, JumpF568
ADDIU R0, R0, 0x0000
LUI AT, 0x4248
LUI T4, 0x8036
LW T4, 0x1160 (T4)
MTC1 AT, F16
ADDIU R0, R0, 0x0000
SWC1 F16, 0x00B0 (T4)
LUI AT, 0x41F0
LUI T5, 0x8036
LW T5, 0x1160 (T5)
MTC1 AT, F18
ADDIU R0, R0, 0x0000
SWC1 F18, 0x00B8 (T5)

JumpF568:
LUI T7, 0x8036
LW T7, 0x1160 (T7)
LW T8, 0x00EC (T7)
ANDI T6, T8, 0x0052
BEQ T6, R0, JumpF5A4
ADDIU R0, R0, 0x0000
LW T0, 0x0154 (T7)
SLTI AT, T0, 0x0065
BNEZ AT, JumpF5A4
ADDIU R0, R0, 0x0000
LUI A0, 0x8036
JAL 0x802A0568
LW A0, 0x1160 (A0)
BEQ R0, R0, JumpF5A4
ADDIU R0, R0, 0x0000

JumpF5A4:
LUI T1, 0x8036
LW T1, 0x1160 (T1)
LW T9, 0x0154 (T1)
SLTI AT, T9, 0x012D
BNEZ AT, JumpF5C8
ADDIU R0, R0, 0x0000
LUI A0, 0x8036
JAL 0x802A0568
LW A0, 0x1160 (A0)

JumpF5C8:
JAL 0x802A2348
ADDIU A0, R0, 0x004E
LUI T2, 0x8036
LW T2, 0x1160 (T2)
SW R0, 0x0134 (T2)
BEQ R0, R0, End
ADDIU R0, R0, 0x0000

End:
LW RA, 0x001C (SP)
LW S0, 0x0018 (SP)
ADDIU SP, SP, 0x0028
JR RA
ADDIU R0, R0, 0x0000

--------------------
I promise to never cancel my hacks
Do any of you guys happen to know the ASM Code where you can skip the Press Start screen (the Mario Head)? That would be very useful for hacks in my opinion. The demo section also has bugs, which makes the code even better.
I can replace Mario's Face with text
That is all i can do for you

--------------------
I promise to never cancel my hacks
I uploaded a heap of old documents here, including SM64 multiplayer: https://sites.google.com/site/supermario64starroad/home/sm64-documents
Lol Goomba with mario head? Hahaha, Skelux.... Why? Haha


------------------------------------
Send me your Mario Maker 2 levels to be featured on my youtube!

My youtube: https://www.youtube.com/channel/UCbX4pLm713laHTRtLj9xpxw
My twitch: https://www.twitch.tv/theqwollone
Thanks again for the codes, Skelux! I'll be sure to make use of these once I get my laptop back from being repaired #w{=)}
Pages: « 1 » Link - Thread Closed
Forum Index - Non-SMW Hacking - Super Mario 64 Hacking - Misc Useful ASM Code

The purpose of this site is not to distribute copyrighted material, but to honor one of our favourite games.

Copyright © 2005 - 2021 - SMW Central
Legal Information - Privacy Policy - Link To Us


Menu

Follow Us On

  • YouTube
  • Twitch
  • Twitter

Affiliates

  • Super Mario Bros. X Community
  • ROMhacking.net
  • Mario Fan Games Galaxy
  • sm64romhacks