| |||
| Views: 12,476,419 |
![]() ![]() ![]()
Main
| FAQ
| Uploader
| IRC chat
| Memberlist
| Active users
| Latest posts
| Calendar
| Stats
| Online users
| Search
|
09-07-10 02:39 PM |
|
| Guest: Register | Login | |||
| Main - ROM Hacking - 65816 ASM tutorial | New thread | New reply |
| Sukasa |
| ||
|
Red Birdo Wow, I'm not even allowed to ban myself Level: 73 Posts: 16/2107 EXP: 3482290 Next: 3578 Since: 02-19-07 Last post: 290 days Last view: 284 days |
(Credit goes to Glyph Pheonix for the original idea)
Yeah, this kind of a thread was quite helpful o NOTE: I tried to finish this up as best I could from the old board. If there are any problems, I'm adfraid I won't be able to fix them until editpost.php is completed. Until then, please hang tight
65816 ASM
|
| Bio |
| |||||||
|
Red Paragoomba Level: 15 Posts: 4/58 EXP: 15903 Next: 481 Since: 02-19-07 Last post: 854 days Last view: 717 days |
(from SMW central, this is about the different adressing mode)
first of all , there is immediate adressing mode, it is used when an opcode should affect the next value insted of a RAM/ROM adress here an example code of how to use it
secondly, there is long adressing mode, long adressing is 3 byte long, allowing it to reach any SNES bank, however, it is more limited, bigger and slower than the other an example of long adressing:
the third o previous code, optimised with the use absolute adressing
the data bank register can be changed by o
this code should change the data bank register the fourth o previous code, optimised with the use direct adressing
the next o
in that case the adress that LDA will load from will be $XX:ODB2+04 Finally, the last o
the lda will load from adress $XX:8D52 because 7E00000 is 52 8D (the pointer is byte-shifted). the sta will store at adress $0D9CB0 since it's indirect long, so the pointer is 3 byte. If you have any question just ask in this thread |
| Hamtaro126 |
| ||
|
Paratroopa Level: 23 Posts: 16/144 EXP: 60466 Next: 7257 Since: 05-02-07 From: Shelton, WA Last post: 11 days Last view: 4 days |
Posted by Sukasa Sukasa: If you are still here, please make a fix. Because it requires AS_IFCE1.OCX. I looked for it o ____________________ Mah boi, romhacking is what all true warriors strive for! I wonder what's for dinner? |
| Sukasa |
| ||
|
Red Birdo Wow, I'm not even allowed to ban myself Level: 73 Posts: 272/2107 EXP: 3482290 Next: 3578 Since: 02-19-07 Last post: 290 days Last view: 284 days |
Odd... Anyways, I'll upload a .zip of it and update. thanks for pointing that out |
| Luigiownsmario |
| ||
|
Micro-Goomba Level: 7 Posts: 1/11 EXP: 1233 Next: 215 Since: 07-22-07 From: Hiding somewhere o Last post: 1129 days Last view: 1121 days |
Could you please give me a link to a good snes compiler, i couldn't find o ____________________ ![]() ![]() ![]() ![]() ![]() ![]() |
| Sukasa |
| ||
|
Red Birdo Wow, I'm not even allowed to ban myself Level: 73 Posts: 370/2107 EXP: 3482290 Next: 3578 Since: 02-19-07 Last post: 290 days Last view: 284 days |
Hm. You could google "WLA-DX" for a SNES ROM compiler, but I use x112f from zophar's for small little code segments, etc... It's a little difficult to use (You need to add ".B" and ".W" to LDA/LDY/CMP/etc.) but otherwise it's nice. |
| Luigiownsmario |
| ||
|
Micro-Goomba Level: 7 Posts: 2/11 EXP: 1233 Next: 215 Since: 07-22-07 From: Hiding somewhere o Last post: 1129 days Last view: 1121 days |
Thanks. ____________________ ![]() ![]() ![]() ![]() ![]() ![]() |
| GameGenie81 |
| ||
|
Koopa Level: 19 Posts: 32/100 EXP: 33453 Next: 2324 Since: 08-15-07 From: Milwaukie, OR Last post: 453 days Last view: 407 days |
So, if I know how to do this, then I may be all set here:
$90F9:A0 05 - LDY #$05: This tells the game to load #$05 into Y. $9106:AC 4E 07 - LDY $074E = #$01: This tells the game to load the value stored at RAM address $074E into Y. $9109:AD 43 07 - LDA $0743 = #$00: This tells the game to load the value stored at RAM address $0743 into A. $9113:85 FB - STA $00FB = #$80: This tells the game to store the value located at RAM address $00FB into A. Also, what does ORA mean? ~Ben (GameGenie81) ____________________ We are a nation with no geographic boundaries, bound together through our beliefs. We are like-minded individuals, sharing a common vision, pushing toward a world rid of color lines. |
| carsr4carpeople1 |
| ||
|
Red Goomba Level: 13 Posts: 1/40 EXP: 8078 Next: 2189 Since: 11-22-07 From: Illinois, USA Last post: 364 days Last view: 8 days |
I dont understand the concept of the stack.. why exactly would you need to push/pull from it? ____________________ Come join #NekoCentral o |
| blackhole89 |
| |||||
![]() The Guardian Transient hoster person 闇を切り裂いて Level: 89 Posts: 1435/3283 EXP: 6772937 Next: 142964 Since: 02-19-07 From: Cambridge, UK Last post: 8 hours Last view: 7 hours |
|
| Sukasa |
| ||
|
Red Birdo Wow, I'm not even allowed to ban myself Level: 73 Posts: 658/2107 EXP: 3482290 Next: 3578 Since: 02-19-07 Last post: 290 days Last view: 284 days |
Posted by GameGenie81 ORA means "OR Bits with A". For example, #$00 OR #$80 would be #$80, while #$82 OR #$80 would be #$82. to view it in binary, 00000000 OR 10000000 is 10000000, and 10000010 OR 10000000 is 10000010. |
| Heian |
| ||
|
Red Koopa Level: 22 Posts: 101/126 EXP: 50574 Next: 7776 Since: 03-08-07 Last post: 867 days Last view: 866 days |
Newbie question: what would 11110000 OR 00001110 be? 11111110, because you get 1 if the corresponding bit in either value is 1? |
| blackhole89 |
| |||||
![]() The Guardian Transient hoster person 闇を切り裂いて Level: 89 Posts: 1438/3283 EXP: 6772937 Next: 142964 Since: 02-19-07 From: Cambridge, UK Last post: 8 hours Last view: 7 hours |
|
| Heian |
| ||
|
Red Koopa Level: 22 Posts: 102/126 EXP: 50574 Next: 7776 Since: 03-08-07 Last post: 867 days Last view: 866 days |
No, I was indeed talking about the bitwise ORA that was being asked about by Ben. This thread is looking very useful to ASM beginners like myself.
Question (and this might be hopelessly oversimplified...): If you want to display some value o |
| blackhole89 |
| |||||
![]() The Guardian Transient hoster person 闇を切り裂いて Level: 89 Posts: 1439/3283 EXP: 6772937 Next: 142964 Since: 02-19-07 From: Cambridge, UK Last post: 8 hours Last view: 7 hours |
|
| Heian |
| ||
|
Red Koopa Level: 22 Posts: 103/126 EXP: 50574 Next: 7776 Since: 03-08-07 Last post: 867 days Last view: 866 days |
Now there's a challenging read! I'll have a look at that; thanks! |
| MathOnNapkins |
| ||
|
Bandit Level: 49 Posts: 317/808 EXP: 826753 Next: 57130 Since: 02-19-07 From: durff Last post: 19 days Last view: 4 days |
Just to elaborate a bit, anything in Qwertie's doc that seems incomplete or hard to understand can be better understood by reading Anomie's documents (register document specifically.) Qwertie's doc is the major o ____________________ hobbies: delectatio morosa |
| Thanatos-Zero |
| ||
|
Red Paratroopa Level: 23 Posts: 10/178 EXP: 60607 Next: 7116 Since: 11-25-08 From: Germany - Rheinlandpfalz - Wittlich - Zur Phillippsburg 25 Last post: 5 days Last view: 2 days |
I have just tried to read all this, but I got a blackout, by all this information . If this continues, I will never be able to expand my abilities to hack. I can o![]() ____________________ I was a prisoner enclosed in the void, were everything might end up just as myself. There I was called the death in the void, but after a long sleep my drill was ready to pierce the void. I came back... to guide those who are in doubt and to crush any corrupted mind. "Just who in the hell do you think I am?!". |
| GameGenie81 |
| ||
|
Koopa Level: 19 Posts: 88/100 EXP: 33453 Next: 2324 Since: 08-15-07 From: Milwaukie, OR Last post: 453 days Last view: 407 days |
What do all these definitions mean? Pardon me for repeating this here again... but I do need better analysis pertinent to this.
Video game: Super Mario Bros. (Nintendo, N.E.S., 1985) ChkAreaType: $9106: AC 4E 07 - LDY $074E $9109: AD 43 07 - LDA $0743 $910C: F0 02 - BEQ $9110 $910E: A0 04 - LDY #$04 StoreMusic: $9110: B9 E7 90 - LDA $90E7,Y $9113: 85 FB - STA $FB (this senses the ROM page of $FB00-$FBFF) $9115: 60 - RTS What goes into the "Y" register that causes any of the following? If "4E" in 0x1117 is changed to "8C" - Water music plays all the time, except for the pipe intro and cloud scenes. The value of RAM address $078C is #$00. If "4E" in 0x1117 is changed to "70" - Ground music plays all the time (bar pipe intro and cloud scenes). The value of RAM address $0770 is #$01. If "4E" in 0x1117 is changed to "61" - Underground music plays all the time (bar pipe intro and cloud scenes). The value of RAM address $0761 is #$02. Default byte "4E" (in 0x1117) senses all six pieces of BGM (the bytes that span from 0x10F7 to 0x10FC; which are stored according to LDA "absolute, Y" instruction in 0x1120) play in their proper scenes. In other words, what values of the RAM addresses, when I play with bytes in ROM addresses 0x1117-1118 (or any other absolute ROM instruction), may arise o Thank you, Ben ____________________ We are a nation with no geographic boundaries, bound together through our beliefs. We are like-minded individuals, sharing a common vision, pushing toward a world rid of color lines. |
| Iceguy |
| ||
|
Newcomer Level: 5 Posts: 2/8 EXP: 457 Next: 72 Since: 07-25-09 Last post: 405 days Last view: 408 days |
I know this tutorial was made back in 2007, but there's still quite a few bugs:
"PHA //Good form to preserve the accumulator LDA $7E0019 CMP #$00 //This is the compare instruction you just learned! BNE NoMakeBig //See how this tells the SNES processor to branch to the instruction following the label "NoMakebig"? LDA #$01 STA $7E0019 NoMakeBig: RTS" You preserved the accumulator, but you didn't pull it back, so you need to pull a PLA right before the NoMakeBig. "You CANNOT multiply or divide with the 65c816" ASL and LSR both work to multiply/divide an address by 2 each time you use it. "These two little guys can't do math at all... " You can do INX/INY/DEX/DEY and you have also showed that in your tutorial, but you can't use do INX $RAM or DEX $RAM (same with Y). They're good for loops though. |
| Main - ROM Hacking - 65816 ASM tutorial | New thread | New reply |
© 2005-2010 Acmlm, Xkeeper, blackhole89 et al. |
|
MySQL - queries: 111, rows: 154/0, time: 0.229 seconds. |