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 Rom Hacking: hukka | 2 guests
Acmlm's Board - I2 Archive - Rom Hacking - Rom ASM question | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
User Post
Sukasa

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

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

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

Since last post: 6 days
Last activity: 1 day
Posted on 03-16-05 05:45 AM Link | Quote
Hey!

I was writing new code over existing code in my ROM, and I need to know one thing. I'm using smaller code than the original, and I need to know how to add filler to take up space. right now i filled the empty spaces with 38 (SEC). is this the right code? It worked in ZSNES, but I'm wondering if that will work in a ral SNES. if not, could anyone tell me what code to use? I don't want to delete code because JSR and JSL routines would be broken.
Apophis

Red Super Koopa
Level: 45

Posts: 385/882
EXP: 640255
For next: 19909

Since: 03-15-04

Since last post: 15 hours
Last activity: 15 hours
Posted on 03-16-05 05:53 AM Link | Quote
Try using NOP (No Operation).
Jathys

Red Goomba
Level: 11

Posts: 12/48
EXP: 5916
For next: 69

Since: 12-21-04

Since last post: 8 days
Last activity: 8 days
Posted on 03-16-05 05:57 AM Link | Quote
Set Carry shoul work just fine, as it's not effecting anything but the carry bit... Just in case Carry is checked by another operation when you leave this section of code, I'd use EA.

EA = NOP = No Operation = Nothing at all gets done to anything.
Sukasa

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

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

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

Since last post: 6 days
Last activity: 1 day
Posted on 03-16-05 06:02 AM Link | Quote
Okay, thanks!

I wondered if I was doing something wrong... nothing ever works the first time for me.
Parasyte

Bullet Bill
Level: 35

Posts: 364/514
EXP: 267348
For next: 12588

Since: 05-25-04

Since last post: 104 days
Last activity: 32 days
Posted on 03-16-05 06:05 AM Link | Quote
If you are referring to "filler" outside of the routines you write, just any byte will work fine. I usually use 0xFF, myself. Just so I can visually see where my free space is, if I ever need it. If you are referring to "filler" in code that actually gets executed... (though I can't figure out why you would do this, in such a situation) using NOP is the only real option.
Sukasa

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

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

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

Since last post: 6 days
Last activity: 1 day
Posted on 03-16-05 06:16 AM Link | Quote
The reason for that is it was preexisting code and this is my first try working with Machine code. I'd say i'm doing pretty good for it.
MathOnNapkins

Math n' Hacks
Level: 67

Posts: 1589/2189
EXP: 2495887
For next: 96985

Since: 03-18-04
From: Base Tourian

Since last post: 1 hour
Last activity: 32 min.
Posted on 03-16-05 08:03 AM Link | Quote
Originally posted by Parasyte
If you are referring to "filler" in code that actually gets executed... (though I can't figure out why you would do this, in such a situation) using NOP is the only real option.


I've seen this in professional SNES roms. And usually it's when you're waiting for a result from hardware divide or multiply. It takes like 8 - 16 cycles or something.
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: 3754/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 03-16-05 09:38 AM Link | Quote
Yeah, but that's not filling empty space, that's delaying. Having space filler actually be executed is rare, but it's generally left as 00 or FF and just ignored. (It mainly depends on your setup... Some flash carts write FF faster than 00 since the empty ROM contains all FF by default; one instruction might be better to have than the other in the event that the game crashes and tries to execute it somehow. On Gameboy/Z80, 00 is NOP while FF is essentially JP $38 (actually RST $38, but that's all it does ), so if you used FF, you could make $38 an error handler and not risk screwing things up.)
d4s

Panser
Level: 29

Posts: 133/325
EXP: 142151
For next: 5734

Since: 03-23-04

Since last post: 13 days
Last activity: 1 day
Posted on 03-16-05 11:12 AM Link | Quote
another idea if your number of unused bytes is greater than 2, is to branch to skip the unwanted bytes.
it looks cleaner in your sourcecode and only uses 2 bytes.

personally, i always prefer just placing hooks in the program that jump to my subroutines instead of writing my stuff over the games code.
its more flexible and you dont have to worry about thight space and such.
BMF98567
BLACK HAS BUILT A SILLY DICE-MAZE!
GO!

Current list of BURNING FURY >8( recipients:
- Yiffy Kitten (x2)
- Xkeeper
Level: 53

Posts: 693/1261
EXP: 1094149
For next: 62970

Since: 03-15-04
From: Blobaria
Special Move: Rising Meatloaf Backhand Combo

Since last post: 21 hours
Last activity: 1 hour
Posted on 03-16-05 02:33 PM Link | Quote
Originally posted by MathOnNapkins
I've seen this in professional SNES roms. And usually it's when you're waiting for a result from hardware divide or multiply. It takes like 8 - 16 cycles or something.
Yeah, and the rest of the time, it indicates a spot where debugging code of some kind used to reside. For example, SMB3 waits for input from controller 2 on the title screen (A+B), but all it activates is a string of 6 NOPs.
Sukasa

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

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

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

Since last post: 6 days
Last activity: 1 day
Posted on 03-17-05 01:21 AM Link | Quote
Yea. I just wanted to re-code the coin counter in SMW, and my new code was a number of bytes shorter, and I don't know JMP in machine code
BMF98567
BLACK HAS BUILT A SILLY DICE-MAZE!
GO!

Current list of BURNING FURY >8( recipients:
- Yiffy Kitten (x2)
- Xkeeper
Level: 53

Posts: 700/1261
EXP: 1094149
For next: 62970

Since: 03-15-04
From: Blobaria
Special Move: Rising Meatloaf Backhand Combo

Since last post: 21 hours
Last activity: 1 hour
Posted on 03-17-05 04:33 AM Link | Quote
Ever think of downloading an opcode list? It's very useful. I'm sure Zophar's Domain has a couple.

Anyway, JMP is 4C, JML (JMP Long) is 5C. The only difference is JML can jump anywhere in the ROM, thanks to the extra bank byte (ex: $82309F would be 5C 9F 30 82).

If you're jumping a rather small distance, though, BRA would be much more efficient (as d4s mentioned). Just use 80 ##, where ## is the number of bytes you want to jump ahead. Start at 00 and count from the byte immediately after ## (00, 01, 02...). You can also branch in reverse by counting backwards (00, FF, FE, FD...).
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: 3766/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 03-17-05 09:17 AM Link | Quote
I bet that A+B thing would have activated the debug menu that lets you choose a world and stuff. I wonder if that's the deal with some of the useless code in Pok
Add to favorites | "RSS" Feed | Next newer thread | Next older thread
Acmlm's Board - I2 Archive - Rom Hacking - Rom ASM question | |


ABII


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



Page rendered in 0.014 seconds.