+  RHDN Forum Archive
|-+  Romhacking
| |-+  ROM Hacking Discussion
| | |-+  SNES ROM Expansion and Moving Pointer Tables.
Pages: 1 2 [3] 4 5
Author Topic: SNES ROM Expansion and Moving Pointer Tables.  (Read 2 times)
creaothceann
Guest
« Reply #30 on: August 20, 2007, 02:23:11 pm »

Quote from: RedComet on August 20, 2007, 01:23:11 pm

*cough*
RedComet
Guest
« Reply #31 on: August 20, 2007, 05:11:29 pm »

Quote from: creaothceann on August 20, 2007, 02:23:11 pm
Quote from: RedComet on August 20, 2007, 01:23:11 pm

*cough*

Yeah. I kind of thought the Line/Cart charts would confuse DS even more.
DarknessSavior
Guest
« Reply #32 on: August 21, 2007, 01:50:02 pm »

I agree with him, it would. But I saved it anyway in hopes that in the future I'll understand it more.

~DS
creaothceann
Guest
« Reply #33 on: August 21, 2007, 04:38:37 pm »

Well, the cartridge connector has 62 electrical lines connecting it with the rest of the SNES, and the expansion port connector has 28 lines. You can see them here.

The four tables in memmap.txt simply show which of these lines are connected with address bus A, address bus B and the data bus. You can simply ignore them since you're only dealing with software.
DarknessSavior
Guest
« Reply #34 on: August 22, 2007, 02:51:15 pm »

Yeah, not something I want to dig into unless I have to. ASM in confusing enough as-is.

I got through the first two lines of code (once I remembered to reset the breakpoint to check for values, doh!). The third one confuses me, but for a normal reason: I don't understand the opcode.

Code:
$00/9E67 A7 17       LDA [$17]  [$03:AD09]   A:0020 X:0000 Y:001C D:0000 DB:00 S:1FE4 P:envmxdiZcHC:0790 VC:088 00 FL:48268
- Direct Indirect Long address mode. Okay, so you go to $000017 (which is $7E0017 in RAM).

09AD03 is the first three bytes, which becomes the effective address.
You go there, and get the first two bytes ($88 AD) and reverse them, and those bytes are then loaded to the accumulator.
Interestingly, those first two bytes are the first two bytes of the menu screen (It from "Item").

$00/9E69 E6 17       INC $17    [$00:0017]   A:AD88 X:0000 Y:001C D:0000 DB:00 S:1FE4 P:eNvmxdizcHC:0878 VC:088 00 FL:48268
- This one's simple. All it's doing is increasing the value at $000017 by one. This changes the $09 to $0A.

$00/9E6B 29 FF 00    AND #$00FF              A:AD88 X:0000 Y:001C D:0000 DB:00 S:1FE4 P:eNvmxdizcHC:0940 VC:088 00 FL:48268
- Now I'm kinda confused. All the two guides I have for ASM say that the "AND" opcode performs an "AND" to the accumulator.
The other one says it is a "Logical AND". Huh? I know that these next two operations are in the Immediate addressing mode.

Can someone better explain the "AND" opcode?

~DS
« Last Edit: August 22, 2007, 03:43:13 pm by KaioShin »
KaioShin
Guest
« Reply #35 on: August 22, 2007, 03:08:07 pm »

AND compares two values, bit by bit. If both are 1, the resulting bit will be 1, if they aren't both 1 the resulting bit will be 0.

Example:

Code:
11001010  <- First operand
10101100  <- Second operand
=======
10001000  <- Result

Clear now?
« Last Edit: August 22, 2007, 03:36:00 pm by KaioShin »
HyperHacker
Guest
« Reply #36 on: August 22, 2007, 03:15:10 pm »

Specifically, "AND #$xx" means Logical AND (see above) the accumulator (register 'A') with #$xx and store the result in the accumulator.

Quote from: DarknessSavior on August 17, 2007, 01:50:44 pm
Well, I've heard of them, but I've never used them. I kinda thought that it just changed random bytes though; I didn't know you could set them to change specific ones.
Some you can set to change all instances of one byte, others just change all bytes.

Quote
Also, I checked all of the instances of 09AD, changing the 09 to 10 (hoping for "Item" to change to "tem")
I hope you mean changed the 09 to 0A. O_o

Oh yeah and hi I'm new. Tongue
DarknessSavior
Guest
« Reply #37 on: August 22, 2007, 03:16:45 pm »

Okay. Sure. But when it says AND #$00FF does it mean it's comparing the first two bytes at $00FF?

And omg...you're right. *headdesk* Stupid me. Mayhaps I should check again.

~DS
KaioShin
Guest
« Reply #38 on: August 22, 2007, 03:23:34 pm »

No...

Looking at your tracelog, A is $AD88 in that step.

Code:
$AD88 = 1010110110001000
$00FF = 0000000011111111
========================
$0088 = 0000000010001000

It compares the value in the accumulator with the immediate operand it is called with and stores the result in the accumulator.


« Last Edit: August 22, 2007, 03:36:21 pm by KaioShin »
HyperHacker
Guest
« Reply #39 on: August 22, 2007, 03:24:05 pm »

Quote from: DarknessSavior on August 22, 2007, 03:16:45 pm
Okay. Sure. But when it says AND #$00FF does it mean it's comparing the first two bytes at $00FF?
No, because of the # sign. "$00FF" means the data at address 00FF. "#$00FF" means the number 00FF.

[edit] Eh, Kaio, that's OR. Tongue 0xAD88 AND 0xFF = 0x88.
MathOnNapkins
Guest
« Reply #40 on: August 22, 2007, 03:30:55 pm »

The $ doesn't mean address, it means hex. It's just like the 0x prefix.
DarknessSavior
Guest
« Reply #41 on: August 22, 2007, 03:37:05 pm »

He's right, it's $88. (I know that because the accumulator value changes to that next). How did you come up with that, the same way Kaio did, just comparing the two bit by bit?

~DS
KaioShin
Guest
« Reply #42 on: August 22, 2007, 03:38:59 pm »

@HyperHacker: Yeah, a slip up on my part. It doesn't compare, it checks if both are 1. It shows I really need to get back to some hacking^^

(But it's far from being OR either, that would have resulted in $ADFF Wink )

I fixed my examples, sorry DS, I hope I haven't confused you in the meantime.

Do you know about bit arithmetic at all? If not you should look for some documents about it, it's fundamental for ASM.
HyperHacker
Guest
« Reply #43 on: August 22, 2007, 03:42:15 pm »

Quote from: DarknessSavior on August 22, 2007, 03:37:05 pm
He's right, it's $88. (I know that because the accumulator value changes to that next). How did you come up with that, the same way Kaio did, just comparing the two bit by bit?

~DS
Start -> Programs -> Accessories -> Calculator (or Start -> Run -> "calc" -> OK) -> View -> Scientific. Notice the base selector in the top left, and the And, Xor, Not, Or etc at the right.
KaioShin
Guest
« Reply #44 on: August 22, 2007, 03:45:04 pm »

Yeah, you can use that to check, however I strongly advise you to learn to do these small calculations (if you even want to call it that) manually, so you have an understanding on what's going on. Relying on a calculator won't help you understanding Wink
Pages: 1 2 [3] 4 5  


Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC