Prev: 54994 Up: Map Next: 55088
55068: Tunnel section - Run game timer and randomly generate creatures
Used by the routine at 54994.
Jump from 55008 if no new tunnel wall has been generated during this particular game cycle.
Every 8 game cycles, there's a chance of a creature appearing.
55068 LD A,(60074) Get the game timer
55071 INC A Increment it
55072 AND 7 Check bits 0-2 (values 0-7)
55074 JR NZ,55188
Executed after 8 game timer cycles. Combined with a pseudo-random number, this affects the likelihood interval of a creature (spider/bat) appearing in the tunnel.
  • The room number is one of the variables in this calculation
  • There's a slightly lower chance of creatures appearing in higher numbered tunnel rooms
  • The room tunnel numbers (26384) start high and decrease for deeper levels within the game - e.g. interconnecting tunnel room numbers within the Gatehouse Level are 251-255
  • This means Maroc will tend to encounter more creatures within Avalon's deeper tunnels
55076 CALL 56070 Generate pseudo-random number in A register
55079 LD C,A Store in C register
55080 LD A,(60087) Get room number
55083 SUB 48 Because tunnels are rooms 224-255, this will result in a value somewhere in the 176-207 range
55085 CP C Is this value greater than the random number?
55086 JR NC,55188 If so, jump out of here
If not, continue to the next routine to generate a SPIDER or a BAT
Prev: 54994 Up: Map Next: 55088