| |||
Views: 86,391,823![]() |
![]() ![]() ![]() ![]() |
03-29-23 06:09 PM![]() |
|
Guest: Register | Login |
0 users currently in ROM Hacking Archives | 1 guest |
Main - ROM Hacking Archives - 65816 ASM tutorial | New thread | Thread closed |
Sukasa |
| ||
![]() ![]() Red Birdo Level: 91 Posts: 16/2112 EXP: 7444289 Next: 24623 Since: 02-19-07 Last post: 4054 days Last view: 2826 days |
(Credit goes to Glyph Pheonix for the original idea)
Yeah, this kind of a thread was quite helpful on the old board, so... 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: 19 Posts: 4/58 EXP: 33878 Next: 1899 Since: 02-19-07 Last post: 5440 days Last view: 5303 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 one is absolute adressing, abslute adrssing is like long adressing, but only 2-byte long, the highest byte is replaced by the value in the data bank register. However, since RAM adress 7E0000-7E1FFF is mirrored in 0000-1FFF of every ROM bank previous code, optimised with the use absolute adressing
the data bank register can be changed by only one instruction(PLB), therefor, a value can be written to it using something like this:
this code should change the data bank register the fourth one is direct adressing mode, it is similar to absolute adressing, except that the value is only 1-byte long and that the highest byte is set by another register(called direct page), since direct page appear to be alway 0 in SMW, this adressing mode should be used to acess RAM adress 7E0000- 7E00FF previous code, optimised with the use direct adressing
the next one is indexed with X or Y, it add the value of X or Y to the destination of the opcode. since exemple are the best, here one:
in that case the adress that LDA will load from will be $XX:ODB2+04 Finally, the last one is indirect and indirect long, they are noticable because they have () around their pointer([] for long). This one is weird, instead of acessing the data, it, interpret the data as a point to the real data. since this is quite complex, here an example:
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 |
| ||
![]() ![]() Cheep-cheep Level: 32 Posts: 16/194 EXP: 205974 Next: 468 Since: 05-02-07 From: Shelton, WA Last post: 2079 days Last view: 1922 days |
Posted by Sukasa Sukasa: If you are still here, please make a fix. Because it requires AS_IFCE1.OCX. I looked for it on google and many websites said it's ''Bad for your PC!'' and is ''Malware''. After you fix it, upload it. ____________________ Mah boi, romhacking is what all true warriors strive for! I wonder what's for dinner? |
Sukasa |
| ||
![]() ![]() Red Birdo Level: 91 Posts: 272/2112 EXP: 7444289 Next: 24623 Since: 02-19-07 Last post: 4054 days Last view: 2826 days |
![]() |
Luigiownsmario |
| ||
![]() ![]() Micro-Goomba Level: 9 Posts: 1/11 EXP: 2761 Next: 401 Since: 07-22-07 From: Hiding somewhere on yoshi's island. Last post: 5715 days Last view: 5707 days |
Could you please give me a link to a good snes compiler, i couldn't find one at zophar.net. thanks in advance. ____________________ ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Sukasa |
| ||
![]() ![]() Red Birdo Level: 91 Posts: 370/2112 EXP: 7444289 Next: 24623 Since: 02-19-07 Last post: 4054 days Last view: 2826 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: 9 Posts: 2/11 EXP: 2761 Next: 401 Since: 07-22-07 From: Hiding somewhere on yoshi's island. Last post: 5715 days Last view: 5707 days |
Thanks. ____________________ ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
GameGenie81 |
| ||
![]() ![]() Koopa Level: 24 Posts: 32/100 EXP: 75533 Next: 2592 Since: 08-15-07 From: Milwaukie, OR Last post: 5040 days Last view: 4993 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: 16 Posts: 1/40 EXP: 18941 Next: 1315 Since: 11-22-07 From: Illinois, USA Last post: 4950 days Last view: 4430 days |
I dont understand the concept of the stack.. why exactly would you need to push/pull from it? ____________________ Come join #NekoCentral on IRC! |
blackhole89 |
| ||
![]() ![]() The Guardian Moloch whose eyes are a thousand blind windows! Level: 123 Posts: 1435/4196 EXP: 20846644 Next: 384622 Since: 02-19-07 From: Ithaca, NY, US Last post: 77 days Last view: 1 day |
|
Sukasa |
| ||
![]() ![]() Red Birdo Level: 91 Posts: 658/2112 EXP: 7444289 Next: 24623 Since: 02-19-07 Last post: 4054 days Last view: 2826 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: 27 Posts: 101/126 EXP: 108313 Next: 7846 Since: 03-08-07 Last post: 5453 days Last view: 5452 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 Moloch whose eyes are a thousand blind windows! Level: 123 Posts: 1438/4196 EXP: 20846644 Next: 384622 Since: 02-19-07 From: Ithaca, NY, US Last post: 77 days Last view: 1 day |
|
Heian |
| ||
![]() ![]() Red Koopa Level: 27 Posts: 102/126 EXP: 108313 Next: 7846 Since: 03-08-07 Last post: 5453 days Last view: 5452 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 on the screen, and you know its address in the ROM, how do you go about doing that? Let's say that a baseball game displays a batter's average (stored at 0xA0000 and A0001) and his home runs (0xA0004), and you know where the font graphics for those digits are stored in the ROM. Now you want to show his speed (0xA0006) in addition -- what do you do? |
blackhole89 |
| ||
![]() ![]() The Guardian Moloch whose eyes are a thousand blind windows! Level: 123 Posts: 1439/4196 EXP: 20846644 Next: 384622 Since: 02-19-07 From: Ithaca, NY, US Last post: 77 days Last view: 1 day |
|
Heian |
| ||
![]() ![]() Red Koopa Level: 27 Posts: 103/126 EXP: 108313 Next: 7846 Since: 03-08-07 Last post: 5453 days Last view: 5452 days |
Now there's a challenging read! I'll have a look at that; thanks! |
MathOnNapkins |
| ||
![]() ![]() Super Koopa Level: 61 Posts: 317/842 EXP: 1873813 Next: 2783 Since: 02-19-07 From: durff Last post: 4094 days Last view: 3618 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 one I learned on, but I'm aware of some of its flaws too :/. And for something neither document really makes things crystal clear, and you'll have to mess with it yourself to truly understand how it works. ____________________ Zelda Hacking Forum hobbies: delectatio morosa |
Thanatos-Zero |
| ||
![]() ![]() Nipper Plant Level: 45 Posts: 10/423 EXP: 629609 Next: 30555 Since: 11-25-08 From: Germany - Rheinlandpfalz - Wittlich - Zur Phillippsburg 25 Last post: 697 days Last view: 660 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 only hack palettes with a Hex-Searcher. It´s so much frustating. ![]() ____________________ 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: 24 Posts: 88/100 EXP: 75533 Next: 2592 Since: 08-15-07 From: Milwaukie, OR Last post: 5040 days Last view: 4993 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 once I do the more complicated math? 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: 8 Posts: 2/8 EXP: 1599 Next: 588 Since: 07-25-09 Last post: 4991 days Last view: 4994 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 Archives - 65816 ASM tutorial | New thread | Thread closed |
© 2005-2023 Acmlm, blackhole89, Xkeeper et al. |
MySQL - queries: 117, rows: 145/146, time: 0.037 seconds. |