README.md

MISC GAME INFO

MISC#1. There is an automatically spawned helicopter for observing the road traffic if you build an Air Port. It flies randomly and every iteration its coordinates tested against the traffic map. If helicopter hovering over the traffic location with density above 9 it will report about it with DPCM speech and a scroller message. Judging from the message index (18th, the last one in the list) and the fact that all previous messages aren't used at all, we may presume that this heli message and sound were added to the game at the late stage of development. However, method of calling this message is the same as in Micropolis sources.

MISC#2. The game engine consists of two main separate parts. First is an interface and display control part or game engine. It handles all inputs, menus, drawing graphics, screen objects/sprites manager. The second is a city control and statistics collector part or simulation engine. It does all city specific calcs on population, industry, energy, pollution and traffic, does stats and charts for info displays, etc... Both parts constantly do its own work in loops, never stop. The most interesting part, the threads manager in NMI handler switches between two process through stack manipulation, so both work some kind like in a parallel threads. The game engine has a priority on simulation engine. If you press any button, it will take control instantly, and city calcs set on hold. However, simulation engine can enter some kind of critical sections, which may protect the simulation calculations from accessing from the game engine. Haven't seen such engine in any game before. Usually threading methods used in a scripted engines. This is the first game that do it on the native code. Basically, this method can be used for multi-threading operation systems for NES, the problem is only in a very small stack.

MISC#3. For some reason until you get the City Status and build a Bank, you have only 3 free Special events slots. The rest of the game you'll have 4 slots. However, if all your slots are full, any pending events will wait until any empty slot appears.

MISC#4. The word ISHI is used as a RAM signature for Soft/Hard Reset test. Most probably this is the name of the developer which made the SNES version too.

MISC#5. All music tracks are used in the game. Most of tracks used to highlight the town population/status. Some tracks are "paired" and consists of two conjuncted parts, an intro and a looped main track (ie 01/02 - title, 08/10 - practice, 48/50, 60/40 - information).

MISC#6. One of the tables in the Sound engine used for calculating note lengths is the same as in Nintendo games Baloon Fight, Duck Hunt, Gumshoe, Gyromite, Hogan's Alley, Stack Up and Wrecking Crew. Definitely, the sound engine was based on the engines for these games. All of them has similar way to play SE by setting flag bits and so on. However, as against the sound engine of Wrecking Crew for example, this one written highly briefly, and little bit simplified. There is no channel data and code optimization, a different set of commands, lack of the loop commands at all, so music data and code incompatible and took a lot more space in ROM.

MISC#7. With the Micropolis source codes it is easier to understand some odd things in the NES code, most of this described in the comments of BFS version. The simulation core of Micropolis engine were taken mostly exactly the same with some small insignificant changes due to optimizations or rough fixed point rounding errors.

MISC#8. Map generation routines for New City mode also taken from Micropolis sources as is with some additional optimizations for NES specific cases.

MISC#9. The power generated by all power stations equals (COAL*700)+(NUCLEAR*2000) points. This power "distributed" between every single powerable tiles including the Powers station and electric wires. Every single powerable tile (all tiles of buildings, electric wires) consume 1 point. Due to optimization rather than bug the recursive algorithm can overpower some tiles inside the buildings or at intersection of wires up to 3 times. So the same amount of buildings may consume more or less power just because of placement and grouping of power wires. Average consumption for 3x3 building is 13, not 9. The original Micropolis core has exactly the same algorithm.

MISC#10. Although the Difficult setting non functional in original game (see - BUGS#20) there are some portions of the code that depends on Difficult setting.

MISC#10.1 Starting amount of money on Easy is 20000, on Normal - 10000, and 5000 on Hard.

MISC#10.2 Tax Rate value higher to 1 on Normal and to 2 on Hard modes while calculating the RCI growth values of the City. So you may have Tax Rate at 7, but the RCI levels will be calculated as if it 8 on Normal or 9 on Hard correspondingly.

MISC#10.3 Fund requested for transport calculated as (roads+(rails*2))*coeff. Where coeff = 0.7 for easy, 0.9 for Normal and 1.2 for Hard. Exactly as in Micropolis sources.

MISC#10.4 Overall tax collected value calculated as (R_L+C_L+I_L)*overall_city_value*coeff*0.71*year_tax_rate. coeff = 1.4 for Easy, 1.2 for Normal and 0.8 for Hard. Also exactly as in Micropolis sources.

CODES

MISC#11. There are some special secret button codes in the NES version.

MISC#11.1 At any time during the game, press "A + B + Select + Start" on pad 1 to Soft Reset.

MISC#11.2 At the title screen, press "A + B + Up + Left" on pad 2 to clear SRAM data.

MISC#11.3 During the game in any mode, at any message window (disasters, hints, information), enter two different button codes in any order. Each raises its own special cheat flag:

CODE#1 Press "A + B + Up + Down + Left + Right" once. Since you couldn't press all the D-Pad buttons at once on a single pad, at least two D-Pad buttons should be pressed on pad 1 and two on pad 2 (for example, "Up + Left" on pad 1 and "Down + Right" on pad 2, or "Down + Left" on pad 1 and "Up + Right" on pad 2, etc...). The "A" and "B" buttons on pad 1 works like a skip/quit commands so you may use them only if you already did another code before, but if you doing this code first, use only pad 2 for "A + B" combination.

CODE#2 The other code have no strict button combination. The main goal here is to have at least two identical buttons held on both pads at the same time (except "A" and "B", since you will close the window before can finish the code) and then press one more additional button on pad 1 (you may use any additional button here, but as mentioned above, you may use "A" or "B" only if you've done another code before). Easiest way here is to hold "Up" for example on both pads and then press "Left" on pad 1. When done, you must leave the message window in order to complete the cheat test sequence. If all done right, a message "I AM GOD I WISH YOU HAPPY" will be displayed. To disable the debug mode, do the same operations one more time and another message will appear then: "I AM GOD DEBUG OFF". The debug mode makes some changes to the gameplay:

MISC#11.3.1 All constructions cost no money. However, the budget income/outcome still work.

