Please enable JavaScript to display the menu.

Disassembling Valis for FM77AV

ysflight.com

2021/12/26

Nihon Telenet released The Fantasm Soldier Valis in 1986 (FM77AV version was released in 1987). It made a big influence to the Japanese game scene. Probably every gamer of my generation knows about this game title. I think I played it then. I vaguely remembered that I was really into namco Dragon Buster, and was expecting Valis to be a similar sword-swinging game, but I had to shoot bullets to kill enemies which somewhat disappointed me. Now I have two sets of Valis for FM77AV disks. Both are from Yahoo! Japan Auction, and the disks I used back in 1986 are not with me any more.

Although I most likely played it in 1986, I don't remember much. So, it's pretty much a new game to me. The university is in winter break, so I gave a shot. Well, if I give a shot, I really shoot it up. I once played through, and then read disassembly to look into the program details.

Maps of All Acts

I haven't found any maps of Valis on the internet. Someone may have done, but I haven't found on the internet. So, I think if someone wants play this game today, these maps may be helpful. I figured locations of items, bosses, and warps by reading disassembly, and annotated on the map. If you play Valis, you will feel you are seeing many of similar map patterns. In 1986, computers didn't have gigabytes of RAM. So, how the programmers made a large map? They made tiles of smaller maps, and assembled them together. By re-using tiles in many locations, programmers could build a large map without consuming too much RAM. In return, you end up seeing repetitive patterns. While I was disassembling, I was calling these tiles as partitions, so in the rest, I call it a partition.

Left and right, and top and bottom of the map are connected. But, Valis used a trick to virtually make map a lot wider or taller. For example, when you move to the left and cross the left edge of the map, you appear on the right. But, the partition Y coordinate may be mapped to a different Y. If you look at Act 2 map, it is a very wide map. When you move right crossing the right edge of the map, you will appear from the left edge and lower than where you were. Without this trick, the width of the map is limited to 32 partitions, but this trick virtually extends the map width. This trick also makes a very long fall in Act 9. In the maps below, I annotated these 'jumps' of the partition coordinate by red letters.

I have also located all items and warps. G for weapon (Gun), A for armor, K for kill-all, I for invulnerability, W for warp, and * is the item that makes enemy invulnerable for certain amount of time. V is the starting location of the Act.

Act 6 map indicates that the boss is inside the wall and cannot reach. I will discuss about this issue in the later part of this article.

You can use 'warp' in Acts 3, 5, and 9. From Act 3, you will enter (U,6) of the warp stage, Act 5 (1,4), and Act 9 (5,1). By entering W in the warp stage, you come back to the regular stage. If you warp from Act 5, you can skip Act 6 and will re-appear in Act 7. If you finish an act by killing the boss, you will lose your armor at the beginning of the next Act. But, the armor you get in the warp stage will not be taken away. By picking up strong armor in the warp stage, the early part of the next Act becomes very easy.

Act1


Act2


Act3


Act4


Act5


Act6


Act7


Act8


Act9


Act10


WARP


Game Play

What you do in each Act is pretty much the same. First get an armor. Then kill enemies and collect gems to increase life. Pick up a better weapon if necessary, and then go to the boss battle.

An arrow shown at the lower right of the screen is supposed to roughly point to the boss. But, from time to time, it indicates totally wrong direction. In Act 5, it looks to be pointing to the warp location. Since Act 6 of FM77AV is like a trap where you cannot get out of (unless you use a secret or cheat key combination), it might have been intentional.

In boss battles, just shoot a few bullets at the enemy and then run to the other side. Just repeat it. It is the same for the last boss. You can kill bosses with little to no damage with this tactic, except Act 9. In Act 9, I just stayed at the wall corner and kept shooting bullets at the bosses. I couldn't find a better tactic. But, unless you really want to beat the boss in Act 9, you can just use a warp to skip the boss-battle. The last boss is easier than Act 9 boss.

The most time-consuming part of each Act is to find an armor. It was nearly impossible without a map. Also sometimes the arrow didn't guide me to the last boss, and it took long time to find the boss-battle location. But, with the maps above, you can navigate relatively smoothly.

Findings

In Valis for FM77AV, is Act 6 un-clearable?

The above Act 6 map tells that the boss is inside the wall. Therefore you cannot kill the boss to go up to the next Act. Was it due to the copy protection? I suspected it, I did my best to catch an indication of the protection-checker called before the beginning of Act 6. I have two sets of Valis disks. One set doesn't boot due to an error in the sectors of cylinder 0 side 1. But, if I boot with the healthy set, and then change disks, I can use the other set. Or, I can make disk images from the two sets, and transplant healthy sectors to the broken disk image to make it boot. This Franken disk didn't make any change to Act 6 map, which means it doesn't seem to be corrupted data. I am highly suspecting it was a bug of the FM77AV version.

