(Link to AcmlmWiki) Offline: thank ||bass
Register | Login
Views: 13,040,846
Main | Memberlist | Active users | Calendar | Chat | Online users
Ranks | FAQ | ACS | Stats | Color Chart | Search | Photo album
05-02-24 10:34 PM
0 users currently in ROM Hacking.
Acmlm's Board - I3 Archive - ROM Hacking - Question New poll | |
Add to favorites | Next newer thread | Next older thread
User Post
kuja killer

Rope


 





Since: 11-17-05
From: Lake Havasu City, AZ

Last post: 6327 days
Last view: 6283 days
Posted on 12-10-05 11:10 AM Link | Quote
Since I only seem to see nothing but mostly mario related posts on here, I hope I may post on here rather than the normal ROM Hacking board if this qualifies. It's not about mario stuff.

So for my megaman 3 (NES) hack I'm working on, I've managed to finally code my own countdown routine after quite awhile that will automatically reset the game after 4 incorrect password attempts for the password system:

Setting up an RAM address with the number of tries left:
LDA #$03
STA $0431 = #$03

In the password code, I've replaced a JSR with my own to jump to some free space where there's plenty of 00's for me to mess around with which I know what I'm doing, then insert my actual code right ?

$A777: 20 71 BB JSR $BB71

Setting up the code:
First place the code from the area I've replaced from the JSR so that the game goes through that all first, that way the game won't glitch or crash suddenly, then putting in my own code:
DEC $0431 = #$02
BPL ;if 0431 is "00" then branch to a JMP $00FE to reset the game otherwise skip this
RTS ;return back to where where everything left off from.

So on a incorrect password attempt, it'll decrement that address by one each time until it's 0 to reset.

What I'm asking is ..i want it to actually display the number on the screen on each try so that the player knows how many tries are left. Someone nicely tried to help me by writing to the PPU registers, $2006 and $2007. Basically how it'd work is ..after 1 wrong attempt, it'll say on the screen "02" based off $0431 currently with the value "02" ..if 0431 is currently "01" ..then it'll print the number 01 onto the screen. ..and so on but I just know I'm doing this completely wrong?? :

LDA #$31
STA $2006
LDA #$04
STA $2006
LDA $0431
STA $2007

This is the result......


Shows up in the nametables on the left, but not on the right? What would I change my code to, to get it on the right nametables?
MathOnNapkins

1100

In SPC700 HELL


 





Since: 11-18-05

Last post: 6283 days
Last view: 6282 days
Posted on 12-10-05 12:04 PM Link | Quote

DEC $0431 = #$02
BPL ;if 0431 is "00" then branch to a JMP $00FE to reset the game otherwise skip this
RTS ;return back to where where everything left off from.


I don't think I can help you with the graphics problem... NES PPU I know virtually nothing about. However, in the above code I would caution you that a zero count results in a positive. This is b/c the most significant bit is still unset. Thus, you are giving the player an unintended extra try. The easy way to fix this is to use BNE instead. (Branches if not zero) Though, given you obviously have not given all your code, that's all the help I can give.
Kailieann



 





Since: 11-18-05

Last post: 6282 days
Last view: 6282 days
Posted on 12-10-05 12:06 PM Link | Quote
Unfortunately I can't help with the problem at hand.
However, the reason you only see SMW related threads is because this used to be the Advanced SMW Hacking forum. XKeeper changed it to Advanced ROM Hacking last night.

Perhaps someone should rename the threads to indicate which game they refer to.
kuja killer

Rope


 





Since: 11-17-05
From: Lake Havasu City, AZ

Last post: 6327 days
Last view: 6283 days
Posted on 12-10-05 02:22 PM Link | Quote
Originally posted by MathOnNapkins


However, in the above code I would caution you that a zero count results in a positive. This is b/c the most significant bit is still unset. Thus, you are giving the player an unintended extra try. The easy way to fix this is to use BNE instead. (Branches if not zero) Though, given you obviously have not given all your code, that's all the help I can give.


Ah, well it's not so much that I'm worried anymore about getting it to even work period since I've accomplished my goal now of getting it to reset after a couple attempts. I could just change the LDA #$03 to an 02. And it'll be 3 attempts rather than 4.

I know people tell me that the reset vectors are FFFA or something, and I should change my JMP to that rather than $00FE ...but according to what I've read from a NES memory map document ...

"$FFFC-$FFFD Reset Vector
This contains the address to jump to when the 6502 hardware is initialized. This occurs when you first turn on the power, or when you press the Reset button. In other words, this contains the address of the "start" of the program."


That's why I just use what I found stored there in the MM3 ROM, and it works perfectly the way I want it to.

Now I'm just wanting to see if I could get the PPU to print those numbers in the proper nametables, at least I'm pretty close to it judging by the results.
Disch

Red Cheep-cheep


 





Since: 12-10-05

Last post: 6562 days
Last view: 6562 days
Posted on 12-10-05 02:35 PM Link | Quote
Originally posted by kuja killer

LDA #$31
STA $2006
LDA #$04
STA $2006
LDA $0431
STA $2007



These writes to $2006 are strange... they will set the PPU address to $3104 -- which are mirrors of the nametables and not actually the "normal" nametable itself. I'd recommend that for drawing to the nametables, you keep the PPU address inside the typical $2xxx range.

Each of the 4 nametables are 1k ($0400) bytes in size

Upper left @ $2000
Upper right @ $2400
Lower left @ $2800
Lower right @ $2C00

Since this part of the screen has vertical mirroring... upper/lower don't really matter. So if you want to change the right pattern tables... keep the PPU address in $2400-27FF range.

As for the reset... "JMP ($FFFC)" would have almost the exact same effect as hitting the reset button on the console... so if that's what you're going for, I'd recommend taking that route.


Edit:

The desired PPU address can be further calculated by adding the desired coordinates to your address:

$2400 + (y * $20) + x

It looks like you want it at about 22,25... so $2400 + (25 * $20) + 22 = $2736

so try:

LDA #$27
STA $2006
LDA #$36
STA $2006
LDA $0431
STA $2007


(edited by Disch on 12-10-05 01:51 PM)
(edited by Disch on 12-10-05 01:52 PM)
MathOnNapkins

1100

In SPC700 HELL


 





Since: 11-18-05

Last post: 6283 days
Last view: 6282 days
Posted on 12-10-05 03:06 PM Link | Quote
Yipe... internal pointers oh my!
kuja killer

Rope


 





Since: 11-17-05
From: Lake Havasu City, AZ

Last post: 6327 days
Last view: 6283 days
Posted on 12-10-05 03:38 PM Link | Quote
I figured I was doing it wrong, but I get it now. I sort of got confused about how you write to $2006, the upper and low byte of the address, so I just assumed I'd do that RAM address I was using of 0431. My mistake.

But I understand this scenario now. I just forgot ..(my own fault) that when writing to 2006, it's VRAM wise, not what I was originally thinking.

Well, now it works.
I modified the text up again and took out the word part, but it's all good, changed the color of the balls, redisgned the boxes in Tile Layer Pro to make this screen look a little bit more interesting than just plain white squares.



(edited by kuja killer on 12-10-05 03:03 PM)
Disch

Red Cheep-cheep


 





Since: 12-10-05

Last post: 6562 days
Last view: 6562 days
Posted on 12-12-05 12:43 PM Link | Quote
I know this is already kinda old and this problem has been long since solved... but I feel kind of silly for not noticing this sooner:

FCEUXD's nametable editor tells you the address. Just hover the mouse over the tile you want to change in the nametable editor and it lists the address next to "PPU Address" at the bottom.

Heh... well I guess knowing how it comes up with that address isn't a bad thing
Add to favorites | Next newer thread | Next older thread
Acmlm's Board - I3 Archive - ROM Hacking - Question |


ABII

Acmlmboard 1.92.999, 9/17/2006
©2000-2006 Acmlm, Emuz, Blades, Xkeeper

Page rendered in 0.071 seconds; used 389.25 kB (max 475.20 kB)