News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Help editing Item Names (and other text) in Dragon Warrior (NES)  (Read 11509 times)

Choppasmith

  • Full Member
  • ***
  • Posts: 102
    • View Profile
Re: Help editing Item Names (and other text) in Dragon Warrior (NES)
« Reply #20 on: September 25, 2018, 12:13:04 am »
Sorry, I didn't see your new PM. I wrote the DTE thing a few months ago, so I'll need to look at it again later today. Basically, DTE-Opt (thanks KingMike for such a simple yet useful tool) gives you a list of the most common combos in order of occurrence (the text file you sent in the PM is not what you use). I think it just appears in the command prompt when you run it, so I use a batch file and capture the output to a text file.

Anyway, once you know your pairs, you can put them in your table file, then use something like Pointer Tables to insert your text into the ROM. Of course, you then need to insert your list of pairs into the ROM so that the game knows what they are.

I can't actually remember where to put the table, but the easiest thing is to just give me your new text and I'll try to insert it. I picked a part of the ROM that shouldn't be used by anything else. Later today I'll be able to look at my files and figure it out.

I admit that I didn't provide much documentation on what I did, but it's because I didn't really think about it being used much by people. Maybe I should make a formal version with documentation and put it in the Utilities section? :huh:

Well here's the finished script if you want to try it yourself

http://www.mediafire.com/file/s72aa472q2ll1uf/dw1_script.txt/file

I also tweaked your table a little bit. Mainly adding the special EF byte and changing the enemy name byte with a space to [ANME] to avoid confusion with the [NME] byte. The former is just used for the opening "Monster" draws near text and adds an A or An at the beginning.