MISC#11.3.2 Be able to place any number of buildings at any position without collision check (causes a lot of glitches if heavily abused).

MISC#11.4.ADDED(BFS) You might not know this but any of 5 small menu windows with the game settings or info (SPEED, OPTIONS, DISASTER, WINDOWS, GAME) can be moved across the screen. To do this, put cursor to the upper-left corner of the window, hold A, then move it with D-Pad buttons. Each window will memorize its last position for the rest of the current game. However, the windows positions can't be saved and lost when exit from the game (the BFS version currently able to save that positions).

MISC#12. Destruction/corruption logic for map objects avoid corruptions of the raw bulldozed grounds. Only flood as a special case can corrupt it. Why at least nuclear pollution can't do the same?

MISC#13.TODO The Monster appearance logic (see - BUGS#15) doesn't use high pollution zones as a destination point as stated in the Scenario message and as actually work in the original Micropolis code. For random disaster the starting and destination points are random. For scenario disaster the Monster appears near the center in a square including Imperator's Palace and walk toward the sea. The area it crosses then mostly the industrial zone so has a high pollution ratio. So the Monster following the rule somehow.

MISC#14.FIXED(BFS) Judging from the Micropolis sources the Drive test for traffic calculation tries to drive from R to C and I areas, from I back to R, but for some reason from C either to R, C and I. The same behaviour ported to the NES version. So most of the C areas does not generate any traffic unless they are in a particular position near the other areas and as a side effect this not interfere with development of C areas.

MISC#15. Surprisingly, the random trees in the park tiles are animated just like the fire. However, all 4 animation tiles are the same so you wont't see a difference. It is possible that parks had animated fountains, as in the original Macintosh version.

MISC#16. The real in-game taxes rates are calculated once at the end of the fiscal year. This means if you want to change funding at the budget screen, you must then wait for the next year to apply settings. You just can't change them any time or free some money by redistributing taxes.

MISC#17.FIXED(BFS) The PPU data transfer for regular and extended name tables are separated long enough in the NMI handler for some reason which causes random garbage on the screen when one ppu data already set but the rest is not. Maybe there is the case when it needed, maybe need more tests.

WHAT'S UNFINISHED IN THE GAME

UNFINISHED#1. There are 6 regular scenarios available at the beginning. When you beat 6 regular scenarios, two additional scenarios will be available: "Las Vegas UFO" and "Freedom".

UNFINISHED#1.2. TODO "Traffic in Bern" scenario seems totally non functional. The initial high traffic quickly calms down when city stabilizes and stopping its growth. So average traffic value here always lower than need to fail this scenario. You will always win even if roads are deteriorating (no roads, no traffic!). Also, as against other game parameters re-calculated in real-time mode only the traffic average calculated once per year with overall city problems recalculations.

UNFINISHED#1.2. TODO Both additional scenarios have no briefing texts and window headers, only blank windows.

UNFINISHED#1.3. TODO Also both have no completing conditions, both are infinite and cannot be completed.

UNFINISHED#1.4. TODO Scenario "Las Vegas UFO" should have an UFO object as a disaster judging from its name. The CHR ROM contains two set of tiles for two frames of the large UFO animation with a tractor beam. However, there aren't any other mentions in the game messages nor the game code for such type of disasters/objects. There is no sprites data associated with it as well. It is just not implemented at all.

UNFINISHED#1.5. ADDED(BFS) Scenario "Freedom" have proper map data but have no any proper scenario parameters to load. So all flags, money amount, game settings are be semi-random at start.

UNFINISHED#2. There are 5 name buffers inside

UNFINISHED#2.1 First is your town name, default name "SIMCITY".

UNFINISHED#2.2. TODO Second is what you enter as a favorite word, used as a sister town name during the game in New Town mode, if not entered, used the default name. In practice and scenario modes is blank, so message about sistership of towns will lack the name of the City at all.

UNFINISHED#2.3. TODO Third name used as the Bank name in the message resources but never initialized with any value, always blank, the same as with blank sister town name.

UNFINISHED#2.4. REMOVED Two more are unused completely.

UNFINISHED#3. ADDED(BFS) One of the SE effects unreferenced and there is not known where it should be used. (DEMO GG for original version: AKOXTGAA+YSXZPKAP. Replaces one of the used sounds with it, write $08 to $00F1 address in RAM to hear a new one).

UNFINISHED#3.2. TODO For one more unused sound set $F2 to value $80. A kind of click or cancel sound.

UNFINISHED#3.1. TODO Another unused sound can be heard by setting var $F2 to value $10. Some kind of low alert buzzer. Maybe for unclear meltdown alert which has no any special indication otherwise

UNFINISHED#4. There are total 25 messages for scroller line at the game's HUD. Only 16 are handled by the game engine. The used ones are: from $0 to $F (except $B "Blackouts") and $18 (starting from a custom handler). The rest aren't used and were just derived from the original Micropolis sources. Most of original messages not presented in this messages are converted to in-game alert window messages, except one (see below).

UNFINISHED#4.1. TODO 0B "BLACKOUTS REPORTED CHECK POWER MAP", when _powered_areas/_stats._total < 0.7. In current NES code there is an unused variable which counts exactly a number of powered areas, but the scroll message handler for it is missing.

UNFINISHED#4.3.TODO 11 "SHIPWRECK REPORTED", 12 "A TRAIN CRASHED", 13 "A HELICOPTER CRASHED", the rest of crashes from original source not implemented here. There were a lot of various cases to damage vehicles like by Tornado/Monster collisions, random crashed when disasters are enabled, etc in the original Micropolis code.

UNFINISHED#4.4. TODO 14 "UNEMPLOYMENT RATE IS HIGH", not used even in the Micropolis sources.

UNFINISHED#4.5. ADDED(BFS) 15 "YOUR CITY HAS GONE BROKE", used in Micropolis when in Autobudget mode Current money plus Taxes collected aren't enough to fully fund all structures. In the NES code there is an unfinished branch for this (see - BUGS#23).

UNFINISHED#4.6. ADDED(BFS) 16 "EXPLOSION DETECTED", explosion were used for either the disasters when damaging the Building, combined with vehicles crashes usually.

UNFINISHED#4.7. ADDED(BFS) 17 "BROWNOUTS BUILD ANOTHER POWER PLANT", when power consumption calculated with power grid map calculation exceeded the amount of generated power by all power plants combined (see - MISC#9).

UNFINISHED#5. There are currently 3 different kind of vehicles visible on the map: a Heli, an Airplain and a Train (its indexes correspondingly 0, 1 and 3). The missing vehicle object with index 2 has most of its code programmed. Judging from the unused CHR data tiles this should be a Ship. The map overview mode displaying all vehicles as a small letters. For used vehicles has accordingly "H" (Heli), "A" (Airplane) and "R" (tRain). Unused vehicle should be displayed as "S" (Ship) correspondingly.

UNFINISHED#5.1. ADDED(BFS) There is an unfinished leftover code from an old attempt to calculate the starting position for unused Ship vehicle. It executes every time when the game engine counts sea ports and trying to search for a specific tile in the map buffer ($FE) then it should set the starting position of the ship, which never used because there is no Ship deploy code in the ROM at all. This also takes a lot of redundant CPU cycles.

UNFINISHED#5.2. TODO The search loop stop conditions in - UNFINISHED#5.1 uses the buffer size instead of the end of the buffer offset so this loop may search through all CPU space, wrap to RAM and ends something in RAM MIRROR area but can stop earlier because there are some $FE bytes in the PRG code.

UNFINISHED#5.3. ADDED(BFS) In any cases, all mentioned code doesn't calculate the correct Ship position, just the last position of the Sea port, which isn't correct, because usually, the $FE tile routes doesn't connected with the Sea ports and ship would just stuck inside the Port or on the ground near it.

UNFINISHED#5.4. TODO The special water tile $FE used only in one map for Detroit Scenario even while other scenarios has the Sea Ports as well. The New City mode can generate routes automatically for river-types of the maps, and does not generate them for isle-type maps. So We couldn't see the ship for many of maps used in game, even if there is a port.

UNFINISHED#5.5. TODO Only two portions of code are looking for a special water tiles. The ship retarget routine in objects handler and the build routines in construction engine. The second one replaces $FE with special road tile called "bridge" (see - APPEND C) to keep the water routes. However, the rest of the code does not aware about special "bridge" tiles or special water tiles to make all this stuff working together properly. Most probably this special bridges is for unimplemented drawbridges which appears only in the SNES version later. The only evidence of this is - UNFINISHED#10

UNFINISHED#5.6. FIXED(BFS) The unused Ship vehicle has two sets of sprites for years before and after 1950. Sprites 5 and 6 of the first set are broken, as well as sprite 3 of the second set.

UNFINISHED#6. REMOVED In the data for in-game menus there are two unused "YES/NO" windows: "DO YOU QUIT PLAYING WITHOUT SAVING?" and "DO YOU WANT TO START NEW CITY?". Both unused. In all cases except "LOAD GAME" the common "SAVE GAME" menu used instead.

UNFINISHED#7. TODO Every year, the current state of city parameters are stored in the graphs arrays. Since all values used here are fixed point, they attempt to scale them down to 8-bit fixed values, also calculate the max value for further scaling. However, this scaling value never used, the actual graphs display routine calculate it's own max value and scaling factor for each graph independently.

UNFINISHED#8. TODO Auto Budget setting in Options does nothing. Budget is planned and trimmed automatically always and the Budget screen can't be disabled or skipped during the game.

UNFINISHED#9. ADDED(GG LEVAUPPA) Helicopter sprite contains a 4 frame animations of the flight for every movement direction. However, only two of four used for some reason.

UNFINISHED#10. There are a lot of unused CHR data for BG objects, presumably intended to be changed according to current date or scenario type. Here is mostly complete list of most significant unused tiles. Bank numbers are in 4K units, so full tile indexes are exact MMC5 ppu data needed to display a particular tile. First number is a rectangular area top-left index, then size of rectangular area in tiles horizontally and vertically. Unused sprites are described in other section where they belongs. Most of unused sprites can be re-added and used except an UFO sprite.

BANK01

5D

1x1

Unused second type of rubble ground tile.

BANK01

A8

8x4

Unknown frames or structures in different shades.

BANK03

60

8x2

"CLEAR" tablet, probably for clear scenarios. Another larger cross-type version is used.

BANK03

A4

6x1

"GRAPHS" with small letters. 3x1 tile fonts used there instead.

BANK03

D0

6x1

"GO TO" 3x2 for BG button, sprite 2x2 used instead.

BANK04

20

2x2

Unused info maps button, judging of placement this is an older version of pushed exit button which currently uses a man running picture and has no push animation.

White House 2 present. The White House is different for every City type in SNES version.

BANK12

60

3x3

White House 3 present.

BANK12

63

3x3

White House 4 present.

BANK12

89

7x1

"Botanical Garden", a description text of unused present for menu.

90

1x1

BANK12

9C

4x1

"Station", a part of present building names for HUD on the black background. Only single "Present" used for all presents.

BANK15

00

9x1

Set of tiles to draw rounded frame on the white background with "W:" letter, usage is unknown.

BANK15

49

1x1

Part of "Water Way Ar[ea]" text: "ea" not fit into the string and left unused.

BANK15

4A

5x1

Copy of "Total area" text with different spacing.

BANK15

79

3x1

Complete sets for Race Track and two different Baseball stadiums buildings along with animation frames. A small portion of it also in BANK0B.

80

16x4

DB

1x1

DC

4x3

BANK16

00

16x2

A couple of present building names for HUD on the black background for "Monument", "Bank" "White House", "Boranical garden", "Amusement park", "Casino", "Zoo", neither of them are used as well.

20

1x1

23

5x1

2F

1x1

BANK19

C6

4x4

Two set for something like thin frame windows.

UNFINISHED#11. Message windows during the game has a various animation sequences depending on current message. There are 19 sequences are used for 10 scenes. Sequences 6 to 11 intended to be used in 4 additional scenes but they isn't. To see each of 4 unused scenes use FIX GG codes and open default hint window during the game by pushing to the "HINT" button. The evidence that the game should have 4 more hint messages is that there are two of the arrays has 40 entries instead of 36 (the number of hint messages currently, see APPEND A below).

UNFINISHED#11.1.TODO(GG ZAEAPGPA+TANAPGLA+YANAZGGA) Scenes 6-7. Uses the same sprites as for Traffic Jam message, but the "Mayor" character stands still at the rightmost window size and constantly looking to the left sweating. The closed door animation in the center of the window which someone ramming from the outside. Sprites of it never appear elsewhere. Both animated sprites together exceeded the 8 sprites per line limit and thus the "Mayor" missing part of its face. In the Micropolis sources there is an unused as well message string "They are rioting the streets!!", but there are no such warnings in current version at all. In the SNES version this animation used for common problems alert screens and hints.

UNFINISHED#11.2.TODO(GG AANAPGLE) Scene 8. The "Mayor" character stand with his back toward us. Sprites never used before. Animation very short. Usage isn't clear.

UNFINISHED#11.3.TODO(GG PANAPGLE) Scene 9. The mayor character at the middle of the screen with crutch and a bandage on its head, explaining something. Sprites aren't used anywhere else also. Most probably should be used for warnings about disasters or low funding of medicine.

UNFINISHED#11.4.TODO(GG ZAEAPGPA+ZANAPGLE+LANAZGGE+LUEZYALU) Scenes 10-11. The "Mayor" character constantly running from the left side to the right side of the window. The green cloud is floating after him. Most probably this animation is for pollution warning message. Also exceeded the 8 sprites limit at some point. In any case, there aren't messages of pollution warning in the game.

UNFINISHED#12. While build transport and power lines on the Water, there are no code for testing a valid bends with water type of tiles. You can do only straight lines continuing other straight lines. Can't bend the road on the water. Just can connect with another straight line starting from the grounds. The SNES version still not implemented this.

UNFINISHED#13.FIXED(BFS) The New city generator screen has 6 small triangle buttons at the bottom-right corner for selecting the map number. There are two tiles for drawing the regular and pressed buttons. There even has some portions of code that loads pressed button tile indexes. But then code goes to number rotate animation code and the pressed button tiles are never showed. The problem was that the button anim code reside in external bank and the FAR call routine uses the tmp values at $000,$001,$002 addresses in RAM, the same addresses used by the number display routine to store an actual decimal value. So they just removed one extra call for the sprite, fixed the glitch but disabled the button pressing animation.

UNFINISHED#14.TODO Unless the SNES version, the NES does not explode Nuclear Power stations randomly for Normal/Hard modes. The Nuclear Meltdown only available for BOSTON scenario and even has no Alert message corresponding to it. Nuclear meltdown occurs with only a sound and "GOTO" button activated.

UNFINISHED#15. There is an unused unreferenced type of Fire disaster which fires half of the Fire disaster tiles on the map at once. In the original Amiga/DOS/C64 versions there was a Scenario for Hamburg Germany 1944 Bombing. There is no such disaster in later version of this game (but there were screens on earliest versions), but such unreferenced type of disaster clearly evidence that they planned it somehow at some point.

UNFINISHED#16. There is an unused music command in a music engine code that adds a different type of envelope calculation to the note. If you replace all regular notes with such alt enveloped this will sounds like under water or maybe like in UFO-style. No music sequences are using it at all. Probably this is a leftover of the unimplemented UFO object?

UNFINISHED#17.TODO Pollution value calculated once per THREAD1 loop, but used currently only for calculating overall city problems list. Never used for any alerts display as well as not used for Graph screen because of BUGS#23.

UNFINISHED#18.FIXED(BFS) RAM addresses $5F6/$5F7 in the main city data array never used by any part of the game. However, they reside at the beginning of average states of the city. The only missing average here is Traffic Level average, which currently assigned to other RAM address $656.

UNFINISHED#19.TODO Unless the SNES version, Casino present in this game does not add a special income to the cash flow.

UNFINISHED#20. The unused tiles with indexes $ED-$FC represents the drawbridge tiles in opened state. The same drawbridges implemented in the SNES version, they may be opened or closed depending on time. There is no code for this in the NES version at all.

UNFINISHED#21.TODO Roads included in pollution calculation as an entities of value on the map, but has no impact in overall pollution value because in the NES version there is no possible to fetch animation tile with traffic which used in original Micropolis source. So traffic does not counts at all now.

UNFINISHED#22.ADDED(BFS) The road tiles for water bridges E0-E1 and EB-EC does not have a road flag set in _map_tiles_flags_tbl. So as a result they can't be used as a transport routes when traffic is calculated and you can't get any growth near them. However, this done by purpose. When drivable, these roads will collect a traffic as well and must be animated. But due to method of data fetching, there are possible only 16 different tiles to be animated. 15 already taken by regular roads. One more left, but we need TWO more. So we may animate only one of the bridge roads. To animate more we need to additional fetch routine or change method of calculating the current one.

UNFINISHED#23.FIXED(BFS) Funding calcs can't drop cur money to negative value, they are always calculated with clamp to 0. However, if we loan the amount of loans will be decremented from 0 and then we get the unsupported negative value. There is an unfinished branch where a special flag is set, when we out of money, but it not used anywhere and does nothing with a negative value.

ORIGINAL GAME BUGS

BUGS#1.FIXED(BFS) Var at $6CC RAM address is a temporary variable used in many places of the program to store intermediate calc data. However, most of the time it has a value of POWER STATIONS counter, which is calculated every game iteration. This var used exactly as a POWER STATIONS count for the warning scrolled messages tests. Although it used for calculations at the end of the fiscal year and has a semi-random value immediately after the year budget screen is closed, this has no really significant effect to the game and message triggering except the case this semi random value gets ZERO, which is rarely possible.

BUGS#2. Use the turbo button A on some input screens to glitch the screen because of ppu queue buffer overflow due to lack of proper sync. CANNOT BE PATCHED

BUGS#2.1.FIXED(BFS) Name input screen.

BUGS#2.2.FIXED(BFS) Budget money adjust screen.

BUGS#3.FIXED(GG GESLGPTZ) There is an unused disabled code in Practice mode events handler which checks if you go well or bad during this game mode. This branch should check your town population after year 1905 (should be 30000), then send a message if you did it well or you need more practice. For some reason they decided to disable it or just make bug in a selection logic.

BUGS#4.FIXED(BFS) Some events haven't appear automatically when you get it (see below) due to some sort of hardly visible bug with indexes comparisons. In case you get this bug, you need to open Hints window manually in order to obtain a Special item. Most of events works just fine, there only 2 of them which are affected. With this bug you may loose your current present if any other message appear before you go to the Hint screen.

BUGS#5.FIXED(BFS) The extra scenarios selecting screen code trying to draw "CLEAR" icons on unlocked scenarios, but there aren't proper icon position data for that, so if you manage to beat at least one of them, the scenarios select screen will glitch, if you beat both, game will hang. This is not really important at all, because you just can't beat any of extra scenarios. Also there is an copy-paste error mistakenly put a wrong variable as a counter, this isn't break anything but does an extra redundant cycles.

BUGS#6.FIXED(BFS) The briefing messages has a couple of spelling errors and incorrect spacing comparing to the original Micropolis messages where they were taken from.

BUGS#7.FIXED(BFS) There is non-critical bug in present items free slot search routine. In case you have no free slots, it will run for 256 redundant extra cycles. This does not break anything though anyway except stolen CPU cycles.

BUGS#8.FIXED(GG KIEXNPVU+OLOZEPUX) The City scan routine uses a copy of power map data fetch routine at PRGB:$A8D9 to check if scanned building is powered or not. This fetch routine uses a bitmask array to test individual bits for every building in the power grid map. If bit 0, then building isn't powered and won't grow or drop down growth instantly. If bit is 1, then all developments are enabled. The problem is opcode to read bitmask data at PRGB:$A90E (AND $A3B6,X) refers to the bitmask table in PRGA, but in PRGB it refers to the portion of the game's code. Seems they overlooked this when moving the code around. As a result, this function may returning non zero values because more than one bit are unmasked then. If you have some powered areas nearby or just not-connected electrics, then not powered building may develop and grow even with no power icon blinking on it.

BUGS#9.FIXED(GG EPXXYZNP) Sound is cracking sometimes in two channels. There is a reasonable solution for square channel by now, thanks to Chris Covell.

BUGS#10.FIXED(GG KEEAGEVE) When airplane crashes, it's damaging one particular tile on the map with enabling "GOTO" alert button. However, due to copy-paste bug, the coordinates of "GOTO" are wrong and not points to the crash site.

BUGS#11.TODO Pollution area zone calculated as a sum of weights of the tiles for every 4x4 map area. Weights are follow: developer I area +2 for a tile (+8 for 2x2 building), coal power station/sea-air ports/fires +3 for a tile (+36 for 3x3 building), and flooded ground +15 for a tile, the rest gives 0. The flooded ground has index B5, the nuclear waste pollution have index B6, so the seems mistakenly swapped them. The Micropolis source uses exactly nuclear waste for this calculation as max pollution source.

BUGS#12. Tere is a var $67D, which never written by any code, but read sometimes and used in calcs.

BUGS#12.1.FIXED(BFS) It is used as "Fires" parameter of City problems list calculations (param = {_fires_count * 5}). The NES version does not count the Fire tiles at all unless the Micropolis original version.

BUGS#12.2.FIXED(GG KENXEOIY) Also it summed with police stations counter in a city assessed value calculations. Based on Micropolis source code, police stations counter summed with fire stations counter.

BUGS#13.FIXED(BFS) The game var init routine clears only the lower nibble of _city_assessed_value not touching the high ones and then immediately clears the _annual_score_change var which is a temporary var resided near the _city_assessed_value ram address. There is unknown if they wether missed two more bytes to be cleared or clear a wrong vars instead.

BUGS#14.FIXED(BFS) City assessed value recalc routine have a major calc mistake: 6 out of 9 parameters has wrong weight multipliers, basically they swapped hi and low nibbles of the 16-bit constants. So instead of weight for hospitals $0190 (decimal 400) we have $9001 (decimal 36865) and so on.

BUGS#15.FIXED(GG PAXUVIAT) Monster disaster appearance logic choses randomly the appearance point inside the map, calculates the destination point based on what side of the map is farthest then select a random position on that side. The selection routine stores both X and Y destination coordinates in the same variable. The most noticeable result of this bug is that the first appearance with higher probability the monster will go up on the map.

BUGS#16.FIXED(BFS) Graphs screen data ranges button selector (10/100 years) default state is 10 and should be displayed as pushed button. However, it not pressed at all by default. Only way to display it properly is to push 100 years button then push 10 again.

BUGS#17.TODO There are several scenario maps with some defects, usually they have one or two power lines not connected properly, so some buildings are not powered at start.

BUGS#18.TODO Sometimes, at the beginning of the Practice mode, when game message window appears at the same time as scroller message on the screen, the R left at the left-top corner.

BUGS#19.FIXED(BFS) Game cursor not disabled when the game event message appears after you enter the Info screens at least once. If triggered, you'll see a garbled cursor near the menu button every time the event message change the page or accept input.

BUGS#20.FIXED(BFS) Difficult settings does not work for New City mode. Although it can be selected, it will reset again at the beginning of a new game, so in any cases you'll play on EASY by default.

BUGS#21.FIXED(BFS) When you build a present, a corresponding item removed from the list and then list is recompressed to remove the holes. However, the current present menu slot index does not changes. If you selected very first present to build, there is no problem. But when you select the last one and does not select another slot manually, you'll build a garbled construction which you couldn't remove or bulldoze.

BUGS#22.TODO Some electric tiles at the shores does not displayed as connected on the Power Grid map screen.

BUGS#23.1.FIXED(BFS) For R it should multiply level value by 2, but instead multiplied integer part of value with itself. The R levels usually are in range 1 to 2, so most of the time we have roughly rounded integer value as a result in case of this bug.

BUGS#23.3.FIXED(BFS) For "Cash Flow" button they uses highest nibble of money which means only money above 65535 will be documented and used. Also they do the same highest bit masking as for special flags in crime and pollution levels values, which never used for money, so this is definitely a copy-paste too. The Micropolis code uses Tax Income value here instead.

BUGS#23.4.FIXED(BFS) For "Crime" button they uses Tax Income mentioned above. It may be positive or negative. They attempted to shift the graph up to be able to display signed values (middle is zero, up - positive, down - negative), but never attempted to determine if there is a positive or negative value they calculating.

BUGS#24.FIXED(BFS) City problems list calculation routines has also at least one more major mistake that gets semi-random results on the overall calc in addition to - BUGS#12.1. One of the problems (unemployment) uses RCI proportion as a test value: param={L_R/(L_C+L_I)*8} also clamped to FRAC portion (0.999). However, calc routine stores divider in wrong temporary variable. Must be $EA-$EB, but gets to $E7-$E8 instead. (INES PATCH: $14C43: EA, $14C4B: EA, $14C4E: EA, $14C51: EA, $14C54: EB, $14C56: EA)

BUGS#24.1.FIXED(BFS) Clamping RCI proportion to 0.999 also wrong. Using this equation we must calc how much times residental zones development level higher than C+I levels combined, means how much unemployed people there are. When unemployment is high, INT portion of result should be non-zero. But this value equals 1 when both levers are equal, means the best case. But code there still truncates it to 0.999 and treat as a bad case. Micropolis source subtract 1.00 from result of proportion and then truncate to 0.999 to have correct values.

BUGS#24.2.FIXED(BFS) The problem sorting routine looks kinda wrong as well. It skips problem with the same amount of percents and takes only the last one of them, also for many cases it takes not the greatest ones. As a result, we see not the actual worst problems list, but semi-random list of high values with lowest ones.

BUGS#25. City score calculations are broken too. The main problem here is because BUGS#26 actually, but may be adjusted for this particular calculations and so the values may be much more reliable.

BUGS#25.1.FIXED(BFS) The problems list summing at the start of the calc routine does calculation on 8-bit values! But the values are 16-bit. So we skip half of problems list as well as INTEGER parts of high problem values are added as a FRAC parts so result is much lower than should be! However, in conjunction with - BUGS#25.2 this does make results looks better! The first bug is balancing the second one occasionally.

BUGS#25.2.FIXED(BFS) The base value of the score is inverted sum of problems multiplied by 4 and truncated to 1000. The max value of sum of problems is FF so this should give a minimum base scores, and so on. The less sum value (except case with 0, rarely possible) more base scores. But, after multiply this value by 4 the code does not save lower nibble of the result. Instead it takes the previously used sum value which is still not inverted. So when you have high nibble of result (~700) and a lower nibble of small sum the result will be less than proper one and vice versa. When you have a lot of problems, you will have additional points higher than they may be.

BUGS#25.3.FIXED(BFS) The transport funding value maximum is 33, but must be 32 instead. There is a comparison during the city scores calculation which need this value be 32 exactly and do wrong calc if it is 33. So you will get worse scores even if you have 100% funding.

BUGS#25.4.FIXED(BFS) RCI growth levels (RCI meters to the bottom-left) never lowers the score. They must do that when negative. But tests are incorrect and never passed.

BUGS#25.5.FIXED(BFS) Result of score adjustment with net migration proportion stored in wrong value, so the actual result is never used, instead used one of the multiplication arguments (exactly the proportion value).

BUGS#26.FIXED(BFS) Overal calculations of average values mostly broken. However, somehow they compensated by BUGS#24, BUGS#25, or were rebalanced manually in attempt to fix incorrect results of previous calculations. The main problem here the original source has a wide range averages for base values. Pollution average, Crime level average are sums of all area levels divided by number of such areas. The average mathematically can't be greater than max value of the single area. In the NES code, values for all areas are in range from $00 to $0F. So average shouldn't be higher than $0F. However, due to some data formats mangling and misunderstanding, the averages calculated as a result of division of two fixed points values. And even if we may assume that area values in range $00 to $0F are a small fixed point values, we mustn't treat the divider the same. Divider is an integer value. If you treat it as fixed point, where low nibble is FRAC, and high nibble is INT, then you will get anything but average value. For example. Sum of crime area levels is $0653, total areas collected is $00F1. Then if divide as fixed point we divide 6.324 to 0.941 ($00F1=0.241/256). But since we divide to value <1, the result will be HIGHER than overall sum. And then this value is used for all other calculations! So we literally using not the average levels, but weighted sums. Other side effect here is when we have more than 256 areas to calc the average the higher nibble of 16-bit counter won't be zero, so we will have a little scaling down of average values, but still not so much high how it should be. Even if we will calc the max number of areas (38*38=1444) the counter won't be greater than $05A4 or only 5 times smalled if treated as a fixed point number. The only way to beat this problem during the game is to keep all averages as closer to zero as possible. Which is mostly impossible for pollution for example, and even for crime rates low on map the average will be high enough to cause a problems.

BUGS#27.FIXED(BFS) Save/Load option in the game has a special game mode index 0. At the same time you may save and load any mode of the game. When restored, the game mode turns zero and then special scenario or practice events won't appear anymore. So literally you just couldn't continue the game properly unless you've played the new city mode.

BUGS#28.FIXED(BFS) The Fires control routine tries to fire up all tiles near it, however, due to incorrect using of the subroutine which corrupts X register, most of the time fires skip the rest of the nearest tiles as soon as at least one near tile appears to be inside any building.

BUGS#29.FIXED(BFS) The liberty statue and an expo statues are presents which should appear automatically after some years of a trigger event, the relationship and expo correspondingly (see APPEND. A). However, there is a bug in addition routine which prevents the correct values to be stored, so both presents appears immediately after trigger events on the next simulation loop. There is a third event with same condition, it's a Bank. But this time the addition performed manually and in different portion of code so does not affected by this bug.

BUGS#30.TODO At the New City generate screen, push any arrow buttons to change the map number manually, then quick put cursor to the "START NEW GAME" button and try to push it. Instead the map number area will blink. This happens when the map generating started but cursor movements not locked when manual map change used.

