Ultima II -- The Fixed Version

    Patch by Mike Marcelais, The Moonstone Dragon.
    April 25, 1996


The Problem:
------------

   When Ultima II was first released, it was released on three floppy
sides:  The Boot Disk, the Player Disk, and the Galactic Disk.  The
last two of these disks held the city and world maps, as well as monster
lists and conversation information for Earth and the other planets.

   The names used on these two disks for many of the files were
identical.  When the Ultima I-VI CD was released, all of the files were
merely dumped together into a single directory which caused some of
the files to be overwritten.  Hence, cities, dungeons, and worlds
on the Galactic disk with the same name as a location on Earth are not
available and the Earth Map is used instead.

   [NEW 9/1/97] It also seems that the data file MAPX15 was corrupted
during its copy to the CD.  The last 260 bytes of the file is the data
for the city in MAPX11 instead of the dungeon information for the '15
dungeon.  This causes Ultima to get upset.  This was fixed easily by
having the patch program also write the correct 260 bytes to this file.

   [NEW 10/3/97] Probably because of that problem, the dungeon entrance
that exists in Pangea to get to the corrupted dungeon was removed from
the map.  The patch program now restores that dungeon entrance.  Thanks
to Angus March for finding this.


The Solution:
-------------

   The data files are identical to the data files used on the original
Apple II version, so I copies the contents of the Apple II Galactic
disk onto my PC (via a Null Modem cable) and renamed all of the fiels
from MONX??, MAPX??, and TLKX?? to MONG??, MAPG??, and TLKG??.

   I then looked at the executable itself: ULTIMAII.EXE

   There was code left in there to handle disk swapping.  That code
no longer does much, but there was a gap where old code used to reside.
Disassembling that code led to the following discoveries:

   On or about location CS:71F1 (all values are hex), there is the code
that prompts you for your Player Disk (after returning from the galactic
view), however the code is skipped completely by a JMP instruction.  I
replaced the code with:

    71F1:  B0 58          mov   al,58
    71F3:  E8 15 00       call  720b
    71F6:  90             nop
    71F7:  90             nop
    71F8:  90             nop

   58 is ascii 'X'.  I'll get into what 720b does later.  ;-)

   On or about location CS:722B, there is the code that prompt for the
Galactic Disk.  That code is replaced with:

    722B:  B0 58          mov   al,47
    722D:  E8 DB FF       call  720b
    7230:  90             nop
    7231:  90             nop
    7232:  90             nop

   47 is ascii 'G'.

   Now, location CS:720b used to contain the message (INSERT GALACTIC DISK)
but that message is no longer used.  Anyway, it gave me a placed to
stick some code that I needed.  The code I put there is:

    720B:  2E A2 BA 22    mov   cs:[22ba],al
    720F:  2E A2 CC 22    mov   cs:[22cc],al
    7213:  2E A2 F7 22    mov   cs:[22f7],al
    7217:  C3             ret
    7218:  00 2D 55 44
    721C:  49 43 2D       db    00,"-UDIC-"

   The three mov instructions overrite the location in memory where the
name of the MON, MAP, and TLK file is loaded from.  Other code in the
program overrites the number stored at that location.  As you can see,
the Galactic code passes in 'G' for al, and the Player code passes in 'X'
for al.  Hence, all of the normal maps will be loaded as MAPX??, and
all of the Galactic maps will be loaded in as MAPG?? so there is no longer
any name conflicts.


Installing:
-----------

   Copy all of the files from the Ultima I-VI CD in the Ultima II directory
into a directory on your hard drive.  Then copy all of the MAPG, MONG, and
TLKG files in this archive into that directory.  Then run the program
U2PATCH.COM to apply these patches OR manually patch the file ULTIMAII.EXE
using the following templates below:


     Offset:  73E8

   Original:  e8 52 f9 bb 14 00 e8 20  95 eb 06 dd 3d 1b ff 75 
    Replace:                              b0 58 e8 15 00 90 90 

   Original:  ef b0 00 a2 4a 00 b0 04  a2 49 00 e8 83 00 c3 eb 
    Replace:  90                                               

   Original:  19 dd 28 49 4e 53 45 52  54 20 47 41 4c 41 43 54 
    Replace:           2e a2 ba 22 2e  a2 cc 22 2e a2 f7 22 c3 

   Original:  49 43 20 44 49 53 4b 29  8d 00 e8 18 f9 bb 14 00 
    Replace:  00 2d 55       43 2d                             

   Original:  e8 e6 94 eb 06 dd 3d 1b  ff 75 ef b0 00 a2 4a 00 
    Replace:           b0 47 e8 db ff  90 90 90                


   Finally, rename the following files from ???x?? to ???g?? because
these are Galactic Disk files on the CD that were not overwritten by
a Player Disk file:

   map:  44, 50, 60, 61, 70, 71, 80, 81, 82, 85, 90, 92, 93
   mon:  44, 50, 60, 61, 70, 71
   tlk:  61, 71, 81, 82, 92, 93

   The following mon files need to be copied since they appear in
identical form on both the Player and Galactic Disk:

   mon:  10, 15, 30, 40, 45

   A batch file named RENGAL.BAT automatically does this.


CREDITS:
--------

   Thanks to `Gametools' for providing an interactive TSR debugger.

   Thanks to the Asimov FTP site and comp.emulators.apple2 for
providing an IBM disk image of the Apple II Galactic Disk.

   Thanks to Origin for making such an excellent series of games.

   And finally, thanks to the Royal Order of the Ultima Dragons
on the Internet for noticing this problem in the first place.