It was common in 1986 that the copy-protection checker blocks the player halfway into the game. In FM77AV Valis, the copy protection was reading F7 sector and checking some bytes of the sector changes the value every time. Basically I can find the checker by stopping the program when it reads a F7 sector. I did it, and I found a checker running on boot up, but that was it. Of course, there can be another checker that is not really reading the sector (like reading address marks to check presence of the F7 sector). But, I have a feeling that Act 6 problem is not the copy protection. I had an intel that FM77AV Valis had two different copy protections. But, it turned out there are two versions of copy-protection checkers. It didn't mean that one copy had two checkers.

This play movie of the PC88 version Valis tells that the boss battle is near partition (G,S). After the start of the Act, Valis moved to the right, then down, and then left. The corridor where the boss appeared didn't have mid-air floors. It is likely to be the corridor near partition (G,S). All other boss battles in Valis are relatively flat ground. So, it is a very likely place. If FM77AV version was supposed to be the same, the boss-battle coordinate of FM77AV version was wrong.

This play movie of the FM77AV version uses a warp from Act 5 to skip Act 6. I don't know if the player knew that Act 6 was un-clearable and intentionally skipped it.

The problematic Act 6 boss-battle coordinate is written in Disk 2, Cylinder 18, Side 1, Sector 1, offset $02A5.

    
02a0 1b 1c 1d 1e 1f 03 08 09 09 10 16 00 00 08 04 0c|................ ^^ ^^
For some reason, Y coordinate is written before X coordinate. In the program, the coordinate is compared after EXG A,B against the memory location $0D26. If the wrong coordinate is used for copy-protection, the checker should run, or the program should look at a flag that the checker raised or cleared before. But, I didn't find any of such code. Anything written by the protection checker that runs on boot up were overwritten by the main program. It should be Y=$1C and X=$0F or X=$10. But, I didn't find any code that changes the values only in Act 6.

I exhausted almost all options but testing with the actual FM77AV hardware with the original disks. I want to avoid using the actual disk media, because the disk media is little by little scratched off by the disk head. But, this time I have no other choices. The partition map and boss location are stored in what's called shadow RAM of FM-7 series. The shadow RAM is $8000 to $FBFF, and this area is taken by F-BASIC ROM until you write a value to I/O $FD0F. Resetting the computer does not clear the shadow RAM, so I could proceed to Act 6 and then reset the computer to dump the shadow-RAM contents. I am using the actual FM77AV hardware and the original disk. If I cannot clear Act 6 in this method, nobody can clear Act 6 without using a cheat key combination.

First I have checked the boss coordinate. After reset, I have typed the following program using F-BASIC MON command, and then EXEC &H2000 to execute. This transferred 256 bytes in the shadow RAM $9DE0 to $5000. The boss coordinate after the transfer can be read in $5004 and $5005.

    
2000 ORG $2000 2000 3401 PSHS CC 2002 1A50 ORCC #$50 2004 B7FD0F STA $FD0F ; Switch to shadow RAM 2007 8E9DE0 LDX #$9DE0 200A CE5000 LDU #$5000 200D 5F CLRB 200E A680 LOOP LDA ,X+ 2010 A7C0 STA ,U+ 2012 5A DECB 2013 26F9 BNE LOOP 2015 B6FD0F LDA $FD0F ; Switch back to F-BASIC ROM 2018 3581 PULS CC,PC

Here comes the results. The boss coordinate in $9DE4 and $9DE5 were $10 and $16, which is inside of the wall and unreachable. The following screenshot shows $10 and $16 in RAM address $5004 and $5005.

What about the partition map? Does this have a passage to the boss battle? This time I needed to see $8000 to $83FF. I modified my code as follows.

    
2000 ORG $2000 2000 3401 PSHS CC 2002 1A50 ORCC #$50 2004 B7FD0F STA $FD0F ; Switch to shadow RAM 2007 108E8000 LDY #$8000 200B CE5000 LDU #$5000 200E 8E0400 LDX #$400 2011 A6A0 LOOP LDA ,Y+ 2013 A7C0 STA ,U+ 2015 301F LEAX -1,X 2017 26F8 BNE LOOP 2019 B6FD0F LDA $FD0F ; Switch back to F-BASIC ROM 201C 3581 PULS CC,PC

The following screenshot is dump of memory address $5000 after the transfer.

FM77AV doesn't have a text resolution to show all of the partition map, so I transferred to Tera TERM via serial. I could do it by a simple F-BASIC program.

