Users browsing this thread: 1 Guest(s)
Changing text pointers?

#1
Posts: 32
Threads: 4
Thanks Received: 0
Thanks Given: 0
Joined: Mar 2012
Reputation: 0
Status
None
One final thing I want to do for my personal project involves moving text pointers, in order to give every item in the game a full description, or as much as window size will allow. I imagine that the bulk (if not all) of the work I'll have to do, has to do with this data from C3 (quoted from the disassembly):

Code:
C3/82DD:    7B          TDC
C3/82DE:    A52A        LDA $2A
C3/82E0:    0A          ASL A
C3/82E1:    AA          TAX
C3/82E2:    7CE582      JMP ($82E5,X)

C3/82E5:    A17F        (put item names and quantities in VRAM buffer?)
C3/82E7:    9E4F        (put spell names in VRAM buffer?)
C3/82E9:    5652        (put lore names in VRAM buffer?)
C3/82EB:    EE53        (put rage names in VRAM buffer?)
C3/82EC:    E354        (put esper names in VRAM buffer?)
C3/82EE:    E29C        (looks like the equip screen VRAM buffer?)

C3/82F1:    200883      JSR $8308
C3/82F4:    7B          TDC            (Clear A)
C3/82F5:    A54B        LDA $4B        (Load index from $4B)
C3/82F7:    A8          TAY            (Transfer index to Y)
C3/82F8:    B96918      LDA $1869,Y    (Load inventory item Y)
C3/82FB:    203857      JSR $5738
C3/82FE:    205683      JSR $8356
C3/8301:    A920        LDA #$20       (Load A with 32)
C3/8303:    8529        STA $29        (set text color to white)
C3/8305:    4C7A83      JMP $837A      (BRA fool!)

C3/8308:    A2A07A      LDX #$7AA0     (Pointers to item descriptions)
C3/830B:    86E7        STX $E7
C3/830D:    A20064      LDX #$6400     (Start of item descriptions)
C3/8310:    86EB        STX $EB
C3/8312:    A9ED        LDA #$ED       (Bank address of pointers to item descriptions)
C3/8314:    85E9        STA $E9
C3/8316:    A9ED        LDA #$ED       (Bank address of item descriptions)
C3/8318:    85ED        STA $ED
C3/831A:    A2C99E      LDX #$9EC9
C3/831D:    8E8121      STX $2181
C3/8320:    60          RTS

I don't know quite what to do with all of it, but I imagine that if this idea is possible for me to pull off, it will involve moving much or all of this into another bank. I have my eyes on the LDX 6400, in particular...in my ROM, item descriptions begin at 2D6600 and end at 2D7990, and if I am to be able to create full descriptions for all items, it would require a *lot* more space than that. There's a lot at the end of my ROM, but its just a matter of being able to point to it, and I'm not sure if I'd be able to do so with this data located here. Actually doing the descriptions should be easy; its the rest of it I'd need help with. Does anyone have any suggestions on where to start?
  Find
Quote  

#2
Posts: 3,969
Threads: 279
Thanks Received: 236
Thanks Given: 57
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
You're right. According to the ROM map the pointers and descriptions are there:

Code:
2D6600    2D799F    TXT    No    "Item Descriptions (256 elements, variable length)"    
2D7CA0    2D7E9F    PTR    No    Pointers to Item Descriptions (256 elements)

However these offsets include the header. You have to subtract 200 bytes. I had a quicklook in C3 and I found this: The pointers offset is in variables $E9$E8$E7 and the descriptions offset is variables $ED$EC$EB. I think it's the only place where they are declared.

Code:
C3/8308: A2 A0 7A     LDX #$7AA0      (pointers low & medium byte)
C3/830B: 86 E7        STX $E7
C3/830D: A2 00 64     LDX #$6400      (descriptions low & medium byte)
C3/8310: 86 EB        STX $EB
C3/8312: A9 ED        LDA #$ED        (pointers high byte)
C3/8314: 85 E9        STA $E9
C3/8316: A9 ED        LDA #$ED        (descriptions high byte)
C3/8318: 85 ED        STA $ED
  Find
Quote  

#3
Posts: 32
Threads: 4
Thanks Received: 0
Thanks Given: 0
Joined: Mar 2012
Reputation: 0
Status
None
I see. I think this will be a lot harder than I imagined! Being a newbie to this (please forgive me!), I hadn't really thought about pointers for the amount of bytes used by each item, which is what is located at 2D7CA0. This will make things a lot more complicated, but I think its something I can manage with a little work. The real brain twister, for me, is figuring out exactly how to move the item descriptions and pointers to another bank (I wanted to start everything at 310200), and get the game to recognize them. I imagine that the 'high' bytes have something to do with this, but they don't seem to point to parts of the ROM in the same fashion as low bytes, and the STA and STX codes may also have something to do it. I think that if I can figure those out, I may be able to do this.

I also noticed that certain parts of bank C3 jump to 8308, and I assume I would also have to change them if I moved the code elsewhere.
  Find
Quote  

#4
Posts: 3,969
Threads: 279
Thanks Received: 236
Thanks Given: 57
Joined: Oct 2011
Reputation: 65
Status
Tissue-aware
(09-24-2012, 11:22 AM)Marketa Lazarova Wrote: I imagine that the 'high' bytes have something to do with this, but they don't seem to point to parts of the ROM in the same fashion as low bytes, and the STA and STX codes may also have something to do it. I think that if I can figure those out, I may be able to do this.

The high byte is the bank. STA means "store in register A". Same goes for STX "Store in register X". See those as temporary variables. So the part you need to change would be this given you move the pointers to 310200:

Code:
C3/8308: A2 00 00     LDX #$0000      (pointers low & medium byte)
C3/830B: 86 E7        STX $E7
C3/830D: A2 00 64     LDX #$6400      (descriptions low & medium byte)
C3/8310: 86 EB        STX $EB
C3/8312: A9 F1        LDA #$F1        (pointers bank)
C3/8314: 85 E9        STA $E9
C3/8316: A9 ED        LDA #$ED        (descriptions bank)
C3/8318: 85 ED        STA $ED



  Find
Quote  

#5
Posts: 32
Threads: 4
Thanks Received: 0
Thanks Given: 0
Joined: Mar 2012
Reputation: 0
Status
None
Wow, I thought it might have been the bank address! I think I know what to do now.
  Find
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite