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 Rom Hacking: hukka | 2 guests
Acmlm's Board - I2 Archive - Rom Hacking - FF Hacking FAQ/Running Q&A | |
Pages: 1 2 3 4 5 6 7Add to favorites | "RSS" Feed | Next newer thread | Next older thread
User Post
Dish

Spiny
Level: 38

Posts: 46/596
EXP: 355646
For next: 14801

Since: 03-15-04
From: Disch

Since last post: 18 days
Last activity: 18 days
Posted on 04-25-04 09:45 AM Link | Quote
The cursors are redrawn every frame for all the menus I've looked at (it clears the $200 area in RAM, which is used as sprite memory, then rewrites all the sprite data to it every frame). To do this, the game typically reads the cursor position (which is at $62 in RAM, or at least it is in every menu I've checked) and *sometimes* runs that value through a lookup table of coords (which is easily editable). Otherwise, it does some sort of math formula to determine the position (it does this for the larger menus, like item and magic menus). Those are more of a pain to work with.

Anyway, if you break on $62 reads in a menu... it should immediatly stop at the code you're interested in. So you can figure out where and how it's getting the coords from.

BUT... if you're looking for specific offsets ... the coords for the main menu subcursor (the one which selects which character you're pointing to) are at $3B7E9 (2 byte pairs.. first byte X.. 2nd byte Y)

Note that since the cursor is a sprite, changing the coords by 1 will move 1 pixel (not 8, like boxes and text... since those were the background). So you'll be working with bigger numbers here.
Imajin

Buster Beetle
Level: 34

Posts: 244/452
EXP: 234863
For next: 18788

Since: 03-15-04
From: Kingdom of Zeal

Since last post: 39 days
Last activity: 53 days
Posted on 04-27-04 01:52 AM Link | Quote
Is it possible to kill the "world-wrap" feature the maps have? (just make it stop scrolling when the edge of the map is reached)
Dish

Spiny
Level: 38

Posts: 47/596
EXP: 355646
For next: 14801

Since: 03-15-04
From: Disch

Since last post: 18 days
Last activity: 18 days
Posted on 04-27-04 06:44 AM Link | Quote
Can't help you with that one. That might proove to be a little difficult... or it might be cake. Probably the biggest difficulty you'd have to overcome is you'd have to manually adjust the player's sprite coords (the player is always drawn center screen... and never moves. So you'd not only have to stop screen scrolling, but you'd also have to move the character's graphics).

There might also be complications if the overworld and inner maps share the same code. I'd assume you would still want the overworld map to wrap.. unless you have some weird end-of-earth plan ;D
NightHawk

Bob-Omb
Level: 39

Posts: 6/621
EXP: 374743
For next: 30028

Since: 03-26-04
From: Switzerland

Since last post: 432 days
Last activity: 339 days
Posted on 04-27-04 12:20 PM Link | Quote
Hi everyone, I've got a couple new questions.

1) I've been collecting lots of info about where and how the game stores and processes various pieces of data, and I'd like to make it available to others for whom it would be useful, but how would be the best way? I don't have a website, nor the spare time to manage one

2) I've been able to modify both the magic and status screens to what I want for my hack (more or less -- I still have a bit left to finish with them), but I can't figure out how the game fills in the character boxes in the main menu. Can anyone help me a bit with that?

Thanks in advance.
drjayphd

Beamos
What's that spell?




pimp!
Level: 56

Posts: 206/1477
EXP: 1387410
For next: 10766

Since: 03-15-04
From: CT

Since last post: 2 hours
Last activity: 2 hours
Posted on 04-28-04 03:58 AM Link | Quote
I can help you on #1: ROM Hacking Repository should have what you're looking for.
Dish

Spiny
Level: 38

Posts: 49/596
EXP: 355646
For next: 14801

Since: 03-15-04
From: Disch

Since last post: 18 days
Last activity: 18 days
Posted on 04-28-04 07:32 AM Link | Quote
The routine which draws the text in the main menu character boxes is at $3B992. A is set to 00,40,80, or C0 when that routine is called (which character's stats to draw)

The first thing it does is it checks the player's max charges (with a LDA command and 7 following ORA commands). If the player has no MP, it skips ahead... otherwise it draw player MP. I haven't fully deciphered the MP drawing section because I didn't have a need to (I ended up rewriting it to conform to drawing the new style MP).

After that... it draws the player's current and max HP values (the numerical values). It writes a string to $0300 in RAM, then jumps to a routine (at $3B954) which formats and draws that string.

After it draws HP... it draws a big chunk of text which has the player's name, his level, and the text "HP". Here's a snippit from my file:


; this builds the next portion of the string
LDA #$00
STA $0301 ; 00 = signal to draw the player's name
LDA #$01
STA $0302 ; 01 = double line break
LDA #$C6
STA $0303 ; C6 = 'L' (not the normal 'L', but the 'L' used for character's level)
LDA $0300 ; load character ID
STA $0304 ; move it here
LDA #$03
STA $0305 ; 03 = signal to draw the player's level
LDA #$01
STA $0306 ; 01 = double line break
LDA $0300 ; load character ID again
STA $0307 ; move it here
LDA #$02
STA $0308 ; 02 = signal to load premade string...
LDA #$00
STA $0309 ; 00 = "HP" premade string
LDA #$00 ; Strangely, this string does not seem to be null terminated =\. Either I'm missing something
; or the code somehow prevents null termination being necessary in this case... however
; I followed up the code as best I could and didn't see any special case here,
; My best guess is that the game stops the string when it loads a premade string "HP" in this case
; However, it doesn't look like the code actually does that =\. I'm stumped.
STA $3E ; reset start of string to $0300
JMP l3E_DE36 ; draw the formatted string and exit


"LDA $0300 ; load character ID" < -- the "character ID" was previously stored at $0300. It is $1x where x is 0,1,2, or 3 depending on which char's stats are to be retreived.

The way it works is... each character is pulled and drawn from that string unless it's a special character. $1x signals to retreive and draw a character stat... and the following byte determines which stat. So "10 00" would draw the player 1's name... "12 05" would draw player 3's current HP, etc.


$3E,$3F are set to $0300, which is the address of the string to be formatted. $3A and $3B are the coords at which that text is to be drawn. The code in this area only adds/subtracts to $3B. I don't think it ever alters $3A.
NightHawk

Bob-Omb
Level: 39

Posts: 10/621
EXP: 374743
For next: 30028

Since: 03-26-04
From: Switzerland

Since last post: 432 days
Last activity: 339 days
Posted on 04-28-04 09:29 AM Link | Quote
Originally posted by Disch
The routine which draws the text in the main menu character boxes is at $3B992. A is set to 00,40,80, or C0 when that routine is called (which character's stats to draw)

The first thing it does is it checks the player's max charges (with a LDA command and 7 following ORA commands). If the player has no MP, it skips ahead... otherwise it draw player MP. I haven't fully deciphered the MP drawing section because I didn't have a need to (I ended up rewriting it to conform to drawing the new style MP).
That was all I'd been able to figure out from this routine so far.


After that... it draws the player's current and max HP values (the numerical values). It writes a string to $0300 in RAM, then jumps to a routine (at $3B954) which formats and draws that string.
$0300? Well, that explains part of my trouble -- the other screens I'd hacked all had their strings in $6C00.


After it draws HP... it draws a big chunk of text which has the player's name, his level, and the text "HP". Here's a snippit from my file:


; this builds the next portion of the string
LDA #$00
STA $0301 ; 00 = signal to draw the player's name
LDA #$01
STA $0302 ; 01 = double line break
LDA #$C6
STA $0303 ; C6 = 'L' (not the normal 'L', but the 'L' used for character's level)
LDA $0300 ; load character ID
STA $0304 ; move it here
LDA #$03
STA $0305 ; 03 = signal to draw the player's level
LDA #$01
STA $0306 ; 01 = double line break
LDA $0300 ; load character ID again
STA $0307 ; move it here
LDA #$02
STA $0308 ; 02 = signal to load premade string...
LDA #$00
STA $0309 ; 00 = "HP" premade string
LDA #$00 ; Strangely, this string does not seem to be null terminated =\. Either I'm missing something
; or the code somehow prevents null termination being necessary in this case... however
; I followed up the code as best I could and didn't see any special case here,
; My best guess is that the game stops the string when it loads a premade string "HP" in this case
; However, it doesn't look like the code actually does that =\. I'm stumped.
STA $3E ; reset start of string to $0300
JMP l3E_DE36 ; draw the formatted string and exit


"LDA $0300 ; load character ID" < -- the "character ID" was previously stored at $0300. It is $1x where x is 0,1,2, or 3 depending on which char's stats are to be retreived.

The way it works is... each character is pulled and drawn from that string unless it's a special character. $1x signals to retreive and draw a character stat... and the following byte determines which stat. So "10 00" would draw the player 1's name... "12 05" would draw player 3's current HP, etc.
Yeah, I'd already figured out those codes it uses, because it does the same thing in the magic and status screens.

Thanks again for the help


Oh, and btw, that string is NULL terminated -- "10 02" always draws "HP", it doesn't have subcodes.
Dish

Spiny
Level: 38

Posts: 50/596
EXP: 355646
For next: 14801

Since: 03-15-04
From: Disch

Since last post: 18 days
Last activity: 18 days
Posted on 04-28-04 07:01 PM Link | Quote
aw..crap. You're right lol.

well that solves that mystery ^^ . Thanks.
NightHawk

Bob-Omb
Level: 39

Posts: 42/621
EXP: 374743
For next: 30028

Since: 03-26-04
From: Switzerland

Since last post: 432 days
Last activity: 339 days
Posted on 05-07-04 04:34 PM Link | Quote
Okay, something of a complex question...
In the last 2 pages (page = 256 bytes) of the ROM, there seems to be a lot of unused "space" that's either filled with $00's, $01's, or seemingly random "stuff". Does anyone know if that stuff is actually USED at somewhere? Or is it just "filler"? (Note: I'm not talking of the various routines in that area, or the vector table at the end of the ROM).
Dish

Spiny
Level: 38

Posts: 61/596
EXP: 355646
For next: 14801

Since: 03-15-04
From: Disch

Since last post: 18 days
Last activity: 18 days
Posted on 05-07-04 10:49 PM Link | Quote
The log file I made a while back marked those areas as unused. Now that doesn't mean that they're for certain unused... but I'd say it's a pretty safe assumption (It's certainly not executable code... and it probably isn't be a lookup table, since it's all the same data).
NightHawk

Bob-Omb
Level: 39

Posts: 71/621
EXP: 374743
For next: 30028

Since: 03-26-04
From: Switzerland

Since last post: 432 days
Last activity: 339 days
Posted on 05-11-04 10:33 AM Link | Quote
Okay... it's me again, lol.
Another couple questions...


1) From what I can tell, $1x seems to be "scratch space", for temporary values, meaning that I can use it as I need to without worrying about stepping on another routine's toes... correct or not? And either way, is there any free space I can use to store variables where they won't be touched?

2) I can't figure out where the cursor position is held during battles... it's not in the same place the game usually holds it, and I can't seem to figure out the code with my debugger.

EDIT: Nevermind the second question, I figured that one out. I just watched what it put into sprite memory, and kinda worked backwards from there...


(edited by NightHawk on 05-11-04 04:52 AM)
Kefka
Indefinitely Unbanned
Level: 81

Posts: 1639/3392
EXP: 4826208
For next: 166641

Since: 03-15-04
From: Pomona, CALIFORNIA BABY!

Since last post: 4 hours
Last activity: 4 hours
Posted on 05-11-04 10:40 AM Link | Quote
Originally posted by NightHawk

2) I can't figure out where the cursor position is held during battles... it's not in the same place the game usually holds it, and I can't seem to figure out the code with my debugger.


Not that this helps much (I'll just let Disch do the talking ), but use a corruptor (like Disch's Corrupster ) or a disassembler for all your data finding needs.
NightHawk

Bob-Omb
Level: 39

Posts: 73/621
EXP: 374743
For next: 30028

Since: 03-26-04
From: Switzerland

Since last post: 432 days
Last activity: 339 days
Posted on 05-11-04 10:43 AM Link | Quote
Originally posted by Kefka
Originally posted by NightHawk

2) I can't figure out where the cursor position is held during battles... it's not in the same place the game usually holds it, and I can't seem to figure out the code with my debugger.


Not that this helps much (I'll just let Disch do the talking ), but use a corruptor (like Disch's Corrupster ) or a disassembler for all your data finding needs.
That won't really help at all
The cursor position is stored in RAM, not ROM (I'm talking about the position in a menu, not the position on screen).
Kefka
Indefinitely Unbanned
Level: 81

Posts: 1646/3392
EXP: 4826208
For next: 166641

Since: 03-15-04
From: Pomona, CALIFORNIA BABY!

Since last post: 4 hours
Last activity: 4 hours
Posted on 05-11-04 06:43 PM Link | Quote


Well why didn't you say so?
Dish

Spiny
Level: 38

Posts: 63/596
EXP: 355646
For next: 14801

Since: 03-15-04
From: Disch

Since last post: 18 days
Last activity: 18 days
Posted on 05-11-04 08:42 PM Link | Quote
$1x pretty much is scratch space... however... I've run into times where I wanted to use those areas, but couldn't =\.

There's a few bytes (like 8) that go unused at $70-$77. And 16 more at $Ax. $340-$3BF go unused as well. And theres yet more at $6DC0-$6EFF.
Blue Antoid
Newcomer
Level: 4

Posts: 2/4
EXP: 195
For next: 84

Since: 03-16-04
From: Arvada, Colorado, USA

Since last post: 95 days
Last activity: 1 day
Posted on 05-31-04 06:34 AM Link | Quote
Just curious. Has the text parsing routine been located? It'd be nice to be able to jam in extra functionality for printing the names of party members in standard dialogue, which I'd have to imagine would be fairly feasible with a modest amount of ASM knowledge.

(Of course, maybe that wouldn't be a good idea, considering I'd just feel it neccessary to keep implementing stuff I don't have the talent for, like extra conditional pointers and whatnot. I swear, EarthBound has spoiled me like none other. There are over 200 unique control bytes in the primary text format alone... )
NightHawk

Bob-Omb
Level: 39

Posts: 139/621
EXP: 374743
For next: 30028

Since: 03-26-04
From: Switzerland

Since last post: 432 days
Last activity: 339 days
Posted on 05-31-04 07:22 PM Link | Quote
Originally posted by Blue Antoid
Just curious. Has the text parsing routine been located? It'd be nice to be able to jam in extra functionality for printing the names of party members in standard dialogue, which I'd have to imagine would be fairly feasible with a modest amount of ASM knowledge.

(Of course, maybe that wouldn't be a good idea, considering I'd just feel it neccessary to keep implementing stuff I don't have the talent for, like extra conditional pointers and whatnot. I swear, EarthBound has spoiled me like none other. There are over 200 unique control bytes in the primary text format alone... )
It already has that feature, and more. The text parsing routine is responsible for printing party member names, the gold count, stats, etc.
The text parsing routine NORMALLY used is at $3DE46, I think, but it uses a different routine for printing spell names in battle (oddly enough, it uses the normal one for the magic screen outside of battle). I don't know where the other routine is, or if there are more....
Imajin

Buster Beetle
Level: 34

Posts: 290/452
EXP: 234863
For next: 18788

Since: 03-15-04
From: Kingdom of Zeal

Since last post: 39 days
Last activity: 53 days
Posted on 06-01-04 05:39 AM Link | Quote
Hm, are you saying that it's possible to have a character's name in dialouge? How?
NightHawk

Bob-Omb
Level: 39

Posts: 141/621
EXP: 374743
For next: 30028

Since: 03-26-04
From: Switzerland

Since last post: 432 days
Last activity: 339 days
Posted on 06-01-04 10:41 AM Link | Quote
Originally posted by Imajin
Hm, are you saying that it's possible to have a character's name in dialouge? How?
In the text string where you want a character's name, insert $10 (for character 1; for other characters you'd use $11/$12/$13), followed by $00. That'll print that character's name.
You can also print their class by $10 (or $11/$12/$13) followed by $01.
$10 ($11/$12/$13) can be followed by any value up to up $42 (higher values act just like $42), and each one does something different.


Oh... in the menus where you choose a specific character (like the magic screen outside of battle, or the character status screen), $10 is replace with the appropriate code for the chosen character.
Dish

Spiny
Level: 38

Posts: 78/596
EXP: 355646
For next: 14801

Since: 03-15-04
From: Disch

Since last post: 18 days
Last activity: 18 days
Posted on 06-01-04 09:07 PM Link | Quote
I tried inserting that in dialogue... it doesn't quite work. Dialogue must use a different drawing routine.

Battles must use a different routine as well.. since they don't support DTE.


(edited by Disch on 06-01-04 12:07 PM)
Pages: 1 2 3 4 5 6 7Add to favorites | "RSS" Feed | Next newer thread | Next older thread
Acmlm's Board - I2 Archive - Rom Hacking - FF Hacking FAQ/Running Q&A | |


ABII


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



Page rendered in 0.048 seconds.