The trouble with hiding
When Sam is wanted by the police, he is supposed to be able to hide inside buildings (but not on roofs or in stairwells that are visible from outside) in order to evade arrest. However, because of a bug in the routine that checks whether Sam can be spotted by the police in his current location (see 70D6), Sam's attempts at hiding may be either futile or undeservedly successful. In particular, if Sam is on the roof of or inside a building other than the hotel (and not in a stairwell that is visible from outside), he will be invisible to the police if he's facing right, but visible if he's facing left.
POKE 28910,44
Hiding in plain sight
If Sam is wanted by the police, one place he can go and be certain that the cops will not get him is the far right edge of the roof of the apartment building next to no. 74. As soon as Sam reaches that spot - at coordinates (23,6), to be precise - any policemen who are chasing him will turn round and head for the top floor of the hotel instead.
hiding_in_plain_sight
The reason for this is that the region containing the roof of the apartment building next to no. 74 is defined such that it extends only to x-coordinate 22 instead of 23, and the region adjacent to it (beginning at x-coordinate 23) corresponds to the top floor of the hotel (see EFE8).
In addition, when the cops reach the top floor of the hotel, they will proceed to the wall of the room on the far right and then freeze.
hiding_in_plain_sight2
When Sam feels that the time is right to turn himself in, he can unfreeze the policemen by approaching them. When he gets close enough, one of them will pick him up.
POKE 61416,24
Hiding in the ceiling
Another place Sam can go and be certain that the cops will not get him is the room above his office. First you'll need to get the hook (POKE 32745,64 while a game is in progress). Then go to the top-floor cyan room in the apartments next to no. 19, call the police, hang up, go to the right edge of the roof of the apartments, throw the hook over the roof of no. 19, make your way across the rope to the roof of no. 17, and go down into the room above Sam's office. Instead of following Sam there, the police will go to Sam's office instead and run up and down continuously.
hiding_in_the_ceiling
The reason for this is that the routine at ED8C assumes that every level of a building is reachable by climbing staircases going up from the ground floor. This is true for every building in the city except no. 17: there is no staircase leading up to the top floor from Sam's office below. So the police make their way to Sam's office only to find that there is no route up to their destination.
Inside and out
Go to the far left of the room above Sam's office (to do which you'll need the hook: POKE 32745,64) and turn round to face right; part of Sam's sprite will appear outside the room.
inside_and_out
Under the rope
After throwing the hook (POKE 32745,64 while a game is in progress gives Sam the hook) over the roof of no. 19, cross the rope to the extreme left edge of the roof of no. 17, turn round, and press 'A' ('down') or 'O' ('left') twice - Sam will step down below the level of the rope so that his feet are hidden. From here it's possible to walk below the level of the rope all the way back to the roof of the apartment building.
under_the_rope
This bug is caused by the location descriptors at B9E6. In particular, the descriptors at B9EC (y=6) and B9EE (y=7) should not apply to x-coordinate 222. One way around this is to give x-coordinate 222 its own set of location descriptors for y-coordinates 13, 19, 25, and 31:
POKE 56568,18: POKE 56569,128 (y=13, z=1; left)
POKE 56570,30: POKE 56571,128 (y=19, z=1; left)
POKE 56572,42: POKE 56573,128 (y=25, z=1; left)
POKE 56574,54: POKE 56575,128 (y=31, z=1; left)
POKE 50654,248: POKE 50910,220
The plight of the non-arresting policeman (1)
If Sam stands on the right edge of the roof of the apartment building next to no. 19 while the rope is there and both policemen are chasing him, one policeman will pick him up, and the other will then walk onto the rope and eventually get stuck at the right end, next to the edge of the roof of no. 17.
potnap1_1
(POKE 32745,64 gives Sam the hook while a game is in progress, and there is a phone in the far left room on the top floor of the apartment building from which Sam can call the police.)
The key to reproducing this bug is to keep the policemen at bay until both of them have spotted Sam on the edge of the roof and are heading there to catch him. This can be done by stepping off the edge of the roof and onto the rope (which makes a chasing policeman turn round and head the other way), staying there for a few seconds, and then turning round and stepping off the rope and back onto the edge of the roof (which makes a chasing policeman turn round again and head for Sam's location).
potnap1_2
Using this technique, Sam can keep one policeman busy until the other shows up, and then allow himself to be arrested.
The non-arresting policeman proceeds to the edge of the roof even after Sam has been arrested because of a quirk in the routine at 72B1, which makes the policeman complete his journey to the spot he was heading for while chasing Sam before resuming normal patrol duty on the sidewalk.
But why doesn't the non-arresting policeman then simply step down from the edge of the roof and return to the sidewalk? Here is where the story gets complicated.
The policeman is standing at (206,6,1) (on the top-right edge of the roof), facing right. His destination is somewhere on the sidewalk or road. Under these conditions, the routine at ED8C returns with A=4 (go down) at EE62. The routine at F600 takes this return value and jumps to the routine at EBA0. This routine then moves the policeman forwards (and therefore onto the rope), because there is no step going down at (206,6): the location descriptor for (206,6,1) at C3F5 says 'left, right' only.
The policeman keeps moving forwards in search of a way down, until he finds one at the right end of the rope, and takes it. With the policeman now at (221,7,1), the routine at ED8C returns with A=1 (go right) at EE5B, because his x-coordinate (221) is less than the x-coordinate of the top of the staircase leading down to the floor below (236, as defined by the third byte of the region identifier entry at EFFC; this is the staircase leading down from the roof of no. 17 to the room above Sam's office). Then the policeman turns round, heads right, and gets stuck at (222,7,1), because the only available direction at that location is left (as defined by the location descriptor at B9EE).
Note, however, that the policeman who gets stuck in this way can still arrest Sam (if Sam later becomes wanted by the police, and tries to make his way across the rope). If that happens, Sam gets stuck too, and the game is effectively over.
The plight of the non-arresting policeman (2)
Further evidence that policemen and roofs don't mix can be found on the roof of the apartment building next to no. 74. If Sam stands in the spot just to the left of the right edge of this roof when both policemen are chasing him, one policeman will pick him up, and the other will then pace up and down the roof continuously, unable to find his way back to the sidewalk and regular patrol duty.
(There is a phone in the right-hand magenta room on the third floor of the apartment building from which Sam can call the police.)
Again, the key to reproducing this bug is to keep the policemen at bay until both of them have spotted Sam near the edge of the roof and are heading there to catch him. This can be done by stepping towards the far right edge of the roof (which makes a chasing policeman turn round and head the other way), staying there for a few seconds, and then turning round and stepping back to the spot just to the left of the edge of the roof (which makes a chasing policeman turn round again and head for Sam's location).
potnap2
So what prevents the non-arresting policeman from returning to the sidewalk after Sam has been arrested in this case? As noted in the previous bug, there is a quirk in the routine at 72B1, which makes the policeman complete his journey to the spot he was heading for while chasing Sam before resuming normal patrol duty on the sidewalk. So first of all, the policeman heads for (22,6), just to the left of the top-right edge of the roof. Unfortunately, however, he never makes it there.
Before any character can reach the location at (22,6), he must first pass the location at (21,7). When the policeman reaches that spot, the routine at ED8C returns with A=2 (go left) at EEAB, because his x-coordinate (21) is greater than the x-coordinate of the bottom of the (non-existent) staircase leading to the floor above (20, as defined - incorrectly - by the fourth byte of the region identifier entry at EFE8). Therefore the policeman turns round and walks left instead of stepping up onto the top edge of the roof.
Then, when the policeman reaches (19,7), the routine at ED8C returns with A=1 (go right) at EEA9, because his x-coordinate (19) is now less than 20. Therefore the policeman turns round and walks right, back to (21,7). And so on and so forth, until Sam is once again wanted by the police, and the policeman's destination changes to wherever Sam is.
POKE 61419,21
Lana doesn't answer
When Sam's score hits 50, the first phone message from Lana (message 0x3B: LANA ANSWERED 'OOH SAM! THEY KILLED MY FIANCE AND STOLE THE BUDGIE') is activated (see 5FF9). However, if Sam calls Lana (on 7162) from the phone in the third-floor magenta room in the apartments next to no. 74 while the room past the catwalk is on-screen, no one answers.
lana_no_answer
The reason no one answers is that (a) a phone in a room that is currently on-screen will be answered only if a character is nearby (see 772F), and (b) Lana's phone is the one in the room past the catwalk (see 6B00).
Hook v. bird
When Sam phones Lana while in possession of the budgie, he should receive the message 'LANA ANSWERED 'OOH SAM! YOUVE GOT THE BIRD. SEE YOU IN YOUR OFFICE''. However, if Sam phones Lana while he has both the hook and the budgie, he will get no message; this is because the event table entry at 60BB checks that Sam has the budgie and only the budgie. (POKE 32745,192 gives Sam the hook and the budgie while a game is in progress.)
POKE 24768,56: POKE 24779,48
OK Cruise we're not coming
In game mode 4 - after Lana has been put in jail and the mob is after Sam - Sam can call 999 and hear the message 'OK CRUISE WE'RE COMING'. However, no policeman ever arrives, because there are no police on patrol duty in game mode 4.
Life sentence
Sam must have at least $46 when he's arrested, otherwise the game will end immediately (see 7B9A). In addition, if Sam has $20 or less when the jailer comes to let him out of the cell, the routine at 7B6A will enter an infinite loop by trying to find a bail amount of $20 or more that Sam can afford, effectively ending the game and sentencing Sam to a life of suspended animation in jail.
But can this actually happen? Is it possible for the jailer to come down from his office too late to save Sam from a life sentence? Let's do the maths and see.
First, let's assume that Sam does have only $46 when he's arrested, and that he's arrested in the location that is farthest from the police station: the roof of the apartment building next to no. 74. It takes the arresting policeman about 1m14s to get to the jail cell (with Sam) from that location. Since Sam loses a dollar every 5.12s (see 7AB6), that means he will have no more than $32 left by the time he's dropped off. And 1m2s later, he will have no more than $20 - the critical amount. The question thus becomes: is it possible for the jailer to take more than 1m2s to come down and let Sam out?
The jailer's routine involves walking up and down in his office for a while, going down to the cell to let Sam out (if he's there), going back up to the office, and starting all over again. The number of walkabouts he performs will be anywhere from 32 to 63 (see F748). Each walkabout consists of walking to a randomly chosen spot that is 6, 4, 2 or 0 x-coordinates to the left of the walkabout origin. Travelling one x-coordinate requires two movements. So the number of movements the jailer will make while walking up and down in his office could be as high as 63*12=756, but will be 47.5*5=237.5 on average.
Now to translate that into actual time. The character-moving routine at F1FC moves three characters at once, and there are 16 characters to be moved. Therefore each character is moved on one in every 5.33 passes through the main loop when running, and one in every 10.66 passes when walking. Passes through the main loop are made at least 0.02s apart, so a walking character is moved once every 0.21s. This means that the jailer could spend as much as 756*0.21=158.76s walking up and down in his office, but will on average spend 237.5*0.21=49.875s doing so. To those figures we would need to add the time taken to walk down to the jail cell from the office.
So it is possible for the jailer to spend too long in his office before coming down to let Sam out. Unlikely, but certainly possible.
Post-traumatic teleportation disorder
When Sam knocks a character over by landing on his head from above, that character is supposed to:
(1) drop to the the floor and remain there for a brief period
(2) stand up and stagger around for another brief period
(3) walk back to the spot where he was hit on the head
(4) resume whatever he was doing at the time he was struck
But because of a bug in the routine at FA83, the walking back part of step (3) is omitted. Worse than that, if the character was midstride at the time of the collision, step (3) is replaced by an immediate teleportation to the character's pre-knockout, post-midstride coordinates. As a result, you might see the recovering character zip from A (the point where he stops staggering around) to B (the spot just to the left or right of where he was hit on the head) without passing through the intervening space.
POKE 64140,40
Sam the escape artist
If Sam moves midstride just before being picked up by a policeman, then he can escape from the jail cell after being dropped there by the simple act of turning round (to face right). As soon as he does that, he will teleport back to the spot where he was arrested.
Whenever Sam (or indeed any character) moves midstride, his post-midstride animatory state, x-coordinate and y-coordinate are calculated and stored in bytes 0x05, 0x06 and 0x07 of his buffer by the section of code at EC07, to be retrieved later (usually soon after) by the routine at EC5A. However, if Sam is picked up by a policeman while he's midstride, his post-midstride movement is delayed. When 'P' is pressed after he's been dropped in the cell, the routine at ECDC is called, which first turns Sam round (because he's facing left). Then that routine jumps to the code at ECE4, which detects the post-midstride y-coordinate stored in byte 0x07 of Sam's buffer, and accordingly sets the midstride timer in byte 0x09 of his buffer to a non-zero value. A few passes through the main loop later, the midstride timer is decremented to zero by the code at F069, and Sam is belatedly moved to the post-midstride coordinates that were calculated just before he was arrested.
The following POKEs fix this bug by making sure that Sam's post-midstride y-coordinate is cleared when he's picked up by a policeman:
POKE 29188,0: POKE 29189,1: POKE 29191,7
Note that the midstride trick does not work with gangsters, because the code at FBA6 sets byte 0x07 of Sam's buffer (which holds his post-midstride y-coordinate) to zero when he lands after being dropped off the roof of a building. To enable the midstride trick to be used with gangsters:
POKE 64426,8
Now when Sam turns round after coming to, he will teleport back to the spot where he was picked up by the gangster.
The persistent sniper
It's possible for part of the sniper's sprite to remain on screen after the screen has scrolled the sniper's body out of view. To see this, go to the first floor of the apartments next to no. 19, and position Sam so that the doorsteps of no. 19 are visible on the left side of the screen.
persistent_sniper1
When the sniper appears on the left side of the doorsteps, move Sam left so that the screen scrolls right. The brim of the sniper's hat and maybe also his gun will remain visible at the right edge of the screen until wiped away by other characters passing by on the sidewalk.
persistent_sniper2
The conspicuous sniper
One of the defining characteristics of a sniper is that he should remain concealed or inconspicuous when aiming at his target. However, because of a bug in the sniper-controlling routine at 621E, the sniper will, after emerging to take aim, remain brazenly out in the open for all to see until Sam gets too close. The apparent intention of the sniper-controlling routine is that the sniper should emerge, shoot once or twice, and then hide again when byte 0x10 of the sniper's buffer has been decremented to zero from its original value between 0x0A and 0x19 (see 62DB).
POKE 25113,46
POKE 25114,16
POKE 25115,52
POKE 25116,24
POKE 25117,84
POKE 25192,176
No. 19 lockout
It's possible to lock the gangsters at no. 19 out of their house, leaving Sam free to enter via the roof and explore the mob stronghold with impunity. To achieve this feat, proceed to no. 19 and stand on the right edge of the front doorstep.
no_19_lockout1
When the door opens, the gangsters will walk out onto the doorstep and then freeze, as if uncertain where to go next to grab Sam.
no_19_lockout2
If Sam then goes back down to the sidewalk, the gangsters will unfreeze and start knocking on the front door - but because there's no one at home to answer it, they'll never get in.
If, on the other hand, Sam approaches the gangsters on the doorstep, one of them will pick him up with the intent of carrying him to the roof, but will instead get stuck at the front door, unable to get in.
The reason that the gangsters freeze on the doorstep of no. 19 is a combination of a quirk in the routine at ED8C (which determines the next move a character should make to reach his destination), the boundary of the inner region that is watched by the gangsters (as defined at FD44), and the logic in the routine at 7A82 (which controls a gangster who is chasing Sam). When a gangster arrives at the front door his coordinates are (211,31,1) and Sam's are (212,31,2). The routine at ED8C then sends the gangster down a step to (210,32,2) instead of simply turning him round and changing his z-coordinate from 1 to 2. But (210,32,2) is outside the inner region watched by the gangster (which extends only to y-coordinate 31), which means the routine at 7A82 will abort without moving the gangster anywhere while Sam remains inside the inner region.
POKE 62177,136: POKE 62178,144 (to give each gangster a key to no. 19)
POKE 64839,33: POKE 64843,33 (to extend the inner region and prevent the gangsters from freezing on the doorstep)
Frozen gangster
The gangsters at no. 19 are not the only ones who can become confused and freeze while chasing Sam: the gangster who watches for Sam outside the police station in game modes 2 and 3 is susceptible to the same trick as well.
To see this, Sam first needs to get to the right edge of the police station steps, just above the sidewalk:
frozen_gangster1
(Sam can get here without being caught by the gangster either by going via the roof of no. 27 - assuming he has the key to that house - or by calling the police and enduring a brief stint in jail first.) When the gangster is beyond the left edge of the police station steps, step down onto the sidewalk, and then quickly back up onto the police station steps. The gangster will follow Sam onto the first step above the sidewalk and then freeze:
frozen_gangster2
The gangster will remain frozen until Sam leaves the outer region (0<=x<255, 10<=y<36) by going to y=9 (between the 4th and 5th floors of a building). It's possible for Sam to run past the gangster (towards no. 31 on the left) while he's frozen without being picked up, but this manoeuvre requires perfect timing that's impossible to judge from just watching the screen, and will fail more often than not.
An urgent message delayed
The routine at 75D0 is supposed to determine the amount of time for which the current message (or message portion) should remain on screen before the next one is displayed. This interval is normally 2.56s, but is reduced to 0.64s if an urgent message has been queued (see 75CA). However, if the urgent message number is stored at a lower address in the 8-byte message queue at 7FB8 than the number of the message currently being displayed, the routine at 75D0 will fail to find it, and so messages will continue to be displayed at normal speed. To demonstrate this:
1. When a new game starts, the message index (held in bits 0-2 at 7FB7) is 3; increase it to 7 by picking up a phone and hanging up twice.
2. Pick up a phone other than Sam's, dial 7337, and wait for Daisy to start relaying the message to Sam; now the message index is 7 (again).
3. While Daisy is relaying the message to Sam, quickly hang up and then press 'J'; this queues an urgent message (see 6177) with index 0, which is less than the index of the message currently being displayed (7).
4. Note how the game pauses, but the message from Daisy continues to display at normal speed, until finally 'JOYSTICK?' appears.
Blank tiles behaving badly
The knocked-out sprites for certain characters contain blank tiles that should be transparent:
The reason for this is that the routine at F928, which prepares the tiles for a knocked-out sprite by making rotated copies of tiles 0x01-0x04 and 0x06-0x09 of the character's base sprite, needlessly makes rotated copies of blank tiles (those with a tile reference of 0x00) too. However, the blank tile (the graphic and mask data for which are located at addresses C700 TO D600 STEP 256) does not contain the correct mask data - it is all zeroes instead of 0xFFs. This is not normally a problem because the sprite-tile-printing routine at E8F3 is optimised to ignore sprite tiles with a tile reference of 0x00. But the rotated copies of the blank tile have non-zero tile references, and are therefore drawn.
This bug is noticeable if Sam knocks over one of the affected characters on the sidewalk: the blank tiles will obscure parts of the building (and possibly other characters) behind the stunned character, as shown here where Sam has just landed on Daisy after being dropped from the roof of no. 19:
daisy_ko
The simplest fix is to set the mask data for the blank tile to all 0xFFs:
POKE 51200,255
POKE 51712,255
POKE 52224,255
POKE 52736,255
POKE 53248,255
POKE 53760,255
POKE 54272,255
POKE 54784,255
Another fix (which leaves the graphic and mask data for the blank tile completely unused) is to set the relevant tile references in the affected sprites to 0x00:
Extended earpiece
The icon for the ringing telephone is perhaps not as it should be. Note how the business end of the earpiece is 3 pixels long, compared with 2 pixels when the phone is not ringing:
phone extended_earpiece
However, this is probably not a bug in the graphic data itself. If the routine at 6FF4 is modified so that it copies the otherwise unused two bytes of graphic data (which correspond to the earpiece) from 7043 to the screen, the ringing telephone icon looks like this instead:
phone extended_earpiece2
POKE 28691,5
The missing blue line
When Sam hits the ground after being dropped from the roof of a building by a gangster, the portion of the screen containing the play area (that is, the top 20 rows) is scrolled up and down seven times, with an accompanying sound effect. On each upward scroll, the 20th row of the screen is supposed to be replaced by a solid blue line (attribute value 9). However, because of a bug in the scrolling routine (see FC6A), instead of the 20th row of the attribute file being POKEd with 9s, the top pixel line of the 20th row of the display file is POKEd with 9s, which produces quite a different - and visually jarring - effect.
POKE 64668,90
z-coordinate confusion
When Sam moves up from the sidewalk onto the front steps of a building, his z-coordinate remains at 4 instead of changing to 2, which means that people walking past on the sidewalk below will be drawn behind him instead of in front of him:
z_confusion
The reason for this is that the location descriptors for z=4 (see C400) that correspond to the front steps of buildings don't have bit 0 or bit 1 set to indicate that a z-coordinate transition should occur, and so the section of code at EBF4 leaves Sam's z-coordinate unchanged upon climbing the step.
Conversely, the location descriptors for z=4 that correspond to the places where there is a step up from the road to the sidewalk (at x=7, 14, 164 and 198) do have bit 0 or bit 1 set. So when Sam moves up from the road to the sidewalk, his z-coordinate will change from 4 to 2, which means that other characters on the sidewalk will be drawn not behind him (as is the norm) but in front of him.
Frozen fiver
After Sam has collected the hook from no. 74, an immobilised banknote can be seen on the sidewalk outside that building or the hotel. The banknote can be somersaulted onto repeatedly (to gain extra cash) without disappearing.
The reason this happens is that the routine at 634C brings the banknote out of service when Sam collects the hook - thus leaving character buffer 0xE5 available for use by the hook when it's thrown - but doesn't remove the banknote from view.
Run, gangster, run
Approach the gangster on the catwalk from the left, and stop at the point where moving right once would make the gangster starting chasing Sam (who is shown outside here for clarity):
run_gangster_run
Now quickly take one step right, and then turn round and run up to the roof of the apartment building. After briefly chasing Sam, the gangster will return to the catwalk, but now he is running continuously instead of walking.
The self-modifying data table
The first entry in the data table at 8128 in the loader code results in 817D being POKEd with 0x86 (replacing the original contents: 0x7C); but 817D is in the data table itself, and corresponds to address D380, which means that D380 ends up being POKEd with 0x86 instead of 0x7C, thus leading to the graphic glitch Lana's waist.
POKEing 817D with 0x86 is actually redundant, since 817D is in an area of memory that is overwritten soon after loading (817D contains the LSB of the operand of the 'LD ($8086),A' instruction at 817C in the save routine).
This bug is not present in the re-release of Contact Sam Cruise by Summit Software in 1988, which uses a different loading scheme.
Tricks with light switches
Some light switches are accessible in places they're probably not supposed to be: when flipped, they affect lights in places other than where the light-switch-flipper is standing.
For example, go to the right-hand side of the shop underneath no. 17 and flip the light switch - it switches on the lights on the second and third floors on the right-hand side of no. 17.
Now go into the door of no. 17 and move as far right as you can; flip the light switch there and the light in the shop underneath no. 15 comes on.
This time, go into the door of no. 17 and move as far left as you can; flip the light switch there and the light in the shop underneath no. 17 comes on.
Displaced dame
When the screen scrolls left or right as Sam moves through the play area, certain members of character groups 0xD7-0xDD are moved in and out of operation, depending on the portion of the play area that is visible. In particular, the lady in a hat who is a member of character group 0xD7 is in operation only when the far left edge of the play area is on screen (see FEAE). That is a rather small range of operation - so small, in fact, that it's possible to see her move out of operation (and become motionless) when the left edge of the play area scrolls out of view:
1. Go to the right-hand magenta room on the third floor of the apartment building at the far left of town.
2. Stand at the location such that moving right once will scroll the screen left (see the image below).
3. Wait until the lady in a hat in the room on the left on the same floor is at the rightmost extremity of her orbit, so that she is partially visible in the stairwell (see the image below).
4. Quickly move right so that the screen scrolls left before the lady turns round and heads back into the room.
5. Note that the portion of the sprite of the lady in a hat that is visible in the stairwell remains visible but motionless either until it's wiped away by another character moving past it, or until the screen scrolls right and the lady starts moving again.
displaced_dame
Displaced dude
Like the displaced dame described above, the man in a bowler hat who is a member of character group 0xDD and walks up and down on the second and third floors of the apartment building next to no. 19 can be seen becoming motionless when the screen scrolls too far to the right:
1. Go to the road outside the apartment building next to no. 19 and stand at the location shown in the image below such that no part of no. 27 is visible on the left.
2. Wait until the man in a bowler hat comes into the cyan room on the second floor of the apartment building and is visible through one of the windows.
3. Quickly move left so that the screen scrolls right (bringing the traffic lights and the left side of no. 27 into view).
4. Note that the man in a bowler hat remains visible but motionless through the window.
displaced_dude