Register | Login
Views: 19364387
Main | Memberlist | Active users | ACS | Commons | Calendar | Online users
Ranks | FAQ | Color Chart | Photo album | IRC Chat
11-02-05 12:59 PM
1 user currently in Super Mario World hacking: labmaster | 3 guests
Acmlm's Board - I2 Archive - Super Mario World hacking - Learning SMW ASM [ASM howto] | |
Pages: 1 2 3 4 5Add to favorites | "RSS" Feed | Next newer thread | Next older thread
User Post
Dark Ludwig

Red Paratroopa
Level: 21

Posts: 64/172
EXP: 45740
For next: 4203

Since: 09-17-04
From: Georgia

Since last post: 9 days
Last activity: 2 days
Posted on 08-11-05 11:37 PM Link | Quote
I also edit it directly in hex rather than using an assembler.

First off, I never could find a good one that's reliable.
Second, it's quicker to edit in hex - open up a hex editor and make a new document, expand the document oh, say, about 20 bytes, then open up 65816REF.HLP and type in whatever you want. With assemblers, there's always some problem that makes it either take twice as long, or can't be fixed and then you're forced to edit in hex anyway.

d4s, you must have a pretty good assembler if that's what you rely on for custom ASM codes.
FuSoYa
Defender of Relm
Level: 26

Posts: 228/255
EXP: 99529
For next: 2746

Since: 03-15-04
From: Moon

Since last post: 7 days
Last activity: 7 hours
Posted on 08-12-05 01:05 AM Link | Quote
Once you start doing larger ASM hacks that take up a few KB and have to be revised fairly often, you soon realize that having to update multiple tables, jumps, and branch offsets every single time you change just a couple of instructions really is a waste of time and effort. The larger it gets, the larger the chance you'll forget to update some offset. And then there's the documentation issue... for example, the SoE 2 player hack is primarily contained in a 24 KB ASM source file that explains where to hook into the game for each little ASM hack and some comments about what it's doing. It's much easier to manage an ASM hacking project that way.

Of course, a reliable assembler is a must.
Sukasa

Boomboom
Error 349857348734534: The system experienced an error.
Level: 57

Posts: 1608/1981
EXP: 1446921
For next: 39007

Since: 02-06-05
From: *Shrug*

Since last post: 6 days
Last activity: 1 day
Posted on 08-12-05 01:08 AM Link | Quote
Oh hell, Large-scale ASM hacks probablely do need assemblers, but for just about all of the project's I've done, a hex editor has done mush better than an assemblers, which never worked right.
Glyph Phoenix

Level: 39

Posts: 448/745
EXP: 385876
For next: 18895

Since: 11-07-04

Since last post: 2 hours
Last activity: 2 hours
Posted on 08-12-05 07:15 AM Link | Quote
Also, Fu, you've got the power of Win-compatible Jeremy Gordon's assembler on your side.

Hex editors work just fine for little edits. For more advanced stuff you'll need more advanced tools, but that is beyond me and beyond these tutorials.

Edit: Added a bit more tutorial information.


(edited by Glyph Phoenix on 08-11-05 10:41 PM)
Bio

Buster Beetle
Level: 27

Posts: 62/458
EXP: 107144
For next: 9015

Since: 07-06-05
From: a laboratory somewhere... Waiting to be completed

Since last post: 8 hours
Last activity: 5 hours
Posted on 08-13-05 11:08 AM Link | Quote
I am getting problem while making custom block, the code Is

AD BF OD C9 31 90 17 18 AD BE 0D C9 01 90 2B E9 02 8D BE 0D AD BF 0D E9
32 8D BF 0D 80 15 18 AD BE 0D C9 02 90 0F E9 03 8D BE 0D AD BF 0D 69 32 8D BF 0D A0 01 A9 26 8D 93 16 60 A0 01 A9 26 8D 93 16 60

It is suppose to buy a yoshi for 250 coin,mario need to sell two live to pay this
If he don't have 50 coin that will cost him 3 live but he will get 50 coin
If he don't have enough coin/cash the block act like 130
Its suppose to do that but it don't work, whatever how many coin/live mario have
Its still reduce 2 live and 50 coin even If he don't have to cash allow him to have -X coin or life(Interpreted by mario world as P6= -1 P5=-2 etc.)Only the '3 life Insted than 2 when you don't have enough cash' setting work

While I am here what is the command to make a sprite appear I need this to the Flower version of this block,What is RAT tag and What is the reloc offset of blocktool I understand any offset exept him


(edited by Bio on 08-13-05 02:08 AM)
(edited by Bio on 08-13-05 02:10 AM)
Sukasa

Boomboom
Error 349857348734534: The system experienced an error.
Level: 57

Posts: 1632/1981
EXP: 1446921
For next: 39007

Since: 02-06-05
From: *Shrug*

Since last post: 6 days
Last activity: 1 day
Posted on 08-13-05 11:43 PM Link | Quote
I believe reloc offests are used when your custom code has jmp and jsr statements and that, to make sure your code doesn't crash. A RATS tag is used by Lunar Magic and ASM programmers to make sure that LM does not overwrite extra code or data that you place in the user area of the ROM, to prevent corruption. For the most part, ignore the reloc offset, and set it to -1.

EDIT: I wrote out the block for you. It's untested, but here's how you use it:

In blocktool, set all offsets to -1, then set the mario Sides, above, and bottom offests to 0. The reloc offset should be -1, and in LM, set the block acts like setting to whichever block you want to have a 2-life, 50-coin price on it.

The source code

The BIN file


(edited by Sukasa on 08-13-05 02:55 PM)
Smallhacker

Green Birdo

SMW Hacking Moderator
Level: 68

Posts: 1990/2273
EXP: 2647223
For next: 81577

Since: 03-15-04
From: Söderhamn, Sweden

Since last post: 10 hours
Last activity: 9 hours
Posted on 08-13-05 11:46 PM Link | Quote
Reloc is only used for Jumps and Jump to Subroutines that jumps to a location within the block code, so that BT can change those addresses to the real address in the rom.
Bio

Buster Beetle
Level: 27

Posts: 66/458
EXP: 107144
For next: 9015

Since: 07-06-05
From: a laboratory somewhere... Waiting to be completed

Since last post: 8 hours
Last activity: 5 hours
Posted on 08-14-05 12:39 AM Link | Quote
thank sukasa but It don't work I don't know the problem here the IPS maybe It can help you find what wrong:
http://www.freewebs.com/bio_amiuss/Mario%20Adventure.zip
and no one answer my question about sprite creation code, there a block in blocktool that create a flower but Its use a bunch of reloc offset


(edited by Bio on 08-13-05 03:48 PM)
(edited by Bio on 08-13-05 05:09 PM)
Sukasa

Boomboom
Error 349857348734534: The system experienced an error.
Level: 57

Posts: 1703/1981
EXP: 1446921
For next: 39007

Since: 02-06-05
From: *Shrug*

Since last post: 6 days
Last activity: 1 day
Posted on 08-22-05 10:41 AM Link | Quote
I think I know where I went wrong... stupid P-O-S compiler.

Anyways, tha reason for my post:

An explanation of the Stack.

The Stack, in SNES programming, is a special memory address that is used for various things. Of these, it (in my experience) is mainly used for JSR and JSL statements, and preserving register states. Think of the stack like a book pile, you can add books (pushing to the stack), or remove a book (But only off of the top!). The stack can be helpful for a reson like this:

You have the accumulator set to $55, but need to use it for math. You have no available RAM, what do you do? Simple, you PusH the Accumulator (PHA), and do your math, storing it to it's RAM location. Now, to get the Accumulator back the way it was, you need to PuLl the Accumulator (PLA). in doing this, you put the Accumulator back to $55, AND did your math without losing any data. See how helpful the stack is?

Now, here's a warning. If you misuse that stack, you'll cause your code to crash, for example:

LDA $55
JSL label1
.
.
.
label1:
PHA
LDA $44 STA $7E0000
RTL
.
.
.



Now, in that code example, your problem is that when you pushed A, you never pulled it! Now your code has RTL'd off somewhere it wasn't supposed to, resulting in that crash. Oh dear...
Bio

Buster Beetle
Level: 27

Posts: 141/458
EXP: 107144
For next: 9015

Since: 07-06-05
From: a laboratory somewhere... Waiting to be completed

Since last post: 8 hours
Last activity: 5 hours
Posted on 08-22-05 10:45 AM Link | Quote
Can I push something in the stack with a custom block and pull it with another or do thet need to be in the same routine
Smallhacker

Green Birdo

SMW Hacking Moderator
Level: 68

Posts: 2016/2273
EXP: 2647223
For next: 81577

Since: 03-15-04
From: Söderhamn, Sweden

Since last post: 10 hours
Last activity: 9 hours
Posted on 08-22-05 11:12 AM Link | Quote
The stack push and pull has to be in the same routine. Otherwise, the game will most likely crash.

Simplification of Sukasa's warning:

Push before you pull.
If you push once in the subroutine, you must pull once in the subroutine.
If you push twice in the subroutine, you must pull twice in the subroutine.
If you push 54 times in a subroutine, you must pull 54 times in the subroutine.
If you never push in the subroutine, you can't pull in the subroutine.

