| Routines

9105: Move the conveyor in the current cavern

Used by the routine at 870E.
9105 | LD HL,($8070) | Pick up the address of the conveyor's location in the screen buffer at 7000 from 8070
9108 | LD E,L | Copy this address to DE
9109 | LD D,H
910A | LD A,($8072) | Pick up the length of the conveyor from 8072
910D | LD B,A | B will count the conveyor tiles
910E | LD A,($806F) | Pick up the direction of the conveyor from 806F
9111 | OR A | Is the conveyor moving right?
9112 | JR NZ,$9127 | Jump if so
The conveyor is moving left.
9114 | LD A,(HL) | Copy the first pixel row of the conveyor tile to A
9115 | RLC A | Rotate it left twice
9117 | RLC A
9119 | INC H | Point HL at the third pixel row of the conveyor tile
911A | INC H
911B | LD C,(HL) | Copy this pixel row to C
911C | RRC C | Rotate it right twice
911E | RRC C
9120 | LD (DE),A | Update the first and third pixel rows of every conveyor tile in the screen buffer at 7000
9121 | LD (HL),C
9122 | INC L
9123 | INC E
9124 | DJNZ $9120
9126 | RET |
The conveyor is moving right.
9127 | LD A,(HL) | Copy the first pixel row of the conveyor tile to A
9128 | RRC A | Rotate it right twice
912A | RRC A
912C | INC H | Point HL at the third pixel row of the conveyor tile
912D | INC H
912E | LD C,(HL) | Copy this pixel row to C
912F | RLC C | Rotate it left twice
9131 | RLC C
9133 | JR $9120 | Jump back to update the first and third pixel rows of every conveyor tile