This F-BASIC program sent the following text to Tera TERM.

202020201E202020202020201E202020202020201E202020202020201E202020
202020201F202020202020201F202020202020201F202020202020201F202020
202020110F1520202020201309172020202020140D162020202020120B182020
20201208090A1620202014100F0E1820202011080B0E1720202013100D0A1520
1B1C0D0B0C0D0B191A1C0B0D0C0B0D191B1C0F090C0F09191A1C090F0C090F19
2020000E0F1005202020020A090807202020030A0D1006202020010E0B080420
2020200109042020202020030F062020202020000B052020202020020D072020
202020201D202020202020201D202020202020201D202020202020201D202020
202020201E202020202020201E202020202020201E202020202020201E202020
202020201F202020202020201F202020202020201F202020202020201F202020
202020120B182020202020110F1520202020201309172020202020140D162020
202013100D0A152020201208090A1620222014100F0E1820202011080B0E1720
1A1C090F0C090F191B1C0D0B0C0D0B191A1C0B0D0C0B0D191B1C0F090C0F0919
2020010E0B0804202020000E0F1005202020020A090807202020030A0D100620
202020020D0720202020200109042020202020030F062020202020000B052020
202020201D202020202020201D202020202020201D202020202020201D202020
202020201E202020202020201E202020202020201E202020202020201E202020
202020201F202020202020201F202020202020201F202020202020201F202020
202020140D162020202020120B182020202020110F1520202020201309172020
202011080B0E1720202013100D0A152020201208090A1620202014100F0E1820
1B1C0F090C0F09191A1C090F0C090F191B1C0D0B0C0D0B191A1C0B0D0C0B0D19
2020030A0D1006202020010E0B0804202020000E0F1005202020020A09080720
202020000B052020202020020D0720202020200109042020202020030F062020
202020201D202020202020201D202020202020201D202020202020201D202020
202020201E202020202022201E202020202020201E202020202020201E202020
202020201F202020202020201F202020202020201F202020202020201F202020
2020201309172020202020140D162020202020120B182020202020110F152020
202014100F0E1820202011080B0E1720202013100D0A152020201208090A1620
1A1C0B0D0C0B0D191B1C0F090C0F09191A1C090F0C090F191B1C0D0B0C0D0B19
2020020A090807202020030A0D1006202020010E0B0804202020000E0F100520
202020030F062020202020000B052020202020020D0720202020200109042020
202020201D202020202020201D202020202020201D202020202020201D202020
To make it easier to see, I highlighted the boss location red. The boss partition is surrounded by $20s. $20 means solid wall. Therefore, the player has no chance of going into the boss partition.

Other games have gimmick like the map transforms by satisfying certain conditions. However, in Valis, no such gimmick had been found in anywhere other than Act 6. I do not see any reason that makes Act 6 special. Therefore, it is reasonable to assume there is no such gimmick in Act 6. PC88 version doesn't require anything special to go to the boss battle in Act 6. There is no reason that FM77AV version should be different.

After all these probes, I am 99% sure that it was a bug. Then the next question is, has there been a bug-fix version? It is very difficult to check. I don't have money to buy all FM77AV Valis disks from Yahoo! Japan Auction.

So, I asked for help from the Game Preservation Society. They checked the sector of interest of 11 disks of FM77AV Valis. As a result, all disks had Act 6 Boss location as Y=$10 and X=$16, which is unreachable. Considering that all 10 disks had the same issue, I believe no bug-fix version was released.

Why wasn't this Act 6 problem un-noticed? I could find a magazine article talking about FM77AV Valis in Oh!FM September 1987 issue, page 82. I couldn't find any other articles specifically talking about the FM77AV version. The Oh!FM article showed a screenshot of the last stage, Act 10. So, whoever wrote this article was able to proceed to the last stage.

For this question, my hypothesis is that the player was supposed to use warp in Act 5. In this game, the player can see an arrow at the lower right corner of the screen. The arrow is supposed to point to the stage-end location. The arrow directions for each partition are written from main RAM $A000 for 200 bytes. Each byte stores information for 2 partitions. Top 4-bit is for odd partition X coordinate, and lower 4-bit even partition X coordinate. If the value is 5, the arrow is not updated (continues to indicate previously shown direction). If the value is greater or equal to six, one should be subtracted. Then one is subtracted from the value, and then finally the direction is taken from the 8-byte look-up table from $3139. The arrow-direction 0 is upward, and incremented by 45 degrees counter-clockwise. The following image is a plot of arrow directions of Act 5.

If the player follows the arrow directions from the start, the player will be guided to the warp point. The location is dead end. But, if the player keeps searching for some clue, the player may step on the warp coordinate. In fact, when I played through before reverse engineering, I ended up hitting the warp. So, I could skip Act 6, and was able to continue on all the way to Act 10.

