,-------------------------------------.
| A Simple Pointer Table Recalculator |
| Written by Prez@lfx.org             |
|                                     |
| This software is licensed under     |
| GNU GPL, visit http://www.gnu.org/  |
| for information regarding copying.  |
|                                     |
| Copyright (C) 2000, Adam Preston.   |
|                                     |
| Last updated: August 22th, 2000.    |
| Current Version: 1.0                |
`-------------------------------------'


What does this program do?
--------------------------

  This program can be used to recalculate the pointer in most roms, depending
  on a few things. The requirements of the program are that:

    - The dialogue block is in order.
        If you don't know what this is, it's probably not a problem for you.
        However, if this is a problem, you can fix it by dumping the script
        by the pointers (I believe Thingy supports this), and when you
        reinsert it, it'll be in order.

    - The rom uses 16-bit pointers.
        Most NES and Gameboy roms use 16-bit pointers. Since I don't know the
        names for the different types of pointers, I'll just say that this
        program works with the type of pointers/dialogue block system used
        used on every game I've worked on except 1.

    - The pointer table is right above the dialog block
        If you happen to know that there is data between the pointer table,
        and the dialogue block, try not using the "Default Pointer Address"
        option, and that should stop the program from overwritting the
        important information.

  Chances are that if you're working with a NES or Gameboy game, that the
  above issues are not problems for you.

  The program requires a little bit of information about the ROM you are
  working with, and it requires that you've already inserted the script you
  need to recalculate the pointer table for. If you need to reinsert a
  script, I suggest using Necrosaro's Thingy. It has the best script
  inserting routine I've seen yet, and if you have been able to insert a
  script with it, you have almost all the information you need to use this
  program.


Program Usage
-------------

  When you run the program with no arguments, it's output looks something
  like this:

    Usage: recalc [rom file] [dialog start addr] [dialog end addr]
                  [pointer table addr] [break value] <default pointer addr>

  First, let me review what each of these arguments are/do.

  ** Required Arguments **
    [rom.bin]: Filename
      This is the filename of the rom that you've inserted the dialog block
      into. For this example, we will use "lb2.gbc".

    [dialog start addr]: Dialog Block Starting Address
      This is the address at which you've inserted the dialog block.
      Generally this is right after the pointer table. For this example,
      the dialog block starts at 38420h in the rom, thus the value '38420'.

    [dialog end addr]: Dialog Block Ending Address
      This is the address at which the dialog block ends. This should be
      the value at which the text in the dialog block ends, and not at the
      physical end of the dialog block. For this example, the dialog block
      ends at the location 3BCB3h in the rom, thus the value '3BCB3'.

    [pointer table addr]: Pointer Table Address
      This is the address at which the pointer table starts. This address is
      required to be before the Dialog Block Starting Address, which it will
      be in almost all games. For this example, the pointer table is located
      at 38000h in the rom, thus the value '38000'.

    [break value]: Message Break Value
      This is the message break value. This is required to be a single
      hexidecimal value. For this example, the game's message break value
      is the hex value FF.

  ** Optional Arguments **
    <default pointer addr>: Default Pointer Address
      If you are inserting an incomplete dialog block, you can use this
      optional argument to tell the pointer recalculator where to point all
      the unaccounted for messages. It will stop many dialogue bugs that can
      occur when inserting half a script. If you are going to use this, put
      a line that says "Untranslated." followed by a break value, then use
      the address of the letter 'U' for the default pointer. For this
      example, we will have our our "Untranslated." message at 3BFF0h in the
      rom, thus the value 3BFF0h.

  So, with the above said, our example program usage would look like this:

    C:\ROMS\LB2>RECALC LB2.GBC 38420 3BCB3 38000 FF 3BFF0

  and would output something like this:

    Recalculating: Dialog Block (38420-3BCB3)
                   Pointer Block (38000)
                   1st pointer: 4420
                   Break value: FF

  After that, the pointer table in the rom should be recalculated to fit the
  inserted dialogue block. Make sense? I sure hope so.


Errors
------

  Here is a list of errors messages the program will output if it runs into
  a problem. With each error I've included an explaination.

    "Error: Your dialog block ends before it starts."
      If the dialog block ending address is less than the starting address,
      this error will be spit out for obvious reasons. I don't know how else
      to explain this ;)

    "Error: Pointer table *should* come before dialog block."
      I can't think of any reason a game would have a pointer block AFTER the
      dialog block, so I haven't even bothered to make the program deal with
      this kind of situation. The way the program currently runs, this would
      cause problems with allocating space.

    "Error: Ran out of memory."
      This means simply that the machine you're running the program on didn't
      have enough free memory to allocate for the program. This REALLY
      shouldn't be a problem, but if you have less than the size of your
      dialog block + pointer table free in memory, it will be.

    "Error: Couldn't open "File.rom"."
      This means the program couldn't open File.rom. Most likely this is
      because the file doesn't exist, did you type the file name properly?

    "Error: Too many script entries, pointer table exausted."
      There are more message entries in the dialogue block than there are
      room for in the pointer table. In any normal situation, this shouldn't
      happen, but if you've got yourself into a situation where you're
      putting stuff from other blocks into the current one, make sure that you
      are setting the "Dialog Block End Address" to after the last message
      that is supposed to be included in the pointer table you are
      regenerating. 


Contact
-------

  If you wish to contact the author of this program in hopes of having
  another feature added or just giving feedback on the program, you can
  get a hold of him a few ways:

  If there is anything I've missed in this README.TXT, please e-mail me
  a note. Thanks.

  E-mail: prez@lfx.org
  ICQ:    1035105
  IRC:    prez_ on EFnet (#romhacking)