Code: [Select]
00=0
01=1
02=2
03=3
04=4
05=5
06=6
07=7
08=8
09=9
0A=a
0B=b
0C=c
0D=d
0E=e
0F=f
10=g
11=h
12=i
13=j
14=k
15=l
16=m
17=n
18=o
19=p
1A=q
1B=r
1C=s
1D=t
1E=u
1F=v
20=w
21=x
22=y
23=z
24=A
25=B
26=C
27=D
28=E
29=F
2A=G
2B=H
2C=I
2D=J
2E=K
2F=L
30=M
31=N
32=O
33=P
34=Q
35=R
36=S
37=T
38=U
39=V
3A=W
3B=X
3C=Y
3D=Z
3E="
3F=""
40=}
41=*
44=:
45=_
47=.
48=,
49=-
4B=?
4C=!
4D=;
4E=)
4F=(
50={
52=.}
53='
54=`
57=[57]
5F=
60=[60]
EF=[S]
F0=[PNT]
F1=[ANME]
F3=[XP]
F4=[NME]
F5=[NUM]
F6=[SPL]
F7=[INV]
F8=[ME]
FB=@
FC=%
FD=&
FF=[ITM]

And yeah I don't know why dteopt doesn't just make a "list" like it does in the command prompt. It's much easier to read than the "chart".

Ah, yes, I didn't update any of the text table stuff.
Psyklax can confirm this, but if you're looking at the DTE code Psyklax posted in the Dragon Warrior 1 in Spanish thread, that code goes looking for the DTE table starting at RAM $BEF0 (ROM 0x7F00) and wants the entries arranged as "entry 1 byte 1, entry 1 byte 2, entry 2 byte 1, entry 2 byte 2, etc.", with DTE entries starting at 80 in your table file. The original script compressed by about 40%, so it might just be enough to fit your larger script in!

Bear with me, I'm still a little confused. Starting at 7FF0 are a bunch FF bytes. So I'd put the various two letter combinations there and then update the table file starting at 80=?

So for example, if the first one I want to put in is "th", I'd put in t and h at 7F00 and 7F01 and then add 80=th to my table file. Is that right?

abw

  • Full Member
  • ***
  • Posts: 232
    • View Profile
Re: Help editing Item Names (and other text) in Dragon Warrior (NES)
« Reply #21 on: September 25, 2018, 06:00:21 pm »
The former is just used for the opening "Monster" draws near text and adds an A or An at the beginning.
Oh, that reminds me - the game code for this treats O and Y as consonants, not vowels, so if you renamed any monsters to start with those letters and wanted "An" instead of "A", you'll need a very tiny ASM hack to fix that.

So for example, if the first one I want to put in is "th", I'd put in t and h at 7F00 and 7F01 and then add 80=th to my table file. Is that right?
Yes, except that after trying this out again, I remembered that the DTE table entries actually start at 81 instead of 80, so you'd have 81=th in your table file instead. However...

Well here's the finished script if you want to try it yourself
Alas, the original game only gives you a total of 15,495 bytes of script space, but DTE or dictionary compression is only going to get your script down to 17,000 - 18,000 bytes. Even 7-zip only compresses the script down to ~ 12,000 bytes. None of the existing ROM banks have enough free space to hold 2,000 - 3,000 bytes of surplus script, so I think you're going to need better compression (something around 50% rather than the 40% DTE/dictionary/Huffman give) or ROM expansion here.

Choppasmith

  • Full Member
  • ***
  • Posts: 102
    • View Profile
Re: Help editing Item Names (and other text) in Dragon Warrior (NES)
« Reply #22 on: September 26, 2018, 03:21:38 pm »
Oh, that reminds me - the game code for this treats O and Y as consonants, not vowels, so if you renamed any monsters to start with those letters and wanted "An" instead of "A", you'll need a very tiny ASM hack to fix that.

Now THAT I spotted in the Spanish translation thread. Thankfully shouldn't apply to me.

Quote
Alas, the original game only gives you a total of 15,495 bytes of script space, but DTE or dictionary compression is only going to get your script down to 17,000 - 18,000 bytes. Even 7-zip only compresses the script down to ~ 12,000 bytes. None of the existing ROM banks have enough free space to hold 2,000 - 3,000 bytes of surplus script, so I think you're going to need better compression (something around 50% rather than the 40% DTE/dictionary/Huffman give) or ROM expansion here.

Yeah, I thought I'd try it in case your calculations were off and yeah, gave me a message that I'm about 5,000 bytes over the limit. Even trying to trim a lot of the script only reduced it by about a K.

Bummer :/

abw

  • Full Member
  • ***
  • Posts: 232
    • View Profile
Re: Help editing Item Names (and other text) in Dragon Warrior (NES)
« Reply #23 on: September 27, 2018, 09:56:13 pm »
Well, probably the easiest way to go here is to expand the ROM (insert 0x10000 bytes at 0xC010, update the iNES header to specify 8 PRG banks [set 0x4 to $08]). After that, it looks like changing a mere 18 bytes (19 if you count the iNES header change) is enough to get the game to flip between reading from the original and expanded banks as appropriate.

When reading text, the relevant bank swaps are controlled from:
0x7558 (when finding the pointer to the right group of strings)
0x756E (when scanning through the group of strings looking for the start of the desired string)
0x7689 (when reading the desired string)

There's no need to change the first bank swap, since storing all the pointers in the original bank isn't a problem. For the other two bank swaps, there's a convenient block of 4 bytes that do the same thing in both places, so those are ideal spots to overwrite with a hook to some new code located in some unused space in the fixed bank (original bank 3, new bank 7):

0x756C and 0x7689:
EA        NOP
20 54 FF  JSR $FF54
Alas, by the time that code runs, the memory that told us which string the game wanted to read has already been overwritten, but there's a completely pointless AND #$F0 (pointless because it's immediately followed by 4 LSRs and there are some ASLs before the next time C matters) back when that information was still available, so we can steal that to store the high byte of the string number in an unused byte of RAM:
0x7544:
86 E1     STX $E1
In the new code to handle selecting which bank to read from, we just read that high byte of the string number (i.e. 0 or 1) and add 2 (to get 2 or 3) to get the bank to read from, then do the LDX from the code that we overwrote to hook in to this new code:
0x1FF64:
A5 E1     LDA $E1
18        CLC
69 02     ADC #$02
A2 9F     LDX #$9F
60        RTS
After that, you'll want to insert the first 256 strings into the original bank (2, a.k.a. 0x8010-0xC00F; they'll all fit with DTE compression), the other 42 into the new bank (3, a.k.a. 0xC010-0x1000F), and... voilà! I played around with it for a couple of minutes and everything seemed to be working okay, though you'll definitely want to add some more breaks in the text, since some of the longer sections take up more than a full window and cause the first line(s) to scroll out of view pretty quickly.

Edited to correct which byte to alter to update the PRG size.
« Last Edit: September 30, 2018, 10:02:26 pm by abw »

Choppasmith

  • Full Member
  • ***
  • Posts: 102
    • View Profile
Re: Help editing Item Names (and other text) in Dragon Warrior (NES)
« Reply #24 on: September 28, 2018, 12:43:37 am »
After that, you'll want to insert the first 256 strings into the original bank (2, a.k.a. 0x8010-0xC00F; they'll all fit with DTE compression), the other 42 into the new bank (3, a.k.a. 0xC010-0x1000F), and... voilà! I played around with it for a couple of minutes and everything seemed to be working okay, though you'll definitely want to add some more breaks in the text, since some of the longer sections take up more than a full window and cause the first line(s) to scroll out of view pretty quickly.

Okay so, you lost me here a bit.

So even if we split the text up into two different banks, pointers can stay in the same exact place, right? I counted the first 256, and unless I'm mistaken that takes me up to the end of the 8030 string (last string being "The [NME] breathes fire!) when I use pointer tables to insert the script it says I'm still over the limit by 1492 bytes. Maybe I just miscounted should I go back a set?

EDIT: Oh wait, I'm looking in the ROM and I can see the last line at c290, maybe I just got that message because it goes past the original limit? Or did I do something wrong there?

Also if I'm going to use PT to insert the rest of the script can I just make a copy of the script with the rest of the strings and just change the Text Start and Text End values to something like C010-1000F or is there a better program to insert a DTE script with for this kind of case?
« Last Edit: September 28, 2018, 12:49:42 am by Choppasmith »

abw

  • Full Member
  • ***
  • Posts: 232
    • View Profile
Re: Help editing Item Names (and other text) in Dragon Warrior (NES)
« Reply #25 on: September 28, 2018, 08:47:46 am »
Yeah, you can keep all of the pointers at 0x8012-0x8037. Splitting the pointers between banks would have cost more in code than the 6 bytes of data we'd regain, so I didn't bother, and it doesn't hurt to keep them all together anyway. 256 strings divided by 16 strings per pointer = 16 pointers, so that's everything down to the end of the 0x8030 pointer a.k.a. the start of the 0x8032 pointer.

I was actually using abcde, but pretty much any program including Pointer Tables should work just as well here. For Pointer Tables, I gave it a try by splitting the script into 2 files and updating each file's header:
Quote from: File #1
Table Start:   8012
Table End:   8031
Text Start:   8038
Text End:   BCBF
XOffset:   10

...
and then the first 16 pointers + text

Quote from: File #2
Table Start:   8032
Table End:   8037
Text Start:   C038
Text End:   FCBF

...
(note the lack of XOffset) and then the last 3 pointers + text. I get the exact same output ROM using either program, so use whichever one you want :beer:.

Choppasmith

  • Full Member
  • ***
  • Posts: 102
    • View Profile
Re: Help editing Item Names (and other text) in Dragon Warrior (NES)
« Reply #26 on: September 30, 2018, 07:49:51 pm »
Yeah, you can keep all of the pointers at 0x8012-0x8037. Splitting the pointers between banks would have cost more in code than the 6 bytes of data we'd regain, so I didn't bother, and it doesn't hurt to keep them all together anyway. 256 strings divided by 16 strings per pointer = 16 pointers, so that's everything down to the end of the 0x8030 pointer a.k.a. the start of the 0x8032 pointer.

I was actually using abcde, but pretty much any program including Pointer Tables should work just as well here. For Pointer Tables, I gave it a try by splitting the script into 2 files and updating each file's header:and then the first 16 pointers + text
(note the lack of XOffset) and then the last 3 pointers + text. I get the exact same output ROM using either program, so use whichever one you want :beer:.

Sorry for the late reply. Very busy work week (a big reason I appreciate the help as I just don't have much spare time to just "figure it out on my own"). I still don't know what I'm doing wrong. I split the script at the right part and it still says I'm 1,492 bytes over the limit (inserting the second part is fine and well UNDER the limit). Loaded up the rom in FCEU and just get a blank screen.

What am I doing wrong?

abw

  • Full Member
  • ***
  • Posts: 232
    • View Profile
Re: Help editing Item Names (and other text) in Dragon Warrior (NES)
« Reply #27 on: September 30, 2018, 08:58:49 pm »
Eh, no worries, we've all been there. It's important to remember this is just a hobby, not a full-time job.

As for the hack, there's a bunch of moving parts here, so it might help to isolate which step is going wrong. Starting from a clean ROM, try redoing each step and checking to make sure the game still works after each step is completed. You should be able to
1) expand the ROM file and update the iNES header
2) apply the DTE code changes
3) insert the script split across both banks; all the script from the original bank should display properly (including the "What luck!" when you open a treasure chest), but the code will still assume pointers to the script in the new bank are pointing to the old bank, so those will display incorrectly (including the King's opening speech when you start a new game)
4) apply the bank swaping code changes; I should have mentioned that those changes were for the PRG1 version, so if you're using the PRG0 version, you might need to adjust the addresses or the actual changes to match the differences between the two versions
5) apply any other changes you've made, e.g. item/spell/monster names, menus, graphics, etc.

For your DTE table, make sure the end tokens (FC/FF) stay as single bytes and don't get included in some DTE combination; the DTE patch only applies while reading the desired string, not while scanning through the group of strings to find the desired string. Also make sure your table file actually has the DTE entries - it sounds obvious, but forgetting to include those would be an explanation for why your script was still too large.

Choppasmith

  • Full Member
  • ***
  • Posts: 102
    • View Profile
Re: Help editing Item Names (and other text) in Dragon Warrior (NES)
« Reply #28 on: September 30, 2018, 09:13:20 pm »
Eh, no worries, we've all been there. It's important to remember this is just a hobby, not a full-time job.

As for the hack, there's a bunch of moving parts here, so it might help to isolate which step is going wrong. Starting from a clean ROM, try redoing each step and checking to make sure the game still works after each step is completed. You should be able to
1) expand the ROM file and update the iNES header
2) apply the DTE code changes
3) insert the script split across both banks; all the script from the original bank should display properly (including the "What luck!" when you open a treasure chest), but the code will still assume pointers to the script in the new bank are pointing to the old bank, so those will display incorrectly (including the King's opening speech when you start a new game)
4) apply the bank swaping code changes; I should have mentioned that those changes were for the PRG1 version, so if you're using the PRG0 version, you might need to adjust the addresses or the actual changes to match the differences between the two versions
5) apply any other changes you've made, e.g. item/spell/monster names, menus, graphics, etc.

For your DTE table, make sure the end tokens (FC/FF) stay as single bytes and don't get included in some DTE combination; the DTE patch only applies while reading the desired string, not while scanning through the group of strings to find the desired string. Also make sure your table file actually has the DTE entries - it sounds obvious, but forgetting to include those would be an explanation for why your script was still too large.

Okay, so I guess it's the first step messing me up.

I take a clean ROM, change x05 from 02 to 08. Using HxD, I go to address C010 and select Insert Bytes: Value= 10000. Save and test and I get a blank screen.

abw

  • Full Member
  • ***
  • Posts: 232
    • View Profile
Re: Help editing Item Names (and other text) in Dragon Warrior (NES)
« Reply #29 on: September 30, 2018, 10:03:48 pm »
change x05 from 02 to 08
:banghead: Sorry, that was my fault, butterfingers again - PRG size is byte 0x04 of the iNES header, not 0x05 (that's CHR size). I've updated my earlier post for posterity.

Choppasmith

  • Full Member
  • ***
  • Posts: 102
    • View Profile
Re: Help editing Item Names (and other text) in Dragon Warrior (NES)
« Reply #30 on: October 02, 2018, 11:44:35 am »
Okay so I was able to expand the size of the rom and add the DTE patch and the ROM loaded just fine, but once I insert the script with pointer tables the big part script a, shows me that it's 1492 bytes OVER the text limit. I load the ROM up and get a blank screen.

For reference my two script files look like this at the beginning

Code: [Select]
Table Start: 8012
Table End: 8031
Text Start: 8038
Text End: BCBF
XOffset: 10

Table Type: 0
Text Type: 0
Custom PT: T0 T1

PT Line Command:
-----------------

and

Code: [Select]
Table Start: 8032
Table End: 8037
Text Start: C038
Text End: FCBF

Table Type: 0
Text Type: 0
Custom PT: T0 T1

PT Line Command:
-----------------

Either PT isn't "compressing the text" or I have another number off.


EDIT: Changing tracks a bit

Just for giggles I thought I'd make a DW1 title screen mockup in Photoshop to get a good idea of what changing Warrior into Quest would look like. PS can automatically center things and it looks like we'd just have to move everything one tile over for it to look centered (I'll probably just use the existing TM tiles)



I'm not sure how the Dragon popping out of the logo would work if we do end up moving everything over a space. Your explanation for how the title screen works make sense to me, it's more the pixel editing that seems more daunting to me but I'd want to give it a try though.
« Last Edit: October 03, 2018, 03:24:49 pm by Choppasmith »

abw

  • Full Member
  • ***
  • Posts: 232
    • View Profile
Re: Help editing Item Names (and other text) in Dragon Warrior (NES)
« Reply #31 on: October 03, 2018, 05:33:04 pm »
Alright, I tried this again from scratch using Pointer Tables and it does work for me, though I added 2 steps to the list:
2a) You'll also need to add the DTE entries to the ROM, not just your table file.
3a) Despite its name, Pointer Tables doesn't actually update any pointer tables, so you need to do that manually :'( (or switch to something else that will automatically update pointers for you, e.g. Atlas).

I compared Pointer Tables' output for a table with no DTE and a table with DTE. For the table with no DTE, I got a total length of 23764 (x5CD4), 8268 bytes over the original text limit, and for my table with DTE, I got a total length of 14619 (x391B), 877 bytes under the original text limit. So, maybe the problem is with the choice of DTE entries? Here's the full table I used:
Code: [Select]
00=0
01=1
02=2
03=3
04=4
05=5
06=6
07=7
08=8
09=9
0A=a
0B=b
0C=c
0D=d
0E=e
0F=f
10=g
11=h
12=i
13=j
14=k
15=l
16=m
17=n
18=o
19=p
1A=q
1B=r
1C=s
1D=t
1E=u
1F=v
20=w
21=x
22=y
23=z
24=A
25=B
26=C
27=D
28=E
29=F
2A=G
2B=H
2C=I
2D=J
2E=K
2F=L
30=M
31=N
32=O
33=P
34=Q
35=R
36=S
37=T
38=U
39=V
3A=W
3B=X
3C=Y
3D=Z
3E="
3F=""
40=}
41=*
44=:
45=_
47=.
48=,
49=-
4B=?
4C=!
4D=;
4E=)
4F=(
50={
52=.}
53='
54=`
57=[57]
5F=
60=[60]
EF=[S]
F0=[PNT]
F1=[ANME]
F3=[XP]
F4=[NME]
F5=[NUM]
F6=[SPL]
F7=[INV]
F8=[ME]
FB=@
FC=%
FD=&
FF=[ITM]

81= t
82=e
83=t
84=s
85=er
86=in
87=ou
88=y
89=,
8A=d
8B=an
8C=ar
8D=of
8E=he
8F=re
90=o
91=st
92=on
93=ha
94=th
95=en
96=or
97=ll
98=&@
99= m
9A=.}
9B=es
9C=om
9D=hi
9E= a
9F=Th
A0=gh
A1= s
A2=ri
A3=el
A4=ra
A5=ow
A6=!}
A7= w
A8=le
A9=la
AA= d
AB= b
AC=_.
AD=se
AE=it
AF= f
B0=!
B1=no
B2=un
B3=ch
B4=ea
B5=ed
B6=ur
B7=ol
B8=wa
B9= p
BA=de
BB=il
BC= c
BD=ce
BE=is
BF=?}
C0=at
C1=ck
C2=ak
C3=ve
C4=al
C5= h
C6=ay
C7=bl
C8=us
C9=.
CA=as
CB=g
CC=ld
CD={I
CE=oo
CF=ag
D0=fa
D1=me
D2=wi
D3=be
D4=ne
D5=os
D6= g
D7=ic
D8= i
D9=ev
DA={W
DB=ir
DC=id
DD=te
DE=?
DF=fr
E0=ru
E1=up
E2=am
E3=et
E4=ly
E5=qu
E6='t
E7=.@
E8=em
E9=li
EA=to
EB=we
EC=ey
ED=mi
EE=ro
I also made the unfortunate discovery that Pointer Tables will quite happily overwrite data beyond the Text End address, so you'll basically have to restart the entire build process from the beginning after every failed Pointer Tables insert :(.

Just for giggles I thought I'd make a DW1 title screen mockup in Photoshop to get a good idea of what changing Warrior into Quest would look like.
Nice! If you do need to shift the dragon (or the sparkle that flashes between the I and O of WARRIOR), it probably wouldn't be too much work, but I'd say to wait to cross that bridge until you get to it - the original placement might still work for the updated title.

Choppasmith

  • Full Member
  • ***
  • Posts: 102
    • View Profile
Re: Help editing Item Names (and other text) in Dragon Warrior (NES)
« Reply #32 on: October 04, 2018, 03:03:53 pm »




(seriously I'm thrilled, things are finally falling into place and I couldn't be happier!)

Aside from the other bank. Just have to put my monster/item/spell name changes back in and we're pretty much good to go. I think your DTE entries were simply better than mine (I think I underestimated that period+end line or end quote + endline entries would probably not work right and focused solely on letters and that kept my size up)

So looking back, you said the newly added space used to be bank 3 and is now bank 7? Is that how I would calculate the pointers for the last few strings (using your little equation on the previous page)?

abw

  • Full Member
  • ***
  • Posts: 232
    • View Profile
Re: Help editing Item Names (and other text) in Dragon Warrior (NES)
« Reply #33 on: October 04, 2018, 05:13:40 pm »
:woot!: :woot!: :woot!:

Yeah, based on DTE-Opt's description, it looks like it ignores everything besides [A-Za-z], which means you lose out on 7 of the best 10 combos in your script, among other things. For reference, I generated my list using ScriptCrunch. Based on the way the game counts strings, you can get away with including end-of-line in your DTE table, but not end-of-string.

For the monster/item/spell name changes, you can insert those normally, just remember that Psyklax's patch puts the DTE code starting at 0x7EB0, a.k.a. immediately after the end of the original spell list, so if your total monster/item/spell list is longer than the original, you'll need to adjust the DTE patch to compensate.

Choppasmith

  • Full Member
  • ***
  • Posts: 102
    • View Profile
Re: Help editing Item Names (and other text) in Dragon Warrior (NES)
« Reply #34 on: October 05, 2018, 01:22:35 am »
:woot!: :woot!: :woot!:

Yeah, based on DTE-Opt's description, it looks like it ignores everything besides [A-Za-z], which means you lose out on 7 of the best 10 combos in your script, among other things. For reference, I generated my list using ScriptCrunch. Based on the way the game counts strings, you can get away with including end-of-line in your DTE table, but not end-of-string.

For the monster/item/spell name changes, you can insert those normally, just remember that Psyklax's patch puts the DTE code starting at 0x7EB0, a.k.a. immediately after the end of the original spell list, so if your total monster/item/spell list is longer than the original, you'll need to adjust the DTE patch to compensate.

Oh, I didn’t realize the DTE code was in all that extra space after those. That might be tricky. Will compression work for those? Otherwise, I wonder if we could move the DTE code and entries to,all that new free space added.

Also how do I add the pointers for the rest of the dialog? I know for the first, big part you take the address, subtract 10 and then reverse the bytes, but is the math different because the text is in a completely different area?

Psyklax

  • Hero Member
  • *****
  • Posts: 911
    • View Profile
    • Psyklax Translations
Re: Help editing Item Names (and other text) in Dragon Warrior (NES)
« Reply #35 on: October 05, 2018, 06:32:15 am »
Sorry, I tuned out of the thread a bit, but yes, my DTE patch goes directly after the item list because there isn't much space elsewhere. If you're expanding the ROM, though, I'd question the need to even use DTE. But again, maybe I missed something...

Choppasmith

  • Full Member
  • ***
  • Posts: 102
    • View Profile
Re: Help editing Item Names (and other text) in Dragon Warrior (NES)
« Reply #36 on: October 05, 2018, 09:50:32 am »
Sorry, I tuned out of the thread a bit, but yes, my DTE patch goes directly after the item list because there isn't much space elsewhere. If you're expanding the ROM, though, I'd question the need to even use DTE. But again, maybe I missed something...

Well unless I'm missing something, my script is 30k, we added 10k to the rom, the existing space for the script is 15k so we still wouldn't be able to fit it in. Only thing I could think of is moving the item/spell/monster list to the new area.

abw

  • Full Member
  • ***
  • Posts: 232
    • View Profile
Re: Help editing Item Names (and other text) in Dragon Warrior (NES)
« Reply #37 on: October 05, 2018, 04:34:01 pm »
I'm just about to run out the door here, so apologies for the brevity:

Oh, I didn’t realize the DTE code was in all that extra space after those. That might be tricky. Will compression work for those? Otherwise, I wonder if we could move the DTE code and entries to,all that new free space added.
The code for printing out the monster/item/spell names doesn't run through the DTE code, so you'd have to make some further ASM changes to add DTE to those.

Also how do I add the pointers for the rest of the dialog? I know for the first, big part you take the address, subtract 10 and then reverse the bytes, but is the math different because the text is in a completely different area?
$4010 is the offset you're looking for. The first pointer in the extra bank should start at RAM $8028 (28 80).

If you're expanding the ROM, though, I'd question the need to even use DTE. But again, maybe I missed something...
Yeah, with all the extra space DTE shouldn't be necessary, unless you care about patch size. If you aren't splitting the script based on the high byte of the pointer number, the ASM for remembering which pointer the game wanted and for deciding which bank to read from will both need tweaking. I haven't tried it, but something like this might work:
Code: [Select]
0x7544
4A      LSR
4A      LSR
4A      LSR
4A      LSR
85 1B    STA $1B
8A      TXA
0A      ASL
0A      ASL
0A      ASL
0A      ASL
65 1B    ADC $1B
18      CLC
69 01    ADC #$01
85 31    STA $31
85 E1    STA $E1

0x1FF64:
LDA $E1
CMP #$09
LDA #$02
BCS +
LDA #$03
+:
LDX #$9F
RTS

we added 10k to the rom
We added $10000 (hexadecimal) to the ROM, not 10000 (decimal) - that's 65,536 bytes a.k.a. 64 KB :P.

Choppasmith

  • Full Member
  • ***
  • Posts: 102
    • View Profile
Re: Help editing Item Names (and other text) in Dragon Warrior (NES)
« Reply #38 on: October 08, 2018, 07:53:20 am »
I'm just about to run out the door here, so apologies for the brevity:
The code for printing out the monster/item/spell names doesn't run through the DTE code, so you'd have to make some further ASM changes to add DTE to those.
$4010 is the offset you're looking for. The first pointer in the extra bank should start at RAM $8028 (28 80).

Thanks for this. I did a double take because it's so close to the first dialog pointer, I thought maybe you were mistaken.

In any case worked great. I found at least one mismatched npc line so far, so I'll have to go over my script and make sure my formatting is right.

If you aren't splitting the script based on the high byte of the pointer number, the ASM for remembering which pointer the game wanted and for deciding which bank to read from will both need tweaking. I haven't tried it, but something like this might work:
Code: [Select]
0x7544
4A      LSR
4A      LSR
4A      LSR
4A      LSR
85 1B    STA $1B
8A      TXA
0A      ASL
0A      ASL
0A      ASL
0A      ASL
65 1B    ADC $1B
18      CLC
69 01    ADC #$01
85 31    STA $31
85 E1    STA $E1

0x1FF64:
LDA $E1
CMP #$09
LDA #$02
BCS +
LDA #$03
+:
LDX #$9F
RTS

So is this basically a revision of your code posted earlier in the thread?

We added $10000 (hexadecimal) to the ROM, not 10000 (decimal) - that's 65,536 bytes a.k.a. 64 KB :P.

Oof, my bad.

abw

  • Full Member
  • ***
  • Posts: 232
    • View Profile
Re: Help editing Item Names (and other text) in Dragon Warrior (NES)
« Reply #39 on: October 08, 2018, 04:29:38 pm »
Thanks for this. I did a double take because it's so close to the first dialog pointer, I thought maybe you were mistaken.
Probably it would make more sense to change the Text Start for the second bank to C010 (no need to waste the first $28 bytes) and then the first pointer into that bank would be to RAM $8000.

So is this basically a revision of your code posted earlier in the thread?
Basically, but it only replaces some of the earlier code and wasn't quite working. Here's a complete version that should actually work; note that without the DTE, you'll need to insert the text for the first 9 pointers into the original bank and the text for the last 10 pointers into the new bank.

0x7544 (remember pointer number so we can use it later):
Code: [Select]
4A        LSR
4A        LSR
4A        LSR
4A        LSR
85 1B     STA $1B
8A        TXA
0A        ASL
0A        ASL
0A        ASL
0A        ASL
65 1B     ADC $1B
18        CLC
69 01     ADC #$01
85 31     STA $31
85 E1     STA $E1

0x756C and 0x7689 (JSR to code to decide which bank to read from):
Code: [Select]
EA        NOP
20 54 FF  JSR $FF54

0x1FF64 (read from expanded ROM bank when pointer number >= #$0A; requires splitting script at the start of the 10th pointer):
Code: [Select]
A5 E1     LDA $E1
C9 0A     CMP #$0A
A9 02     LDA #$02
90 02     BCC $FF5E
A9 03     LDA #$03
A2 9F     LDX #$9F
60        RTS

Oof, my bad.
No problem, it's a mistake I've been guilty of making on more than one occasion :P.