What if the player didn't find this warp point, and try to go to the boss battle? To get to the boss, the player needs to pass partition (E,1) or (E,3). However, the arrow will pointing the other direction from the boss. It is discouraging the player to get to the boss. It is highly likely that the developer wanted the player to find the warp. Or, even assumed the player to use the warp in Act 5. If the player reached the boss, it meant that the player disregarded the intention of the developer. By letting the player find the warp here, the player consider the possibility of another warp in the previous stages. Also the player would search for the warp in the coming stages. It is highly likely that the developer intentionally guided the player to warp in Act 5.

One more question. You are supposed to be able to get to the "Stage End" by following the arrows. Where do Act 6 arrows of FM77AV version guide the player to? In the above-mentioned PC88 version play movie, the player just follows the arrows to get to the boss very easily. In Act 6 of the FM77AV version, arrows will guide the player to nowhere. First, the starting partition (G,C) will tell the player to go to the right. However, once the player moves through the narrow opening, the arrow points to the left. It makes the dead lock already. Let's say the player ignored the left arrow and moved to farther right. Then, at partition (K,C) the arrow points upward, (K,D) downward. Just by a little bit of difference in height, the player will be directed to the complete opposite direction. Let's say the player followed the down arrow. The arrow keeps pointing down until (K,F). But, in (K,G) the arrow points up. The arrows in Act 6 of FM77AV version does not help. This is another indication that Act 6 of FM77AV version was an intentionally made trap.


It was 1986. If the player was explained that winning the boss in Act 5 and going into Act 6 was a trap, the player would have believed, and it might really have been an intentional trap.


Warp by jumping straight up from this location.

Secret Cheat Keys

The manual does not tell about the PAUSE. But you can pause by pressing the ESC key. While paused, you can use the following secret cheat-key combinations. This was found by reading disassembly from main RAM $2528.

Item Codes

1-6 Weapon
7-10 Armor
11 Kill All Enemies in the Screen
12 Invulnerable for certain time
13 Cannot kill enemies for certain time
14 Warp (Yes, warp point was implemented as an item)

Memory Map

$0D02 Act number. The first Act is 1. If in warp stage, $FF for the warp stage from Act 3, $FE from Act 5, and $FD from Act 9.
$0D07 Start boss battle by writing 1.
$0D0A Clears the act by writing 1.
$0D0B Warp by writing 1.
$0D0E Stage select by writing non-zero value. 1 to 10($0A) will jump to the Act. 11($0B) for ending. $FF,$FD,$FB,$F9,$F7 will jump to Act 1. $FE,$FC,$FA,$F8,$F6 will jump to the warp stage, but may end up starting inside the wall.
$0D26,$0D27 Partition coordinate at the top-left corner of the screen.
$0D28,$0D29 In-partition block coordinate at the top-left corner of the screen.
$0D43 Pointer to the in-map item table. Item table consists of 6-byte structures.+0=(00:Still exists FF:Taken of not exists)、+1=Item Code、(+2,+3)=Partition coordinate、(+4,+5)=In-partition block coordinate.
$0E80~ Key state. Based on FM77AV key scan code. FF means key is held down. 00 means key is up.
$8000-$83FF 32x32 partition map.
$8400-$9CFF In-partition map. Each partition is 20x10 blocks. Therefore, 200-byte per partition. $4*,$5* are floors. $8*,$C*,$D* is unpassable wall. 0 is background. Others are passable background pictures.
$9D60-$9D7F Partition Y transformation table for 32<=Partition X.
$9D80-$9D9F Partition Y transformation table for Partition X<0
$9DA0-$9DBF Partition X transformation table for 32<=Partition Y
$9DC0-$9DDF Partition X transformation table for Partition Y<0
$9DE4 Boss Partition Coordinate. Y first.
$A800 Visible blocks. (20x10)
$B800 Character structures. $2D byte each. $B800 is for Yuko.
$B815 Time left for invulnerability.
$B80A Yuko X coordinate on screen. It is half-block increment, therefore it can be 0<=x<40 and 0<=y<20, although the blocks on screen is 20x10.
$B80B Yuko Y coordinate on screen. It is half-block increment, therefore it can be 0<=x<40 and 0<=y<20, although the blocks on screen is 20x10.
$B81D Weapon type
$B81E Armor type
$B995- Items visible on screen. $2D byte per item. (+4=Pointer to the item structure, +10=block coordinate Y on screen, +11=block coordinate Y on screen)
Comments are welcome.  Send E-Mail to: 

Back to http://www.ysflight.com