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 - Changing an instruction via ASM
  
User name:
Password:
Reply:
 

UserPost
mikeyk
Posts: 9/110
Thanks for the clarification. I went with something along the lines of #1, and I'm happy to say I have a hack where Chucks have different HP depending on the level. On to bigger and better things. Thanks again
d4s
Posts: 57/325
next time you ask some assembler-related question, please show us a bit more than just one opcode.

your mistake is obvious, though.

A9 05 (LDA #$05)
8F EF C7 02 (STA $02C7EF) ;<----you are trying to store 05 in the actual rom, thats not possible.
the rom is read-only.
you probably didnt know, but what you are trying to do is called self-modifying code, it only works if executing code from ram, however.

you have two options:

1.)
write a small routine that checks wich level is currently loaded(i think smws variables in ram are documented, arent they?).
replace the CMP #$03 with CMP $var in a hexeditor.
var is a variable you have to set up first.
now the game doesnt load byte #$03, it loads a
byte from the variable you specified.
find an adress in the ram wich isnt used by smw, that will be your variable.
write #$03 to it on bootup and let your levelcheckroutine write #$05 to that variable when that level is running, else write #$03 to it.
be sure A is set to 8bit when while reading/writing that variable (use SEP #$20 to set, REP #$30 to reset to 16bit in case the preceding routine uses 16bit A/mem),
else you would be using a 16 bit value.

2.)
if you are keen on that selfmodifying code thing, copy the routine to ram(probably too stuffed already) or expand the battery backed sram in the nintendo header so you have some space in the sram,
copy the routine there and execute it from there.
that would be more work however, youd have to update and control the
bank and program registers via the stack and this generally too difficult for newbies.


i'd prefer the former.






mikeyk
Posts: 8/110
I am just starting out with ASM. So far I have just been observing the original code and making small modifications. I know that the Chargin Chuck hit points are set by this instuction which is at ROM location 0x149EF:

$02/C7EE C9 03 CMP #$03

I want to keep the value of 3 throughout my game, but I am trying to make one level where Chucks will take 5 hits instead. I installed BMF's palette controlled ASM hack and tested it with some code involving coins, and that worked out great. So I was hoping to add a bit of code to change the Chucks, that is changing the above instuction to CMP #$05. I thought it would be as easy as adding this...

A9 05 (LDA #$05)
8F EF C7 02 (STA $02C7EF)

but that didn't produce any changes. I'm just starting to poke around with ASM, so I realize there's probably something wrong with how I'm thinking about this. Is it possible to modify an original instuction for a level using BMF's palette control? Please help me out if you can.
Acmlm's Board - I2 Archive - Super Mario World hacking - Changing an instruction via ASM


ABII


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



Page rendered in 0.002 seconds.