BUGS#31.TODO Rate of growth map should display the zero growth as orange color for the whole map and only a patches of growth/degrade areas. After some time map degraded to be completely colorless with just a small patches of growth/degrade areas.

APPENDIX A - EVENTS/PRESENTS

INDEX

EVENT

REQUIREMENTS

RESULTS

REPEATS

MESSAGE APPEAR

01

Becomes a Town

2000 population

history record

once per game

yes

02

Becomes a City

10000 population

history record, present "White House"

once per game

yes

03

Becomes a Capital

50000 population

history record

once per game

yes

04

Becomes a Metropolis

100000 population

history record

once per game

yes

05

Becomes a Megapolis

500000 population

history record

once per game

yes

06

Traffic is bumper to bumper

traffic level 7

-

every recalculation

yes

07

Commuters are grid-locket

traffic level 2

-

every recalculation

yes

08

Crime rate is much too high

crime level 7

-

every recalculation

yes

09

Monster disaster

scenario specific

monster appears, destroy all on its path

scenario specific

yes

0A

Eartquake disaster

scenario specific

ground shake, destroy random areas

scenario specific

yes

0B

Bank wants to build office

5 years after White House has built

present "Bank"

once per game

yes

0C

City wants relationship

150000 population

relationship begin

once per game

yes

0D

Open amusement park

120000 population

present "Amusement Park"

once per game

yes

0E

Open a Zoo

250000 population

present "Zoo"

once per game

yes

0F

Open a Casino

200000 population

present "Casino"

once per game

yes

10

Build an extra land

2 sea ports

present "Extra Land"

once per game

no, see BUGS#4

11

New Police Station

10 police stations

present "New Police St."

once per game

yes

12

New FireStation

10 police stations

present "New Fire St."

once per game

yes

13

10th anniversary monument

practice/city JAN 1910

present "10th Monument"

once per game

yes

14

100th anniversary monument

practice/city JAN 2000

present "100th Monument"

once per game

yes

15

Holding World Expo

practice/city JAN 1950

expo starts

once per game

yes

16

Erect Expo monument

practice/city JAN 1951

present "Expo Monument"

once per game

yes, see BUGS#29

17

Statue of Liberty present

practice/city 10 years after City Sistership

present "Liberty"

once per game

yes, see BUGS#29

18

Build a Library

70000 population

present "Library"

once per game

no, see BUGS#4

19

Parks expand

200 park squares

present "Extra Park"

once per game

yes

1A

Railroad Station

150 rail squares

present "Railroad St."

once per game

yes

1B

Practice Intro

Practice FEB 1900

-

once per game

yes

1C

Practice Hint

Practice FEB 1901

-

once per game

yes

1D

Practice mode Failed

Practice FEB 1905, <30000 population

-

once per game

no, see BUGS#3

1E

Practice mode Complete

Prectice FEB 1905, >=30000 population

-

once per game

no, see BUGS#3

1F

Bank Hint

Bank has build

"BANK" button enabled at Budget screen

once per game

yes

20

Fire disaster

manual request

burn random areas

scenario specific

yes

21

Flood disaster

scenario specific

flood shore areas

scenario specific

yes

22

Airplane Crash

random or when PLANE collide with HELI

destroy single area

scenario specific

yes

23

Tornado disaster

scenario specific

destroy all on its path

scenario specific

yes

APPEND B. SCROLL MESSAGES

INDEX

MESSAGE

REQUIREMENTS

FORCED

NOTES

00

MORE RESIDENTIAL ZONES NEEDED

R<(R+C+I)/4

no

-

01

MORE COMMERCIAL ZONES NEEDED

C<(R+C+I)/8

no

-

02

MORE INDUSTRIAL ZONES NEEDED

I<(R+C+I)/8

no

-

03

MORE ROADS REQUIRED

(R+C+I)>=10, (R+C+I)>ROADS

no

-

04

INADEQUATE RAIL SYSTEM

(R+C+I)>=50, (R+C+I)>RAILS

no

-

05

BUILD A POWER PLANT

(R+C+I)>=10, POWER=0

no

see BUGS#1

06

RESIDENTS DEMAND A STADIUM

R_L>=500fp, STADIUM=0

yes

-

07

INDUSTRY REQUIRES A SEA PORT

I_L>=100fp, SEAPORT=0

yes

-

08

COMMERCE REQUIRES AN AIRPORT

C_L>=150fp, AIRPORT=0

yes

-

09

CITIZENS DEMAND A FIRE DEPARTMENT

ALL_L>=60fp, SPOLICE=0

no

ALL_L=(R_L+C_L+I_L)

0A

CITIZENS DEMAND A POLICE DEPARTMENT

ALL_L>=60fp, SFIRE=0

no

ALL_L=(R_L+C_L+I_L)

0B

BLACKOUTS REPORTED CHECK POWER MAP

-unused-

-

see UNFINISHED#4.1

0C

CITIZENS UPSET THE TAX RATE IS TOO HIGH

TAX_RATE>=0C

no

-

0D

ROADS DETERIORATING DUE TO LACK OF FUNDS

RFUND_RATE<18, ROADS>=30

no

-

0E

FIRE DEPARTMENTS NEED FUNDING

FFUND_RATE<0B, ALL_L>=20fp

no

ALL_L=(R_L+C_L+I_L)

0F

POLICE DEPARTMENTS NEED FUNDING

PFUND_RATE<0B, ALL_L>=20fp

no

ALL_L=(R_L+C_L+I_L)

10

A PLANE HAS CRASHED

-unused-

-

used as EVENT MESSAGE #22**

11

SHIPWRECK REPORTED

-unused-

-

see UNFINISHED#4.3

12

A TRAIN CRASHED

-unused-

-

see UNFINISHED#4.3

13

A HELICOPTER CRASHED

-unused-

-

see UNFINISHED#4.3

14

UNEMPLOYMENT RATE IS HIGH

-unused-

-

see UNFINISHED#4.4

15

YOUR CITY HAS GONE BROKE

-unused-

-

see UNFINISHED#4.5

16

EXPLOSION DETECTED

