Routines
 Prev: 30291 Up: Map Next: 30380
30292: Check for walls, doors and windows in the path of a mouse, frog or pellet
Used by the routines at 30380, 30804 and 31254. Returns with the carry flag set if there is a wall, closed door or closed window blocking the path of the mouse, frog or pellet
Input
DE Coordinates of the spot in front of the mouse/frog/pellet
30292 PUSH HL
30293 LD HL,32756 32756 contains the doors flags
30296 LD A,E A=x-coordinate of the point in front of the mouse/frog/pellet
30297 CP 190 This is the x-coordinate of the far wall of the girls' skool
30299 JR NC,30335 Jump if the mouse/frog/pellet is facing this wall
30301 LD A,D A=y-coordinate of the mouse/frog/pellet
30302 CP 5 Is the mouse/frog/pellet on the top floor (or just below it)?
30304 JR NC,30338 Jump if not
The mouse/frog/pellet is on the top floor.
30306 LD A,E A=x-coordinate of the point in front of the mouse/frog/pellet
30307 CP 159 This is the x-coordinate of the left wall of the girls' skool
30309 JR Z,30335 Jump if the mouse/frog/pellet is facing this wall
30311 LD D,1 Set bit 0: left study door
30313 CP 72 This is the x-coordinate of the left study door
30315 JR Z,30331 Jump if the mouse/frog/pellet is facing this door
30317 INC D Set bit 1: right study door
30318 CP 84 This is the x-coordinate of the right study door
30320 JR Z,30331 Jump if the mouse/frog/pellet is facing this door
30322 LD D,64 Set bit 6: top-floor window
30324 CP 92 This is the x-coordinate of the top-floor window
30326 JR Z,30331 Jump if the mouse/frog/pellet is facing this window
30328 AND A Clear the carry flag: no obstacles ahead
30329 POP HL Restore the character number of the mouse/frog/pellet to H
30330 RET Return with the carry flag reset
30331 LD A,D A holds the identifier of the door or window in front of the mouse/frog/pellet
30332 AND (HL) Is this door/window open?
30333 JR NZ,30329 Jump if so
30335 SCF Set the carry flag: no admittance
30336 POP HL Restore the character number of the mouse/frog/pellet to H
30337 RET Return with the carry flag set
30338 CP 12
30340 LD A,E
30341 JR NC,30366 Jump if the mouse/frog/pellet is on the bottom floor (or just above it)
The mouse/frog/pellet is on the middle floor.
30343 CP 159 This is the x-coordinate of the left wall of the girls' skool
30345 JR Z,30335 Jump if the mouse/frog/pellet is facing this wall
30347 CP 62 This is the x-coordinate of the far wall of the Science Lab storeroom
30349 JR Z,30335 Jump if the mouse/frog/pellet is facing this wall
30351 CP 53 This is the x-coordinate of the Science Lab storeroom door
30353 LD D,4 Set bit 2: Science Lab storeroom door
30355 JR Z,30331 Jump if the mouse/frog/pellet is facing this door
30357 LD D,128 Set bit 7: middle-floor window
30359 CP 94 This is the x-coordinate of the middle-floor window
30361 JR Z,30331 Jump if the mouse/frog/pellet is facing this window
30363 AND A Clear the carry flag: no obstacles ahead
30364 POP HL Restore the character number of the mouse/frog/pellet to H
30365 RET Return with the carry flag reset
The mouse/frog/pellet is on the bottom floor.
30366 LD D,8 Set bit 3: boys' skool door
30368 CP 94 This is the x-coordinate of the boys' skool door
30370 JR Z,30331 Jump if mouse/frog/pellet is facing this door
30372 LD D,16 Set bit 4: skool gate
30374 CP 133 This is the x-coordinate of the skool gate
30376 JR Z,30331 Jump if the mouse/frog/pellet is facing this
30378 JR 30363 Otherwise it's all clear
 Prev: 30291 Up: Map Next: 30380