Breaking these rules = Crash.

(Remember that block code is always a subroutine.)
HyperLamer
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 6478/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 08-22-05 12:00 PM Link | Quote
Think of JSL as 'push current address and jump' and RTL as 'pop address and jump to it'. The same goes for JSR and RTS but with less bytes used, no big difference unless you use a LOT of stack space but you need to match them; you can't start with JSL and end with RTS, because JSL pushes 3 bytes and RTS only pops 2. Basically whenever you push any number of times, you need to pop the same number to even it out.

A few ways you can mix different stack accesses to your advantage:

PHA
PHY
PLA
PLY - Swap the values of Y and A.

PHA
PLY - Copy A to Y. Not useful on SNES, since you can just use TAY, but the same technique can be used on other consoles and CPUs.

PHY
JMP subroutine - call a subroutine, but return to the address specified in Y instead of the next byte. Y (or whichever register you use) MUST be 16-bit for this. (If it's 8-bit, you can just push two values.)

PHY
PHA
JML subroutine - long version of above. A specifies bank number. A needs to be 8-bit, Y 16-bit.

Unless you're doing crazy stunts like this, though, you'd best not mix stack access types. PHA -> PLA, JSR -> RTS and so on.

Tip: Suppose you need to call a subroutine in bank 4 from bank 7, but you can't use JSL because it ends with RTS. What do you do? Find an RTL in bank 4 (any byte with the value 6B will do). Let's say it's at 04:8123, and 'whatever' is at 07:9ABC.

LDA #$BC
PHA
LDA #$9A
PHA
LDA #$07 ;Push the address $07:9ABC
PHA
LDA #$23
PHA
LDA #$81 ;Push the address $8123
PHA
JML subroutine
whatever: ;code returns here

What happens is that when the subroutine encounters an RTS, it pops a 16-bit address off the stack, which in this case is the $8123 you pushed. It jumps there whith is an RTL statement, which pops a 3-byte address, $07:9ABC, and jumps to it, putting it right back at the next instruction of your code. Unfortunately this is difficult to use in custom blocks, since you need to know the location of your code; your best bet is to put the code in a fixed location and just have your block call it. (Don't forget the RATS tag if you use the expanded area - anything past $801FF.)

Also, make sure the 6B you use isn't data that may be edited. It need not be code, necessarily; it can just be any random thing, but if it gets changed the game will crash. If you can't find a suitable address in the current bank, you can try to find an unused byte to stick one in. SMW is very inefficient, so there are a lot of unused table entries you can look for, or you can probably find free space near the end of a bank.

And if you hadn't guessed, pop = pull.


(edited by HyperHacker on 08-22-05 03:12 AM)
(edited by HyperHacker on 08-22-05 03:13 AM)
DisruptiveIdiot

Paratroopa
Level: 21

Posts: 132/147
EXP: 42614
For next: 7329

Since: 04-09-04

Since last post: 4 days
Last activity: 5 hours
Posted on 09-08-05 05:53 AM Link | Quote
Can you guys explain to me the different addressing modes for certain commands? I've been trying to learn how to add a new variable to the status bar and I need some help.

The 65c816 reference file I have describes these addressing modes:
[code]
imm8/16 Immediate (8/16-bit value)
dp Direct
abs Absolute
long Absolute Long
A Accumulator
(dp), y Direct Indirect Indexed with Y
[dp], y Direct Indirect Indexed Long with Y
(dp, x) Direct Indexed with X Indirect
dp, x Direct Indexed with X
dp, y Direct Indexed with Y
abs, x Absolute Indexed with X
long, x Absolute Long Indexed with X
abs, y Absolute Indexed with Y
pcr Program Counter Relative
pcrlong Program Counter Relative Long
(abs) Absolute Indirect

(abs, x) Absolute Indexed with X Indirect
(dp) Direct Indirect
[dp] Direct Indirect Long
sr, s Stack Relative
(sr, s), y Stack Relative Indirect Indexed with Y
srcbank, destbank Block Move
[/code]

And it becomes apparant I need to know at least some of the more essential modes before I can do anything.

For example: Let's say I wanted to make a block that incremented this new variable every time it is touched. To do so, I could use increment, INC.

Now, INC has many addressing modes according to this file. However, I'd just like to know the most important ones, direct and absolute. What's the difference between them? Which one would I use? INC direct is E6 while INC absolute is EE.

Glyph Phoenix

Level: 39

Posts: 550/745
EXP: 385876
For next: 18895

Since: 11-07-04

Since last post: 2 hours
Last activity: 2 hours
Posted on 09-08-05 11:27 AM Link | Quote
Direct is not the most important one.

What you need is imm8/16, immediate. That basically does whatever the command is with the next number in the series. For example, A9 05 loads 05 into the accumulator. A9 is the imm8/16 addressing mode of LDA.

And you need absolute. Absolute, instead of dealing with the next address, deals with RAM variables. For example, AD BF 0D loads your coins (or lives? I forget.)into the accumulator. AD is the absolute addressing mode of LDA.

Direct is something totally different; you automatically load the high byte of ram or some such... I'm not too familiar with that addressing mode.

Indexed with X or Y addressing modes are basically just regular ones, except the X or Y register is added.

Long is a lot like absolute, except you specify a 24 bit address instead of a 16 bit one. For example, using STA long you can store things in bank 7E.
HyperLamer
<||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people

Sesshomaru
Tamaranian

Level: 118

Posts: 6950/8210
EXP: 18171887
For next: 211027

Since: 03-15-04
From: Canada, w00t!
LOL FAD

Since last post: 2 hours
Last activity: 2 hours
Posted on 09-09-05 07:07 AM Link | Quote
7E is the default bank, though. You use long for every other bank.
Glyph Phoenix

Level: 39

Posts: 556/745
EXP: 385876
For next: 18895

Since: 11-07-04

Since last post: 2 hours
Last activity: 2 hours
Posted on 09-09-05 10:57 PM Link | Quote
Blah. I meant 7F. 7F's the only one I ever had any reason to long address to. I don't know what's in the other banks.
DisruptiveIdiot

Paratroopa
Level: 21

Posts: 133/147
EXP: 42614
For next: 7329

Since: 04-09-04

Since last post: 4 days
Last activity: 5 hours
Posted on 09-10-05 12:46 AM Link | Quote
Very helpful I assumed direct would be important because well, direct sounds important

Ok, so I need to find an empty address in the RAM, and then make a block that accumulates 1 to that address when it is activated. Ok, I got that, sounds very simple and it probably is.

Then I have to edit the status bar to refer to display this new variable next to the appropriate symbol of my choosing, right? I'll have to find out how the status bar is stored then.

Could someone explain the process of saving SMW uses a little so I can get the gist of it? That's the last part of what I want to do, I want SMW to save this piece of data and load it because it is an important part of my hack.
Bio

Buster Beetle
Level: 27

Posts: 352/458
EXP: 107144
For next: 9015

Since: 07-06-05
From: a laboratory somewhere... Waiting to be completed

Since last post: 8 hours
Last activity: 5 hours
Posted on 09-27-05 08:00 AM Link | Quote
the status bar is ram adress 7E0EF9 to 7E0F2E write data to change the tile used. and also do their a way to make the code wait before continue to execute?


(edited by Bio on 09-26-05 11:00 PM)
(edited by Bio on 09-26-05 11:02 PM)
(edited by Bio on 09-26-05 11:32 PM)
Glyph Phoenix

Level: 39

Posts: 597/745
EXP: 385876
For next: 18895

Since: 11-07-04

Since last post: 2 hours
Last activity: 2 hours
Posted on 10-04-05 08:57 AM Link | Quote
No. You can't just copy a feature and paste it in another game. It's even tougher for roms, since features like that status bar undoubtably use RAM that is already designated for something entirely different in SMW.

It'd be much easier just to write an enemy life bar from scratch than copy one from a game. And you picked a NES game, to boot. What are you thinking? Get a move on.

Oh, sorry, I mixed up "things to tell people when they ask stupid questions" with "things the announcer from Multi Racing Championship says". Sharp right turn.
Forte.EXE

Buzzy Beetle
Level: 31

Posts: 322/396
EXP: 170237
For next: 15126

Since: 07-23-04
From: DenTech City - Maverick Hunter HQ

Since last post: 1 hour
Last activity: 1 hour
Posted on 10-04-05 09:21 AM Link | Quote
Ninja Gaiden Trilogy is a SNES game Glyph, it just has NES styled graphics. Something simular to the HP bar from SMO but made from scratch... wait, oh well, forget it, was worth a shot. I'll just keep quiet about it.


(edited by Forte.EXE on 10-04-05 12:24 AM)
Pages: 1 2 3 4 5Add to favorites | "RSS" Feed | Next newer thread | Next older thread
Acmlm's Board - I2 Archive - Super Mario World hacking - Learning SMW ASM [ASM howto] | |


ABII


AcmlmBoard vl.ol (11-01-05)
© 2000-2005 Acmlm, Emuz, et al



Page rendered in 0.026 seconds.