-unused-

-

see UNFINISHED#4.6

17

BROWNOUTS BUILD ANOTHER POWER PLANT

-unused-

-

see UNFINISHED#4.7

18

HEAVY TRAFFIC REPORTED

TRAFFIC>=10 under HELI pos

yes

see MISC#1

APPEND C. MAP TILE INDEXES

INDEX

BUILDING

FLAGS

FLAG BITS

NOTES

00-18

regular R area

CA

11001010

19

hospital

CA

11001010

1A

school

CA

11001010

1B-1F

-

-

-

20-38

C area

CA

11001010

39-3F

-

-

-

40-48

I area

CA

11001010

49-4F

-

-

-

50

police station

CA

11001010

51

fire station

CA

11001010

52-5F

-

-

-

60

coal power station

CA

11001010

61

nuclear power station

CA

11001010

62

sea port

CA

11001010

63

stadium

CA

11001010

64

air port

CA

11001010

65-6F

-

-

-

70

bank

CE

11001110

71

amusement park

CE

11001110

72

zoo

CE

11001110

73

casino

CE

11001110

74

reclaimed water ground

CE

11001110

*turns to 90 when used

75

new police station

CE

11001110

76

new fire station

CE

11001110

77

10th monument

CE

11001110

78

100th monument

CE

11001110

79

expo monument

CE

11001110

7A

liberty monument

CE

11001110

7B

library

CE

11001110

7C

park

CE

11001110

7D

train station

CE

11001110

7E

white house

CE

11001110

7F

-

-

-

80-8E

internal building's tiles

C0

11000000

8F

-

-

-

90

bulldozed ground

02

00000010

91-9B

road

62

01100010

9C-A6

rail

52

01010010

A7-B1

electric

C2

11000010

B2

park grass

46

01000110

B3

park tree

06

00000110

B4

corrupt ground

02

00000010

B5

flooded ground

00

00000000

B6

polluted ground

00

00000000

B7-B8

road+rail

52

01010010

B9-BA

electric+road

E2

11100010

BB-BC

electric+rail

D2

11010010

BD

water

05

00000101

BE-CD

ground/water shores

06

00000110

CE-DF

unbulldozed ground

46

01000110

E0-E1

water+road

05

00000101

E2-E3

water+rail

15

00010101

E4-E5

water+electric

85

10000101

E6

fire ground

00

00000000

E7-EA

disaster ground anim

00

00000000

EB-EC

sailable water+road

05

00000101

ED-FC

open bridge road

05

00000101

unused

FD

-

-

-

FE

sailable water tile

05

00000101

FF

-

-

-

APPEND D. FLAG BITS DESCRIPTION

7bit (80) - conductor tile

6bit (40) - flammable tile

5bit (20) - road tile

4bit (10) - rail tile

3bit (08) - building tile

2bit (04) - terrain tile

1bit (02) - floodable tile

0bit (01) - water tile

BFS CHANGES LIST

Removed garbage and commented out all unreferenced data and code for further possible usage, if any.

Cleanup some portions of the code, minor optimizations on size.

Macrofication of the code for much more readable listing.

Commented as much as possible code and data which i clearly understand what it does and sometimes some thoughts about how those people wrote this program.

Optimized redundant or duplicated code chunks, similar routines merged and used as common system routines. Overall reducing of the code more than 4Kb without any changes to the game's logic (except maybe timings and sometimes RNG as a result of this).

Better screen refresh while ppu data dequeue process (see - MISC#17), now has less visible garbage and cause less wrong CHR data logging. However, still not ideal.

While fixing BUGS#27 by rearranging the RAM variables which also need to be saved with the City map and data, also rearranged the Difficult setting variable which properly fixed BUGS#20 too, also the configuration window positions saved with the city as well.

Fixed issue in MISC#14 section, now drive from C to C areas are forbidden.

Swapped the correct values for corresponding buttons in Graphs screen, also Tax Income value used instead of Money higher nibbles for "Cash Flow" button.

Rescaled and rebalanced some values after fixing some calculation bugs. This may also change the overall game mechanics and difficulty.

"FREEDOM" scenario treated as a Practice mode with Freedom map and speed setting SLOW. So this is restored and fixed the original bug at the same time.

Attributes of the pressed buttons on the Name entry screens are now not inverted while pressed. However, they may invert it on purpose but this looks odd actually. The evidence it may be done on purpose that non-sprite push button ("CL") animation uses attr switch the same way as sprites does.

Restored sound effect (UNFINISHED#3) can be heard when var $00F1 write value $80. Still have no idea where it should be used.

Restored ship object (UNFINISHED#5) uses the existing movement logic with some corrections to be more like in the SNES version, and a totally new deploy code made by guess.

Restored water road drive ability (UNFINISHED#22) using additional unused tiles (UNFINISHED#10) also rewritten fetch routine to allow more tiles to be accessible.

Restored part of Present building descriptions for HUD display (UNFINISHED#10). Missing entries uses either common "Build Monument" or "BuildPresent" strings.

Money can't drop down to zero now even with loan. If money are negative after the budget calcs, the "CITY GONE BROKE" message is displayed once after the end of the year or every time you exit the budget screen. Total city amount stay at 0 even if budget currently show negative balance.

Fixing BUGS#24, BUGS#25, BUGS#26 revealed the other problem. The trigger values for events and tests now has to be recalibrated too.

There are some other special variables left unsaved for BUGS#27 when scenario is triggered. No object or internal counters of current disaster aren't stored. Sometimes with this you may "skip" disaster.

Probably better way to signal about city gone broke, maybe constantly. In this case reimplement gone broke flag clear.

Three parts of the game uses three different versions of the same routines to read/write, test and combine nearest tiles. Some of them are optimized, some very unoptimal, some uses it's own data arrays duplicated the ones common used in other places.

Adjust amount of taxes collected, seems balance here is broken now.

BFS BUGS

Ship object goes completely invisible when stuck on the edge of the map or in the ponds.

During the New City mode game (or other maybe), sometimes an unknown object is floating around the screen with garbled sprites. Looks like there is a tornado obj handler broken somehow.